Fixed fullscreen issues in video player

Affects issue #563
This commit is contained in:
daniel oeh 2014-12-07 23:10:54 +01:00
parent f534481ed0
commit bf0257a405
4 changed files with 30 additions and 19 deletions

View File

@ -54,6 +54,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY); // has to be called before setting layout content
super.onCreate(savedInstanceState);
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0x80000000));
@ -116,6 +117,9 @@ public class VideoplayerActivity extends MediaplayerActivity {
videoview.getHolder().addCallback(surfaceHolderCallback);
videoview.setOnTouchListener(onVideoviewTouched);
if (Build.VERSION.SDK_INT >= 16) {
videoview.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
}
setupVideoControlsToggler();
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
@ -333,10 +337,9 @@ public class VideoplayerActivity extends MediaplayerActivity {
butPlay.startAnimation(animation);
}
if (Build.VERSION.SDK_INT >= 14) {
videoview.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
int videoviewFlag = (Build.VERSION.SDK_INT >= 16) ? View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION : 0;
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | videoviewFlag);
}
videoOverlay.setVisibility(View.GONE);
butPlay.setVisibility(View.GONE);

View File

@ -1,31 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:orientation="vertical">
<de.danoeh.antennapod.view.AspectRatioVideoView
android:id="@+id/videoview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
android:layout_gravity="center" />
<ProgressBar
android:id="@+id/progressIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible"
android:indeterminateOnly="true"/>
android:indeterminateOnly="true"
android:visibility="invisible" />
<ImageButton
android:id="@+id/butPlay"
android:contentDescription="@string/pause_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/overlay_button_circle_background"
android:src="@drawable/ic_av_pause_circle_outline_80dp"/>
android:contentDescription="@string/pause_label"
android:src="@drawable/ic_av_pause_circle_outline_80dp" />
<LinearLayout
android:id="@+id/overlay"
@ -39,8 +40,8 @@
android:id="@+id/timecontrol"
android:layout_width="match_parent"
android:layout_height="50dp"
android:paddingTop="8dp"
android:layout_marginBottom="4dp">
android:layout_marginBottom="4dp"
android:paddingTop="8dp">
<TextView
android:id="@+id/txtvPosition"
@ -52,9 +53,9 @@
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:text="@string/position_default_label"
android:textColor="@color/white"
android:textStyle="bold"
android:text="@string/position_default_label"/>
android:textStyle="bold" />
<TextView
android:id="@+id/txtvLength"
@ -66,9 +67,10 @@
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:paddingRight="@dimen/navigation_bar_width"
android:text="@string/position_default_label"
android:textColor="@color/white"
android:textStyle="bold"
android:text="@string/position_default_label"/>
android:textStyle="bold" />
<SeekBar
android:id="@+id/sbPosition"
@ -76,7 +78,7 @@
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/txtvLength"
android:layout_toRightOf="@+id/txtvPosition"
android:max="500"/>
android:max="500" />
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="navigation_bar_width">42dp</dimen>
</resources>

View File

@ -33,4 +33,6 @@
<dimen name="listitem_icon_leftpadding">16dp</dimen>
<dimen name="listitem_icon_rightpadding">16dp</dimen>
<dimen name="navigation_bar_width">0dp</dimen>
</resources>