Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Honeycomb Gmail Like Application

does anyone knows (or can show me an exemple) of how can I develop an aplication that behaves just like honeycomb gmail? How can I swop between frame layouts and change their sizes to display contents. like when you click on your message and then the fragment floats left to make room for the message, and se fragment containing you boxes disappear.

like image 941
Filipe Avatar asked Oct 22 '11 05:10

Filipe


1 Answers

I think you sad it all :) Provide a layout for your components, I'd suggest a LinearLayout with horizontal orientation. Then you add all three fragments to it, and you hide the third one - containing the Message.

FolderListFragment folderListFragment = new FolderListFragment();
MessageListFragment messageListFragment = new MessageListFragment();
MessageFragment messageFragment = new MessageFragment();

FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(container_view_layout, folderListFragment);
ft.add(container_view_layout, messageListFragment);
ft.add(container_view_layout, messageFragment);
ft.hide(messageFragment);
ft.commit();

Then when you want to show message fragment:

void showMessage(Message message) {
   // Initialize messageFragment
   messageFragment.setMessage(message);
   FragmentTransaction ft = getFragmentManager().beginTransaction();
   ft.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left);
   ft.hide(folderListFragment);
   ft.show(messageFragment);
   ft.commit();
}

void showFolders() {
   FragmentTransaction ft = getFragmentManager().beginTransaction();
   ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right);
   ft.hide(folderListFragment);
   ft.show(messageFragment);
   ft.commit();
}

And for the animations the slide_in_left for folder fragment would be, you can derive the others (400 is the width of the component):

<set>
   <objectAnimator
      android:propertyName="x"
      android:duration="500"
      android:valueFrom="-400"
      android:valueTo="0"
      android:valueType="intType"/>
</set>
like image 118
Andras Balázs Lajtha Avatar answered Nov 12 '22 03:11

Andras Balázs Lajtha