icon changer test
appname cursed
This commit is contained in:
@@ -48,7 +48,7 @@ public class PreferencesUtil{
|
||||
fragment.getPreferenceScreen().addPreference(preference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addListPreferenceIcon(MaterialPreferenceToolbarFragment fragment, String key, String def, CharSequence title, String icon, CharSequence summary, CharSequence[] entries, CharSequence[] entriesValue){
|
||||
public static void addListPreferenceIcon(MaterialPreferenceToolbarFragment fragment, String key, String def, CharSequence title, String icon, CharSequence summary, CharSequence[] entries, CharSequence[] entriesValue, Preference.OnPreferenceChangeListener listener){
|
||||
ListPreference preference = new ListPreference(getContext());
|
||||
preference.setEntries(entries);
|
||||
preference.setEntryValues(entriesValue);
|
||||
@@ -57,6 +57,8 @@ public class PreferencesUtil{
|
||||
preference.setDialogTitle(title); // setDialogTitle
|
||||
preference.setKey(key); // setKey
|
||||
preference.setDefaultValue(def); // setDefaultValue
|
||||
preference.setOnPreferenceChangeListener(listener);
|
||||
|
||||
if (icon != null)
|
||||
preference.setIcon(setTint(getContext(), getDrawable(getContext(), icon))); // preference.setIcon
|
||||
fragment.getPreferenceScreen().addPreference(preference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
|
||||
@@ -16,6 +16,10 @@ import static ru.vtosters.lite.utils.Globals.getUserPhoto;
|
||||
import static ru.vtosters.lite.utils.Globals.getUsername;
|
||||
import static ru.vtosters.lite.utils.Globals.isGmsInstalled;
|
||||
import static ru.vtosters.lite.utils.Globals.restartApplication;
|
||||
import static ru.vtosters.lite.utils.IconManager.iconSwitcher;
|
||||
import static ru.vtosters.lite.utils.IconManager.icons;
|
||||
import static ru.vtosters.lite.utils.IconManager.iconsPlus;
|
||||
import static ru.vtosters.lite.utils.IconManager.iconsValues;
|
||||
import static ru.vtosters.lite.utils.Preferences.DoNotUseOldIcons;
|
||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||
import static ru.vtosters.lite.utils.Preferences.devmenu;
|
||||
@@ -180,6 +184,14 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
|
||||
});
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
PreferencesUtil.addListPreferenceIcon(this, "selectedicon", "vt", "Icons", "ic_vk_logo_48", "", icons(), iconsValues(), (preference, o) -> {
|
||||
edit().putString("selectedicon", o.toString()).apply();
|
||||
iconSwitcher(o.toString(), "standard");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (!isGmsInstalled()) {
|
||||
PreferencesUtil.addPreference(this, "", Globals.getString("installgms"), "", "ic_warning_24", preference -> {
|
||||
Context context = getContext();
|
||||
@@ -384,8 +396,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
|
||||
Globals.getString("autoclearcachedisabled"), "100 MB", "500 MB", "1 GB", "2 GB", "5 GB"
|
||||
}, new String[] {
|
||||
"Default", "100mb", "500mb", "1gb", "2gb", "5gb"
|
||||
});
|
||||
|
||||
}, null);
|
||||
|
||||
PreferencesUtil.addPreference(this, "", Globals.getString("vtlother"), othersumm, !DoNotUseOldIcons() ? "ic_more_24" : "ic_more_horizontal_28", preference -> {
|
||||
Context context = getContext();
|
||||
|
||||
@@ -2,9 +2,12 @@ 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.Globals.sendToast;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
import static ru.vtosters.lite.utils.Preferences.isValidSignature;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,36 +20,47 @@ public class IconManager{
|
||||
"standard", "vt", "vkontakte" // available appnames list
|
||||
);
|
||||
|
||||
public static List<String> availablecomponents = 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
|
||||
);
|
||||
|
||||
public static List<String> iconsPlus = Arrays.asList(
|
||||
"standard", "vt", "dev" // available icons list for verified users
|
||||
"standard", "vt", "navy", "tiger", "spring", "sea", "sakura", "party", "paint", "flamingo" // available icons list for verified users
|
||||
);
|
||||
|
||||
public static List<String> appnamesPlus = Arrays.asList(
|
||||
"standard", "vt", "vkontakte" // available appnames list for verified users
|
||||
);
|
||||
|
||||
public static List<String> availablecomponentsPlus = Arrays.asList(
|
||||
"00", "01", "02", "03", "10", "11", "12", "20", "21", "22" // 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 CharSequence[] icons() {
|
||||
var iconsList = icons;
|
||||
|
||||
if (hasVerification() && isValidSignature()) {
|
||||
iconsList = iconsPlus;
|
||||
}
|
||||
|
||||
return iconsList.toArray(new CharSequence[0]);
|
||||
}
|
||||
|
||||
public static CharSequence[] iconsValues() {
|
||||
var iconsList = icons;
|
||||
|
||||
|
||||
if (hasVerification() && isValidSignature()) {
|
||||
iconsList = iconsPlus;
|
||||
}
|
||||
|
||||
return iconsList.toArray(new CharSequence[0]);
|
||||
}
|
||||
|
||||
public static void iconSwitcher(String icon, String appname){
|
||||
var iconComponent = 1; // def value for standard icon
|
||||
var appNameComponent = 1; // def value for standard appname
|
||||
|
||||
Log.d("IconManager", "iconSwitcher: icon = " + icon + ", appname = " + appname);
|
||||
|
||||
var iconsList = icons;
|
||||
var appnamesList = appnames;
|
||||
var availablecomponentsList = availablecomponents;
|
||||
|
||||
var getCurrComponent = getPreferences().getInt("component_enabled", 11); // get current component value
|
||||
|
||||
if (hasVerification() && isValidSignature()) {
|
||||
iconsList = iconsPlus;
|
||||
appnamesList = appnamesPlus;
|
||||
availablecomponentsList = availablecomponentsPlus;
|
||||
}
|
||||
|
||||
if (iconsList.contains(icon)) { // check if icon is exist
|
||||
@@ -57,13 +71,16 @@ public class IconManager{
|
||||
appNameComponent = appnamesList.indexOf(appname); // get appname index
|
||||
}
|
||||
|
||||
if (getCurrComponent == iconComponent + appNameComponent || availablecomponentsList.get(iconComponent + appNameComponent) == null)
|
||||
var oldint = getPreferences().getInt("component_enabled", 11);
|
||||
var newint = Integer.parseInt(iconComponent + "" + appNameComponent);
|
||||
|
||||
if (oldint == newint)
|
||||
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
|
||||
componentSwitcher("id" + oldint, false); // disable current component to prevent conflict with custom value
|
||||
|
||||
edit().putInt("component_enabled", iconComponent + appNameComponent).commit(); // save custom value
|
||||
edit().putInt("component_enabled", newint).commit(); // save custom value
|
||||
|
||||
componentSwitcher("id" + iconComponent + appNameComponent, true); // enable custom value
|
||||
componentSwitcher("id" + newint, true); // enable custom value
|
||||
}
|
||||
}
|
||||
|
||||
+255
-3
@@ -275,7 +275,7 @@
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="20"
|
||||
android:icon="@mipmap/mp_launcher"
|
||||
android:icon="@mipmap/mp_launcher_navy"
|
||||
android:name=".id20"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
@@ -287,7 +287,7 @@
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="21"
|
||||
android:icon="@mipmap/mp_launcher"
|
||||
android:icon="@mipmap/mp_launcher_navy"
|
||||
android:name=".id21"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
@@ -299,7 +299,7 @@
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="22"
|
||||
android:icon="@mipmap/mp_launcher"
|
||||
android:icon="@mipmap/mp_launcher_navy"
|
||||
android:name=".id22"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
@@ -309,6 +309,258 @@
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="30"
|
||||
android:icon="@mipmap/mp_launcher_tiger"
|
||||
android:name=".id30"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="31"
|
||||
android:icon="@mipmap/mp_launcher_tiger"
|
||||
android:name=".id31"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="32"
|
||||
android:icon="@mipmap/mp_launcher_tiger"
|
||||
android:name=".id32"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="40"
|
||||
android:icon="@mipmap/mp_launcher_spring"
|
||||
android:name=".id40"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="41"
|
||||
android:icon="@mipmap/mp_launcher_spring"
|
||||
android:name=".id41"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="42"
|
||||
android:icon="@mipmap/mp_launcher_spring"
|
||||
android:name=".id42"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="50"
|
||||
android:icon="@mipmap/mp_launcher_sea"
|
||||
android:name=".id50"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="51"
|
||||
android:icon="@mipmap/mp_launcher_sea"
|
||||
android:name=".id51"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="52"
|
||||
android:icon="@mipmap/mp_launcher_sea"
|
||||
android:name=".id52"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="60"
|
||||
android:icon="@mipmap/mp_launcher_sakura"
|
||||
android:name=".id60"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="61"
|
||||
android:icon="@mipmap/mp_launcher_sakura"
|
||||
android:name=".id61"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="62"
|
||||
android:icon="@mipmap/mp_launcher_sakura"
|
||||
android:name=".id62"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="70"
|
||||
android:icon="@mipmap/mp_launcher_party"
|
||||
android:name=".id70"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="71"
|
||||
android:icon="@mipmap/mp_launcher_party"
|
||||
android:name=".id71"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="72"
|
||||
android:icon="@mipmap/mp_launcher_party"
|
||||
android:name=".id72"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="80"
|
||||
android:icon="@mipmap/mp_launcher_paint"
|
||||
android:name=".id80"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="81"
|
||||
android:icon="@mipmap/mp_launcher_paint"
|
||||
android:name=".id81"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="82"
|
||||
android:icon="@mipmap/mp_launcher_paint"
|
||||
android:name=".id82"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="90"
|
||||
android:icon="@mipmap/mp_launcher_flamingo"
|
||||
android:name=".id90"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="91"
|
||||
android:icon="@mipmap/mp_launcher_flamingo"
|
||||
android:name=".id91"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="92"
|
||||
android:icon="@mipmap/mp_launcher_flamingo"
|
||||
android:name=".id92"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity
|
||||
android:name="com.vtosters.lite.FragmentWrapperActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||
|
||||
Reference in New Issue
Block a user