Bug 1826944 - Onboarding now follows device orientation for tablets

fenix/114.1.0
rahulsainani 2 years ago committed by mergify[bot]
parent 872333dd83
commit 6c7fcda055

@ -45,8 +45,10 @@ class JunoOnboardingFragment : Fragment() {
@SuppressLint("SourceLockedOrientationActivity") @SuppressLint("SourceLockedOrientationActivity")
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
if (isNotATablet()) {
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
} }
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU) @RequiresApi(Build.VERSION_CODES.TIRAMISU)
override fun onCreateView( override fun onCreateView(
@ -69,8 +71,10 @@ class JunoOnboardingFragment : Fragment() {
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
if (isNotATablet()) {
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
} }
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU) @RequiresApi(Build.VERSION_CODES.TIRAMISU)
@Composable @Composable
@ -169,4 +173,7 @@ class JunoOnboardingFragment : Fragment() {
private fun shouldShowNotificationPage(context: Context) = private fun shouldShowNotificationPage(context: Context) =
!NotificationManagerCompat.from(context.applicationContext).areNotificationsEnabledSafe() && !NotificationManagerCompat.from(context.applicationContext).areNotificationsEnabledSafe() &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
private fun isNotATablet() =
!resources.getBoolean(R.bool.tablet)
} }

Loading…
Cancel
Save