IconManager manifest inject

This commit is contained in:
gdlbo
2022-07-07 19:18:02 +03:00
parent eb659dd453
commit 4498d231ad
4 changed files with 110 additions and 31 deletions
@@ -23,21 +23,7 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment{
prefs();
}
public boolean apply(Preference preference, Object obj){
if((Boolean) obj){
componentSwitcher("VTIconDefault", false);
componentSwitcher("VTIconVK", true);
} else {
componentSwitcher("VTIconDefault", true);
componentSwitcher("VTIconVK", false);
}
ToastUtils.a(Globals.getString("iconapplying"));
return true;
}
private void prefs(){
findPreference("iconvk").setOnPreferenceChangeListener(new a());
findPreference("navbar").setOnPreferenceClickListener(new restart());
}
@@ -48,11 +34,4 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment{
return true;
}
}
public class a implements Preference.OnPreferenceChangeListener{
@Override
public boolean onPreferenceChange(Preference preference, Object obj){
return ThemesFragment.this.apply(preference, obj);
}
}
}
@@ -58,10 +58,10 @@ public class IconManager{
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
componentSwitcher("id" + getCurrComponent, false); // disable current component to prevent conflict with custom value
edit().putInt("component_enabled", iconComponent + appNameComponent).commit(); // save custom value
componentSwitcher("id." + iconComponent + appNameComponent, true); // enable custom value
componentSwitcher("id" + iconComponent + appNameComponent, true); // enable custom value
}
}
+108 -1
View File
@@ -201,7 +201,114 @@
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
</intent-filter>
</activity>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/mp_launcher"
android:name=".id11"
android:enabled="true"
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="@string/app_name_orig"
android:icon="@mipmap/mp_launcher"
android:name=".id00"
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="01"
android:icon="@mipmap/mp_launcher"
android:name=".id01"
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="02"
android:icon="@mipmap/mp_launcher"
android:name=".id02"
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="10"
android:icon="@mipmap/mp_launcher"
android:name=".id10"
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="12"
android:icon="@mipmap/mp_launcher"
android:name=".id12"
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="20"
android:icon="@mipmap/mp_launcher"
android:name=".id20"
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="21"
android:icon="@mipmap/mp_launcher"
android:name=".id21"
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="22"
android:icon="@mipmap/mp_launcher"
android:name=".id22"
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"
-7
View File
@@ -25,13 +25,6 @@
android:key="lighttheme"
android:title="@string/appearance_theme_light_theme" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/vticon">
<com.vtosters.lite.ui.MaterialSwitchPreference
android:defaultValue="false"
android:key="iconvk"
android:summary="@string/vticonsummary"
android:title="@string/vticonbtn" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/vtlother">
<com.vtosters.lite.ui.MaterialSwitchPreference
android:defaultValue="true"