add aspect ratio mode

This commit is contained in:
Bnyro 2022-07-17 17:35:36 +02:00
parent 00a1303180
commit 88aef190f9
2 changed files with 15 additions and 11 deletions

View File

@ -445,13 +445,17 @@ class PlayerFragment : Fragment() {
}
// switching between original aspect ratio (black bars) and zoomed to fill device screen
val aspectRatioModes = arrayOf(
AspectRatioFrameLayout.RESIZE_MODE_FIT,
AspectRatioFrameLayout.RESIZE_MODE_ZOOM,
AspectRatioFrameLayout.RESIZE_MODE_FILL
)
playerBinding.aspectRatioButton.setOnClickListener {
val isZoomed = exoPlayerView.resizeMode != AspectRatioFrameLayout.RESIZE_MODE_FIT
if (isZoomed) {
exoPlayerView.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT
} else {
exoPlayerView.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
}
val index = aspectRatioModes.indexOf(exoPlayerView.resizeMode)
val newAspectRatioMode =
if (index + 1 < aspectRatioModes.size) aspectRatioModes[index + 1]
else aspectRatioModes[0]
exoPlayerView.resizeMode = newAspectRatioMode
}
// lock and unlock the player

View File

@ -72,10 +72,10 @@ object ThemeHelper {
// Disable Old Icon(s)
for (activityAlias in activityAliases) {
val activityClass = "com.github.libretube." +
if (activityAlias == activityAliases[0]) "activities.MainActivity" // default icon/activity
else activityAlias
if (activityAlias == activityAliases[0]) "activities.MainActivity" // default icon/activity
else activityAlias
// remove old icons
// remove old icons
context.packageManager.setComponentEnabledSetting(
ComponentName(context.packageName, activityClass),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
@ -85,8 +85,8 @@ object ThemeHelper {
// set the class name for the activity alias
val newLogoActivityClass = "com.github.libretube." +
if (newLogoActivityAlias == activityAliases[0]) "activities.MainActivity" // default icon/activity
else newLogoActivityAlias
if (newLogoActivityAlias == activityAliases[0]) "activities.MainActivity" // default icon/activity
else newLogoActivityAlias
// Enable New Icon
context.packageManager.setComponentEnabledSetting(
ComponentName(context.packageName, newLogoActivityClass),