From 60ea36c0db8815f5a042f85dbcbc93988210daf7 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 6 Jun 2022 18:15:54 +0200 Subject: [PATCH] fix reversed portrait not working --- app/src/main/AndroidManifest.xml | 2 +- app/src/main/java/com/github/libretube/MainActivity.kt | 4 ++-- .../java/com/github/libretube/fragments/PlayerFragment.kt | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cf45f4b9c..91eb90323 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -35,7 +35,7 @@ android:supportsPictureInPicture="true" android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" android:hardwareAccelerated="true" - android:screenOrientation="portrait" + android:screenOrientation="userPortrait" > diff --git a/app/src/main/java/com/github/libretube/MainActivity.kt b/app/src/main/java/com/github/libretube/MainActivity.kt index b535f68f2..bc9b161c0 100644 --- a/app/src/main/java/com/github/libretube/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/MainActivity.kt @@ -87,7 +87,7 @@ class MainActivity : AppCompatActivity() { } } else { setContentView(R.layout.activity_main) - requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT bottomNavigationView = findViewById(R.id.bottomNav) navController = findNavController(R.id.fragment) @@ -266,7 +266,7 @@ class MainActivity : AppCompatActivity() { findViewById(R.id.main_container).isClickable = false val motionLayout = findViewById(R.id.playerMotionLayout) motionLayout.transitionToEnd() - requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT with(motionLayout) { getConstraintSet(R.id.start).constrainHeight(R.id.player, 0) enableTransition(R.id.yt_transition, true) diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index 48405e6f6..018bd0508 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -209,7 +209,7 @@ class PlayerFragment : Fragment() { view.findViewById(R.id.close_imageView).setOnClickListener { motionLayout.transitionToEnd() val mainActivity = activity as MainActivity - mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT mainActivity.supportFragmentManager.beginTransaction() .remove(this) .commit() @@ -217,7 +217,7 @@ class PlayerFragment : Fragment() { view.findViewById(R.id.close_imageButton).setOnClickListener { motionLayout.transitionToEnd() val mainActivity = activity as MainActivity - mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT mainActivity.supportFragmentManager.beginTransaction() .remove(this) .commit() @@ -289,7 +289,7 @@ class PlayerFragment : Fragment() { view.findViewById(R.id.main_container).isClickable = false view.findViewById(R.id.linLayout).visibility = View.VISIBLE val mainActivity = activity as MainActivity - mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT isFullScreen = false } } @@ -983,7 +983,7 @@ class PlayerFragment : Fragment() { view?.findViewById(R.id.linLayout)?.visibility = View.GONE view?.findViewById(R.id.top_bar)?.visibility = View.GONE val mainActivity = activity as MainActivity - mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT isFullScreen = false } else { with(motionLayout) {