Commit 5a6c4cdd authored by Geoffrey Métais's avatar Geoffrey Métais

VideoPlayer: Fix controls layout after rotation

(cherry picked from commit 17835234)
parent aba39430
...@@ -607,8 +607,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C ...@@ -607,8 +607,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
@Override @Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
if (!AndroidUtil.isHoneycombOrLater) if (!AndroidUtil.isHoneycombOrLater) changeSurfaceLayout();
changeSurfaceLayout();
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
getWindowManager().getDefaultDisplay().getMetrics(mScreen); getWindowManager().getDefaultDisplay().getMetrics(mScreen);
mCurrentScreenOrientation = newConfig.orientation; mCurrentScreenOrientation = newConfig.orientation;
...@@ -617,6 +616,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C ...@@ -617,6 +616,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
resetHudLayout(); resetHudLayout();
} }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public void resetHudLayout() { public void resetHudLayout() {
if (mHudBinding == null) return; if (mHudBinding == null) return;
final RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)mHudBinding.playerOverlayButtons.getLayoutParams(); final RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)mHudBinding.playerOverlayButtons.getLayoutParams();
...@@ -625,15 +625,13 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C ...@@ -625,15 +625,13 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
final int endOf = AndroidUtil.isJellyBeanMR1OrLater ? RelativeLayout.END_OF : RelativeLayout.RIGHT_OF; final int endOf = AndroidUtil.isJellyBeanMR1OrLater ? RelativeLayout.END_OF : RelativeLayout.RIGHT_OF;
final int startOf = AndroidUtil.isJellyBeanMR1OrLater ? RelativeLayout.START_OF : RelativeLayout.LEFT_OF; final int startOf = AndroidUtil.isJellyBeanMR1OrLater ? RelativeLayout.START_OF : RelativeLayout.LEFT_OF;
if (portrait) { final int endAlign = AndroidUtil.isJellyBeanMR1OrLater ? RelativeLayout.ALIGN_PARENT_END : RelativeLayout.ALIGN_PARENT_RIGHT;
layoutParams.addRule(RelativeLayout.BELOW, R.id.player_overlay_length); final int startAlign = AndroidUtil.isJellyBeanMR1OrLater ? RelativeLayout.ALIGN_PARENT_START : RelativeLayout.ALIGN_PARENT_LEFT;
layoutParams.addRule(endOf, 0); layoutParams.addRule(startAlign, portrait ? 1 : 0);
layoutParams.addRule(startOf, 0); layoutParams.addRule(endAlign, portrait ? 1 : 0);
} else { layoutParams.addRule(RelativeLayout.BELOW, portrait ? R.id.player_overlay_length : R.id.player_overlay_seekbar);
layoutParams.addRule(RelativeLayout.BELOW, R.id.player_overlay_seekbar); layoutParams.addRule(endOf, portrait ? 0 : R.id.player_overlay_time);
layoutParams.addRule(endOf, R.id.player_overlay_time); layoutParams.addRule(startOf, portrait ? 0 : R.id.player_overlay_length);
layoutParams.addRule(startOf, R.id.player_overlay_length);
}
mHudBinding.playerOverlayButtons.setLayoutParams(layoutParams); mHudBinding.playerOverlayButtons.setLayoutParams(layoutParams);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment