Skip to content

Commit bfbda39

Browse files
committed
Fix option to show or hide icon shadow
Signed-off-by: Saul Henriquez <saul_henriquez@hotmail.com>
1 parent 49c3653 commit bfbda39

6 files changed

Lines changed: 27 additions & 22 deletions

File tree

Omega/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@
273273
<string name="color_presets">Presets</string>
274274
<string name="color_dynamic">Dynamic</string>
275275
<string name="title_adaptify_pack">Create adaptive icons for icon pack</string>
276+
<string name="title_show_icon_shadow">Show Icon Shadow</string>
277+
<string name="summary_show_icon_shadow">Show shadow for non-adaptive icons.</string>
276278
<string name="title_force_shapeless">Force shapeless icons</string>
277279
<string name="title_themed_icons">Themed Icons</string>
278280
<string name="title_themed_background">Transparent icon background</string>

Omega/src/com/neoapps/neolauncher/compose/pages/preferences/ProfilePrefsPage.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ fun ProfilePrefsPage() {
7575
prefs.profileIconShape,
7676
prefs.profileIconAdaptify,
7777
prefs.profileIconColoredBackground,
78+
prefs.profileIconShadow,
7879
if (customIconsCount > 0) {
7980
prefs.profileResetCustomIcons
8081
} else {

Omega/src/com/neoapps/neolauncher/preferences/NeoPrefs.kt

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -187,22 +187,6 @@ class NeoPrefs private constructor(val context: Context) {
187187
}
188188
)
189189

190-
var profileTransparentBgIcons = BooleanPref(
191-
titleId = R.string.title_themed_background,
192-
dataStore = dataStore,
193-
key = PrefKey.PROFILE_ICON_TRANSPARENT_BG,
194-
defaultValue = false
195-
)
196-
197-
var profileShapeLessIcon = BooleanPref(
198-
titleId = R.string.title_force_shapeless,
199-
summaryId = R.string.summary_force_shapeless,
200-
dataStore = dataStore,
201-
key = PrefKey.PROFILE_ICON_SHAPE_LESS,
202-
defaultValue = false,
203-
onChange = { reloadModel() }
204-
)
205-
206190
var profileIconColoredBackground = BooleanPref(
207191
dataStore = dataStore,
208192
key = PrefKey.PROFILE_ICON_COLORED_BG,
@@ -214,6 +198,17 @@ class NeoPrefs private constructor(val context: Context) {
214198
}
215199
)
216200

201+
var profileIconShadow = BooleanPref(
202+
dataStore = dataStore,
203+
key = PrefKey.PROFILE_ICON_SHADOW,
204+
titleId = R.string.title_show_icon_shadow,
205+
summaryId = R.string.summary_show_icon_shadow,
206+
defaultValue = false,
207+
onChange = {
208+
legacyPrefs.savePreference("profile_icon_shadow", it)
209+
}
210+
)
211+
217212
var profileIconAdaptify = BooleanPref(
218213
dataStore = dataStore,
219214
key = PrefKey.PROFILE_ICON_ADAPTIFY,

Omega/src/com/neoapps/neolauncher/preferences/PrefKey.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ object PrefKey {
3838
val PROFILE_ICON_PACK = stringPreferencesKey("profile_icon_pack")
3939
val PROFILE_ICON_SHAPE = stringPreferencesKey("profile_icon_shape")
4040
val PROFILE_ICON_COLORED_BG = booleanPreferencesKey("profile_icon_colored_background")
41-
val PROFILE_ICON_TRANSPARENT_BG = booleanPreferencesKey("profile_transparent_icon")
4241
val PROFILE_THEMED_ICONS = booleanPreferencesKey("themed_icons")
4342
val PROFILE_ICON_ADAPTIFY = booleanPreferencesKey("profile_icon_adaptify")
4443
val PROFILE_ICON_RESET_CUSTOM = stringPreferencesKey("profile_icon_reset_custom")
45-
val PROFILE_ICON_SHAPE_LESS = booleanPreferencesKey("profile_icon_shape_less")
44+
val PROFILE_ICON_SHADOW = booleanPreferencesKey("profile_icon_shadow")
4645
val PROFILE_WINDOW_CORNER_RADIUS = floatPreferencesKey("profile_custom_window_corner_radius")
4746
val PROFILE_STATUSBAR_SHADOW = booleanPreferencesKey("profile_status_bar_shadow")
4847

libs_systemui/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,17 +398,22 @@ constructor(
398398
icon.wrapIntoSquareDrawable(options.iconScale)
399399
else icon
400400
iconToDraw.setBounds(0, 0, iconBitmapSize, iconBitmapSize)
401-
401+
val legacyBackground = prefs.getWrapperBackgroundColor(icon)
402402
return createBitmap(options) { canvas, bitmap ->
403-
if (drawFullBleed) canvas.drawColor(Color.BLACK)
404-
iconToDraw.draw(canvas)
403+
if (prefs.coloredIconBackground() && prefs.coloredIconBackground()) {
404+
canvas.drawColor(legacyBackground)
405+
} else {
406+
canvas.drawColor(Color.TRANSPARENT)
407+
}
405408

406-
if (options.addShadows && bitmap != null && !drawFullBleed) {
409+
if (options.addShadows && bitmap != null && !drawFullBleed && prefs.iconShadow()) {
407410
// Shadow extraction only works in software mode
408411
shadowGenerator.drawShadow(bitmap, canvas)
409412

410413
// Draw the icon again on top
411414
iconToDraw.draw(canvas)
415+
} else {
416+
iconToDraw.draw(canvas)
412417
}
413418
}
414419
}

libs_systemui/iconloaderlib/src/com/neoapps/neolauncher/icons/IconPreferences.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ class IconPreferences(context: Context) {
3636
fun shouldWrapAdaptive(): Boolean {
3737
return prefs.getBoolean("profile_icon_adaptify", false)
3838
}
39+
fun iconShadow(): Boolean {
40+
return prefs.getBoolean("profile_icon_shadow", false)
41+
}
3942

4043
fun coloredIconBackground(): Boolean {
4144
return prefs.getBoolean("profile_icon_colored_background", false)

0 commit comments

Comments
 (0)