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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With