mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
increase bottom bar margin upon landscape
This commit is contained in:
parent
4f7d28ee0e
commit
404ea99c8e
@ -1,5 +1,6 @@
|
||||
package com.github.libretube.ui.activities
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.res.Configuration
|
||||
@ -387,15 +388,13 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SwitchIntDef")
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
val orientation = newConfig.orientation
|
||||
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
println("Portrait")
|
||||
unsetFullscreen()
|
||||
} else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
println("Landscape")
|
||||
setFullscreen()
|
||||
|
||||
when (newConfig.orientation) {
|
||||
Configuration.ORIENTATION_PORTRAIT -> unsetFullscreen()
|
||||
Configuration.ORIENTATION_LANDSCAPE -> setFullscreen()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1558,12 +1558,11 @@ class PlayerFragment : BaseFragment() {
|
||||
|
||||
if (autoRotationEnabled) {
|
||||
val orientation = newConfig.orientation
|
||||
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
when (orientation) {
|
||||
// go to fullscreen mode
|
||||
setFullscreen()
|
||||
} else {
|
||||
Configuration.ORIENTATION_LANDSCAPE -> setFullscreen()
|
||||
// exit fullscreen if not landscape
|
||||
unsetFullscreen()
|
||||
else -> unsetFullscreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.github.libretube.ui.views
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.AttributeSet
|
||||
@ -384,4 +385,19 @@ internal class CustomExoPlayerView(
|
||||
}
|
||||
.show(childFragmentManager)
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration?) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
|
||||
val offsetFactor: Float = when (newConfig?.orientation) {
|
||||
Configuration.ORIENTATION_LANDSCAPE -> 2F
|
||||
else -> 1F / 2F
|
||||
}
|
||||
|
||||
binding.progressBar.let {
|
||||
val params = it.layoutParams as MarginLayoutParams
|
||||
params.bottomMargin = (params.bottomMargin * offsetFactor).toInt()
|
||||
it.layoutParams = params
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user