manager: Add alternate app icon toggle (#129)
Signed-off-by: WenHao2130 <wenhao2130@outlook.com> Co-authored-by: MiRinChan <148533509+MiRinChan@users.noreply.github.com>
This commit is contained in:
@@ -114,7 +114,7 @@ Please **all** refer to https://kernelsu.org/zh_CN/guide/installation.html
|
||||
|
||||
- The file in the “kernel” directory is under [GPL-2.0-only](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) license.
|
||||
|
||||
- The images of the files `ic_launcher*` with anime character emoticons are copyrighted by [五十根大虾仁](https://space.bilibili.com/370927), the Brand Intellectual Property in the images is owned by [明风OuO](https://space.bilibili.com/274939213), and the vectorization is done by @MiRinChan. Before using these files, in addition to complying with [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt), you also need to comply with the authorization of the two authors to use these artistic contents.
|
||||
- The images of the files `ic_launcher(?!.*alt.*).*` with anime character emoticons are copyrighted by [五十根大虾仁](https://space.bilibili.com/370927), the Brand Intellectual Property in the images is owned by [明风OuO](https://space.bilibili.com/274939213), and the vectorization is done by @MiRinChan. Before using these files, in addition to complying with [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt), you also need to comply with the authorization of the two authors to use these artistic contents.
|
||||
|
||||
- Except for the files or directories mentioned above, all other parts are under [GPL-3.0 or later](https://www.gnu.org/licenses/gpl-3.0.html) license.
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ https://kernelsu.org/zh_CN/guide/installation.html をご参照ください。
|
||||
## ライセンス
|
||||
|
||||
- `kernel` ディレクトリ以下のファイルは[GPL-2.0-only](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)です。
|
||||
- アニメキャラクターの絵文字を含むファイル `ic_launcher*` の画像は[五十根大虾仁](https://space.bilibili.com/370927)が著作権を所有しており、画像内のブランド知的財産権は[明风OuO](https://space.bilibili.com/274939213)が所有しています。ベクトル化は @MiRinChan が行っています。これらのファイルを使用する前に、[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt)に準拠することに加えて、これらの芸術コンテンツを使用するには、2人の著者の許可にも従う必要があります。
|
||||
- アニメキャラクターの絵文字を含むファイル `ic_launcher(?!.*alt.*).*` の画像は[五十根大虾仁](https://space.bilibili.com/370927)が著作権を所有しており、画像内のブランド知的財産権は[明风OuO](https://space.bilibili.com/274939213)が所有しています。ベクトル化は @MiRinChan が行っています。これらのファイルを使用する前に、[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt)に準拠することに加えて、これらの芸術コンテンツを使用するには、2人の著者の許可にも従う必要があります。
|
||||
- 上記のファイルまたはディレクトリを除き、その他のすべての部分は[GPL-3.0以降](https://www.gnu.org/licenses/gpl-3.0.html)です。
|
||||
|
||||
## スポンサーシップの一覧
|
||||
|
||||
@@ -121,7 +121,7 @@ Lütfen **tümünü** https://kernelsu.org/zh_CN/guide/installation.html adresin
|
||||
## Lisans
|
||||
|
||||
- `kernel` dizinindeki dosyalar [GPL-2.0-only](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) lisansı altındadır.
|
||||
- Anime karakter ifadeleri içeren `ic_launcher*` dosyalarının görüntüleri [五十根大虾仁](https://space.bilibili.com/370927) tarafından telif hakkıyla korunmaktadır, görüntülerdeki Marka Fikri Mülkiyeti [明风 OuO](https://space.bilibili.com/274939213)'ye aittir ve vektörleştirme @MiRinChan tarafından yapılmıştır. Bu dosyaları kullanmadan önce, [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) ile uyumlu olmanın yanı sıra, bu sanatsal içerikleri kullanmak için iki yazarın yetkilendirmesine de uymanız gerekir.
|
||||
- Anime karakter ifadeleri içeren `ic_launcher(?!.*alt.*).*` dosyalarının görüntüleri [五十根大虾仁](https://space.bilibili.com/370927) tarafından telif hakkıyla korunmaktadır, görüntülerdeki Marka Fikri Mülkiyeti [明风 OuO](https://space.bilibili.com/274939213)'ye aittir ve vektörleştirme @MiRinChan tarafından yapılmıştır. Bu dosyaları kullanmadan önce, [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) ile uyumlu olmanın yanı sıra, bu sanatsal içerikleri kullanmak için iki yazarın yetkilendirmesine de uymanız gerekir.
|
||||
- Yukarıda belirtilen dosyalar veya dizinler hariç, diğer tüm parçalar [GPL-3.0 veya üzeri](https://www.gnu.org/licenses/gpl-3.0.html)'dir.
|
||||
|
||||
## Afdian Bağlantısı
|
||||
|
||||
@@ -123,7 +123,7 @@ KPM 模板地址: https://github.com/udochina/KPM-Build-Anywhere
|
||||
## 许可证
|
||||
|
||||
- `kernel` 目录下的文件是 [GPL-2.0-only](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)。
|
||||
- 有动漫人物图片表情包的这些文件 `ic_launcher*` 的图像版权为[五十根大虾仁](https://space.bilibili.com/370927)所有,图像中的 Brand Intellectual Property 由[明风OuO](https://space.bilibili.com/274939213)所有,矢量化由 @MiRinChan 完成,在使用这些文件之前,除了必须遵守 [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) 以外,还需要遵守向前两者索要使用这些艺术内容的授权。
|
||||
- 有动漫人物图片表情包的这些文件 `ic_launcher(?!.*alt.*).*` 的图像版权为[五十根大虾仁](https://space.bilibili.com/370927)所有,图像中的 Brand Intellectual Property 由[明风OuO](https://space.bilibili.com/274939213)所有,矢量化由 @MiRinChan 完成,在使用这些文件之前,除了必须遵守 [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) 以外,还需要遵守向前两者索要使用这些艺术内容的授权。
|
||||
- 除了以上所述的文件或目录外,所有其他部分均为 [GPL-3.0 或更高版本](https://www.gnu.org/licenses/gpl-3.0.html)。
|
||||
|
||||
## 爱发电链接
|
||||
|
||||
@@ -32,6 +32,19 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity-alias
|
||||
android:name=".ui.MainActivityAlias"
|
||||
android:exported="true"
|
||||
android:enabled="false"
|
||||
android:icon="@mipmap/ic_launcher_alt"
|
||||
android:roundIcon="@mipmap/ic_launcher_alt_round"
|
||||
android:targetActivity=".ui.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
|
||||
<activity
|
||||
android:name=".ui.webui.WebUIActivity"
|
||||
android:autoRemoveFromRecents="true"
|
||||
|
||||
@@ -4,6 +4,8 @@ import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.ComponentName
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Configuration
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
@@ -106,6 +108,19 @@ fun saveCardConfig(context: Context) {
|
||||
CardConfig.save(context)
|
||||
}
|
||||
|
||||
fun toggleLauncherIcon(context: Context, useAlt: Boolean) {
|
||||
val pm = context.packageManager
|
||||
val main = ComponentName(context, MainActivity::class.java.name)
|
||||
val alt = ComponentName(context, "${MainActivity::class.java.name}Alias")
|
||||
if (useAlt) {
|
||||
pm.setComponentEnabledSetting(main, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP)
|
||||
pm.setComponentEnabledSetting(alt, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP)
|
||||
} else {
|
||||
pm.setComponentEnabledSetting(alt, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP)
|
||||
pm.setComponentEnabledSetting(main, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("LocalContextConfigurationRead", "ObsoleteSdkInt")
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Destination<RootGraph>
|
||||
@@ -341,6 +356,16 @@ fun MoreSettingsScreen() {
|
||||
mutableStateOf(ThemeConfig.customBackgroundUri != null)
|
||||
}
|
||||
|
||||
// Alternate icon state
|
||||
var useAltIcon by remember { mutableStateOf(prefs.getBoolean("use_alt_icon", false)) }
|
||||
|
||||
val onUseAltIconChange = { newValue: Boolean ->
|
||||
prefs.edit { putBoolean("use_alt_icon", newValue) }
|
||||
useAltIcon = newValue
|
||||
toggleLauncherIcon(context, newValue)
|
||||
Toast.makeText(context, context.getString(R.string.icon_switched), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
// 图片编辑状态
|
||||
var showImageEditor by remember { mutableStateOf(false) }
|
||||
var selectedImageUri by remember { mutableStateOf<Uri?>(null) }
|
||||
@@ -875,6 +900,16 @@ fun MoreSettingsScreen() {
|
||||
SettingsCard(
|
||||
title = stringResource(R.string.custom_settings)
|
||||
) {
|
||||
// 图标切换by lshwjgpt
|
||||
SwitchItem(
|
||||
icon = Icons.Default.Android,
|
||||
title = stringResource(R.string.icon_switch_title),
|
||||
summary = stringResource(R.string.icon_switch_summary),
|
||||
checked = useAltIcon
|
||||
) {
|
||||
onUseAltIconChange(it)
|
||||
}
|
||||
|
||||
// 添加简洁模式开关
|
||||
SwitchItem(
|
||||
icon = Icons.Filled.Brush,
|
||||
@@ -1326,4 +1361,4 @@ private fun TopBar(
|
||||
windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal),
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
|
||||
<group
|
||||
android:scaleX="0.135"
|
||||
android:scaleY="0.135">
|
||||
<path
|
||||
android:pathData="M 259 259 H 541 V 541 H 259 V 259 Z"
|
||||
android:strokeWidth="18"
|
||||
android:strokeColor="#1e110d" />
|
||||
<path
|
||||
android:fillColor="#1e110d"
|
||||
android:pathData="M 257 257 H 407 V 407 H 257 V 257 Z" />
|
||||
<path
|
||||
android:fillColor="#1e110d"
|
||||
android:pathData="M 393 393 H 543 V 543 H 393 V 393 Z" />
|
||||
</group>
|
||||
</vector>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
|
||||
<group
|
||||
android:scaleX="0.135"
|
||||
android:scaleY="0.135">
|
||||
<path
|
||||
android:pathData="M 259 259 H 541 V 541 H 259 V 259 Z"
|
||||
android:strokeWidth="18"
|
||||
android:strokeColor="#000000" />
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M 257 257 H 407 V 407 H 257 V 257 Z" />
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M 393 393 H 543 V 543 H 393 V 393 Z" />
|
||||
</group>
|
||||
</vector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground_alt"/>
|
||||
<monochrome android:drawable="@drawable/ic_launcher_monochrome_alt" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground_alt"/>
|
||||
<monochrome android:drawable="@drawable/ic_launcher_monochrome_alt" />
|
||||
</adaptive-icon>
|
||||
@@ -321,6 +321,9 @@
|
||||
<string name="susfs_disabled">SuSFS 已禁用</string>
|
||||
<string name="background_set_success">背景设置成功</string>
|
||||
<string name="background_removed">已移除自定义背景</string>
|
||||
<string name="icon_switch_title">备选图标</string>
|
||||
<string name="icon_switch_summary">更换为 KernelSU 图标</string>
|
||||
<string name="icon_switched">已切换图标</string>
|
||||
<string name="root_require_for_install">需要 root 权限</string>
|
||||
<!-- KPM display settings -->
|
||||
<string name="show_kpm_info">显示 KPM 功能</string>
|
||||
|
||||
@@ -323,6 +323,9 @@
|
||||
<string name="susfs_disabled">SuSFS 未啟用</string>
|
||||
<string name="background_set_success">背景設置成功</string>
|
||||
<string name="background_removed">刪除背景</string>
|
||||
<string name="icon_switch_title">備選圖示</string>
|
||||
<string name="icon_switch_summary">將啟動器圖示變更為 KernelSU 圖示</string>
|
||||
<string name="icon_switched">圖示已切換</string>
|
||||
<string name="root_require_for_install">需要root權限</string>
|
||||
<!-- KPM display settings -->
|
||||
<string name="show_kpm_info">顯示KPM功能</string>
|
||||
|
||||
@@ -321,6 +321,9 @@
|
||||
<string name="susfs_disabled">SuSFS disabled</string>
|
||||
<string name="background_set_success">Background set successfully</string>
|
||||
<string name="background_removed">Removed custom backgrounds</string>
|
||||
<string name="icon_switch_title">備選圖示</string>
|
||||
<string name="icon_switch_summary">將啟動器圖示變更為 KernelSU 圖示</string>
|
||||
<string name="icon_switched">Icon switched</string>
|
||||
<string name="root_require_for_install">Requires root privileges</string>
|
||||
<!-- KPM display settings -->
|
||||
<string name="show_kpm_info">Display KPM Function</string>
|
||||
|
||||
@@ -323,6 +323,9 @@
|
||||
<string name="susfs_disabled">SuSFS disabled</string>
|
||||
<string name="background_set_success">Background set successfully</string>
|
||||
<string name="background_removed">Removed custom backgrounds</string>
|
||||
<string name="icon_switch_title">Alternate icon</string>
|
||||
<string name="icon_switch_summary">Change the launcher icon to KernelSU\'s icon.</string>
|
||||
<string name="icon_switched">Icon switched</string>
|
||||
<string name="root_require_for_install">Requires root privileges</string>
|
||||
<!-- KPM display settings -->
|
||||
<string name="show_kpm_info">Display KPM Function</string>
|
||||
|
||||
Reference in New Issue
Block a user