Skip to content

Commit bfd5808

Browse files
committed
PeekDisplayView: improved icon settings
1 parent af41650 commit bfd5808

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

app/src/main/java/it/dhd/oxygencustomizer/xposed/views/peek/PeekDisplayView.java

+16-18
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import static it.dhd.oxygencustomizer.xposed.ResourceManager.modRes;
66
import static it.dhd.oxygencustomizer.xposed.hooks.systemui.ControllersProvider.getActivityStarterExternal;
77
import static it.dhd.oxygencustomizer.xposed.utils.SystemUtils.PackageManager;
8+
import static it.dhd.oxygencustomizer.xposed.utils.ViewHelper.dp2px;
89

910
import android.annotation.SuppressLint;
1011
import android.app.Notification;
@@ -341,24 +342,21 @@ private boolean checkChange(int newIconStyle, int iconSize, int backgroundColor,
341342
boolean requireUpdate = false;
342343
PeekIconStyle iconStyle = mCurrentPeekStyle.getPeekIconStyle();
343344
if (newIconStyle == 2) { // Custom icon selected
344-
if (iconStyle.getStyle() == 2) { //old
345-
// Custom old and before
346-
boolean shouldUpdate = PEEK_STYLE_ICON_CUSTOM.getIconBackgroundColor() != iconStyle.getIconBackgroundColor() ||
347-
(PEEK_STYLE_ICON_CUSTOM.getIconSize() != iconStyle.getIconSize()) ||
348-
(PEEK_STYLE_ICON_CUSTOM.getIconSpacing() != iconStyle.getIconSpacing()) ||
349-
(PEEK_STYLE_ICON_CUSTOM.getIconPadding() != iconStyle.getIconPadding());
350-
if (shouldUpdate) {
351-
PEEK_STYLE_ICON_CUSTOM = new PeekIconStyle(
352-
PEEK_STYLE_ICON_CUSTOM.getName(),
353-
PEEK_STYLE_ICON_CUSTOM.getStyle(),
354-
iconSize,
355-
backgroundColor,
356-
iconMarginEnd,
357-
iconPadding
358-
);
359-
mCurrentIconStyle = PEEK_STYLE_ICON_CUSTOM;
360-
return true;
361-
}
345+
boolean shouldUpdate = PEEK_STYLE_ICON_CUSTOM.getIconBackgroundColor() != backgroundColor ||
346+
(PEEK_STYLE_ICON_CUSTOM.getIconSize() != iconSize) ||
347+
(PEEK_STYLE_ICON_CUSTOM.getIconSpacing() != iconMarginEnd) ||
348+
(PEEK_STYLE_ICON_CUSTOM.getIconPadding() != iconPadding);
349+
if (shouldUpdate) {
350+
PEEK_STYLE_ICON_CUSTOM = new PeekIconStyle(
351+
PEEK_STYLE_ICON_CUSTOM.getName(),
352+
PEEK_STYLE_ICON_CUSTOM.getStyle(),
353+
dp2px(mContext, iconSize),
354+
backgroundColor,
355+
dp2px(mContext, iconMarginEnd),
356+
dp2px(mContext, iconPadding)
357+
);
358+
mCurrentIconStyle = PEEK_STYLE_ICON_CUSTOM;
359+
return true;
362360
}
363361
}
364362
if (iconStyle.getStyle() != newIconStyle) {

0 commit comments

Comments
 (0)