mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +05:30
fullscreen orientation setting
This commit is contained in:
parent
72fb852c26
commit
73beffef22
@ -284,7 +284,22 @@ class PlayerFragment : Fragment() {
|
|||||||
scaleFactor = 1.3F
|
scaleFactor = 1.3F
|
||||||
|
|
||||||
val mainActivity = activity as MainActivity
|
val mainActivity = activity as MainActivity
|
||||||
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
|
val fullscreenOrientationPref = PreferenceHelper
|
||||||
|
.getString(requireContext(), "fullscreen_rotation", "ratio")
|
||||||
|
val orientation = when(fullscreenOrientationPref) {
|
||||||
|
"ratio" -> {
|
||||||
|
val videoSize = exoPlayer.videoSize
|
||||||
|
// probably a youtube shorts video
|
||||||
|
if (videoSize.height > videoSize.width) ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
||||||
|
// a video with normal aspect ratio
|
||||||
|
else ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
|
||||||
|
}
|
||||||
|
"auto" -> ActivityInfo.SCREEN_ORIENTATION_USER
|
||||||
|
"landscape" -> ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
|
||||||
|
"portrait" -> ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
||||||
|
else -> ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
|
||||||
|
}
|
||||||
|
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
||||||
} else {
|
} else {
|
||||||
// leave fullscreen mode
|
// leave fullscreen mode
|
||||||
with(binding.playerMotionLayout) {
|
with(binding.playerMotionLayout) {
|
||||||
@ -1214,7 +1229,7 @@ class PlayerFragment : Fragment() {
|
|||||||
enableTransition(R.id.yt_transition, false)
|
enableTransition(R.id.yt_transition, false)
|
||||||
}
|
}
|
||||||
binding.mainContainer.isClickable = true
|
binding.mainContainer.isClickable = true
|
||||||
|
|
||||||
val mainActivity = activity as MainActivity
|
val mainActivity = activity as MainActivity
|
||||||
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
||||||
isFullScreen = false
|
isFullScreen = false
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:tint="@android:color/white"
|
android:tint="?android:attr/colorControlNormal"
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
|
@ -694,4 +694,17 @@
|
|||||||
<item>30</item>
|
<item>30</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="fullscreenOrientation">
|
||||||
|
<item>@string/aspect_ratio</item>
|
||||||
|
<item>@string/auto_rotation</item>
|
||||||
|
<item>@string/landscape</item>
|
||||||
|
<item>@string/portrait</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="fullscreenOrientationValues">
|
||||||
|
<item>ratio</item>
|
||||||
|
<item>auto</item>
|
||||||
|
<item>landscape</item>
|
||||||
|
<item>portrait</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -143,7 +143,7 @@
|
|||||||
<string name="no_update_available">You are running the latest version.</string>
|
<string name="no_update_available">You are running the latest version.</string>
|
||||||
<string name="playback_speed">Default playback speed</string>
|
<string name="playback_speed">Default playback speed</string>
|
||||||
<string name="advanced">Advanced</string>
|
<string name="advanced">Advanced</string>
|
||||||
<string name="player">Audio and video</string>
|
<string name="player">Player</string>
|
||||||
<string name="appearance_summary">Adjust the app to your liking.</string>
|
<string name="appearance_summary">Adjust the app to your liking.</string>
|
||||||
<string name="advanced_summary">Downloads, history</string>
|
<string name="advanced_summary">Downloads, history</string>
|
||||||
<string name="live">Live</string>
|
<string name="live">Live</string>
|
||||||
@ -215,4 +215,10 @@
|
|||||||
<string name="auth_instances">Choose an auth instance</string>
|
<string name="auth_instances">Choose an auth instance</string>
|
||||||
<string name="hls">Auto</string>
|
<string name="hls">Auto</string>
|
||||||
<string name="github">GitHub</string>
|
<string name="github">GitHub</string>
|
||||||
|
<string name="audio_video">Audio and video</string>
|
||||||
|
<string name="fullscreen_orientation">Fullscreen orientation</string>
|
||||||
|
<string name="aspect_ratio">Video aspect ratio</string>
|
||||||
|
<string name="auto_rotation">Auto rotation</string>
|
||||||
|
<string name="landscape">Landscape</string>
|
||||||
|
<string name="portrait">Portrait</string>
|
||||||
</resources>
|
</resources>
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory app:title="@string/behavior">
|
<PreferenceCategory app:title="@string/player">
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:icon="@drawable/ic_speed"
|
android:icon="@drawable/ic_speed"
|
||||||
@ -53,6 +53,10 @@
|
|||||||
app:summary="@string/buffering_goal_summary"
|
app:summary="@string/buffering_goal_summary"
|
||||||
app:title="@string/buffering_goal" />
|
app:title="@string/buffering_goal" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory app:title="@string/behavior">
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:icon="@drawable/ic_play_filled"
|
android:icon="@drawable/ic_play_filled"
|
||||||
android:summary="@string/autoplay_summary"
|
android:summary="@string/autoplay_summary"
|
||||||
@ -65,6 +69,15 @@
|
|||||||
app:key="pause_screen_off"
|
app:key="pause_screen_off"
|
||||||
app:title="@string/pauseOnScreenOff" />
|
app:title="@string/pauseOnScreenOff" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:icon="@drawable/ic_fullscreen"
|
||||||
|
app:defaultValue="ratio"
|
||||||
|
app:entries="@array/fullscreenOrientation"
|
||||||
|
app:entryValues="@array/fullscreenOrientationValues"
|
||||||
|
app:key="fullscreen_orientation"
|
||||||
|
app:title="@string/fullscreen_orientation"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user