fixes
This commit is contained in:
+16
-13
@@ -17,14 +17,15 @@ import static ru.vtosters.lite.utils.Themes.getDarkTheme;
|
||||
import static ru.vtosters.lite.utils.Themes.getImDarkTheme;
|
||||
import static ru.vtosters.lite.utils.Themes.getImLightTheme;
|
||||
import static ru.vtosters.lite.utils.Themes.getLightTheme;
|
||||
import static ru.vtosters.lite.utils.Themes.setTheme;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.vk.about.AboutAppFragment;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.identity.fragments.IdentityListFragment;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vk.notifications.settings.NotificationsSettingsFragment;
|
||||
@@ -45,7 +46,7 @@ import ru.vtosters.lite.ui.fragments.dockbar.DockBarFragment;
|
||||
import ru.vtosters.lite.ui.fragments.multiaccount.MultiAccountFragment;
|
||||
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
|
||||
|
||||
public class VKMeSettings extends MaterialPreferenceToolbarFragment {
|
||||
public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public void b(Bundle bundle) {
|
||||
@@ -54,7 +55,7 @@ public class VKMeSettings extends MaterialPreferenceToolbarFragment {
|
||||
String keyVKAccount = getCurrentAccount().getString("key_vk_account", "");
|
||||
String avatarUrl = withRegex(keyVKAccount, ".*\"photo\":\\{.*?:\"(.*?)\"\\}.*", "https://vk.com/images/camera_200.png").replace("\\/", "/");
|
||||
String name = withRegex(keyVKAccount, ".*\"name\":\\{.*?:\"(.*?)\"\\}.*", "");
|
||||
String id = "@id" + Integer.toString(getUserId());
|
||||
String id = "@id" + getUserId();
|
||||
int vtosterXml = getIdentifier("empty", "xml");
|
||||
this.a(vtosterXml);
|
||||
|
||||
@@ -65,7 +66,7 @@ public class VKMeSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "isdark", "Темная тема", "", "ic_palette_24", false, (preference, o) -> {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "isdark", getString("vtsettdarktheme"), "", "ic_palette_24", false, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
|
||||
if(value){
|
||||
@@ -76,19 +77,21 @@ public class VKMeSettings extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
edit().putBoolean("isdark", value).commit();
|
||||
|
||||
VKThemeHelper.a(this.p());
|
||||
setTheme(this.p());
|
||||
|
||||
restartApplicationWithTimer();
|
||||
return true;
|
||||
});
|
||||
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "systemtheme", getString("appearance_theme_use_system"), getString("appearance_theme_use_system_summary"), "ic_recent_24", true, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
if (Build.VERSION.SDK_INT >= 29) {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "systemtheme", getString("appearance_theme_use_system"), getString("appearance_theme_use_system_summary"), "ic_recent_24", true, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
|
||||
edit().putBoolean("systemtheme", value).commit();
|
||||
edit().putBoolean("systemtheme", value).commit();
|
||||
|
||||
return true;
|
||||
});
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
if (!isGmsInstalled()) {
|
||||
PreferencesUtil.addPreference(this, "", getString("installgms"), "", "ic_alert", preference -> {
|
||||
@@ -116,7 +119,7 @@ public class VKMeSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
}
|
||||
|
||||
PreferencesUtil.addPreferenceCategory(this, "Аккаунт");
|
||||
PreferencesUtil.addPreferenceCategory(this, getString("vtsettaccount"));
|
||||
|
||||
PreferencesUtil.addPreference(this, "", getString("vkconnect"), "", "ic_tags_24", preference -> {
|
||||
Context context = getContext();
|
||||
@@ -194,7 +197,7 @@ public class VKMeSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
}
|
||||
|
||||
PreferencesUtil.addPreferenceCategory(this, "Настройки модификации");
|
||||
PreferencesUtil.addPreferenceCategory(this, getString("vtsettmod"));
|
||||
|
||||
if (!vkme()) {
|
||||
PreferencesUtil.addPreference(this, "", getString("vtlfeed"), "", "ic_newsfeed_24", preference -> {
|
||||
@@ -268,7 +271,7 @@ public class VKMeSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
PreferencesUtil.addPreferenceCategory(this, "О модификации");
|
||||
PreferencesUtil.addPreferenceCategory(this, getString("vtsettaboutmod"));
|
||||
|
||||
PreferencesUtil.addPreference(this, "", getString("menu_about"), "", "ic_about_24", preference -> {
|
||||
Context context = getContext();
|
||||
@@ -33,7 +33,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import ru.vtosters.lite.ui.fragments.VKMeSettings;
|
||||
import ru.vtosters.lite.ui.fragments.VTSettings;
|
||||
|
||||
public class Preferences {
|
||||
public static SharedPreferences preferences = getContext().getSharedPreferences("com.vtosters.lite_preferences", Context.MODE_PRIVATE);
|
||||
@@ -148,7 +148,7 @@ public class Preferences {
|
||||
|
||||
public static Class useNewSettings() {
|
||||
boolean bool = getBoolValue("useNewSettings", true);
|
||||
return bool? VKMeSettings.class : SettingsListFragment.class;
|
||||
return bool? VTSettings.class : SettingsListFragment.class;
|
||||
}
|
||||
|
||||
public static boolean VKUI_INJ() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
import static com.vk.im.ui.themes.ImTheme.*;
|
||||
import static ru.vtosters.lite.utils.Globals.edit;
|
||||
import static ru.vtosters.lite.utils.Globals.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
@@ -13,6 +14,7 @@ import static ru.vtosters.lite.utils.Preferences.systemtheme;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
import static ru.vtosters.lite.utils.Preferences.vksans;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
@@ -46,6 +48,9 @@ public class Themes {
|
||||
ImThemeHelper.b.a(imtheme); // ImThemeHelper.b.a(ImTheme value) VK Theme Msg apply
|
||||
} // Apply VKTheme and ImTheme (hard applying without dynamic theme changing)
|
||||
|
||||
public static void setTheme(Activity activity) {
|
||||
VKThemeHelper.a(activity); // apply changed theme
|
||||
}
|
||||
public static boolean isDarkTheme() {
|
||||
return !VKThemeHelper.d();
|
||||
}
|
||||
@@ -128,9 +133,9 @@ public class Themes {
|
||||
public static ImTheme getImDarkTheme() {
|
||||
switch (getPrefsValue("darktheme")) {
|
||||
case "amoled":
|
||||
return roundedmsgs() ? ImTheme.VKME_AMOLED : ImTheme.VKAPP_AMOLED;
|
||||
return roundedmsgs() ? VKME_AMOLED : VKAPP_AMOLED;
|
||||
default:
|
||||
return roundedmsgs() ? ImTheme.VKME_DARK : ImTheme.VKAPP_DARK;
|
||||
return roundedmsgs() ? VKME_DARK : VKAPP_DARK;
|
||||
}
|
||||
} // Return needed theme for theme changer
|
||||
|
||||
@@ -144,7 +149,7 @@ public class Themes {
|
||||
public static ImTheme getImLightTheme() {
|
||||
switch (getPrefsValue("lighttheme")) {
|
||||
default:
|
||||
return roundedmsgs() ? ImTheme.VKME_LIGHT : ImTheme.VKAPP_LIGHT;
|
||||
return roundedmsgs() ? VKME_LIGHT : VKAPP_LIGHT;
|
||||
}
|
||||
} // Return needed theme for theme changer
|
||||
|
||||
@@ -313,6 +318,7 @@ public class Themes {
|
||||
return "images";
|
||||
}
|
||||
|
||||
|
||||
public static int getNavigationHeight(int Default) {
|
||||
int VKME = R.dimen.design_bottom_sheet_peek_height_min;
|
||||
|
||||
|
||||
@@ -4449,5 +4449,10 @@
|
||||
<string name="vkme">Режим VK Me</string>
|
||||
<string name="vkmesumm">Замена докбара и некоторых элементов на что-то похожее как в VK Me</string>
|
||||
|
||||
<string name="vtsettaccount">Аккаунт</string>
|
||||
<string name="vtsettdarktheme">Темная тема</string>
|
||||
<string name="vtsettaboutmod">О модификации</string>
|
||||
<string name="vtsettmod">Настройки мода</string>
|
||||
|
||||
<string name="empty_text" />
|
||||
</resources>
|
||||
|
||||
@@ -4583,6 +4583,12 @@ May look like a fake leaving the online"</string>
|
||||
<string name="vkme">VK Me mode</string>
|
||||
<string name="vkmesumm">Replacing the dock and some elements with something similar as in VK Me</string>
|
||||
|
||||
<string name="vtsettaccount">Account</string>
|
||||
<string name="vtsettdarktheme">Dark theme</string>
|
||||
<string name="vtsettaboutmod">About modification</string>
|
||||
<string name="vtsettmod">Mod settings</string>
|
||||
|
||||
|
||||
<item type="string" name="APKTOOL_DUMMY_10be" />
|
||||
<item type="string" name="APKTOOL_DUMMY_10bf" />
|
||||
<item type="string" name="APKTOOL_DUMMY_10c0" />
|
||||
|
||||
Reference in New Issue
Block a user