revert attribute hooks for monet
This commit is contained in:
@@ -152,6 +152,39 @@ public class ThemesCore {
|
||||
themedColors.put(R.attr.im_bubble_outgoing_highlighted, accentColor);
|
||||
}
|
||||
|
||||
@SuppressLint("NonConstantResourceId")
|
||||
public static int getThemedAttr(Context context, @IdRes int attr) {
|
||||
return switch (attr) {
|
||||
case R.attr.im_bubble_wallpaper_outgoing, R.attr.im_bubble_outgoing -> outgoinging_msg;
|
||||
case R.attr.im_bubble_outgoing_highlighted -> outgoinging_msg_highlight;
|
||||
case R.attr.newsfeed_post_title_color -> darken_color;
|
||||
default -> themedColors.get(attr);
|
||||
};
|
||||
}
|
||||
|
||||
public static boolean hasThemedAttr(Context context, int attrID) {
|
||||
// try {
|
||||
// Log.d(TAG, "Requesting color by attr " + context.getResources().getResourceName(attrID));
|
||||
// } catch (Exception e) {
|
||||
// }
|
||||
|
||||
if (isCachedAccents()) {
|
||||
if (ThemesUtils.isDarkTheme()) {
|
||||
return (themedColors.get(attrID) != 0 && ACCENT_THEME_ONLY_DARK.get(attrID, true) && (
|
||||
ThemesUtils.isMilkshake() ?
|
||||
ACCENT_THEME_ONLY_MILK_DARK.get(attrID, true) :
|
||||
ACCENT_THEME_ONLY_NOMILK_DARK.get(attrID, true)));
|
||||
} else {
|
||||
return (themedColors.get(attrID) != 0 && ACCENT_THEME_ONLY_LIGHT.get(attrID, true) && (
|
||||
ThemesUtils.isMilkshake() ?
|
||||
ACCENT_THEME_ONLY_MILK_LIGHT.get(attrID, true) :
|
||||
ACCENT_THEME_ONLY_NOMILK_LIGHT.get(attrID, true)));
|
||||
}
|
||||
} else {
|
||||
return themedColors.get(attrID) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
cachedAccents = false;
|
||||
themedColors.clear();
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package ru.vtosters.lite.themes;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.*;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.lite.themes.utils.RecolorUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class ThemesHacks {
|
||||
// Фиксит селектор (все/свои/архив) в профиле
|
||||
public static void fixProfileSelector(View view) {
|
||||
if (!ThemesUtils.isMilkshake()) return;
|
||||
var id = view.getId();
|
||||
|
||||
if (id == R.id.profile_wall_owner_posts || id == R.id.profile_wall_all_posts || id == R.id.profile_wall_archived_posts) {
|
||||
StateListDrawable states = (StateListDrawable) ((LayerDrawable) view.getBackground()).getDrawable(0);
|
||||
LayerDrawable selected = (LayerDrawable) ((DrawableContainer.DrawableContainerState) states.getConstantState()).getChildren()[0];
|
||||
((ColorDrawable) selected.getDrawable(0)).setColor(ThemesUtils.getAccentColor());
|
||||
}
|
||||
}
|
||||
|
||||
public static void fixThemedFeed(TextView textView, int i) {
|
||||
if (i != R.layout.themed_feed_tab_2) {
|
||||
return;
|
||||
}
|
||||
textView.setTextColor(RecolorUtils.recolorCSL(textView.getTextColors()));
|
||||
((InsetDrawable) ((DrawableContainer.DrawableContainerState) textView.getBackground().getConstantState()).getChildren()[0]).getDrawable().setTint(ThemesUtils.lighten(ThemesUtils.getAccentColor(), 0.15f));
|
||||
}
|
||||
|
||||
public static void fixDropdown(Drawable drawable) {
|
||||
if (!ThemesUtils.isDarkTheme() && ThemesUtils.isMilkshake() && ThemesCore.isCachedAccents()) {
|
||||
StateListDrawable stateListDrawable = (StateListDrawable) drawable;
|
||||
((DrawableContainer.DrawableContainerState) stateListDrawable.getConstantState()).getChildren()[0].setTint(ThemesUtils.getAccentColor());
|
||||
((DrawableContainer.DrawableContainerState) stateListDrawable.getConstantState()).getChildren()[1].setTint(ThemesUtils.halfAlpha(ThemesUtils.getAccentColor()));
|
||||
}
|
||||
}
|
||||
|
||||
public static int getHackedColor(@NonNull Context context, @ColorRes int color) {
|
||||
if (ThemesCore.isCachedAccents() && ColorReferences.isAccentedColor(context.getResources().getColor(color))) {
|
||||
return ThemesUtils.getAccentColor();
|
||||
}
|
||||
|
||||
if (ThemesCore.isCachedAccents() && ColorReferences.isMutedAccentedColor(context.getResources().getColor(color))) {
|
||||
return ThemesUtils.getMutedAccentColor();
|
||||
}
|
||||
|
||||
return Build.VERSION.SDK_INT > 23 ? context.getColor(color) : context.getResources().getColor(color);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package ru.vtosters.lite.themes;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class VTLResources extends Resources {
|
||||
private static final String TAG = "VTLResources";
|
||||
private final Context context;
|
||||
private static Field typedArrayField;
|
||||
|
||||
private static final List<Integer> attributesToTheme = new ArrayList<>();
|
||||
|
||||
static {
|
||||
try {
|
||||
typedArrayField = TypedArray.class.getDeclaredField("mData");
|
||||
typedArrayField.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
attributesToTheme.add(16843041);
|
||||
attributesToTheme.add(android.R.attr.backgroundTint);
|
||||
attributesToTheme.add(16843173);
|
||||
}
|
||||
|
||||
public VTLResources(Context context, Resources parent) {
|
||||
super(parent.getAssets(), parent.getDisplayMetrics(), parent.getConfiguration());
|
||||
this.context = context;
|
||||
// Log.d(TAG, "VTLResources: init");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedArray obtainAttributes(AttributeSet set, int[] attrs) {
|
||||
var typedArray = super.obtainAttributes(set, attrs);
|
||||
var data = getArrayData(typedArray);
|
||||
for (int i = 0; i < attrs.length; i++) {
|
||||
try {
|
||||
int attrID = attrs[i];
|
||||
if (attributesToTheme.contains(attrID)) {
|
||||
int type = data[i*6];
|
||||
int cnt = data[(i*6)+1];
|
||||
|
||||
if (type == TypedValue.TYPE_ATTRIBUTE && isAttrThemeable(cnt)) {
|
||||
data[i*6] = TypedValue.TYPE_INT_COLOR_RGB8;
|
||||
data[(i*6)+1] = ThemesUtils.getAccentColor();
|
||||
data[(i*6)+2] = 0; // clear reference content
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "TAVzlom failed! (obtainAttributes)");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return typedArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getDrawable(int id, @Nullable Theme theme) throws NotFoundException {
|
||||
var drawable = super.getDrawable(id, theme);
|
||||
if (id == com.vtosters.lite.R.drawable.newsfeed_tab_dropdown_16) {
|
||||
ThemesHacks.fixDropdown(drawable);
|
||||
}
|
||||
return drawable;
|
||||
}
|
||||
|
||||
private static boolean isAttrThemeable(int attrID) {
|
||||
return !ThemesUtils.isDarkTheme() && attrID == com.vtosters.lite.R.attr.button_primary_background;
|
||||
}
|
||||
|
||||
private static int[] getArrayData(TypedArray arr) {
|
||||
try {
|
||||
return (int[]) typedArrayField.get(arr);
|
||||
} catch (IllegalAccessException e) {
|
||||
Log.e(TAG, "getArrayData: ", e);
|
||||
e.printStackTrace();
|
||||
return new int[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,18 @@ import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class RecolorUtils {
|
||||
public static Drawable recolorDrawableToolbar(Drawable drawable) {
|
||||
if (drawable == null) return null;
|
||||
|
||||
return new RecoloredDrawable(drawable, ThemesUtils.getHeaderText());
|
||||
} // Recolor toolbar drawable to accent color
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
public static Drawable recolorDrawableInt(int drawable) {
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables") Drawable res = AndroidUtils.getResources().getDrawable(drawable);
|
||||
return new RecoloredDrawable(res, ThemesUtils.getAccentColor());
|
||||
} // Get res drawable via id and coloring to accent
|
||||
|
||||
public static int recolorHexColor(int i){
|
||||
var accented = ColorReferences.isAccentedColor(i);
|
||||
@@ -19,6 +31,12 @@ public class RecolorUtils {
|
||||
return (accented || mutedaccented) ? (accented ? ThemesUtils.getAccentColor() : ThemesUtils.getMutedAccentColor()) : i;
|
||||
}
|
||||
|
||||
public static ColorStateList recolorCSL(ColorStateList colorStateList) {
|
||||
if (colorStateList == null) return null;
|
||||
|
||||
return ColorStateList.valueOf(ThemesUtils.getAccentColor());
|
||||
} // Recolor ColorStateList to accent color
|
||||
|
||||
@SuppressLint("UseCompatLoadingForColorStateLists")
|
||||
public static ColorStateList themeCSL(Context context, int color) {
|
||||
if (ColorReferences.isColorRefAccented(color)) {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
|
||||
requireActivity().runOnUiThread(() -> showErrorDialog("Ошибка при инвалидации кэша"));
|
||||
}
|
||||
});
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
var navBarPreference = findPreference("navbar");
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import com.vk.articles.preload.WebCachePreloader;
|
||||
import com.vk.core.drawable.RecoloredDrawable;
|
||||
@@ -21,9 +27,13 @@ import com.vk.core.ui.themes.VKTheme;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.data.ThemeTracker;
|
||||
import ru.vtosters.lite.deviceinfo.OEMDetector;
|
||||
import ru.vtosters.lite.hooks.VKUIHook;
|
||||
import ru.vtosters.lite.themes.ThemesHacks;
|
||||
import ru.vtosters.lite.ui.wallpapers.WallpapersHooks;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.*;
|
||||
import static ru.vtosters.lite.utils.Preferences.*;
|
||||
|
||||
@@ -40,6 +50,14 @@ public class ThemesUtils {
|
||||
return ColorStateList.valueOf(getAccentColor());
|
||||
}
|
||||
|
||||
public static int getSystemModeTheme() {
|
||||
return AppCompatDelegate.getDefaultNightMode();
|
||||
}
|
||||
|
||||
public static void setSystemModeTheme(int theme) {
|
||||
AppCompatDelegate.setDefaultNightMode(theme);
|
||||
}
|
||||
|
||||
public static void setTheme(VKTheme theme, Activity activity) {
|
||||
if (activity == null) {
|
||||
activity = LifecycleUtils.getCurrentActivity();
|
||||
@@ -51,6 +69,17 @@ public class ThemesUtils {
|
||||
WebCachePreloader.e();
|
||||
} // apply changed theme
|
||||
|
||||
public static void setThemeFL(VKTheme theme, Activity activity, float[] fl) {
|
||||
if (activity == null) {
|
||||
activity = LifecycleUtils.getCurrentActivity();
|
||||
}
|
||||
VKThemeHelper.theme(theme, activity, fl);
|
||||
ThemeTracker.a();
|
||||
VKUIHook.isLoaded = false;
|
||||
new WebView(activity).clearCache(true);
|
||||
WebCachePreloader.e();
|
||||
}
|
||||
|
||||
public static boolean isDarkTheme() {
|
||||
return VKThemeHelper.r();
|
||||
}
|
||||
@@ -64,17 +93,111 @@ public class ThemesUtils {
|
||||
}
|
||||
|
||||
public static int getAccentColor() {
|
||||
return getColorFromAttr(R.attr.accent);
|
||||
var accent = AndroidUtils.getPreferences().getInt("accent_color", getColorFromAttr(R.attr.accent));
|
||||
return (accent == 0 || !isMilkshake()) || isMonetTheme() ? getColorFromAttr(R.attr.accent) : accent;
|
||||
} // Color accent
|
||||
|
||||
public static int getMutedAccentColor() {
|
||||
return getMutedColor(getAccentColor());
|
||||
}
|
||||
|
||||
@SuppressLint("DiscouragedPrivateApi")
|
||||
public static void setCursorColor(EditText view) {
|
||||
try {
|
||||
view.setHighlightColor(ThemesUtils.getMutedAccentColor());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
view.getTextCursorDrawable().setColorFilter(new PorterDuffColorFilter(ThemesUtils.getAccentColor(), PorterDuff.Mode.SRC_IN));
|
||||
} else if (!OEMDetector.isMIUI()) {
|
||||
Field field = TextView.class.getDeclaredField("mCursorDrawableRes");
|
||||
field.setAccessible(true);
|
||||
int drawableResId = field.getInt(view);
|
||||
|
||||
field = TextView.class.getDeclaredField("mEditor");
|
||||
field.setAccessible(true);
|
||||
Object editor = field.get(view);
|
||||
|
||||
if (editor != null) {
|
||||
Drawable drawable = ContextCompat.getDrawable(view.getContext(), drawableResId);
|
||||
drawable.setColorFilter(getAccentColor(), PorterDuff.Mode.SRC_IN);
|
||||
Drawable[] drawables = {drawable, drawable};
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
field = editor.getClass().getDeclaredField("mCursorDrawable");
|
||||
} else {
|
||||
field = editor.getClass().getDeclaredField("mDrawableForCursor");
|
||||
}
|
||||
field.setAccessible(true);
|
||||
field.set(editor, drawables);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("ThemesUtils", "setCursorColor: ", e);
|
||||
}
|
||||
}
|
||||
@SuppressLint("DiscouragedPrivateApi")
|
||||
public static void colorHandles(TextView view) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
PorterDuffColorFilter filter = new PorterDuffColorFilter(ThemesUtils.getAccentColor(), PorterDuff.Mode.SRC_IN);
|
||||
view.getTextSelectHandle().setColorFilter(filter);
|
||||
view.getTextSelectHandleRight().setColorFilter(filter);
|
||||
view.getTextSelectHandleLeft().setColorFilter(filter);
|
||||
} else if (!OEMDetector.isMIUI()) {
|
||||
Field editorField = TextView.class.getDeclaredField("mEditor");
|
||||
|
||||
if (!editorField.isAccessible()) editorField.setAccessible(true);
|
||||
|
||||
Object editor = editorField.get(view);
|
||||
|
||||
if (editor != null) {
|
||||
Class<?> editorClass;
|
||||
|
||||
editorClass = editor.getClass();
|
||||
|
||||
String[] handleNames = {"mSelectHandleLeft", "mSelectHandleRight", "mSelectHandleCenter"};
|
||||
String[] resNames = {"mTextSelectHandleLeftRes", "mTextSelectHandleRightRes", "mTextSelectHandleRes"};
|
||||
|
||||
for (int i = 0; i < handleNames.length; i++) {
|
||||
Field handleField = editorClass.getDeclaredField(handleNames[i]);
|
||||
if (!handleField.isAccessible()) {
|
||||
handleField.setAccessible(true);
|
||||
}
|
||||
|
||||
Drawable handleDrawable = (Drawable) handleField.get(editor);
|
||||
|
||||
if (handleDrawable == null) {
|
||||
Field resField = TextView.class.getDeclaredField(resNames[i]);
|
||||
if (!resField.isAccessible()) {
|
||||
resField.setAccessible(true);
|
||||
}
|
||||
int resId = resField.getInt(view);
|
||||
handleDrawable = view.getResources().getDrawable(resId);
|
||||
}
|
||||
|
||||
if (handleDrawable != null) {
|
||||
Drawable drawable = handleDrawable.mutate();
|
||||
drawable.setColorFilter(getAccentColor(), PorterDuff.Mode.SRC_IN);
|
||||
handleField.set(editor, drawable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("ThemesUtils", "colorHandles: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getMutedColor(int color) {
|
||||
return ColorUtils.blendARGB(color, (isDarkTheme() ? Color.BLACK : Color.WHITE), (isMilkshake() ? 0.5f : isDarkTheme() ? 0.32f : 0.1f));
|
||||
}
|
||||
|
||||
public static void setCustomAccentColor(int newColor, boolean async) {
|
||||
var editor = AndroidUtils.edit().putInt("accent_color", newColor);
|
||||
if (async) editor.apply();
|
||||
else editor.commit();
|
||||
}
|
||||
|
||||
public static int getTextAttr() {
|
||||
return getColorFromAttr(R.attr.text_primary);
|
||||
} // Text Primary color
|
||||
@@ -181,6 +304,10 @@ public class ThemesUtils {
|
||||
tw.getBackground().setColorFilter(ThemesUtils.getAccentColor(), PorterDuff.Mode.SRC_OVER);
|
||||
}
|
||||
|
||||
public static void recolorBGView(View view) {
|
||||
view.getBackground().setColorFilter(ThemesUtils.getAccentColor(), PorterDuff.Mode.SRC_OVER);
|
||||
}
|
||||
|
||||
public static int darken(int color, float by) {
|
||||
float[] hsl = new float[3];
|
||||
ColorUtils.colorToHSL(color, hsl);
|
||||
@@ -208,8 +335,8 @@ public class ThemesUtils {
|
||||
return ColorUtils.setAlphaComponent(src, 169);
|
||||
}
|
||||
|
||||
public static int getColor(int color) {
|
||||
return Build.VERSION.SDK_INT > 23 ? getGlobalContext().getColor(color) : getGlobalContext().getResources().getColor(color);
|
||||
public static int getColor(int i) {
|
||||
return ThemesHacks.getHackedColor(getGlobalContext(), i);
|
||||
} // Android Support color injector + accent color checker
|
||||
|
||||
public static int getAlertStyle() {
|
||||
|
||||
@@ -5723,7 +5723,7 @@
|
||||
sget v5, Landroidx/appcompat/R$color;->abc_input_method_navigation_guard:I
|
||||
|
||||
.line 19
|
||||
invoke-virtual {v4, v5}, Landroid/content/res/Resources;->getColor(I)I
|
||||
invoke-static {v5}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result v4
|
||||
|
||||
|
||||
@@ -79,9 +79,7 @@
|
||||
.end annotation
|
||||
|
||||
.line 1
|
||||
iget-object v0, p0, Landroidx/appcompat/widget/ResourcesWrapper;->mResources:Landroid/content/res/Resources;
|
||||
|
||||
invoke-virtual {v0, p1}, Landroid/content/res/Resources;->getColor(I)I
|
||||
invoke-static {p1}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result p1
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@
|
||||
|
||||
sget v1, Landroidx/cardview/R$color;->cardview_light_background:I
|
||||
|
||||
invoke-virtual {p3, v1}, Landroid/content/res/Resources;->getColor(I)I
|
||||
invoke-static {v1}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result p3
|
||||
|
||||
@@ -249,7 +249,7 @@
|
||||
|
||||
sget v1, Landroidx/cardview/R$color;->cardview_dark_background:I
|
||||
|
||||
invoke-virtual {p3, v1}, Landroid/content/res/Resources;->getColor(I)I
|
||||
invoke-static {v1}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result p3
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
.line 5
|
||||
sget v1, Landroidx/cardview/R$color;->cardview_shadow_start_color:I
|
||||
|
||||
invoke-virtual {p1, v1}, Landroid/content/res/Resources;->getColor(I)I
|
||||
invoke-static {v1}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result v1
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
.line 6
|
||||
sget v1, Landroidx/cardview/R$color;->cardview_shadow_end_color:I
|
||||
|
||||
invoke-virtual {p1, v1}, Landroid/content/res/Resources;->getColor(I)I
|
||||
invoke-static {v1}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result v1
|
||||
|
||||
|
||||
@@ -245,6 +245,13 @@
|
||||
.annotation build Landroidx/annotation/ColorInt;
|
||||
.end annotation
|
||||
|
||||
# ru.vtosters.lite.themes.ThemesHacks.getHackedColor(Landroid/content/Context;I)I
|
||||
invoke-static {p0, p1}, Lru/vtosters/lite/themes/ThemesHacks;->getHackedColor(Landroid/content/Context;I)I
|
||||
|
||||
move-result v0
|
||||
|
||||
return v0
|
||||
|
||||
.line 1
|
||||
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
||||
|
||||
@@ -285,31 +292,37 @@
|
||||
.annotation build Landroidx/annotation/Nullable;
|
||||
.end annotation
|
||||
|
||||
.line 1
|
||||
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
||||
|
||||
const/16 v1, 0x17
|
||||
|
||||
if-lt v0, v1, :cond_0
|
||||
|
||||
.line 2
|
||||
invoke-virtual {p0, p1}, Landroid/content/Context;->getColorStateList(I)Landroid/content/res/ColorStateList;
|
||||
invoke-static {p0, p1}, Lru/vtosters/lite/themes/utils/RecolorUtils;->themeCSL(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
|
||||
|
||||
move-result-object p0
|
||||
|
||||
return-object p0
|
||||
|
||||
.line 3
|
||||
:cond_0
|
||||
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
||||
|
||||
move-result-object p0
|
||||
|
||||
invoke-virtual {p0, p1}, Landroid/content/res/Resources;->getColorStateList(I)Landroid/content/res/ColorStateList;
|
||||
|
||||
move-result-object p0
|
||||
|
||||
return-object p0
|
||||
# .line 1
|
||||
# sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
||||
#
|
||||
# const/16 v1, 0x17
|
||||
#
|
||||
# if-lt v0, v1, :cond_0
|
||||
#
|
||||
# .line 2
|
||||
# invoke-virtual {p0, p1}, Landroid/content/Context;->getColorStateList(I)Landroid/content/res/ColorStateList;
|
||||
#
|
||||
# move-result-object p0
|
||||
#
|
||||
# return-object p0
|
||||
#
|
||||
# .line 3
|
||||
# :cond_0
|
||||
# invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
||||
#
|
||||
# move-result-object p0
|
||||
#
|
||||
# invoke-virtual {p0, p1}, Landroid/content/res/Resources;->getColorStateList(I)Landroid/content/res/ColorStateList;
|
||||
#
|
||||
# move-result-object p0
|
||||
#
|
||||
# return-object p0
|
||||
.end method
|
||||
|
||||
.method public static getDataDir(Landroid/content/Context;)Ljava/io/File;
|
||||
|
||||
@@ -48,23 +48,7 @@
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.line 1
|
||||
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
||||
|
||||
const/16 v1, 0x17
|
||||
|
||||
if-lt v0, v1, :cond_0
|
||||
|
||||
.line 2
|
||||
invoke-virtual {p0, p1, p2}, Landroid/content/res/Resources;->getColor(ILandroid/content/res/Resources$Theme;)I
|
||||
|
||||
move-result p0
|
||||
|
||||
return p0
|
||||
|
||||
.line 3
|
||||
:cond_0
|
||||
invoke-virtual {p0, p1}, Landroid/content/res/Resources;->getColor(I)I
|
||||
invoke-static {p1}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result p0
|
||||
|
||||
|
||||
@@ -645,6 +645,10 @@
|
||||
.end annotation
|
||||
.end param
|
||||
|
||||
invoke-static {p1}, Lru/vtosters/lite/themes/utils/RecolorUtils;->themeCSL(Landroid/content/res/ColorStateList;)Landroid/content/res/ColorStateList;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
.line 1
|
||||
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
||||
|
||||
|
||||
@@ -3494,14 +3494,14 @@
|
||||
|
||||
const v1, 0x7f060018
|
||||
|
||||
invoke-static {p1, v1}, Landroidx/core/content/ContextCompat;->getColor(Landroid/content/Context;I)I
|
||||
invoke-static {v1}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result v2
|
||||
|
||||
const v3, 0x7f060105
|
||||
|
||||
.line 20
|
||||
invoke-static {p1, v3}, Landroidx/core/content/ContextCompat;->getColor(Landroid/content/Context;I)I
|
||||
invoke-static {v3}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result v4
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
.end annotation
|
||||
.end field
|
||||
|
||||
.field private resources:Landroid/content/res/Resources;
|
||||
|
||||
|
||||
# direct methods
|
||||
.method public constructor <init>(Landroid/content/Context;I)V
|
||||
@@ -150,4 +152,30 @@
|
||||
move-result-object p1
|
||||
|
||||
return-object p1
|
||||
.end method
|
||||
.end method
|
||||
|
||||
.method public getResources()Landroid/content/res/Resources;
|
||||
.registers 3
|
||||
|
||||
iget-object v0, p0, Lcom/vk/core/ui/themes/VKThemeHelper$b;->resources:Landroid/content/res/Resources;
|
||||
|
||||
if-eqz v0, :cond_7
|
||||
|
||||
iget-object v0, p0, Lcom/vk/core/ui/themes/VKThemeHelper$b;->resources:Landroid/content/res/Resources;
|
||||
|
||||
:goto_6
|
||||
return-object v0
|
||||
|
||||
:cond_7
|
||||
new-instance v0, Lru/vtosters/lite/themes/VTLResources;
|
||||
|
||||
invoke-static {}, Lru/vtosters/lite/utils/AndroidUtils;->getResources()Landroid/content/res/Resources;
|
||||
|
||||
move-result-object v1
|
||||
|
||||
invoke-direct {v0, p0, v1}, Lru/vtosters/lite/themes/VTLResources;-><init>(Landroid/content/Context;Landroid/content/res/Resources;)V
|
||||
|
||||
iput-object v0, p0, Lcom/vk/core/ui/themes/VKThemeHelper$b;->resources:Landroid/content/res/Resources;
|
||||
|
||||
goto :goto_6
|
||||
.end method
|
||||
|
||||
@@ -920,6 +920,19 @@
|
||||
.end annotation
|
||||
.end param
|
||||
|
||||
invoke-static {p0, p1}, Lru/vtosters/lite/themes/ThemesCore;->hasThemedAttr(Landroid/content/Context;I)Z
|
||||
|
||||
move-result v1
|
||||
|
||||
if-eqz v1, :cond_b
|
||||
|
||||
invoke-static {p0, p1}, Lru/vtosters/lite/themes/ThemesCore;->getThemedAttr(Landroid/content/Context;I)I
|
||||
|
||||
move-result v1
|
||||
|
||||
return v1
|
||||
:cond_b
|
||||
|
||||
.line 1
|
||||
invoke-virtual {p0}, Landroid/content/Context;->getTheme()Landroid/content/res/Resources$Theme;
|
||||
|
||||
|
||||
@@ -61,13 +61,9 @@
|
||||
.line 2
|
||||
sget-object v0, Lcom/vk/core/util/AppContextHolder;->a:Landroid/content/Context;
|
||||
|
||||
invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
sget v1, Lb/h/z/c;->light_blue:I
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getColor(I)I
|
||||
invoke-static {v1}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result v0
|
||||
|
||||
|
||||
@@ -27,11 +27,7 @@
|
||||
.line 2
|
||||
sget v0, Lcom/vk/mentions/p;->light_blue:I
|
||||
|
||||
invoke-virtual/range {p1 .. p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
invoke-virtual {p1, v0}, Landroid/content/res/Resources;->getColor(I)I
|
||||
invoke-static {v0}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result p1
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
const v0, 0x7f0600f7
|
||||
|
||||
invoke-virtual {p3, v0}, Landroid/content/res/Resources;->getColor(I)I
|
||||
invoke-static {v0}, Lru/vtosters/lite/utils/ThemesUtils;->getColor(I)I
|
||||
|
||||
move-result p3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user