[Android] Audio player: remove useless code for the orientation change handling

Adrien Maglo git at videolan.org
Fri Dec 6 10:43:09 CET 2013


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Dec  6 10:26:43 2013 +0100| [a8512e7d15fb65da98fe89653944f9fda5cce693] | committer: Adrien Maglo

Audio player: remove useless code for the orientation change handling

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=a8512e7d15fb65da98fe89653944f9fda5cce693
---

 .../vlc/gui/audio/AudioPlayerFragment.java         |   23 +-------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
index 6c2cfc5..5353bec 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
@@ -75,7 +75,6 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
     private ListView mSongsList;
 
     private AudioServiceController mAudioController;
-    private boolean mOrientationChanged = false;
     private boolean mShowRemainingTime = false;
     private String lastTitle;
 
@@ -205,13 +204,6 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
     }
 
     @Override
-    public void onConfigurationChanged(Configuration newConfig) {
-        super.onConfigurationChanged(newConfig);
-        mOrientationChanged = true;
-        update();
-    }
-
-    @Override
     public void onResume() {
         super.onResume();
         MainActivity activity = (MainActivity) getActivity();
@@ -250,23 +242,10 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
 
         // Exit the player and return to the main menu when there is no media
         if (!mAudioController.hasMedia()) {
-            if (!mOrientationChanged)
-                getActivity().getSupportFragmentManager().popBackStackImmediate(); // remove this fragment from view
+            getActivity().getSupportFragmentManager().popBackStackImmediate(); // remove this fragment from view
             return;
         }
 
-        // because the activity is not recreated when orientation changes (configChanges in manifest),
-        // the fragment's layout is not refreshed between layout & layout-land.
-        // we have to do it manually
-        if (mOrientationChanged) {
-            LayoutInflater inflater = LayoutInflater.from(getActivity());
-            ViewGroup rootView = (ViewGroup) getView();
-            rootView.removeAllViews();
-            rootView.addView(onCreateView(inflater, rootView, null));
-            lastTitle = "";
-            mOrientationChanged = false;
-        }
-
         String title = mAudioController.getTitle();
         if (title != null && !title.equals(lastTitle)) {
             Bitmap cover = mAudioController.getCover();



More information about the Android mailing list