Merge branch 'dev' into enqueue-autoplay
This commit is contained in:
commit
9d63e2ae97
3 changed files with 29 additions and 5 deletions
|
@ -175,6 +175,10 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||||
setLandscape(lastOrientationWasLandscape);
|
setLandscape(lastOrientationWasLandscape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int lastResizeMode = defaultPreferences.getInt(
|
||||||
|
getString(R.string.last_resize_mode), AspectRatioFrameLayout.RESIZE_MODE_FIT);
|
||||||
|
playerImpl.setResizeMode(lastResizeMode);
|
||||||
|
|
||||||
// Upon going in or out of multiwindow mode, isInMultiWindow will always be false,
|
// Upon going in or out of multiwindow mode, isInMultiWindow will always be false,
|
||||||
// since the first onResume needs to restore the player.
|
// since the first onResume needs to restore the player.
|
||||||
// Subsequent onResume calls while multiwindow mode remains the same and the player is
|
// Subsequent onResume calls while multiwindow mode remains the same and the player is
|
||||||
|
@ -705,14 +709,27 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int nextResizeMode(int currentResizeMode) {
|
protected int nextResizeMode(int currentResizeMode) {
|
||||||
|
final int newResizeMode;
|
||||||
switch (currentResizeMode) {
|
switch (currentResizeMode) {
|
||||||
case AspectRatioFrameLayout.RESIZE_MODE_FIT:
|
case AspectRatioFrameLayout.RESIZE_MODE_FIT:
|
||||||
return AspectRatioFrameLayout.RESIZE_MODE_FILL;
|
newResizeMode = AspectRatioFrameLayout.RESIZE_MODE_FILL;
|
||||||
|
break;
|
||||||
case AspectRatioFrameLayout.RESIZE_MODE_FILL:
|
case AspectRatioFrameLayout.RESIZE_MODE_FILL:
|
||||||
return AspectRatioFrameLayout.RESIZE_MODE_ZOOM;
|
newResizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return AspectRatioFrameLayout.RESIZE_MODE_FIT;
|
newResizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storeResizeMode(newResizeMode);
|
||||||
|
return newResizeMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void storeResizeMode(@AspectRatioFrameLayout.ResizeMode int resizeMode) {
|
||||||
|
defaultPreferences.edit()
|
||||||
|
.putInt(getString(R.string.last_resize_mode), resizeMode)
|
||||||
|
.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -683,12 +683,17 @@ public abstract class VideoPlayer extends BasePlayer
|
||||||
if (getAspectRatioFrameLayout() != null) {
|
if (getAspectRatioFrameLayout() != null) {
|
||||||
final int currentResizeMode = getAspectRatioFrameLayout().getResizeMode();
|
final int currentResizeMode = getAspectRatioFrameLayout().getResizeMode();
|
||||||
final int newResizeMode = nextResizeMode(currentResizeMode);
|
final int newResizeMode = nextResizeMode(currentResizeMode);
|
||||||
getAspectRatioFrameLayout().setResizeMode(newResizeMode);
|
setResizeMode(newResizeMode);
|
||||||
getResizeView().setText(PlayerHelper.resizeTypeOf(context, newResizeMode));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setResizeMode(@AspectRatioFrameLayout.ResizeMode final int resizeMode) {
|
||||||
|
getAspectRatioFrameLayout().setResizeMode(resizeMode);
|
||||||
|
getResizeView().setText(PlayerHelper.resizeTypeOf(context, resizeMode));
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract int nextResizeMode(@AspectRatioFrameLayout.ResizeMode final int resizeMode);
|
protected abstract int nextResizeMode(@AspectRatioFrameLayout.ResizeMode final int resizeMode);
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// SeekBar Listener
|
// SeekBar Listener
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
|
@ -105,6 +105,8 @@
|
||||||
|
|
||||||
<string name="last_orientation_landscape_key" translatable="false">last_orientation_landscape_key</string>
|
<string name="last_orientation_landscape_key" translatable="false">last_orientation_landscape_key</string>
|
||||||
|
|
||||||
|
<string name="last_resize_mode" translatable="false">last_resize_mode</string>
|
||||||
|
|
||||||
<!-- DEBUG ONLY -->
|
<!-- DEBUG ONLY -->
|
||||||
<string name="debug_pref_screen_key" translatable="false">debug_pref_screen_key</string>
|
<string name="debug_pref_screen_key" translatable="false">debug_pref_screen_key</string>
|
||||||
<string name="allow_heap_dumping_key" translatable="false">allow_heap_dumping_key</string>
|
<string name="allow_heap_dumping_key" translatable="false">allow_heap_dumping_key</string>
|
||||||
|
|
Loading…
Reference in a new issue