[Android] Simplifications

Ludovic Fauvet git at videolan.org
Sat Jun 23 15:19:00 CEST 2012


android | branch: master | Ludovic Fauvet <etix at videolan.org> | Sat Jun 23 14:50:32 2012 +0200| [80d5f369fd489b615316716976a2042178ca8f28] | committer: Ludovic Fauvet

Simplifications

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

 .../src/org/videolan/vlc/gui/MainActivity.java     |   10 ++------
 .../org/videolan/vlc/widget/AudioMiniPlayer.java   |   27 +++++++++++++-------
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index f9f3af5..851791f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -399,18 +399,12 @@ public class MainActivity extends SherlockFragmentActivity {
     }*/
 
     public void hideAudioPlayer() {
-        FragmentManager fm = getSupportFragmentManager();
-        FragmentTransaction ft = fm.beginTransaction();
-        ft.hide(mAudioPlayer);
-        ft.commit();
+        mAudioPlayer.hide();
         mAudioController.stop();
     }
 
     public void showAudioPlayer() {
-        FragmentManager fm = getSupportFragmentManager();
-        FragmentTransaction ft = fm.beginTransaction();
-        ft.show(mAudioPlayer);
-        ft.commit();
+        mAudioPlayer.show();
     }
 
     private void showInfoDialog() {
diff --git a/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java b/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java
index eb2a819..2b1a31d 100644
--- a/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java
@@ -168,17 +168,10 @@ public class AudioMiniPlayer extends Fragment implements IAudioPlayer {
     public void update() {
         if (mAudioPlayerControl != null && getActivity() != null) {
 
-            FragmentManager fm = getActivity().getSupportFragmentManager();
-            FragmentTransaction ft = fm.beginTransaction();
-
             if (mAudioPlayerControl.hasMedia()) {
-                ft.setCustomAnimations(R.anim.anim_enter_bottom, 0);
-                ft.show(this);
-                ft.commit();
+                show();
             } else {
-                ft.setCustomAnimations(0, R.anim.anim_leave_bottom);
-                ft.hide(this);
-                ft.commit();
+                hide();
                 return;
             }
 
@@ -218,4 +211,20 @@ public class AudioMiniPlayer extends Fragment implements IAudioPlayer {
 
     }
 
+    public void show() {
+        FragmentTransaction ft = getActivity().getSupportFragmentManager()
+                .beginTransaction();
+        ft.setCustomAnimations(R.anim.anim_enter_bottom, 0);
+        ft.show(this);
+        ft.commit();
+    }
+
+    public void hide() {
+        FragmentTransaction ft = getActivity().getSupportFragmentManager()
+                .beginTransaction();
+        ft.setCustomAnimations(0, R.anim.anim_leave_bottom);
+        ft.hide(this);
+        ft.commit();
+    }
+
 }



More information about the Android mailing list