Skip to content

Commit

Permalink
feat: 添加使用 MIUI 大图标选项
Browse files Browse the repository at this point in the history
  • Loading branch information
GSWXXN committed Sep 9, 2023
1 parent fd85675 commit 6460ffe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ object DataConst {
val ENABLE_HIDE_SPLASH_SCREEN_ICON = PrefsData("enable_hide_splash_screen_icon", false)
val ENABLE_HIDE_ICON = PrefsData("enable_hide_icon", false)
val ENABLE_REPLACE_ICON = PrefsData("enable_replace_icon", false)
val ENABLE_USE_MIUI_LARGE_ICON = PrefsData("enable_use_miui_large_icon", false)
val ENABLE_ADD_ICON_BLUR_BG = PrefsData("enable_add_blur_bg", false)
val ICON_PACK_PACKAGE_NAME = PrefsData("icon_pack_package_name", "None")
val OVERALL_BG_COLOR = PrefsData("overall_bg_color", "#FFFFFF")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ object IconHookHandler: BaseHookHandler() {
return ColorDrawable(Color.TRANSPARENT)
}

if (atLeastMIUI14) {
// MIUI 大图标
// 使用 MIUI 大图标
if (atLeastMIUI14 && prefs.get(DataConst.ENABLE_USE_MIUI_LARGE_ICON)) {
largeIcons.getOriginLargeIconDrawable(currentPackageName, currentActivity, "2x2")?.let {
iconDrawable = it
currentUseMIUILagerIcon = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.gswxxn.restoresplashscreen.ui.SubSettings
import com.gswxxn.restoresplashscreen.ui.`interface`.ISubSettings
import com.gswxxn.restoresplashscreen.utils.CommonUtils.toast
import com.gswxxn.restoresplashscreen.utils.IconPackManager
import com.gswxxn.restoresplashscreen.utils.YukiHelper
import com.gswxxn.restoresplashscreen.view.BlockMIUIItemData
import com.gswxxn.restoresplashscreen.view.SwitchView
import com.highcapable.yukihookapi.hook.factory.prefs
Expand Down Expand Up @@ -68,6 +69,13 @@ object IconSettings : ISubSettings {
SwitchView(DataConst.ENABLE_REPLACE_ICON)
)

// 使用 MIUI 大图标
if (YukiHelper.atLeastMIUI14)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.use_miui_large_icon, tipsId = R.string.use_miui_large_icon_tips),
SwitchView(DataConst.ENABLE_USE_MIUI_LARGE_ICON)
)

// 使用图标包
val availableIconPacks = IconPackManager(context).getAvailableIconPacks()
TextWithSpinner(
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
<string name="replace_icon">替换图标获取方式</string>
<string name="add_icon_blur_bg">为缩小的图标添加模糊背景</string>
<string name="replace_icon_tips">开启此选项后,Splash Screen的图标可以跟随主题设定。但是通常获取到的主题图标分辨率较低,经过放大后图标可能会比较模糊。</string>
<string name="use_miui_large_icon">使用 MIUI 大图标</string>
<string name="use_miui_large_icon_tips">目前仅显示 2x2 的大图标, 且此选项不受 \"缩小图标\" 的影响</string>
<string name="use_icon_pack">使用图标包</string>
<string name="icon_pack_is_removed">图标包被删除, 请重新选择</string>
<string name="default_style">忽略应用主动设置的图标</string>
Expand Down

0 comments on commit 6460ffe

Please sign in to comment.