fix neko Icon selector

This commit is contained in:
luvletter2333 2022-07-10 14:58:02 +08:00
parent de2d16705a
commit 11f055d23f
No known key found for this signature in database
GPG Key ID: A26A8880836E1978
21 changed files with 24 additions and 10 deletions

View File

@ -81,6 +81,7 @@ public class AppIconsSelectorCell extends RecyclerListView implements Notificati
holderView.bind(icon);
holderView.iconView.setBackground(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(ICONS_ROUND_RADIUS), Color.TRANSPARENT, Theme.getColor(Theme.key_listSelector), Color.BLACK));
holderView.iconView.setForeground(icon.foreground);
holderView.iconView.setIsNekoXIcon(icon.isNekoX());
}
@Override
@ -289,6 +290,7 @@ public class AppIconsSelectorCell extends RecyclerListView implements Notificati
}
public static class AdaptiveIconImageView extends ImageView {
private boolean isNekoXIcon = false;
private Drawable foreground;
private Path path = new Path();
private int outerPadding = AndroidUtilities.dp(5);
@ -303,6 +305,10 @@ public class AppIconsSelectorCell extends RecyclerListView implements Notificati
invalidate();
}
public void setIsNekoXIcon(boolean value) {
this.isNekoXIcon = value;
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
@ -325,11 +331,12 @@ public class AppIconsSelectorCell extends RecyclerListView implements Notificati
public void draw(Canvas canvas) {
canvas.save();
canvas.clipPath(path);
canvas.scale(1f + backgroundOuterPadding / (float) getWidth(), 1f + backgroundOuterPadding / (float) getHeight(), getWidth() / 2f, getHeight() / 2f);
if (!this.isNekoXIcon)
canvas.scale(1f + backgroundOuterPadding / (float) getWidth(), 1f + backgroundOuterPadding / (float) getHeight(), getWidth() / 2f, getHeight() / 2f);
super.draw(canvas);
canvas.restore();
if (foreground != null) {
if (foreground != null && !this.isNekoXIcon) {
foreground.setBounds(-outerPadding, -outerPadding, getWidth() + outerPadding, getHeight() + outerPadding);
foreground.draw(canvas);
}

View File

@ -34,10 +34,12 @@ public class AppIconBulletinLayout extends Bulletin.ButtonLayout {
textView.setTypeface(Typeface.SANS_SERIF);
addView(textView, LayoutHelper.createFrameRelatively(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 56, 0, 16, 0));
// NekoX: try to fix NekoX icon
imageView.setImageDrawable(ContextCompat.getDrawable(context, icon.background));
imageView.setOuterPadding(AndroidUtilities.dp(8));
imageView.setBackgroundOuterPadding(AndroidUtilities.dp(24));
imageView.setForeground(icon.foreground);
imageView.setIsNekoXIcon(icon.isNekoX());
textView.setText(AndroidUtilities.replaceTags(LocaleController.formatString(R.string.AppIconChangedTo, LocaleController.getString(icon.title))));
}
}

View File

@ -55,6 +55,7 @@ public class PremiumAppIconsPreviewView extends FrameLayout implements PagerHead
AdaptiveIconImageView iconImageView = new AdaptiveIconImageView(ctx, i);
iconImageView.setLayoutParams(LayoutHelper.createFrame(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER, 0, 52, 0, 0));
iconImageView.setForeground(icon.foreground);
iconImageView.setIsNekoXIcon(icon.isNekoX());
iconImageView.setBackgroundResource(icon.background);
iconImageView.setPadding(AndroidUtilities.dp(8));
iconImageView.setBackgroundOuterPadding(AndroidUtilities.dp(32));

View File

@ -34,12 +34,12 @@ public class LauncherIconController {
}
public enum LauncherIcon {
DEFAULT("DefaultIcon", R.drawable.icon_background_sa, R.mipmap.icon_foreground_sa, R.string.AppIconDefault),
DEFAULT("DefaultIcon", R.drawable.ic_launcher_foreground, R.mipmap.ic_launcher, R.string.AppIconDefault),
VINTAGE("VintageIcon", R.drawable.icon_6_background_sa, R.mipmap.icon_6_foreground_sa, R.string.AppIconVintage),
AQUA("AquaIcon", R.drawable.icon_4_background_sa, R.mipmap.icon_foreground_sa, R.string.AppIconAqua),
PREMIUM("PremiumIcon", R.drawable.icon_3_background_sa, R.mipmap.icon_3_foreground_sa, R.string.AppIconPremium, true),
TURBO("TurboIcon", R.drawable.icon_5_background_sa, R.mipmap.icon_5_foreground_sa, R.string.AppIconTurbo, true),
NOX("NoxIcon", R.drawable.icon_2_background_sa, R.mipmap.icon_foreground_sa, R.string.AppIconNox, true);
PREMIUM("PremiumIcon", R.drawable.icon_3_background_sa, R.mipmap.icon_3_foreground_sa, R.string.AppIconPremium),
TURBO("TurboIcon", R.drawable.icon_5_background_sa, R.mipmap.icon_5_foreground_sa, R.string.AppIconTurbo),
NOX("NoxIcon", R.drawable.icon_2_background_sa, R.mipmap.icon_foreground_sa, R.string.AppIconNox);
public final String key;
public final int background;
@ -67,5 +67,9 @@ public class LauncherIconController {
this.title = title;
this.premium = premium;
}
public boolean isNekoX() {
return this == DEFAULT;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/icon_2_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<foreground android:drawable="@mipmap/icon_foreground" />
</adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/icon_2_background_round" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<foreground android:drawable="@mipmap/icon_foreground_round" />
</adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/icon_4_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<foreground android:drawable="@mipmap/icon_foreground" />
</adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/icon_4_background_round" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<foreground android:drawable="@mipmap/icon_foreground_round" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 991 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB