ContactsExpansionpublic class ContactsExpansion extends android.app.Activity
Fields Summary |
---|
String[] | contactsData | android.view.View | currentItem | android.transition.TransitionSet | mMyAutoTransition |
Methods Summary |
---|
private void | addContact(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 void | onCreate(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);
|
|