More player updates (#593)

* Rewrite and clean up player controls and activity

* rename crashlogs to aniyomi

* Update PlayerActivity.kt
This commit is contained in:
Quickdesh 2022-05-22 17:23:20 +09:00 committed by GitHub
parent c35a074b08
commit 5b40fa3d71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 408 additions and 538 deletions

View file

@ -108,6 +108,8 @@ class PlayerActivity :
internal val player get() = binding.player
private val playerControls get() = binding.playerControls
private var audioManager: AudioManager? = null
private var fineVolume = 0F
private var maxVolume = 0
@ -209,16 +211,16 @@ class PlayerActivity :
// Fade out Volume Bar
private val volumeViewRunnable = Runnable {
AnimationUtils.loadAnimation(this, R.anim.fade_out_medium).also { fadeAnimation ->
binding.volumeView.startAnimation(fadeAnimation)
binding.volumeView.visibility = View.GONE
playerControls.binding.volumeView.startAnimation(fadeAnimation)
playerControls.binding.volumeView.visibility = View.GONE
}
}
// Fade out Brightness Bar
private val brightnessViewRunnable = Runnable {
AnimationUtils.loadAnimation(this, R.anim.fade_out_medium).also { fadeAnimation ->
binding.brightnessView.startAnimation(fadeAnimation)
binding.brightnessView.visibility = View.GONE
playerControls.binding.brightnessView.startAnimation(fadeAnimation)
playerControls.binding.brightnessView.visibility = View.GONE
}
}
@ -234,12 +236,12 @@ class PlayerActivity :
}
"volume" -> {
callback = volumeViewRunnable
itemView = binding.volumeView
itemView = playerControls.binding.volumeView
delay = 750L
}
"brightness" -> {
callback = brightnessViewRunnable
itemView = binding.brightnessView
itemView = playerControls.binding.brightnessView
delay = 750L
}
else -> return
@ -269,7 +271,7 @@ class PlayerActivity :
private var hadPreviousAudio = false
override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
binding.playerControls.resetControlsFade()
playerControls.resetControlsFade()
return super.dispatchTouchEvent(ev)
}
@ -289,7 +291,7 @@ class PlayerActivity :
}
setVisibilities()
binding.playerControls.showAndFadeControls()
playerControls.showAndFadeControls()
setMpvConf()
player.initialize(applicationContext.filesDir.path)
@ -370,19 +372,13 @@ class PlayerActivity :
if (width <= height) {
width = height.also { height = width }
}
binding.playerControls.binding.controlsTopLandscape.visibility = View.VISIBLE
binding.playerControls.binding.controlsTopPortrait.visibility = View.GONE
setupGestures()
setViewMode()
} else {
if (width >= height) {
width = height.also { height = width }
}
binding.playerControls.binding.controlsTopPortrait.visibility = View.VISIBLE
binding.playerControls.binding.controlsTopLandscape.visibility = View.GONE
setupGestures()
setViewMode()
}
setupGestures()
setViewMode()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) player.paused?.let { updatePictureInPictureActions(!it) }
}
}
@ -440,11 +436,11 @@ class PlayerActivity :
}
}
fun toggleControls() = binding.playerControls.toggleControls()
fun toggleControls() = playerControls.toggleControls()
private fun showLoadingIndicator(visible: Boolean) {
if (binding.loadingIndicator.isVisible == visible) return
binding.playerControls.binding.playBtn.isVisible = !visible
playerControls.binding.playBtn.isVisible = !visible
binding.loadingIndicator.isVisible = visible
}
@ -526,7 +522,7 @@ class PlayerActivity :
@Suppress("UNUSED_PARAMETER")
fun playPause(view: View) {
player.cyclePause()
binding.playerControls.playPause()
playerControls.playPause()
}
private val doubleTapPlayPauseRunnable = Runnable {
@ -538,9 +534,9 @@ class PlayerActivity :
fun doubleTapPlayPause() {
animationHandler.removeCallbacks(doubleTapPlayPauseRunnable)
playPause(binding.playerControls.binding.playBtn)
playPause(playerControls.binding.playBtn)
if (!binding.playerControls.binding.controlsView.isVisible) {
if (!playerControls.binding.controlsView.isVisible) {
when {
player.paused!! -> { binding.playPauseView.setImageResource(R.drawable.ic_pause_80dp) }
!player.paused!! -> { binding.playPauseView.setImageResource(R.drawable.ic_play_arrow_80dp) }
@ -559,7 +555,7 @@ class PlayerActivity :
val v = if (time < 0) binding.rewBg else binding.ffwdBg
val w = if (time < 0) width * 0.2F else width * 0.8F
val x = (event?.x?.toInt() ?: w.toInt()) - v.x.toInt()
val y = (event?.y?.toInt() ?: height / 2) - v.y.toInt()
val y = (event?.y?.toInt() ?: (height / 2)) - v.y.toInt()
ViewAnimationUtils.createCircularReveal(v, x, y, 0f, kotlin.math.max(v.height, v.width).toFloat()).setDuration(500).start()
ObjectAnimator.ofFloat(v, "alpha", 0f, 0.2f).setDuration(500).start()
@ -587,10 +583,16 @@ class PlayerActivity :
binding.brightnessOverlay.isVisible = false
}
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); binding.brightnessBar.max = 100 } else { binding.brightnessImg.setImageResource(R.drawable.ic_brightness_negative_24dp); binding.brightnessBar.max = 75 }
playerControls.binding.brightnessText.text = finalBrightness.toString()
playerControls.binding.brightnessBar.progress = finalBrightness
playerControls.binding.brightnessBar.secondaryProgress = abs(finalBrightness)
if (finalBrightness >= 0) {
playerControls.binding.brightnessImg.setImageResource(R.drawable.ic_brightness_positive_24dp)
playerControls.binding.brightnessBar.max = 100
} else {
playerControls.binding.brightnessImg.setImageResource(R.drawable.ic_brightness_negative_24dp)
playerControls.binding.brightnessBar.max = 75
}
showGestureView("brightness")
}
@ -600,10 +602,10 @@ class PlayerActivity :
// val newVolumePercent = 100 * newVolume / maxVolume
audioManager!!.setStreamVolume(AudioManager.STREAM_MUSIC, newVolume, 0)
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)
playerControls.binding.volumeText.text = newVolume.toString()
playerControls.binding.volumeBar.progress = newVolume
if (newVolume == 0) playerControls.binding.volumeImg.setImageResource(R.drawable.ic_volume_none_24dp)
else playerControls.binding.volumeImg.setImageResource(R.drawable.ic_volume_high_24dp)
showGestureView("volume")
}
@ -662,7 +664,7 @@ class PlayerActivity :
val newDiff = newPos - initialSeek
// seek faster than assigning to timePos but less precise
MPVLib.command(arrayOf("seek", newPos.toString(), "absolute+keyframes"))
binding.playerControls.updatePlaybackPos(newPos)
playerControls.updatePlaybackPos(newPos)
val diffText = Utils.prettyTime(newDiff, true)
binding.seekText.text = getString(R.string.ui_seek_distance, Utils.prettyTime(newPos), diffText)
@ -751,13 +753,13 @@ class PlayerActivity :
fun switchDecoder(view: View) {
player.cycleHwdec()
preferences.getPlayerViewMode()
binding.playerControls.updateDecoderButton()
playerControls.updateDecoderButton()
}
@Suppress("UNUSED_PARAMETER")
fun cycleSpeed(view: View) {
player.cycleSpeed()
binding.playerControls.updateSpeedButton()
playerControls.updateSpeedButton()
}
@Suppress("UNUSED_PARAMETER")
@ -769,18 +771,16 @@ class PlayerActivity :
// forces update of entire UI, used when resuming the activity
val paused = player.paused ?: return
updatePlaybackStatus(paused)
player.timePos?.let { binding.playerControls.updatePlaybackPos(it) }
player.duration?.let { binding.playerControls.updatePlaybackDuration(it) }
player.timePos?.let { playerControls.updatePlaybackPos(it) }
player.duration?.let { playerControls.updatePlaybackDuration(it) }
updatePlaylistButtons()
updateEpisodeText()
player.loadTracks()
}
private fun updateEpisodeText() {
binding.playerControls.binding.titleMainTxtLandscape.text = presenter.anime?.title
binding.playerControls.binding.titleSecondaryTxtLandscape.text = presenter.currentEpisode?.name
binding.playerControls.binding.titleMainTxtPortrait.text = presenter.anime?.title
binding.playerControls.binding.titleSecondaryTxtPortrait.text = presenter.currentEpisode?.name
playerControls.binding.titleMainTxt.text = presenter.anime?.title
playerControls.binding.titleSecondaryTxt.text = presenter.currentEpisode?.name
}
private fun updatePlaylistButtons() {
@ -789,11 +789,11 @@ class PlayerActivity :
val grey = ContextCompat.getColor(this, R.color.tint_disabled)
val white = ContextCompat.getColor(this, R.color.tint_normal)
with(binding.playerControls.binding.prevBtn) {
with(playerControls.binding.prevBtn) {
this.imageTintList = ColorStateList.valueOf(if (plPos == 0) grey else white)
this.isClickable = plPos != 0
}
with(binding.playerControls.binding.nextBtn) {
with(playerControls.binding.nextBtn) {
this.imageTintList = ColorStateList.valueOf(if (plPos == plCount - 1) grey else white)
this.isClickable = plPos != plCount - 1
}
@ -802,7 +802,7 @@ class PlayerActivity :
private fun updatePlaybackStatus(paused: Boolean) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isInPipMode) updatePictureInPictureActions(!paused)
val r = if (paused) R.drawable.ic_play_arrow_80dp else R.drawable.ic_pause_80dp
binding.playerControls.binding.playBtn.setImageResource(r)
playerControls.binding.playBtn.setImageResource(r)
if (paused) {
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
@ -851,7 +851,7 @@ class PlayerActivity :
if (isInPictureInPictureMode) {
// On Android TV it is required to hide controller in this PIP change callback
binding.playerControls.hideControls(true)
playerControls.hideControls(true)
binding.loadingIndicator.indicatorSize = binding.loadingIndicator.indicatorSize / 2
mReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
@ -876,7 +876,7 @@ class PlayerActivity :
}
registerReceiver(mReceiver, IntentFilter(ACTION_MEDIA_CONTROL))
} else {
if (player.paused!!) binding.playerControls.hideControls(false)
if (player.paused!!) playerControls.hideControls(false)
binding.loadingIndicator.indicatorSize = binding.loadingIndicator.indicatorSize * 2
if (mReceiver != null) {
unregisterReceiver(mReceiver)
@ -1136,8 +1136,8 @@ class PlayerActivity :
private fun eventPropertyUi(property: String, value: Long) {
when (property) {
"time-pos" -> binding.playerControls.updatePlaybackPos(value.toInt())
"duration" -> binding.playerControls.updatePlaybackDuration(value.toInt())
"time-pos" -> playerControls.updatePlaybackPos(value.toInt())
"duration" -> playerControls.updatePlaybackDuration(value.toInt())
}
}

View file

@ -63,28 +63,23 @@ class PlayerControlsView @JvmOverloads constructor(context: Context, attrs: Attr
override fun onViewAdded(child: View?) {
binding.pipBtn.isVisible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
binding.backArrowBtnLandscape.setOnClickListener { activity.onBackPressed() }
binding.backArrowBtnPortrait.setOnClickListener { activity.onBackPressed() }
binding.backArrowBtn.setOnClickListener { activity.onBackPressed() }
// Lock and Unlock controls
binding.lockBtn.setOnClickListener { lockControls(true) }
binding.unlockBtn.setOnClickListener { lockControls(false) }
// Cycle, Long click controls
binding.cycleAudioBtnLandscape.setOnLongClickListener { pickAudio(); true }
binding.cycleAudioBtnPortrait.setOnLongClickListener { pickAudio(); true }
binding.cycleAudioBtn.setOnLongClickListener { pickAudio(); true }
binding.cycleSpeedBtn.setOnLongClickListener { pickSpeed(); true }
binding.cycleSubsBtnLandscape.setOnLongClickListener { pickSub(); true }
binding.cycleSubsBtnPortrait.setOnLongClickListener { pickSub(); true }
binding.cycleSubsBtn.setOnLongClickListener { pickSub(); true }
binding.playbackSeekbar.setOnSeekBarChangeListener(seekBarChangeListener)
binding.nextBtn.setOnClickListener { activity.switchEpisode(false) }
binding.prevBtn.setOnClickListener { activity.switchEpisode(true) }
binding.settingsBtnPortrait.setOnClickListener { showSettings() }
}
private val animationHandler = Handler(Looper.getMainLooper())
@ -151,11 +146,10 @@ class PlayerControlsView @JvmOverloads constructor(context: Context, attrs: Attr
}
internal fun updateDecoderButton() {
if (binding.cycleDecoderBtnLandscape.visibility != View.VISIBLE && binding.cycleDecoderBtnPortrait.visibility != View.VISIBLE) {
if (binding.cycleDecoderBtn.visibility != View.VISIBLE && binding.cycleDecoderBtn.visibility != View.VISIBLE) {
return
}
binding.cycleDecoderBtnLandscape.text = if (activity.player.hwdecActive) "HW" else "SW"
binding.cycleDecoderBtnPortrait.text = if (activity.player.hwdecActive) "HW" else "SW"
binding.cycleDecoderBtn.text = if (activity.player.hwdecActive) "HW" else "SW"
}
internal fun updateSpeedButton() {
@ -296,9 +290,4 @@ class PlayerControlsView @JvmOverloads constructor(context: Context, attrs: Attr
}
picker.number = MPVLib.getPropertyDouble("speed")
}
private fun showSettings() {
if (binding.settingsLayoutPortrait.isVisible) fadeOutView(binding.settingsLayoutPortrait)
else fadeInView(binding.settingsLayoutPortrait)
}
}

View file

@ -24,7 +24,7 @@ class CrashLogUtil(private val context: Context) {
fun dumpLogs() {
launchIO {
try {
val file = context.createFileInCacheDir("tachiyomi_crash_logs.txt")
val file = context.createFileInCacheDir("aniyomi_crash_logs.txt")
Runtime.getRuntime().exec("logcat *:E -d -f ${file.absolutePath}").waitFor()
file.appendText(getDebugInfo())

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="56dp"
android:height="56dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/black"
android:pathData="M6,18l8.5,-6L6,6v12zM16,6v12h2V6h-2z" />
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="56dp"
android:height="56dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/black"
android:pathData="M6,6h2v12L6,18zM9.5,12l8.5,6L18,6z" />
</vector>

View file

@ -65,90 +65,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/volumeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_centerInParent="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="45dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/volumeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10"
android:gravity="left"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:layout_marginBottom="5dp"/>
<ProgressBar
style="@android:style/Widget.ProgressBar.Horizontal"
android:id="@+id/volumeBar"
android:layout_width="26dp"
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="#FFFFFF"
android:layout_marginTop="5dp"
tools:ignore="ContentDescription" />
</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_centerInParent="true"
android:layout_marginRight="45dp"
android:layout_marginTop="105dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/brightnessText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="100"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<ProgressBar
android:id="@+id/brightnessBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="26dp"
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="#FFFFFF"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/seekView"
android:layout_width="match_parent"
@ -181,7 +97,8 @@
android:background="#70000000"
android:visibility="gone"
app:tint="?attr/colorOnPrimarySurface"
tools:src="@drawable/ic_play_arrow_80dp" />
tools:src="@drawable/ic_play_arrow_80dp"
tools:visibility="visible" />
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/loading_indicator"

View file

@ -5,8 +5,9 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="RtlHardcoded,HardcodedText" >
tools:ignore="RtlHardcoded,HardcodedText">
<!-- Locked player check -->
<LinearLayout
android:id="@+id/lockedView"
@ -28,436 +29,381 @@
</LinearLayout>
<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/controlsView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#70000000">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/controlsTopPortrait"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<!-- Top Controls (Right)-->
<ImageButton
android:id="@+id/backArrowBtnPortrait"
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/fullTitleTxtPortrait"
app:layout_constraintTop_toTopOf="parent"/>
<LinearLayout
android:id="@+id/fullTitleTxtPortrait"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical"
app:layout_constraintLeft_toRightOf="@id/backArrowBtnPortrait"
app:layout_constraintRight_toLeftOf="@id/qualityBtnPortrait"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/titleMainTxtPortrait"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:textColor="?attr/colorOnPrimarySurface"
android:text=""
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/titleSecondaryTxtPortrait"
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/qualityBtnPortrait"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="Quality"
android:background="?attr/selectableItemBackground"
android:onClick="openQuality"
android:src="@drawable/ic_video_quality_24dp"
app:tint="?attr/colorOnPrimarySurface"
app:layout_constraintRight_toLeftOf="@id/settingsBtnPortrait"
app:layout_constraintTop_toTopOf="parent"/>
<ImageButton
android:id="@+id/settingsBtnPortrait"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginRight="10dp"
android:contentDescription="Settings"
android:background="?attr/selectableItemBackground"
android:src="@drawable/ic_settings_24dp"
app:tint="?attr/colorOnPrimarySurface"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/settingsLayoutPortrait"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:gravity="center"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/settingsBtnPortrait"
android:visibility="gone">
<ImageButton
android:id="@+id/cycleSubsBtnPortrait"
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" />
<ImageButton
android:id="@+id/cycleAudioBtnPortrait"
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:tint="?attr/colorOnPrimarySurface" />
<Button
android:id="@+id/cycleDecoderBtnPortrait"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:background="?attr/selectableItemBackground"
android:onClick="switchDecoder"
android:text=".."
android:textColor="?attr/colorOnPrimarySurface" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/controlsTopLandscape"
android:layout_width="match_parent"
android:layout_height="wrap_content"
<ImageButton
android:id="@+id/backArrowBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:visibility="gone">
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Go back"
android:src="@drawable/ic_arrow_back_24dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/titleMainTxt"
app:layout_constraintTop_toTopOf="parent"
app:tint="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/backArrowBtnLandscape"
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/fullTitleTxtLandscape"
app:layout_constraintTop_toTopOf="parent"/>
<LinearLayout
android:id="@+id/fullTitleTxtLandscape"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintLeft_toRightOf="@id/backArrowBtnLandscape"
app:layout_constraintRight_toLeftOf="@id/cycleDecoderBtnLandscape"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/titleMainTxt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:layout_marginTop="10dp"
android:text=""
android:textColor="?attr/colorOnPrimarySurface"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@id/backArrowBtn"
app:layout_constraintRight_toLeftOf="@id/cycleDecoderBtn"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/titleMainTxtLandscape"
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="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:alpha="0.5"
android:text=""
android:textColor="?attr/colorOnPrimarySurface"
android:textSize="12sp"
app:layout_constraintLeft_toRightOf="@id/backArrowBtn"
app:layout_constraintRight_toLeftOf="@id/cycleDecoderBtn"
app:layout_constraintTop_toBottomOf="@id/titleMainTxt" />
<TextView
android:id="@+id/titleSecondaryTxtLandscape"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/colorOnPrimarySurface"
android:alpha = "0.5"
android:textSize="12sp"
android:text="" />
<!-- Top Controls (Left)-->
</LinearLayout>
<ImageButton
android:id="@+id/qualityBtnLandscape"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="Settings"
android:background="?attr/selectableItemBackground"
android:onClick="openQuality"
android:layout_marginRight="10dp"
android:src="@drawable/ic_video_quality_24dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:tint="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/qualityBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="Settings"
android:onClick="openQuality"
android:src="@drawable/ic_video_quality_24dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/cycleSubsBtnLandscape"
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/cycleAudioBtnLandscape"
app:layout_constraintRight_toLeftOf="@id/qualityBtnLandscape"
app:layout_constraintTop_toTopOf="parent"/>
<ImageButton
android:id="@+id/cycleSubsBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="Subtitles"
android:onClick="cycleSub"
android:src="@drawable/ic_subtitles_black_24dp"
app:layout_constraintRight_toLeftOf="@id/qualityBtn"
app:layout_constraintTop_toTopOf="@id/qualityBtn"
app:tint="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/cycleAudioBtnLandscape"
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/cycleDecoderBtnLandscape"
app:layout_constraintRight_toLeftOf="@id/cycleSubsBtnLandscape"
app:tint="?attr/colorOnPrimarySurface" />
<ImageButton
android:id="@+id/cycleAudioBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="Audio"
android:onClick="cycleAudio"
android:src="@drawable/ic_audiotrack_black_24dp"
app:layout_constraintRight_toLeftOf="@id/cycleSubsBtn"
app:layout_constraintTop_toTopOf="@id/cycleSubsBtn"
app:tint="?attr/colorOnPrimarySurface" />
<Button
android:id="@+id/cycleDecoderBtnLandscape"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_toLeftOf="@id/cycleAudioBtnLandscape"
android:background="?attr/selectableItemBackground"
android:onClick="switchDecoder"
android:text=".."
android:textColor="?attr/colorOnPrimarySurface"
app:layout_constraintRight_toLeftOf="@id/cycleAudioBtnLandscape"
app:layout_constraintTop_toTopOf="parent"/>
<Button
android:id="@+id/cycleDecoderBtn"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:background="?attr/selectableItemBackground"
android:onClick="switchDecoder"
android:text=".."
android:textColor="?attr/colorOnPrimarySurface"
app:layout_constraintRight_toLeftOf="@id/cycleAudioBtn"
app:layout_constraintTop_toTopOf="@id/cycleAudioBtn" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- Audio -->
<RelativeLayout
android:id="@+id/controls_bottom"
<TextView
android:id="@+id/titleTextView"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:visibility="visible">
android:layout_height="wrap_content"
android:gravity="center"
android:text="-"
android:textColor="@color/tint_normal"
android:textSize="24sp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/minorTitleTextView"
app:layout_constraintLeft_toLeftOf="parent" />
<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" />
<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"
app:layout_constraintBottom_toTopOf="@id/lockBtn"
app:layout_constraintLeft_toLeftOf="parent" />
<!-- Bottom controls (Left) -->
<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">
<ImageButton
android:id="@+id/lockBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="10dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="Lock player"
android:src="@drawable/ic_lock_24dp"
app:layout_constraintBottom_toTopOf="@id/playbackSeekbar"
app:layout_constraintLeft_toLeftOf="parent"
app:tint="?attr/colorOnPrimarySurface" />
<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/rotateBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="Rotate player"
android:onClick="rotatePlayer"
android:src="@drawable/ic_screen_rotation_24dp"
app:layout_constraintBottom_toTopOf="@id/playbackSeekbar"
app:layout_constraintLeft_toRightOf="@id/lockBtn"
app:tint="?attr/colorOnPrimarySurface" />
<!-- These two are only used for audio -->
<Button
android:id="@+id/cycleSpeedBtn"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:background="?attr/selectableItemBackground"
android:onClick="cycleSpeed"
android:text=".."
android:textColor="?attr/colorOnPrimarySurface"
app:layout_constraintBottom_toTopOf="@id/playbackSeekbar"
app:layout_constraintLeft_toRightOf="@id/rotateBtn" />
<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" />
<!-- Bottom controls (Right) -->
<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" />
<ImageButton
android:id="@+id/pipBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginRight="10dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/action_player_pip"
android:onClick="startPiP"
android:src="@drawable/ic_picture_in_picture_24dp"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/playbackSeekbar"
app:layout_constraintRight_toRightOf="parent" />
</LinearLayout>
<ImageButton
android:id="@+id/cycleViewModeBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="Cycle view modes"
android:onClick="cycleViewMode"
android:src="@drawable/ic_fullscreen_black_24dp"
app:layout_constraintBottom_toTopOf="@id/playbackSeekbar"
app:layout_constraintRight_toLeftOf="@id/pipBtn"
app:tint="?attr/colorOnPrimarySurface" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/controls_skip_intro_btn"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:background="?attr/selectableItemBackground"
android:onClick="skipIntro"
android:text="@string/player_controls_skip_intro_text"
android:textColor="?attr/colorOnPrimarySurface"
app:layout_constraintBottom_toTopOf="@id/playbackSeekbar"
app:layout_constraintRight_toLeftOf="@id/cycleViewModeBtn" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!-- SeekBar Group (Bottom) -->
<ImageButton
android:id="@+id/lockBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="10dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="Lock player"
android:src="@drawable/ic_lock_24dp"
app:tint="?attr/colorOnPrimarySurface" />
<TextView
android:id="@+id/playbackPositionTxt"
android:layout_width="96dp"
android:layout_height="48dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:gravity="center"
android:text="0:00:00"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<ImageButton
android:id="@+id/rotateBtn"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="Rotate player"
android:onClick="rotatePlayer"
android:src="@drawable/ic_screen_rotation_24dp"
app:tint="?attr/colorOnPrimarySurface" />
<SeekBar
android:id="@+id/playbackSeekbar"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:layout_marginBottom="10dp"
android:layout_weight="80"
android:progressBackgroundTint="@color/tint_seekbar_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/playbackPositionTxt"
app:layout_constraintRight_toLeftOf="@id/playbackDurationTxt" />
<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>
<TextView
android:id="@+id/playbackDurationTxt"
android:layout_width="96dp"
android:layout_height="48dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:gravity="center"
android:text="0:00:00"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:gravity="right"
android:orientation="horizontal">
<!-- Middle Controls -->
<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/prevBtn"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginRight="240dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/action_previous_episode"
android:padding="@dimen/screen_edge_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_skip_previous_56dp"
app:tint="?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/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:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="?attr/colorOnPrimarySurface"
tools:src="@drawable/ic_play_arrow_80dp"
tools:visibility="visible" />
<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:onClick="startPiP"
android:src="@drawable/ic_picture_in_picture_24dp"
android:visibility="visible" />
<ImageButton
android:id="@+id/nextBtn"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginLeft="240dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/action_next_episode"
android:padding="@dimen/screen_edge_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_skip_next_56dp"
app:tint="?attr/colorOnPrimarySurface" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<!-- Extra Controls -->
<LinearLayout
android:id="@+id/volumeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true"
android:layout_marginLeft="18dp"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
android:id="@+id/controls_seekbar_group"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="100">
<TextView
android:id="@+id/volumeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:gravity="left"
android:text="10"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<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" />
<ProgressBar
android:id="@+id/volumeBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="26dp"
android:layout_height="125dp"
android:max="15"
android:progress="10"
android:progressDrawable="@drawable/player_bar" />
<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" />
<ImageView
android:id="@+id/volumeImg"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_marginTop="5dp"
android:src="@drawable/ic_volume_high_24dp"
app:tint="#FFFFFF"
tools:ignore="ContentDescription" />
<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>
<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" />
<LinearLayout
android:id="@+id/brightnessView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_marginRight="18dp"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<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" />
<TextView
android:id="@+id/brightnessText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="100"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<ProgressBar
android:id="@+id/brightnessBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="26dp"
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="#FFFFFF"
tools:ignore="ContentDescription" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>