6.7.0 - Alpha3 - 应用启动器图标支持自适应图标特性 (issue #405)

This commit is contained in:
SuperMonster003
2025-07-03 15:25:23 +08:00
parent c1973beeb0
commit ef86f8aecc
14 changed files with 25 additions and 12 deletions

View File

@@ -209,7 +209,6 @@
<activity
android:name="org.autojs.autojs.ui.splash.SplashActivity"
android:exported="true"
android:icon="@drawable/autojs6_material"
android:label="@string/app_name"
android:theme="@style/AppTheme.Splash"
tools:ignore="RedundantLabel">
@@ -403,7 +402,6 @@
<activity-alias
android:name="org.autojs.autojs.external.tasker.PluginActivity"
android:exported="true"
android:icon="@drawable/autojs6_material"
android:label="@string/app_name"
android:targetActivity="org.autojs.autojs.external.tasker.TaskPrefEditActivity"
tools:ignore="ExportedActivity">
@@ -507,7 +505,6 @@
<activity
android:name="org.autojs.autojs.external.open.EditIntentActivity"
android:exported="true"
android:icon="@drawable/autojs6_material"
android:label="@string/text_edit_script">
<intent-filter>
@@ -533,7 +530,6 @@
<activity
android:name="org.autojs.autojs.external.open.RunIntentActivity"
android:exported="true"
android:icon="@drawable/autojs6_material"
android:label="@string/text_run_script"
android:taskAffinity="org.autojs.autojs.external.open.RunIntentActivity"
android:theme="@android:style/Theme.NoDisplay">
@@ -561,7 +557,6 @@
<activity
android:name="org.autojs.autojs.external.open.ImportIntentActivity"
android:exported="true"
android:icon="@drawable/autojs6_material"
android:label="@string/text_import_script"
android:theme="@style/AppTheme.Transparent">
<intent-filter>

View File

@@ -29,6 +29,7 @@ object Dimensions {
private val DIMENSION_PATTERN = Pattern.compile("([+-]?[0-9.]+)([a-zA-Z]*)")
@JvmStatic
fun parseToPixel(dimension: String, view: View, parent: ViewGroup?, horizontal: Boolean): Int {
if (dimension.endsWith("%") && parent != null) {
val pct = dimension.substring(0, dimension.length - 1).toFloat() / 100.0f
@@ -37,15 +38,18 @@ object Dimensions {
return parseToIntPixel(dimension, view.context)
}
@JvmStatic
fun parseToPixel(dimension: String, view: View): Float {
return parseToPixel(dimension, view.context)
}
@JvmStatic
fun parseToPixel(view: View, dimension: String): Float {
return parseToPixel(dimension, view.context)
}
@SuppressLint("DiscouragedApi")
@JvmStatic
fun parseToPixel(dimension: String, context: Context): Float {
if (dimension.startsWith("?")) {
val attr = intArrayOf(
@@ -71,14 +75,17 @@ object Dimensions {
}.getOrElse { e -> throw RuntimeException(e) }
}
@JvmStatic
fun parseToIntPixel(value: String, view: View): Int {
return parseToPixel(value, view).roundToInt()
}
@JvmStatic
fun parseToIntPixel(value: String, context: Context): Int {
return parseToPixel(value, context).roundToInt()
}
@JvmStatic
fun parseToIntPixelArray(view: View, value: String): IntArray {
val split: Array<String> = ViewAttributes.parseAttrValue(value).toTypedArray()
val pixels = IntArray(4)

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<monochrome android:drawable="@mipmap/ic_app_launcher_monochrome"/>
<background android:drawable="@color/ic_app_launcher_adaptive_background"/>
<foreground android:drawable="@mipmap/ic_app_launcher_adaptive_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_app_launcher_adaptive_background">#FFFFFF</color>
</resources>