Skip to content

Commit d7c16ec

Browse files
authored
Replace shortcut icons (#729)
1 parent 63a68d4 commit d7c16ec

4 files changed

Lines changed: 34 additions & 4 deletions

File tree

app/src/main/java/com/github/kr328/clash/MainActivity.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,14 @@ class MainActivity : BaseActivity<MainDesign>() {
169169
// Skip dynamic shortcut setup when the app icon is hidden.
170170
if (uiStore.hideAppIcon) return
171171

172-
val icon = IconCompat.createWithResource(this, R.mipmap.ic_launcher)
173172
val flags = Intent.FLAG_ACTIVITY_NEW_TASK or
174173
Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS or
175174
Intent.FLAG_ACTIVITY_NO_ANIMATION
176175

177176
val toggle = ShortcutInfoCompat.Builder(this, "toggle_clash")
178177
.setShortLabel(getString(DesignR.string.shortcut_toggle_short))
179178
.setLongLabel(getString(DesignR.string.shortcut_toggle_long))
180-
.setIcon(icon)
179+
.setIcon(IconCompat.createWithResource(this, R.drawable.ic_toggle_all))
181180
.setIntent(
182181
Intent(Intents.ACTION_TOGGLE_CLASH)
183182
.setClassName(this, ExternalControlActivity::class.java.name)
@@ -189,7 +188,7 @@ class MainActivity : BaseActivity<MainDesign>() {
189188
val start = ShortcutInfoCompat.Builder(this, "start_clash")
190189
.setShortLabel(getString(DesignR.string.shortcut_start_short))
191190
.setLongLabel(getString(DesignR.string.shortcut_start_long))
192-
.setIcon(icon)
191+
.setIcon(IconCompat.createWithResource(this, R.drawable.ic_toggle_on))
193192
.setIntent(
194193
Intent(Intents.ACTION_START_CLASH)
195194
.setClassName(this, ExternalControlActivity::class.java.name)
@@ -201,7 +200,7 @@ class MainActivity : BaseActivity<MainDesign>() {
201200
val stop = ShortcutInfoCompat.Builder(this, "stop_clash")
202201
.setShortLabel(getString(DesignR.string.shortcut_stop_short))
203202
.setLongLabel(getString(DesignR.string.shortcut_stop_long))
204-
.setIcon(icon)
203+
.setIcon(IconCompat.createWithResource(this, R.drawable.ic_toggle_off))
205204
.setIntent(
206205
Intent(Intents.ACTION_STOP_CLASH)
207206
.setClassName(this, ExternalControlActivity::class.java.name)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="1024"
5+
android:viewportHeight="1024">
6+
<path
7+
android:fillColor="#000000"
8+
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" />
9+
</vector>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="21.021898dp"
4+
android:viewportWidth="1170"
5+
android:viewportHeight="1024">
6+
7+
<path
8+
android:fillColor="#000000"
9+
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" />
10+
11+
</vector>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="21.021898dp"
4+
android:viewportWidth="1170"
5+
android:viewportHeight="1024">
6+
7+
<path
8+
android:fillColor="#000000"
9+
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" />
10+
11+
</vector>

0 commit comments

Comments
 (0)