[Android] Do not show player when playback fails
Geoffrey Métais
git at videolan.org
Wed Dec 12 18:09:16 CET 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 12 18:08:30 2018 +0100| [81d5510c68f898071fdfd50ec8d7e3146fba094c] | committer: Geoffrey Métais
Do not show player when playback fails
> https://code.videolan.org/videolan/vlc-android/commit/81d5510c68f898071fdfd50ec8d7e3146fba094c
---
.../vlc/gui/AudioPlayerContainerActivity.java | 36 ++++++++++++++--------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index 7af8428c0..d26a8f81a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -23,21 +23,12 @@
package org.videolan.vlc.gui;
-import androidx.lifecycle.Observer;
import android.content.SharedPreferences;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import com.google.android.material.appbar.AppBarLayout;
-import androidx.coordinatorlayout.widget.CoordinatorLayout;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import androidx.core.view.ViewCompat;
-import androidx.appcompat.widget.Toolbar;
-import androidx.appcompat.widget.ViewStubCompat;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -46,6 +37,8 @@ import android.widget.FrameLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
+import com.google.android.material.appbar.AppBarLayout;
+
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.medialibrary.Medialibrary;
import org.videolan.vlc.BuildConfig;
@@ -67,6 +60,16 @@ import org.videolan.vlc.util.WeakHandler;
import java.util.List;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.widget.Toolbar;
+import androidx.appcompat.widget.ViewStubCompat;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
+import androidx.core.view.ViewCompat;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.lifecycle.Observer;
+
public class AudioPlayerContainerActivity extends BaseActivity {
public static final String TAG = "VLC/AudioPlayerContainerActivity";
@@ -336,6 +339,8 @@ public class AudioPlayerContainerActivity extends BaseActivity {
final AudioPlayerBottomSheetCallback mAudioPlayerBottomSheetCallback = new AudioPlayerBottomSheetCallback();
private static final int ACTION_DISPLAY_PROGRESSBAR = 1339;
+ private static final int ACTION_SHOW_PLAYER = 1340;
+ private static final int ACTION_HIDE_PLAYER = 1341;
public boolean isAudioPlayerReady() {
return mAudioPlayer != null;
@@ -374,8 +379,8 @@ public class AudioPlayerContainerActivity extends BaseActivity {
PlaylistManager.Companion.getShowAudioPlayer().observe(this, new Observer<Boolean>() {
@Override
public void onChanged(@Nullable Boolean showPlayer) {
- if (showPlayer) showAudioPlayer();
- else hideAudioPlayer();
+ if (showPlayer) mActivityHandler.sendEmptyMessageDelayed(ACTION_SHOW_PLAYER, 100L);
+ else mActivityHandler.sendEmptyMessage(ACTION_HIDE_PLAYER);
}
});
MediaParsingService.Companion.getProgress().observe(this, new Observer<ScanProgress>() {
@@ -423,6 +428,13 @@ public class AudioPlayerContainerActivity extends BaseActivity {
removeMessages(ACTION_DISPLAY_PROGRESSBAR);
owner.showProgressBar();
break;
+ case ACTION_SHOW_PLAYER:
+ owner.showAudioPlayer();
+ break;
+ case ACTION_HIDE_PLAYER:
+ removeMessages(ACTION_SHOW_PLAYER);
+ owner.hideAudioPlayer();
+ break;
}
}
}
More information about the Android
mailing list