Variable width for caption button and hiding system UI after popup close

This commit is contained in:
Avently 2020-09-19 22:52:59 +03:00
parent f41549ccf1
commit 518eb97e3a
3 changed files with 73 additions and 84 deletions

View File

@ -134,7 +134,6 @@ public class VideoPlayerImpl extends VideoPlayer
static final String POPUP_SAVED_WIDTH = "popup_saved_width";
static final String POPUP_SAVED_X = "popup_saved_x";
static final String POPUP_SAVED_Y = "popup_saved_y";
private static final int MINIMUM_SHOW_EXTRA_WIDTH_DP = 300;
private static final int IDLE_WINDOW_FLAGS = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
private static final int ONGOING_PLAYBACK_WINDOW_FLAGS = IDLE_WINDOW_FLAGS
@ -988,6 +987,7 @@ public class VideoPlayerImpl extends VideoPlayer
super.onDismiss(menu);
if (isPlaying()) {
hideControls(DEFAULT_CONTROLS_DURATION, 0);
hideSystemUIIfNeeded();
}
}
@ -1012,15 +1012,6 @@ public class VideoPlayerImpl extends VideoPlayer
setInitialGestureValues();
queueLayout.getLayoutParams().height = height - queueLayout.getTop();
if (popupPlayerSelected()) {
final float widthDp = Math.abs(r - l) / service.getResources()
.getDisplayMetrics().density;
final int visibility = widthDp > MINIMUM_SHOW_EXTRA_WIDTH_DP
? View.VISIBLE
: View.GONE;
secondaryControls.setVisibility(visibility);
}
}
}

View File

@ -232,7 +232,12 @@
tools:ignore="HardcodedText,RtlHardcoded"
tools:text="FIT"/>
<Button
<FrameLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3">
<TextView
android:id="@+id/captionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -245,16 +250,11 @@
android:minWidth="50dp"
android:textColor="@android:color/white"
android:textStyle="bold"
android:textAllCaps="false"
android:background="?attr/selectableItemBackground"
tools:ignore="RelativeOverlap,RtlHardcoded"
tools:text="English"/>
<Space
android:id="@+id/spaceBeforeButton"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="3"/>
</FrameLayout>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/playWithKodi"
@ -311,16 +311,11 @@
android:contentDescription="@string/mute"
tools:ignore="RtlHardcoded" />
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/fullScreenButton"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="@dimen/player_main_buttons_padding"
android:layout_alignParentRight="true"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
@ -330,6 +325,10 @@
android:visibility="gone"
tools:visibility="visible"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/bottomControls"
android:layout_width="match_parent"

View File

@ -231,6 +231,11 @@
tools:ignore="HardcodedText,RtlHardcoded"
tools:text="FIT"/>
<FrameLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3">
<TextView
android:id="@+id/captionTextView"
android:layout_width="wrap_content"
@ -239,7 +244,6 @@
android:layout_marginEnd="8dp"
android:gravity="center|left"
android:minHeight="35dp"
android:maxWidth="100dp"
android:lines="1"
android:ellipsize="end"
android:minWidth="50dp"
@ -249,11 +253,7 @@
tools:ignore="RelativeOverlap,RtlHardcoded"
tools:text="English"/>
<Space
android:id="@+id/spaceBeforeButton"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="3"/>
</FrameLayout>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/playWithKodi"
@ -310,16 +310,11 @@
android:contentDescription="@string/mute"
tools:ignore="RtlHardcoded" />
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/fullScreenButton"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="@dimen/player_main_buttons_padding"
android:layout_alignParentRight="true"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
@ -329,6 +324,10 @@
android:visibility="gone"
tools:visibility="visible"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/bottomControls"
android:layout_width="match_parent"