[Android] Fix AudioPlayer started twice on device rotation

Geoffrey Métais git at videolan.org
Wed Apr 4 18:36:03 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Mar 29 15:48:01 2018 +0200| [64f190b2446140180ea36b5f23f9f4dcffe23b46] | committer: Geoffrey Métais

Fix AudioPlayer started twice on device rotation

> https://code.videolan.org/videolan/vlc-android/commit/64f190b2446140180ea36b5f23f9f4dcffe23b46
---

 vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java | 2 +-
 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index 23fbef5c7..84f680c80 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -122,7 +122,7 @@ public class AudioPlayerContainerActivity extends BaseActivity {
     }
 
     private void initAudioPlayer() {
-        ((ViewStubCompat)findViewById(R.id.audio_player_stub)).inflate();
+        findViewById(R.id.audio_player_stub).setVisibility(View.VISIBLE);
         mAudioPlayer = (AudioPlayer) getSupportFragmentManager().findFragmentById(R.id.audio_player);
         mBottomSheetBehavior = BottomSheetBehavior.from(mAudioPlayerContainer);
         mBottomSheetBehavior.setPeekHeight(getResources().getDimensionPixelSize(R.dimen.player_peek_height));
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index 28be41ee3..777f1153d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -428,7 +428,7 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, PlaybackSe
     override fun beforeTextChanged(charSequence: CharSequence, start: Int, before: Int, count: Int) {}
 
     fun clearSearch(): Boolean {
-        playlistModel.filter(null)
+        if (this::playlistModel.isInitialized) playlistModel.filter(null)
         return hideSearchField()
     }
 



More information about the Android mailing list