Improve gesture overlays (#514)

This commit is contained in:
Quickdesh 2022-04-13 05:02:46 +09:00 committed by GitHub
parent 8c188b7b00
commit 494b2bb374
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 499 additions and 231 deletions

View file

@ -29,6 +29,7 @@ import android.view.View
import android.view.ViewAnimationUtils
import android.view.WindowManager
import android.view.animation.AnimationUtils
import android.widget.LinearLayout
import android.widget.RelativeLayout
import android.widget.SeekBar
import androidx.annotation.RequiresApi
@ -193,21 +194,71 @@ class PlayerActivity :
private var userIsOperatingSeekbar = false
// private var lockedUI = false
private lateinit var mDetector: GestureDetectorCompat
private val animationHandler = Handler(Looper.getMainLooper())
// Fade out gesture text
private val gestureTextRunnable = Runnable {
binding.gestureTextView.visibility = View.GONE
// I spent like an hour trying to make the below 4 vals and functions, into one function. Failed miserably!
// All on you man, sorry
// Fade out seek text
private val seekTextRunnable = Runnable {
AnimationUtils.loadAnimation(this, R.anim.fade_out_medium).also { fadeAnimation ->
findViewById<LinearLayout>(R.id.seekView).startAnimation(fadeAnimation)
binding.seekView.visibility = View.GONE
}
}
private fun showGestureText() {
animationHandler.removeCallbacks(gestureTextRunnable)
binding.gestureTextView.visibility = View.VISIBLE
private fun showSeekText() {
animationHandler.removeCallbacks(seekTextRunnable)
binding.seekView.visibility = View.VISIBLE
animationHandler.postDelayed(gestureTextRunnable, 500L)
animationHandler.postDelayed(seekTextRunnable, 500L)
}
// Fade out Volume Bar
private val volumeViewRunnable = Runnable {
AnimationUtils.loadAnimation(this, R.anim.fade_out_medium).also { fadeAnimation ->
findViewById<LinearLayout>(R.id.volumeView).startAnimation(fadeAnimation)
binding.volumeView.visibility = View.GONE
}
}
private fun showVolumeView() {
animationHandler.removeCallbacks(volumeViewRunnable)
binding.volumeView.visibility = View.VISIBLE
animationHandler.postDelayed(volumeViewRunnable, 500L)
}
// Fade out Brightness Bar
private val brightnessViewRunnable = Runnable {
AnimationUtils.loadAnimation(this, R.anim.fade_out_medium).also { fadeAnimation ->
findViewById<LinearLayout>(R.id.brightnessView).startAnimation(fadeAnimation)
binding.brightnessView.visibility = View.GONE
}
}
private fun showBrightnessView() {
animationHandler.removeCallbacks(brightnessViewRunnable)
binding.brightnessView.visibility = View.VISIBLE
animationHandler.postDelayed(brightnessViewRunnable, 500L)
}
// Fade out Player controls
private val controlsViewRunnable = Runnable {
AnimationUtils.loadAnimation(this, R.anim.fade_out_medium).also { fadeAnimation ->
findViewById<RelativeLayout>(R.id.player_controls).startAnimation(fadeAnimation)
binding.playerControls.visibility = View.GONE
}
}
private fun showControlsView() {
animationHandler.removeCallbacks(controlsViewRunnable)
binding.playerControls.visibility = View.VISIBLE
animationHandler.postDelayed(controlsViewRunnable, 1500L)
}
private val seekBarChangeListener = object : SeekBar.OnSeekBarChangeListener {
@ -357,42 +408,19 @@ class PlayerActivity :
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
if (isLocked) {
// Hide controls
binding.controlsTop.isVisible = false
binding.controlsBottom.isVisible = false
binding.background.isVisible = false
binding.playerControls.isVisible = false
// Toggle unlock button
binding.unlockBtn.isVisible = !binding.unlockBtn.isVisible
} else {
var animation = R.anim.fade_in_medium
if (binding.background.isVisible) {
animation = R.anim.fade_out_medium
}
AnimationUtils.loadAnimation(this, animation).also { fadeAnimation ->
findViewById<RelativeLayout>(R.id.controls_top).startAnimation(fadeAnimation)
findViewById<RelativeLayout>(R.id.controls_bottom).startAnimation(fadeAnimation)
findViewById<View>(R.id.background).startAnimation(fadeAnimation)
binding.controlsTop.isVisible = !binding.controlsTop.isVisible
binding.controlsBottom.isVisible = !binding.controlsBottom.isVisible
binding.background.isVisible = !binding.background.isVisible
}
// Toggle controls
// Hide unlock button
if(!binding.playerControls.isVisible) showControlsView()
else { animationHandler.removeCallbacks(controlsViewRunnable); binding.playerControls.isVisible = false }
binding.unlockBtn.isVisible = false
}
}
private fun hideControls(hide: Boolean) {
if (hide) {
binding.controlsTop.isVisible = false
binding.controlsBottom.isVisible = false
binding.background.isVisible = false
} else {
binding.controlsTop.isVisible = true
binding.controlsBottom.isVisible = true
binding.background.isVisible = true
}
binding.playerControls.isVisible = !hide
}
private fun showLoadingIndicator(visible: Boolean) {
@ -601,8 +629,8 @@ class PlayerActivity :
MPVLib.command(arrayOf("seek", time.toString(), "relative"))
val diffText = Utils.prettyTime(time, true)
binding.gestureTextView.text = getString(R.string.ui_seek_distance, Utils.prettyTime(newPos), diffText)
showGestureText()
binding.seekText.text = getString(R.string.ui_seek_distance, Utils.prettyTime(newPos), diffText)
showSeekText()
}
fun verticalScrollLeft(diff: Float) {
@ -611,6 +639,7 @@ class PlayerActivity :
// value of 0 and 0.01 is broken somehow
screenBrightness = brightness.coerceAtLeast(0.02F)
}
if (brightness < 0) {
binding.brightnessOverlay.isVisible = true
val alpha = (abs(brightness) * 256).toInt()
@ -618,19 +647,26 @@ class PlayerActivity :
} else {
binding.brightnessOverlay.isVisible = false
}
binding.gestureTextView.text = getString(R.string.ui_brightness, (brightness * 100).roundToInt())
showGestureText()
val finalBrightness = (brightness * 100).roundToInt()
binding.brightnessText.text = finalBrightness.toString()
binding.brightnessBar.progress = finalBrightness
binding.brightnessBar.secondaryProgress = abs(finalBrightness)
if (finalBrightness >= 0) binding.brightnessImg.setImageResource(R.drawable.ic_brightness_positive_24dp)
else binding.brightnessImg.setImageResource(R.drawable.ic_brightness_negative_24dp)
showBrightnessView()
}
fun verticalScrollRight(diff: Float) {
fineVolume = (fineVolume + (diff * maxVolume)).coerceIn(0F, maxVolume.toFloat())
val newVolume = fineVolume.toInt()
val newVolumePercent = 100 * newVolume / maxVolume
// val newVolumePercent = 100 * newVolume / maxVolume
audioManager!!.setStreamVolume(AudioManager.STREAM_MUSIC, newVolume, 0)
binding.gestureTextView.text = getString(R.string.ui_volume, newVolumePercent)
showGestureText()
binding.volumeText.text = newVolume.toString()
binding.volumeBar.progress = newVolume
if (newVolume == 0) binding.volumeImg.setImageResource(R.drawable.ic_volume_none_24dp)
else binding.volumeImg.setImageResource(R.drawable.ic_volume_high_24dp)
showVolumeView()
}
fun initSeek() {
@ -650,8 +686,8 @@ class PlayerActivity :
updatePlaybackPos(newPos)
val diffText = Utils.prettyTime(newDiff, true)
binding.gestureTextView.text = getString(R.string.ui_seek_distance, Utils.prettyTime(newPos), diffText)
showGestureText()
binding.seekText.text = getString(R.string.ui_seek_distance, Utils.prettyTime(newPos), diffText)
showSeekText()
}
@Suppress("UNUSED_PARAMETER")

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="50dp" />
<solid android:color="#505050"/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip android:clipOrientation="vertical" android:gravity="bottom">
<shape>
<corners android:radius="50dp" />
<solid android:color="?attr/colorAccent"/>
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip android:clipOrientation="vertical" android:gravity="bottom">
<shape>
<corners android:radius="50dp" />
<solid android:color="?attr/colorPrimary"/>
</shape>
</clip>
</item>
</layer-list>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:fillColor="#000000"
android:pathData="M13.719 1.8A8.759 8.759 0 1 1 1.8 13.719c3.335 1.867 7.633 1.387 10.469-1.449 2.837-2.837 3.318-7.134 1.45-10.47z" />
</vector>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="45.16"
android:viewportHeight="45.16">
<path
android:fillColor="#000000"
android:pathData="M22.58,11.269c-6.237,0-11.311,5.075-11.311,11.312s5.074,11.312,11.311,11.312c6.236,0,11.311-5.074,11.311-11.312 S28.816,11.269,22.58,11.269z" />
<path
android:fillColor="#000000"
android:pathData="M22.58,7.944c-1.219,0-2.207-0.988-2.207-2.206V2.207C20.373,0.988,21.361,0,22.58,0c1.219,0,2.207,0.988,2.207,2.207 v3.531C24.787,6.956,23.798,7.944,22.58,7.944z" />
<path
android:fillColor="#000000"
android:pathData="M22.58,37.215c-1.219,0-2.207,0.988-2.207,2.207v3.53c0,1.22,0.988,2.208,2.207,2.208c1.219,0,2.207-0.988,2.207-2.208 v-3.53C24.787,38.203,23.798,37.215,22.58,37.215z" />
<path
android:fillColor="#000000"
android:pathData="M32.928,12.231c-0.861-0.862-0.861-2.259,0-3.121l2.497-2.497c0.861-0.861,2.259-0.861,3.121,0 c0.862,0.862,0.862,2.26,0,3.121l-2.497,2.497C35.188,13.093,33.791,13.093,32.928,12.231z" />
<path
android:fillColor="#000000"
android:pathData="M12.231,32.93c-0.862-0.863-2.259-0.863-3.121,0l-2.497,2.496c-0.861,0.861-0.862,2.26,0,3.121 c0.862,0.861,2.26,0.861,3.121,0l2.497-2.498C13.093,35.188,13.093,33.79,12.231,32.93z" />
<path
android:fillColor="#000000"
android:pathData="M37.215,22.58c0-1.219,0.988-2.207,2.207-2.207h3.531c1.219,0,2.207,0.988,2.207,2.207c0,1.219-0.988,2.206-2.207,2.206 h-3.531C38.203,24.786,37.215,23.799,37.215,22.58z" />
<path
android:fillColor="#000000"
android:pathData="M7.944,22.58c0-1.219-0.988-2.207-2.207-2.207h-3.53C0.988,20.373,0,21.361,0,22.58c0,1.219,0.988,2.206,2.207,2.206 h3.531C6.956,24.786,7.944,23.799,7.944,22.58z" />
<path
android:fillColor="#000000"
android:pathData="M32.928,32.93c0.862-0.861,2.26-0.861,3.121,0l2.497,2.497c0.862,0.86,0.862,2.259,0,3.12s-2.259,0.861-3.121,0 l-2.497-2.497C32.066,35.188,32.066,33.791,32.928,32.93z" />
<path
android:fillColor="#000000"
android:pathData="M12.231,12.231c0.862-0.862,0.862-2.259,0-3.121L9.734,6.614c-0.862-0.862-2.259-0.862-3.121,0 c-0.862,0.861-0.862,2.259,0,3.12l2.497,2.497C9.972,13.094,11.369,13.094,12.231,12.231z" />
</vector>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1000"
android:viewportHeight="1000">
<group
android:translateY="511.000000"
android:scaleX="0.100000"
android:scaleY="-0.100000">
<path
android:fillColor="#000000"
android:pathData="M4644.5,4740.9c-38.8-9.7-104.2-36.3-145.4-55.7c-38.8-21.8-579.1-596.1-1199.4-1276.9L2172.9,2172.4l-809.3-2.4c-567,0-838.4-9.7-908.6-29.1c-128.4-38.8-285.9-196.3-324.7-324.7c-38.8-133.3-41.2-3268.7-2.4-3414.1c33.9-121.2,203.5-290.8,329.5-324.7c55.7-17,414.3-26.7,903.8-29.1h811.7l278.7-307.7C3747.9-3693.8,4445.8-4442.5,4516-4476.4c138.1-63,230.2-70.3,365.9-31.5c176.9,50.9,315,198.7,353.8,375.6c19.4,89.6,26.6,1313.3,26.6,4264.6c0,3569.2-4.8,4153.1-36.3,4257.3C5153.3,4631.8,4881.9,4796.6,4644.5,4740.9z" />
<path
android:fillColor="#000000"
android:pathData="M6304.2,3219.2v-508.8l201.1-17C7935,2579.5,9032.6,1263.8,8875.1-146.4c-70.3-620.3-312.6-1129.2-746.3-1567.7c-431.3-436.1-1022.5-714.8-1623.4-760.8l-201.1-14.5v-508.8v-508.8l213.2,17C7603-3407.9,8548-2894.2,9194.9-2034c184.2,244.7,443.4,746.3,535.5,1041.9c235,736.6,225.3,1550.8-26.7,2277.7c-472.5,1366.6-1713.1,2314-3174.2,2425.5l-225.3,17V3219.2z" />
<path
android:fillColor="#000000"
android:pathData="M6304.2,1152.3v-504l104.2-24.2c150.2-38.8,293.2-150.2,356.2-283.5c43.6-89.7,50.9-143,43.6-264.1c-14.5-249.6-155.1-414.4-399.8-477.4l-104.2-26.7v-506.4c0-278.7,7.3-506.4,19.4-506.4c9.7,0,87.2,12.1,174.5,24.2c651.8,104.2,1136.4,542.8,1296.3,1175.2c46.1,184.2,46.1,518.5,0,702.7c-164.8,651.8-707.5,1117-1373.9,1182.4l-116.3,12.1V1152.3z" />
</group>
</vector>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1000"
android:viewportHeight="1000">
<group
android:translateY="511.000000"
android:scaleX="0.100000"
android:scaleY="-0.100000">
<path
android:fillColor="#000000"
android:pathData="M4318,4485.8c-92-41.4-69-18.4-1244.8-1306.9c-908.9-996.3-1010.1-1097.5-1086-1109c-46-6.9-405-11.5-800.7-9.2l-717.9,2.3l-110.4-55.2c-75.9-41.4-131.1-92-179.5-170.3l-69-110.4l-6.9-1578.4c-6.9-1769.4-13.8-1698.1,158.8-1854.5c50.6-46,117.3-92,149.6-103.5c32.2-13.8,402.7-23,849-23h789.2l342.8-372.8c188.7-207.1,662.7-727.1,1053.8-1157.3c391.2-430.3,734-800.7,759.3-821.5c25.3-23,89.7-57.5,142.7-78.2c280.7-110.5,602.8,96.6,639.6,411.8c6.9,64.4,11.5,1896,6.9,4065.7l-6.9,3946.1l-57.5,103.5c-87.4,154.2-220.9,237-398.1,246.2C4444.5,4515.7,4361.7,4506.5,4318,4485.8z" />
<path
android:fillColor="#000000"
android:pathData="M6011.5,588.1c-13.8-4.6-23-186.4-23-478.6v-469.4h1955.8H9900v471.7c0,361.2-6.9,471.7-27.6,474C9764.2,590.4,6029.9,592.7,6011.5,588.1z" />
</group>
</vector>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1000"
android:viewportHeight="1000">
<group
android:translateY="511.000000"
android:scaleX="0.100000"
android:scaleY="-0.100000">
<path
android:fillColor="#000000"
android:pathData="M5592.5,5043.3c-70-30-370-340-1237.5-1292.5c-630-687.5-1165-1272.5-1190-1295c-40-40-117.5-45-905-45c-745,0-872.5-5-942.5-40c-112.5-57.5-190-132.5-245-240c-45-90-47.5-172.5-47.5-1820c0-1497.5,5-1740,37.5-1817.5l40-92.5l2610,2610L6325,3623.4v525c0,457.5-7.5,537.5-47.5,625C6157.5,5033.4,5855,5153.4,5592.5,5043.3z" />
<path
android:fillColor="#000000"
android:pathData="M4630,403.4l-4530-4530l367.5-370l370-367.5L2165-3536.6l1325,1325l362.5-395c200-217.5,650-712.5,1002.5-1097.5c507.5-555,662.5-712.5,745-745c270-107.5,572.5,20,685,290c35,82.5,40,375,40,2437.5v2345l1787.5,1787.5L9900,4198.4l-370,370l-367.5,367.5L4630,403.4z" />
</group>
</vector>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1000"
android:viewportHeight="1000">
<group
android:translateY="511.000000"
android:scaleX="0.100000"
android:scaleY="-0.100000">
<path
android:fillColor="#000000"
android:pathData="M4318,4485.8c-92-41.4-69-18.4-1244.8-1306.9c-908.9-996.3-1010.1-1097.5-1086-1109c-46-6.9-405-11.5-800.7-9.2l-717.9,2.3l-110.4-55.2c-75.9-41.4-131.1-92-179.5-170.3l-69-110.4l-6.9-1578.4c-6.9-1769.4-13.8-1698.1,158.8-1854.5c50.6-46,117.3-92,149.6-103.5c32.2-13.8,402.7-23,849-23h789.2l342.8-372.8c188.7-207.1,662.7-727.1,1053.8-1157.3c391.2-430.3,734-800.7,759.3-821.5c25.3-23,89.7-57.5,142.7-78.2c280.7-110.5,602.8,96.6,639.6,411.8c6.9,64.4,11.5,1896,6.9,4065.7l-6.9,3946.1l-57.5,103.5c-87.4,154.2-220.9,237-398.1,246.2C4444.5,4515.7,4361.7,4506.5,4318,4485.8z" />
<path
android:fillColor="#000000"
android:pathData="M7484,2060.6c-13.8-4.6-23-269.2-23-729.4c0-667.3-2.3-722.5-39.1-734c-23-6.9-340.5-11.5-708.7-11.5c-365.9,2.3-681.1,2.3-694.9,0c-23-2.3-29.9-112.7-29.9-474v-471.7h736.3H7461v-736.3v-736.3h483.2h483.2v736.3v736.3h736.3H9900v471.7c0,432.6-2.3,471.7-39.1,474c-23,2.3-352,4.6-731.7,6.9l-690.3,2.3l-6.9,731.7l-4.6,729.4l-168,2.3C7626.7,2067.5,7504.8,2067.5,7484,2060.6z" />
</group>
</vector>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/player_activity"
@ -15,11 +16,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#70000000" />
<!-- This LinearLayout only exists to prevent clipping -->
<LinearLayout
@ -64,16 +61,16 @@
app:tint="?attr/colorOnPrimarySurface" />
<RelativeLayout
android:id="@+id/controls_top"
android:id="@+id/player_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center">
android:background="#70000000">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/title_txt_group"
android:id="@+id/controls_top"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<ImageButton
android:id="@+id/backArrowBtn"
@ -87,6 +84,7 @@
app:layout_constraintRight_toLeftOf="@id/fullTitleTxt"
app:layout_constraintTop_toTopOf="parent"/>
<LinearLayout
android:id="@+id/fullTitleTxt"
android:layout_width="0dp"
@ -130,7 +128,6 @@
app:tint="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/cycleSubsBtn"
android:layout_width="48dp"
@ -169,223 +166,308 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
<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"
<RelativeLayout
android:id="@+id/controls_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="vertical"
android:layout_height="match_parent"
tools:visibility="visible">
<LinearLayout
android:id="@+id/controls_title_group"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android: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" />
<!-- 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:id="@+id/control_bar"
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="vertical"
tools:visibility="visible">
<LinearLayout
android:layout_width="wrap_content"
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_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:background="?attr/selectableItemBackgroundBorderless"
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/selectableItemBackgroundBorderless"
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/selectableItemBackgroundBorderless"
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/selectableItemBackgroundBorderless"
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/lockBtn"
android:id="@+id/prevBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_lock_24dp"
android:contentDescription="@string/action_previous_episode"
android:padding="@dimen/screen_edge_margin"
app:srcCompat="@drawable/ic_skip_previous_24dp"
app:tint="?attr/colorOnPrimarySurface" />
<Button
android:id="@+id/cycleSpeedBtn"
<TextView
android:id="@+id/playbackPositionTxt"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackgroundBorderless"
android:onClick="cycleSpeed"
android:text=".."
android:textColor="?attr/colorOnPrimarySurface" />
</LinearLayout>
android:layout_weight="10"
android:gravity="center"
android:text="0:00"
android:textColor="@android:color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<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" />
<Button
android:id="@+id/controls_skip_intro_btn"
<TextView
android:id="@+id/playbackDurationTxt"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackgroundBorderless"
android:onClick="skipIntro"
android:text="@string/player_controls_skip_intro_text"
android:textColor="?attr/colorOnPrimarySurface" />
android:layout_weight="10"
android:gravity="center"
android:text="0:00"
android:textColor="@android:color/white" />
<ImageButton
android:id="@+id/cycleViewModeBtn"
android:id="@+id/nextBtn"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_height="48dp"
android:layout_marginRight="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Cycle view modes"
android:onClick="cycleViewMode"
android:src="@drawable/ic_fullscreen_black_24dp"
android:contentDescription="@string/action_next_episode"
android:padding="@dimen/screen_edge_margin"
app:srcCompat="@drawable/ic_skip_next_24dp"
app:tint="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/pipBtn"
android:layout_width="48dp"
android:layout_height="match_parent"
android:src="@drawable/ic_picture_in_picture_24dp"
android:background="?android:attr/selectableItemBackground"
android:visibility="visible"
android:contentDescription="@string/action_player_pip" />
</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: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>
</RelativeLayout>
<LinearLayout
android:id="@+id/volumeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_alignParentLeft="true"
android:layout_marginLeft="45dp"
android:layout_marginTop="90dp"
android:visibility="gone">
<TextView
android:id="@+id/volumeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10"
android:gravity="left"
android:textColor="?attr/colorOnPrimarySurface"
android:textSize="15sp"
android:layout_marginBottom="5dp"/>
<ProgressBar
style="@android:style/Widget.ProgressBar.Horizontal"
android:id="@+id/volumeBar"
android:layout_width="25dp"
android:layout_height="125dp"
android:max="15"
android:progress="10"
android:progressDrawable="@drawable/player_bar" />
<ImageView
android:id="@+id/volumeImg"
android:layout_width="30dp"
android:layout_height="20dp"
android:src="@drawable/ic_volume_high_24dp"
app:tint="?attr/colorOnPrimarySurface"
android:layout_marginTop="5dp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/brightnessView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_alignParentRight="true"
android:layout_marginRight="45dp"
android:layout_marginTop="90dp"
android:visibility="gone">
<TextView
android:id="@+id/brightnessText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="100"
android:textColor="?attr/colorOnPrimarySurface"
android:textSize="15sp" />
<ProgressBar
android:id="@+id/brightnessBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="25dp"
android:layout_height="125dp"
android:max="100"
android:progress="10"
android:progressDrawable="@drawable/player_bar" />
<ImageView
android:id="@+id/brightnessImg"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_marginTop="5dp"
android:src="@drawable/ic_brightness_positive_24dp"
app:tint="?attr/colorOnPrimarySurface" />
</LinearLayout>
<LinearLayout
android:id="@+id/seekView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<TextView
android:id="@+id/seekText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:shadowColor="#000000"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="4"
android:text="[gesture]"
android:textAlignment="center"
android:textColor="#ffffff"
android:textSize="36sp"
android:textStyle="bold" />
</LinearLayout>
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/loading_indicator"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:indeterminate="true"
app:indicatorColor="?attr/colorAccent"
app:indicatorColor="?attr/colorPrimary"
app:indicatorSize="65dp" />
<TextView
android:id="@+id/gestureTextView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:shadowColor="#000000"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="4"
android:text="[gesture]"
android:textAlignment="center"
android:textColor="#ffffff"
android:textSize="36sp"
android:textStyle="bold"
android:visibility="gone" />
<View
android:id="@+id/brightness_overlay"
android:layout_width="match_parent"