FileDocCategorySizeDatePackage
ContactsExpansion.javaAPI DocAndroid 5.1 API5453Thu Mar 12 22:22:44 GMT 2015com.android.transitiontests

ContactsExpansion

public class ContactsExpansion extends android.app.Activity

Fields Summary
String[]
contactsData
android.view.View
currentItem
android.transition.TransitionSet
mMyAutoTransition
Constructors Summary
Methods Summary
private voidaddContact(android.view.ViewGroup container, int dataIndex, int thumbnailID)

        LayoutInflater inflater = (LayoutInflater)
                getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View contactItem = inflater.inflate(R.layout.contact_collapsed, container, false);
        ImageView thumbnailView = (ImageView) contactItem.findViewById(R.id.contact_picture);
        thumbnailView.setImageResource(thumbnailID);
        ((TextView)contactItem.findViewById(R.id.contact_name)).setText(contactsData[dataIndex++]);
        ((TextView)contactItem.findViewById(R.id.contact_street)).
                setText(contactsData[dataIndex++]);
        ((TextView)contactItem.findViewById(R.id.contact_city)).setText(contactsData[dataIndex++]);
        ((TextView)contactItem.findViewById(R.id.contact_phone)).setText(contactsData[dataIndex++]);
        ((TextView)contactItem.findViewById(R.id.contact_email)).setText(contactsData[dataIndex++]);
        container.addView(contactItem);

        final TransitionSet myTransition = new TransitionSet();
        myTransition.addTransition(new Fade(Fade.IN)).
                addTransition(new Rotate().addTarget(R.id.contact_arrow)).
                addTransition(new ChangeBounds()).
                addTransition(new Fade(Fade.OUT)).
                addTransition(new Crossfade().addTarget(R.id.contact_picture));
        final ToggleScene toggleScene = new ToggleScene(container, myTransition);
        contactItem.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                currentItem = v;
                toggleScene.changeToScene();
            }
        });
    
protected voidonCreate(android.os.Bundle savedInstanceState)


    
        
        super.onCreate(savedInstanceState);
        setContentView(R.layout.contacts_list);
        ViewGroup contactsContainer = (ViewGroup) findViewById(R.id.contactsContainer);

        int contactsIndex = 0;
        addContact(contactsContainer, contactsIndex, R.drawable.self_portrait_square_100);
        contactsIndex += 5;
        addContact(contactsContainer, contactsIndex, R.drawable.self_portrait_square_100);
        contactsIndex += 5;
        addContact(contactsContainer, contactsIndex, R.drawable.self_portrait_square_100);