diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 75e501e..59a68d7 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -89,9 +89,6 @@
-
(
- transformations
+ transformations
)
RequestOptions.bitmapTransform(multi)
} else {
RequestOptions()
}
requestOptions.placeholder(R.drawable.image)
- .error(R.drawable.image_not_supported)
+ .error(R.drawable.image_not_supported)
return requestOptions
}
@@ -131,10 +132,10 @@ object GlobalMethod {
val context = view.context;
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
PopupMenu(
- context,
- view,
- Gravity.NO_GRAVITY,
- 0, com.google.android.material.R.style.Widget_Material3_PopupMenu
+ context,
+ view,
+ Gravity.NO_GRAVITY,
+ 0, com.google.android.material.R.style.Widget_Material3_PopupMenu
)
} else {
PopupMenu(context, view)
@@ -165,24 +166,24 @@ object GlobalMethod {
* @param func Function1
*/
fun showColorPickerDialog(
- context: Context,
- useARGB: Boolean = false, func: ((String) -> Unit)
+ context: Context,
+ useARGB: Boolean = false, func: ((String) -> Unit)
) {
ColorPickerDialogBuilder
- .with(context).showAlphaSlider(useARGB)
- .setTitle(context.getString(R.string.choose_color))
- .initialColor(Color.WHITE)
- .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
- .density(12)
- .setOnColorSelectedListener {
- //toast("onColorSelected: 0x" + Integer.toHexString(selectedColor));
- }
- .setPositiveButton(R.string.dialog_ok) { dialog, selectedColor, allColors ->
- func.invoke(colorToString(selectedColor, useARGB))
- }
- .setNegativeButton(R.string.dialog_cancel) { dialog, which -> }
- .build()
- .show()
+ .with(context).showAlphaSlider(useARGB)
+ .setTitle(context.getString(R.string.choose_color))
+ .initialColor(Color.WHITE)
+ .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
+ .density(12)
+ .setOnColorSelectedListener {
+ //toast("onColorSelected: 0x" + Integer.toHexString(selectedColor));
+ }
+ .setPositiveButton(R.string.dialog_ok) { dialog, selectedColor, allColors ->
+ func.invoke(colorToString(selectedColor, useARGB))
+ }
+ .setNegativeButton(R.string.dialog_cancel) { dialog, which -> }
+ .build()
+ .show()
}
/**
@@ -243,11 +244,11 @@ object GlobalMethod {
stringBuilder.append("\n\n------\n\n")
}
val title =
- context.getString(R.string.update_record) + "(" + data.size + ")"
+ context.getString(R.string.update_record) + "(" + data.size + ")"
MaterialAlertDialogBuilder(context).setTitle(title)
- .setMessage(stringBuilder.toString()).setCancelable(false)
- .setPositiveButton(R.string.dialog_ok) { i, i2 ->
- }.show()
+ .setMessage(stringBuilder.toString()).setCancelable(false)
+ .setPositiveButton(R.string.dialog_ok) { i, i2 ->
+ }.show()
} else {
Toast.makeText(context, t.message, Toast.LENGTH_SHORT).show()
}
@@ -261,9 +262,9 @@ object GlobalMethod {
override fun onFailure(e: Exception) {
Toast.makeText(
- context,
- context.getString(R.string.network_error),
- Toast.LENGTH_SHORT
+ context,
+ context.getString(R.string.network_error),
+ Toast.LENGTH_SHORT
).show()
}
@@ -278,19 +279,29 @@ object GlobalMethod {
fun requestStoragePermissions(activity: FragmentActivity, requestCompleted: (Boolean) -> Unit) {
val list = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
listOf(
- Manifest.permission.MANAGE_EXTERNAL_STORAGE
+ Manifest.permission.MANAGE_EXTERNAL_STORAGE
)
} else {
listOf(
- Manifest.permission.READ_EXTERNAL_STORAGE,
- Manifest.permission.WRITE_EXTERNAL_STORAGE
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE
)
}
- XXPermissions.with(activity).permission(
- list
- ).request { _, allGranted ->
- requestCompleted.invoke(allGranted)
+ if (XXPermissions.isGranted(activity, list)) {
+ return
}
+ MaterialAlertDialogBuilder(activity).setTitle(R.string.permission_request_title)
+ .setMessage(R.string.permission_request_message)
+ .setPositiveButton(
+ R.string.dialog_ok
+ ) { _, _ ->
+ XXPermissions.with(activity).permission(
+ list
+ ).request { _, allGranted ->
+ requestCompleted.invoke(allGranted)
+ }
+ }.setNegativeButton(R.string.dialog_cancel, null).setCancelable(false).show()
+
}
@@ -325,14 +336,14 @@ object GlobalMethod {
clipboardManager.setPrimaryClip(ClipData.newPlainText("", text))
if (showView != null) {
if (AppSettings.getValue(
- AppSettings.Setting.ClipboardCue,
- Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2
- )
+ AppSettings.Setting.ClipboardCue,
+ Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2
+ )
) {
Snackbar.make(
- showView,
- String.format(context.getText(R.string.copy_complete).toString(), text),
- Snackbar.LENGTH_SHORT
+ showView,
+ String.format(context.getText(R.string.copy_complete).toString(), text),
+ Snackbar.LENGTH_SHORT
).show()
}
}
@@ -350,8 +361,8 @@ object GlobalMethod {
// When setting the clip board text.
clipboardManager.setPrimaryClip(ClipData.newPlainText("", text))
Toast.makeText(
- context,
- "已复制", Toast.LENGTH_SHORT
+ context,
+ "已复制", Toast.LENGTH_SHORT
).show()
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6cee8ec..399e209 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -616,4 +616,6 @@
在安卓13及以上系统,应用将内容复制到剪贴板时,弹出提示。
分享
变量名
+ 请求权限
+ 我们需要存储权限以访问您的模组。
\ No newline at end of file
diff --git a/app/src/main/res/xml-v25/shortcuts.xml b/app/src/main/res/xml-v25/shortcuts.xml
deleted file mode 100644
index f37f981..0000000
--- a/app/src/main/res/xml-v25/shortcuts.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-