[Android] Animate the transition between the audio browser and the track list

Ludovic Fauvet git at videolan.org
Sat Jun 23 00:54:41 CEST 2012


android | branch: master | Ludovic Fauvet <etix at videolan.org> | Sat Jun 23 00:53:07 2012 +0200| [896b6efc6a43f1f6ed444b9ea125b3d400685b8f] | committer: Ludovic Fauvet

Animate the transition between the audio browser and the track list

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=896b6efc6a43f1f6ed444b9ea125b3d400685b8f
---

 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java  |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index c9de90d..b0e6354 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -42,6 +42,7 @@ import android.graphics.Color;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
+import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
 import android.view.ContextMenu;
 import android.view.ContextMenu.ContextMenuInfo;
@@ -188,8 +189,12 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
             b.putInt(AudioListFragment.EXTRA_MODE, mFlingViewGroup.getPosition());
             audioList.setArguments(b);
 
-            FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
-            ft.replace(R.id.fragment_placeholder, audioList);
+            FragmentManager fm = getActivity().getSupportFragmentManager();
+            FragmentTransaction ft = fm.beginTransaction();
+            ft.setCustomAnimations(R.anim.anim_enter_left, R.anim.anim_leave_left, R.anim.anim_enter_left, 0);
+            ft.detach(fm.findFragmentByTag("audio"));
+            ft.setCustomAnimations(R.anim.anim_enter_right, R.anim.anim_leave_right, 0, R.anim.anim_leave_right);
+            ft.replace(R.id.fragment_placeholder, audioList, "tracks");
             ft.addToBackStack(null);
             ft.commit();
 



More information about the Android mailing list