Replace shortcut icons (#729)

This commit is contained in:
Zongle Wang
2026-05-09 16:54:26 +08:00
committed by GitHub
parent 63a68d43f2
commit d7c16ecd42
4 changed files with 34 additions and 4 deletions

View File

@@ -169,7 +169,6 @@ class MainActivity : BaseActivity<MainDesign>() {
// Skip dynamic shortcut setup when the app icon is hidden.
if (uiStore.hideAppIcon) return
val icon = IconCompat.createWithResource(this, R.mipmap.ic_launcher)
val flags = Intent.FLAG_ACTIVITY_NEW_TASK or
Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS or
Intent.FLAG_ACTIVITY_NO_ANIMATION
@@ -177,7 +176,7 @@ class MainActivity : BaseActivity<MainDesign>() {
val toggle = ShortcutInfoCompat.Builder(this, "toggle_clash")
.setShortLabel(getString(DesignR.string.shortcut_toggle_short))
.setLongLabel(getString(DesignR.string.shortcut_toggle_long))
.setIcon(icon)
.setIcon(IconCompat.createWithResource(this, R.drawable.ic_toggle_all))
.setIntent(
Intent(Intents.ACTION_TOGGLE_CLASH)
.setClassName(this, ExternalControlActivity::class.java.name)
@@ -189,7 +188,7 @@ class MainActivity : BaseActivity<MainDesign>() {
val start = ShortcutInfoCompat.Builder(this, "start_clash")
.setShortLabel(getString(DesignR.string.shortcut_start_short))
.setLongLabel(getString(DesignR.string.shortcut_start_long))
.setIcon(icon)
.setIcon(IconCompat.createWithResource(this, R.drawable.ic_toggle_on))
.setIntent(
Intent(Intents.ACTION_START_CLASH)
.setClassName(this, ExternalControlActivity::class.java.name)
@@ -201,7 +200,7 @@ class MainActivity : BaseActivity<MainDesign>() {
val stop = ShortcutInfoCompat.Builder(this, "stop_clash")
.setShortLabel(getString(DesignR.string.shortcut_stop_short))
.setLongLabel(getString(DesignR.string.shortcut_stop_long))
.setIcon(icon)
.setIcon(IconCompat.createWithResource(this, R.drawable.ic_toggle_off))
.setIntent(
Intent(Intents.ACTION_STOP_CLASH)
.setClassName(this, ExternalControlActivity::class.java.name)

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#000000"
android:pathData="M277.3,554.7h469.3a192,192 0,1 1,0 384h-469.3a192,192 0,1 1,0 -384zM746.7,85.3a192,192 0,1 1,0 384h-469.3a192,192 0,0 1,0 -384h469.3zM746.7,810.7a64,64 0,1 1,0 -128,64 64,0 0,1 0,128zM277.3,640a106.7,106.7 0,1 0,0 213.3h469.3a106.7,106.7 0,1 0,0 -213.3h-469.3zM746.7,170.7h-469.3a106.7,106.7 0,0 0,0 213.3h469.3a106.7,106.7 0,1 0,0 -213.3zM277.3,341.3a64,64 0,1 1,0 -128,64 64,0 0,1 0,128z" />
</vector>

View File

@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="21.021898dp"
android:viewportWidth="1170"
android:viewportHeight="1024">
<path
android:fillColor="#000000"
android:pathData="M658.3,512q0,-59.4 -23.1,-113.4T572.6,305.1 479.1,242.6 365.7,219.4t-113.4,23.1T158.9,305.1 96.3,398.6 73.1,512t23.1,113.4T158.9,718.9t93.4,62.6T365.7,804.6t113.4,-23.1T572.6,718.9t62.6,-93.4T658.3,512zM1097.1,512q0,-59.4 -23.1,-113.4T1011.4,305.1t-93.4,-62.6T804.6,219.4h-220.6q68,51.4 107.7,128t39.7,164.6 -39.7,164.6 -107.7,128h220.6q59.4,0 113.4,-23.1T1011.4,718.9t62.6,-93.4T1097.1,512zM1170.3,512q0,74.3 -29.1,142t-78,116.6 -116.6,78 -142,29.1L365.7,877.7q-74.3,0 -142,-29.1t-116.6,-78 -78,-116.6T0,512t29.1,-142 78,-116.6 116.6,-78T365.7,146.3h438.9q74.3,0 142,29.1t116.6,78 78,116.6 29.1,142z" />
</vector>

View File

@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="21.021898dp"
android:viewportWidth="1170"
android:viewportHeight="1024">
<path
android:fillColor="#000000"
android:pathData="M0,512q0,-74.3 29.1,-142t78,-116.6 116.6,-78T365.7,146.3h438.9q74.3,0 142,29.1t116.6,78 78,116.6 29.1,142 -29.1,142 -78,116.6 -116.6,78 -142,29.1L365.7,877.7q-74.3,0 -142,-29.1t-116.6,-78 -78,-116.6T0,512zM804.6,804.6q59.4,0 113.4,-23.1T1011.4,718.9t62.6,-93.4T1097.1,512t-23.1,-113.4T1011.4,305.1t-93.4,-62.6T804.6,219.4t-113.4,23.1T597.7,305.1 535.1,398.6 512,512t23.1,113.4T597.7,718.9t93.4,62.6T804.6,804.6z" />
</vector>