fixes some themes logic

This commit is contained in:
gdlbo
2022-06-08 17:22:11 +03:00
parent 155fa80c95
commit 3abff8cad1
9 changed files with 76 additions and 378 deletions
@@ -0,0 +1,26 @@
package com.vk.core.ui.themes;
import com.vk.s.R;
import ru.vtosters.lite.utils.Themes;
public enum VKTheme {
DEFAULT_LIGHT(0, R.g.BaseStyle),
DARK(1, R.g.BaseDarkStyle),
AMOLED(2, Themes.getAmoledTheme());
private final long id;
private final int themeResId;
VKTheme(long j, int i) {
this.id = j;
this.themeResId = i;
}
public final long a() {
return this.id;
}
public final int b() {
return this.themeResId;
}
}
@@ -0,0 +1,32 @@
package com.vk.im.ui.themes;
import static com.vk.im.ui.R.m.VkIm_Theme_VkApp_Dark;
import static com.vk.im.ui.R.m.VkIm_Theme_VkApp_Light;
import static com.vk.im.ui.R.m.VkIm_Theme_VkMe_Dark;
import static com.vk.im.ui.R.m.VkIm_Theme_VkMe_Light;
import ru.vtosters.lite.utils.Themes;
public enum ImTheme {
VKAPP_LIGHT(0, VkIm_Theme_VkApp_Light),
VKAPP_DARK(3, VkIm_Theme_VkApp_Dark),
VKME_LIGHT(1, VkIm_Theme_VkMe_Light),
VKME_DARK(2, VkIm_Theme_VkMe_Dark),
VKAPP_AMOLED(4, Themes.getAmoledImTheme());
private final int id;
private final int themeResId;
ImTheme(int i, int i2) {
this.id = i;
this.themeResId = i2;
}
public final int a() {
return this.id;
}
public final int b() {
return this.themeResId;
}
}
@@ -147,15 +147,15 @@ public class Newsfeed {
}
public static String friendsads() {
return !postsrecomm() ? "user_rec" : "null";
return postsrecomm() ? "null" : "user_rec";
}
public static String getFriendRecomm() {
return !friendsrecomm() ? "friends_recommendations" : "null";
return friendsrecomm() ? "null" : "friends_recommendations";
}
public static String authorsads() {
return !authorsrecomm() ? "authors_rec" : "null";
return authorsrecomm() ? "null" : "authors_rec";
}
public static String widgetads() {
@@ -330,6 +330,10 @@ public class Preferences {
return getBoolValue("vkme_msg", false);
}
public static boolean vkme_theme() {
return getBoolValue("vkme_theme", false);
}
public static boolean donaterecomm() {
return getBoolValue("donaterecomm", false);
}
@@ -9,6 +9,7 @@ import static ru.vtosters.lite.utils.Preferences.color_grishka;
import static ru.vtosters.lite.utils.Preferences.isBGStickersEnabled;
import static ru.vtosters.lite.utils.Preferences.navbar;
import static ru.vtosters.lite.utils.Preferences.systemtheme;
import static ru.vtosters.lite.utils.Preferences.vkme_theme;
import static ru.vtosters.lite.utils.Preferences.vksans;
import android.content.Context;
@@ -119,7 +120,7 @@ public class Themes {
case "amoled":
return ImTheme.VKAPP_AMOLED;
default:
return ImTheme.VKAPP_DARK;
return vkme_theme() ? ImTheme.VKME_DARK : ImTheme.VKAPP_DARK;
}
} // Return needed theme for theme changer
@@ -133,7 +134,7 @@ public class Themes {
public static ImTheme getImLightTheme() {
switch (getPrefsValue("lighttheme")) {
default:
return ImTheme.VKAPP_LIGHT;
return vkme_theme() ? ImTheme.VKME_LIGHT : ImTheme.VKAPP_LIGHT;
}
} // Return needed theme for theme changer