Skip to content

Commit 3c0c172

Browse files
committed
Upload file
1 parent 2f35ec1 commit 3c0c172

2 files changed

Lines changed: 25 additions & 33 deletions

File tree

common/src/main/java/com/omarea/common/ui/DialogFullScreen.kt

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,50 +29,41 @@ class DialogAppChooser(private val darkMode: Boolean): DialogFullScreen(R.layout
2929
}
3030
*/
3131

32-
open class DialogFullScreen(private val layout: Int, darkMode: Boolean) : androidx.fragment.app.DialogFragment() {
33-
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
34-
currentView = inflater.inflate(layout, container)
35-
return currentView
36-
}
32+
open class DialogFullScreen(
33+
private val layout: Int,
34+
darkMode: Boolean
35+
) : DialogFragment() {
3736

38-
private var themeResId: Int = 0
39-
private lateinit var currentView: View
37+
init {
38+
setStyle(
39+
STYLE_NORMAL,
40+
if (darkMode)
41+
R.style.dialog_full_screen_dark
42+
else
43+
R.style.dialog_full_screen_light
44+
)
45+
}
4046

41-
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
42-
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
43-
Dialog(activity!!, if (themeResId != 0) themeResId else R.style.dialog_full_screen_light)
44-
} else {
45-
Dialog(activity!!, -1)
46-
}
47+
override fun onCreateView(
48+
inflater: LayoutInflater,
49+
container: ViewGroup?,
50+
savedInstanceState: Bundle?
51+
): View {
52+
return inflater.inflate(layout, container, false)
4753
}
4854

4955
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
5056
super.onViewCreated(view, savedInstanceState)
5157

52-
val activity = this.activity
53-
if (activity != null) {
54-
dialog?.window?.run {
55-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
56-
setWindowAnimations(android.R.style.Animation_Translucent)
57-
}
58-
59-
DialogHelper.setWindowBlurBg(this, activity)
58+
dialog?.window?.let { window ->
59+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
60+
window.setWindowAnimations(android.R.style.Animation_Translucent)
6061
}
62+
DialogHelper.setWindowBlurBg(window, requireActivity())
6163
}
6264
}
6365

64-
override fun onActivityCreated(savedInstanceState: Bundle?) {
65-
super.onActivityCreated(savedInstanceState)
66-
}
67-
6866
fun closeView() {
69-
try {
70-
dismiss()
71-
} catch (ex: java.lang.Exception) {
72-
}
73-
}
74-
75-
init {
76-
themeResId = if (darkMode) R.style.dialog_full_screen_dark else R.style.dialog_full_screen_light
67+
dismissAllowingStateLoss()
7768
}
7869
}

pio/src/main/assets/home/etc/start-early.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ if [ "$ROT" == 1 ];then
1212
# Cấp quyền ở miui, hyper
1313
# Danh sách các ứng dụng đã cài đặt
1414
cmd appops set $PACKAGE_NAME 10022 allow
15+
cmd appops set $PACKAGE_NAME QUERY_ALL_PACKAGES allow
1516
# Phím tắt màn hình chính
1617
cmd appops set $PACKAGE_NAME 10017 allow
1718
fi

0 commit comments

Comments
 (0)