[Android] Hide PiP & background option when rendering video
Geoffrey Métais
git at videolan.org
Fri Jan 26 15:16:33 CET 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 19 14:57:40 2018 +0100| [2ec23bd72d311b3a1bc68753256dc11d66d3e1d9] | committer: Geoffrey Métais
Hide PiP & background option when rendering video
> https://code.videolan.org/videolan/vlc-android/commit/2ec23bd72d311b3a1bc68753256dc11d66d3e1d9
---
.../videolan/vlc/gui/dialogs/AdvOptionsDialog.java | 22 ++++++++++++----------
.../vlc/gui/video/VideoPlayerActivity.java | 2 ++
2 files changed, 14 insertions(+), 10 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 5591600b7..4aadaf260 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -70,6 +70,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
public final static String TAG = "VLC/AdvOptionsDialog";
public static final String MODE_KEY = "mode";
+ public static final String PRIMARY_DISPLAY = "primary_display";
public static final int MODE_VIDEO = 0;
public static final int MODE_AUDIO = 1;
@@ -94,6 +95,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
private Activity mActivity;
private int mMode = -1;
+ private boolean primary;
AutoFitRecyclerView mRecyclerView;
private AdvOptionsAdapter mAdapter;
@@ -124,10 +126,11 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
super.onCreate(savedInstanceState);
if (VLCApplication.sPlayerSleepTime != null && VLCApplication.sPlayerSleepTime.before(Calendar.getInstance()))
VLCApplication.sPlayerSleepTime = null;
- if (getArguments() != null && getArguments().containsKey(MODE_KEY))
- mMode = getArguments().getInt(MODE_KEY);
- else
- mMode = MODE_VIDEO;
+ final Bundle args = getArguments();
+ if (args != null) {
+ mMode = args.containsKey(MODE_KEY) ? args.getInt(MODE_KEY) : MODE_VIDEO;
+ primary = args.containsKey(PRIMARY_DISPLAY) && args.getBoolean(PRIMARY_DISPLAY);
+ }
setStyle(DialogFragment.STYLE_NO_FRAME, 0);
}
@@ -515,11 +518,11 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
mAdapter.addOption(new Option(ID_EQUALIZER, R.attr.ic_equalizer_normal_style, getString(R.string.equalizer)));
if (mMode == MODE_VIDEO) {
- if (!tvUi && mService.getAudioTracksCount() > 0)
+ if (primary && !tvUi && mService.getAudioTracksCount() > 0)
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 || AndroidDevices.hasPiP)
+ if (primary && (!tvUi || AndroidDevices.hasPiP))
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())
@@ -542,7 +545,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
mService = null;
}
- GridLayoutManager.SpanSizeLookup mSpanSizeLookup = new GridLayoutManager.SpanSizeLookup() {
+ final GridLayoutManager.SpanSizeLookup mSpanSizeLookup = new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
switch (mAdapter.getItemViewType(position)) {
@@ -583,8 +586,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
private void setDialogDimensions(int offset) {
final Dialog dialog = getDialog();
- if (dialog == null)
- return;
+ if (dialog == null) return;
final int dialogWidth = getResources().getDimensionPixelSize(R.dimen.option_width) * SPAN_COUNT + mRecyclerView.getPaddingLeft()+ mRecyclerView.getRight();
final int count = mAdapter.getItemCount()-offset;
final int rows = offset + (count + SPAN_COUNT-1) / SPAN_COUNT;
@@ -606,7 +608,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
@Override
public AdvOptionsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
- View v = LayoutInflater.from(parent.getContext())
+ final View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.adv_option_item, parent, false);
v.setOnClickListener(AdvOptionsDialog.this);
v.setOnFocusChangeListener(AdvOptionsDialog.this);
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 77d97748a..9135e7987 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -3362,6 +3362,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
public void showAdvancedOptions() {
final FragmentManager fm = getSupportFragmentManager();
final AdvOptionsDialog advOptionsDialog = new AdvOptionsDialog();
+ final Bundle args = new Bundle(1);
+ args.putBoolean(AdvOptionsDialog.PRIMARY_DISPLAY, mDisplayManager.isPrimary());
advOptionsDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
More information about the Android
mailing list