diff --git a/app/src/main/java/me/ranko/autodark/ui/ActivationScopeDialog.kt b/app/src/main/java/me/ranko/autodark/ui/ActivationScopeDialog.kt index 846114f..4622264 100644 --- a/app/src/main/java/me/ranko/autodark/ui/ActivationScopeDialog.kt +++ b/app/src/main/java/me/ranko/autodark/ui/ActivationScopeDialog.kt @@ -1,6 +1,7 @@ package me.ranko.autodark.ui import android.app.Dialog +import android.content.pm.ActivityInfo import android.os.Bundle import android.view.View import android.view.ViewGroup @@ -19,10 +20,18 @@ class ActivationScopeDialog : BottomSheetDialogFragment() { val dialog = BottomSheetDialog(requireContext(), R.style.AppTheme_BottomSheetDialogDayNight) dialog.setContentView(R.layout.dialog_activation_scope) dialog.setOnShowListener { + val activity = requireActivity() + val savedOrientation = activity.requestedOrientation + activity.requestedOrientation = + ActivityInfo.SCREEN_ORIENTATION_LOCKED.or(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) + val root = dialog.findViewById(R.id.title)!!.parent as View val xposedContainer: ViewGroup = root.findViewById(R.id.container) managerView = XposedManagerView(requireActivity(), xposedContainer) - root.findViewById(R.id.button).setOnClickListener { dismiss() } + root.findViewById(R.id.button).setOnClickListener { + dismiss() + activity.requestedOrientation = savedOrientation + } val screenSize = ScreenSizeCalculator.getInstance().getScreenSize(requireActivity()) dialog.behavior.peekHeight = screenSize.y