Minor player fixes (#535)

* Remove redundant Linear Layout

* Fix Hiding Status Bar in dialogs
This commit is contained in:
Quickdesh 2022-04-19 02:25:08 +09:00 committed by GitHub
parent 0febe6e56b
commit 78580ef4de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 249 additions and 258 deletions

View file

@ -413,7 +413,8 @@ class PlayerActivity :
binding.root.systemUiVisibility =
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LOW_PROFILE
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && preferences.playerFullscreen()) {

View file

@ -28,312 +28,302 @@
</LinearLayout>
<!-- Double layout for consistency in code -->
<LinearLayout
<RelativeLayout
android:id="@+id/controlsView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#70000000">
<RelativeLayout
android:layout_width="wrap_content"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/controls_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UselessParent">
android:layout_marginTop="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/controls_top"
<ImageButton
android:id="@+id/backArrowBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="Go back"
android:src="@drawable/ic_arrow_back_24dp"
android:layout_marginHorizontal="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
app:tint="?attr/colorOnPrimarySurface"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/fullTitleTxt"
app:layout_constraintTop_toTopOf="parent"/>
<LinearLayout
android:id="@+id/fullTitleTxt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintLeft_toRightOf="@id/backArrowBtn"
app:layout_constraintRight_toLeftOf="@id/cycleDecoderBtn"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/titleMainTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/colorOnPrimarySurface"
android:text=""
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/titleSecondaryTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/colorOnPrimarySurface"
android:alpha = "0.5"
android:textSize="12sp"
android:text="" />
</LinearLayout>
<ImageButton
android:id="@+id/settingsBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="Settings"
android:background="?attr/selectableItemBackground"
android:onClick="openSettings"
android:layout_marginRight="10dp"
android:src="@drawable/ic_settings_24dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:tint="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/cycleSubsBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="Subtitles"
android:onClick="cycleSub"
android:src="@drawable/ic_subtitles_black_24dp"
android:background="?attr/selectableItemBackground"
app:tint="?attr/colorOnPrimarySurface"
app:layout_constraintRight_toRightOf="@id/cycleAudioBtn"
app:layout_constraintRight_toLeftOf="@id/settingsBtn"
app:layout_constraintTop_toTopOf="parent"/>
<ImageButton
android:id="@+id/cycleAudioBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="Audio"
android:background="?attr/selectableItemBackground"
android:onClick="cycleAudio"
android:src="@drawable/ic_audiotrack_black_24dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="@id/cycleDecoderBtn"
app:layout_constraintRight_toLeftOf="@id/cycleSubsBtn"
app:tint="?attr/colorOnPrimarySurface" />
<Button
android:id="@+id/cycleDecoderBtn"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_toLeftOf="@id/cycleAudioBtn"
android:background="?attr/selectableItemBackground"
android:onClick="switchDecoder"
android:text=".."
android:textColor="?attr/colorOnPrimarySurface"
app:layout_constraintRight_toLeftOf="@id/cycleAudioBtn"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:id="@+id/controls_bottom"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:visibility="visible">
<ImageButton
android:id="@+id/play_btn"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Play/Pause"
android:onClick="playPause"
android:textColor="@android:color/white"
android:visibility="gone"
app:tint="?attr/colorOnPrimarySurface"
tools:src="@drawable/ic_play_arrow_80dp"
tools:visibility="visible" />
<LinearLayout
android:id="@+id/control_bar"
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<ImageButton
android:id="@+id/backArrowBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="Go back"
android:src="@drawable/ic_arrow_back_24dp"
android:layout_marginHorizontal="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
app:tint="?attr/colorOnPrimarySurface"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/fullTitleTxt"
app:layout_constraintTop_toTopOf="parent"/>
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="vertical"
tools:visibility="visible">
<LinearLayout
android:id="@+id/fullTitleTxt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/controls_title_group"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintLeft_toRightOf="@id/backArrowBtn"
app:layout_constraintRight_toLeftOf="@id/cycleDecoderBtn"
app:layout_constraintTop_toTopOf="parent">
android:visibility="visible">
<!-- These two are only used for audio -->
<TextView
android:id="@+id/titleMainTxt"
android:id="@+id/titleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/colorOnPrimarySurface"
android:text=""
android:textSize="16sp"
android:textStyle="bold" />
android:gravity="center"
android:text="-"
android:textColor="@color/tint_normal"
android:textSize="24sp"
android:visibility="gone" />
<TextView
android:id="@+id/titleSecondaryTxt"
android:id="@+id/minorTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/colorOnPrimarySurface"
android:alpha = "0.5"
android:textSize="12sp"
android:text="" />
android:gravity="center"
android:text="-"
android:textColor="@color/tint_normal"
android:textSize="14sp"
android:visibility="gone" />
</LinearLayout>
<ImageButton
android:id="@+id/settingsBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="Settings"
android:background="?attr/selectableItemBackground"
android:onClick="openSettings"
android:layout_marginRight="10dp"
android:src="@drawable/ic_settings_24dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:tint="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/cycleSubsBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="Subtitles"
android:onClick="cycleSub"
android:src="@drawable/ic_subtitles_black_24dp"
android:background="?attr/selectableItemBackground"
app:tint="?attr/colorOnPrimarySurface"
app:layout_constraintRight_toRightOf="@id/cycleAudioBtn"
app:layout_constraintRight_toLeftOf="@id/settingsBtn"
app:layout_constraintTop_toTopOf="parent"/>
<ImageButton
android:id="@+id/cycleAudioBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="Audio"
android:background="?attr/selectableItemBackground"
android:onClick="cycleAudio"
android:src="@drawable/ic_audiotrack_black_24dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="@id/cycleDecoderBtn"
app:layout_constraintRight_toLeftOf="@id/cycleSubsBtn"
app:tint="?attr/colorOnPrimarySurface" />
<Button
android:id="@+id/cycleDecoderBtn"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_toLeftOf="@id/cycleAudioBtn"
android:background="?attr/selectableItemBackground"
android:onClick="switchDecoder"
android:text=".."
android:textColor="?attr/colorOnPrimarySurface"
app:layout_constraintRight_toLeftOf="@id/cycleAudioBtn"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:id="@+id/controls_bottom"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:visibility="visible">
<ImageButton
android:id="@+id/play_btn"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Play/Pause"
android:onClick="playPause"
android:textColor="@android:color/white"
android:visibility="gone"
app:tint="?attr/colorOnPrimarySurface"
tools:src="@drawable/ic_play_arrow_80dp"
tools:visibility="visible" />
<LinearLayout
android:id="@+id/control_bar"
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="vertical"
tools:visibility="visible">
android:orientation="horizontal">
<LinearLayout
android:id="@+id/controls_title_group"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="visible">
<!-- These two are only used for audio -->
<TextView
android:id="@+id/titleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="-"
android:textColor="@color/tint_normal"
android:textSize="24sp"
android:visibility="gone" />
<TextView
android:id="@+id/minorTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="-"
android:textColor="@color/tint_normal"
android:textSize="14sp"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:id="@+id/lockBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="10dp"
android:contentDescription="Lock player"
android:background="?attr/selectableItemBackground"
android:src="@drawable/ic_lock_24dp"
app:tint="?attr/colorOnPrimarySurface" />
<Button
android:id="@+id/cycleSpeedBtn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:onClick="cycleSpeed"
android:text=".."
android:textColor="?attr/colorOnPrimarySurface" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:gravity="right"
android:orientation="horizontal">
<Button
android:id="@+id/controls_skip_intro_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:onClick="skipIntro"
android:text="@string/player_controls_skip_intro_text"
android:textColor="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/cycleViewModeBtn"
android:layout_width="48dp"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:contentDescription="Cycle view modes"
android:onClick="cycleViewMode"
android:src="@drawable/ic_fullscreen_black_24dp"
app:tint="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/pipBtn"
android:layout_width="48dp"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/action_player_pip"
android:src="@drawable/ic_picture_in_picture_24dp"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/controls_seekbar_group"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="100">
<ImageButton
android:id="@+id/prevBtn"
android:id="@+id/lockBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/action_previous_episode"
android:padding="@dimen/screen_edge_margin"
app:srcCompat="@drawable/ic_skip_previous_24dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="Lock player"
android:src="@drawable/ic_lock_24dp"
app:tint="?attr/colorOnPrimarySurface" />
<TextView
android:id="@+id/playbackPositionTxt"
<Button
android:id="@+id/cycleSpeedBtn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="10"
android:gravity="center"
android:text="0:00"
android:textColor="@android:color/white" />
android:background="?attr/selectableItemBackground"
android:onClick="cycleSpeed"
android:text=".."
android:textColor="?attr/colorOnPrimarySurface" />
</LinearLayout>
<SeekBar
android:id="@+id/playbackSeekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="80"
android:progressBackgroundTint="@color/tint_seekbar_bg" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:gravity="right"
android:orientation="horizontal">
<TextView
android:id="@+id/playbackDurationTxt"
<Button
android:id="@+id/controls_skip_intro_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="10"
android:gravity="center"
android:text="0:00"
android:textColor="@android:color/white" />
android:background="?attr/selectableItemBackground"
android:onClick="skipIntro"
android:text="@string/player_controls_skip_intro_text"
android:textColor="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/nextBtn"
android:id="@+id/cycleViewModeBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginRight="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/action_next_episode"
android:padding="@dimen/screen_edge_margin"
app:srcCompat="@drawable/ic_skip_next_24dp"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:contentDescription="Cycle view modes"
android:onClick="cycleViewMode"
android:src="@drawable/ic_fullscreen_black_24dp"
app:tint="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/pipBtn"
android:layout_width="48dp"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/action_player_pip"
android:src="@drawable/ic_picture_in_picture_24dp"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/controls_seekbar_group"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="100">
<ImageButton
android:id="@+id/prevBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/action_previous_episode"
android:padding="@dimen/screen_edge_margin"
app:srcCompat="@drawable/ic_skip_previous_24dp"
app:tint="?attr/colorOnPrimarySurface" />
<TextView
android:id="@+id/playbackPositionTxt"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="10"
android:gravity="center"
android:text="0:00"
android:textColor="@android:color/white" />
<SeekBar
android:id="@+id/playbackSeekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="80"
android:progressBackgroundTint="@color/tint_seekbar_bg" />
<TextView
android:id="@+id/playbackDurationTxt"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="10"
android:gravity="center"
android:text="0:00"
android:textColor="@android:color/white" />
<ImageButton
android:id="@+id/nextBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginRight="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/action_next_episode"
android:padding="@dimen/screen_edge_margin"
app:srcCompat="@drawable/ic_skip_next_24dp"
app:tint="?attr/colorOnPrimarySurface" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>