[Android] Improve TV specific checks
Geoffrey Métais
git at videolan.org
Wed Feb 8 17:47:04 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 8 17:46:32 2017 +0100| [d98d4ba698abadbb69bf358c02bdc43270abe2d3] | committer: Geoffrey Métais
Improve TV specific checks
> https://code.videolan.org/videolan/vlc-android/commit/d98d4ba698abadbb69bf358c02bdc43270abe2d3
---
.../src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java | 4 ++--
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 8 ++++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
index ed0a251..5f368f5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -34,7 +34,6 @@ import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
-import android.support.annotation.RequiresApi;
import android.support.v4.app.DialogFragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.preference.PreferenceManager;
@@ -60,6 +59,7 @@ import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.gui.video.VideoPlayerActivity;
import org.videolan.vlc.gui.view.AutoFitRecyclerView;
import org.videolan.vlc.interfaces.IPlaybackSettingsController;
+import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.Permissions;
import org.videolan.vlc.util.Strings;
@@ -558,7 +558,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
mAdapter.addOption(new Option(ID_PLAY_AS_AUDIO, R.attr.ic_playasaudio_on, getString(R.string.play_as_audio)));
mAdapter.addOption(new Option(ID_SPU_DELAY, R.attr.ic_subtitledelay, getString(R.string.spu_delay)));
mAdapter.addOption(new Option(ID_AUDIO_DELAY, R.attr.ic_audiodelay, getString(R.string.audio_delay)));
- if (!tvUi || AndroidUtil.isNougatOrLater())
+ if (!tvUi || AndroidDevices.isAndroidTv() && AndroidUtil.isNougatOrLater())
mAdapter.addOption(new Option(ID_POPUP_VIDEO, R.attr.ic_popup_dim, getString(R.string.popup_playback_title)));
mAdapter.addOption(new Option(ID_REPEAT, R.attr.ic_repeat, getString(R.string.repeat_title)));
if (mService.canShuffle())
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index d57702e..f9037a7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -585,12 +585,16 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mSize.setOnClickListener(null);
/* Stop the earliest possible to avoid vout error */
- if ((!AndroidUtil.isNougatOrLater() || !isInPictureInPictureMode()) &&
- (isFinishing() || (AndroidDevices.isAndroidTv() && !requestVisibleBehind(true))))
+ if (!isInPictureInPictureMode() && (isFinishing() || !requestVisibleBehind(true)))
stopPlayback();
}
@Override
+ public boolean requestVisibleBehind(boolean visible) {
+ return AndroidDevices.isAndroidTv() && super.requestVisibleBehind(visible);
+ }
+
+ @Override
public void onVisibleBehindCanceled() {
super.onVisibleBehindCanceled();
stopPlayback();
More information about the Android
mailing list