From 4541ef61c12d0828d889e25e937b8ec29d8d7c26 Mon Sep 17 00:00:00 2001 From: gdlbo <41114720+gdlbo@users.noreply.github.com> Date: Thu, 7 Jul 2022 16:40:40 +0300 Subject: [PATCH] Update IconManager.java --- .../ru/vtosters/lite/utils/IconManager.java | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/ru/vtosters/lite/utils/IconManager.java b/app/src/main/java/ru/vtosters/lite/utils/IconManager.java index 19b0379df..ca59b8220 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/IconManager.java +++ b/app/src/main/java/ru/vtosters/lite/utils/IconManager.java @@ -2,6 +2,7 @@ package ru.vtosters.lite.utils; import static ru.vtosters.lite.utils.Globals.componentSwitcher; import static ru.vtosters.lite.utils.Globals.edit; import static ru.vtosters.lite.utils.Globals.getPreferences; +import static ru.vtosters.lite.utils.Preferences.*; import java.util.Arrays; import java.util.List; @@ -19,21 +20,44 @@ public class IconManager{ "00", "01", "02", "03", "10", "11", "12" // 00 - standard standard, 01 - standard vt, 02 - standard vkontakte, 10 - vt standard, 11 - vt vt, 12 - vt vkontakte ); + + public static List iconsPlus = Arrays.asList( + "standard", "vt", "dev" // available icons list for verified users + ); + + public static List appnamesPlus = Arrays.asList( + "standard", "vt", "vkontakte" // available appnames list for verified users + ); + + public static List availablecomponentsPlus = Arrays.asList( + "00", "01", "02", "03", "10", "11", "12" // 00 - standard standard, 01 - standard vt, 02 - standard vkontakte, 10 - vt standard, 11 - vt vt, 12 - vt vkontakte, 20 - dev standard, 21 - dev vt, 22 - dev vkontakte + ); + public static void iconSwitcher(String icon, String appname){ var iconComponent = 1; // def value for standard icon var appNameComponent = 1; // def value for standard appname + var iconsList = icons; + var appnamesList = appnames; + var availablecomponentsList = availablecomponents; + var getCurrComponent = getPreferences().getInt("component_enabled", 11); // get current component value - if(icons.contains(icon)){ // check if icon is exist - iconComponent = icons.indexOf(icon); // get icon index + if(hasVerification() && isValidSignature()){ + iconsList = iconsPlus; + appnamesList = appnamesPlus; + availablecomponentsList = availablecomponentsPlus; } - if(appnames.contains(appname)){ // check if appname is exist - appNameComponent = appnames.indexOf(appname); // get appname index + if(iconsList.contains(icon)){ // check if icon is exist + iconComponent = iconsList.indexOf(icon); // get icon index } - if(getCurrComponent == iconComponent + appNameComponent || availablecomponents.get(iconComponent + appNameComponent) == null) return; // check if current component is equal to custom value or if custom value is not exist + if(appnamesList.contains(appname)){ // check if appname is exist + appNameComponent = appnamesList.indexOf(appname); // get appname index + } + + if(getCurrComponent == iconComponent + appNameComponent || availablecomponentsList.get(iconComponent + appNameComponent) == null) return; // check if current component is equal to custom value or if custom value is not exist componentSwitcher("id." + getCurrComponent, false); // disable current component to prevent conflict with custom value