fix 2
This commit is contained in:
@@ -36,8 +36,6 @@ public class Recolor {
|
||||
recolors.add(new TintTextViewRecolor());
|
||||
recolors.add(new ToolbarRecolor());
|
||||
recolors.add(new ViewRecolor());
|
||||
|
||||
// attrs.add(new AccentAttrs());
|
||||
}
|
||||
|
||||
public static void recolorViewOrViewGroup(View target, SparseArray<ViewModel> satts) {
|
||||
|
||||
@@ -51,23 +51,23 @@ public class VTLResources {
|
||||
var data = getData(target);
|
||||
for (int i = 0; i < attrs.length; i++) {
|
||||
//var attr = attrs[i];
|
||||
var index = STYLE_NUM_ENTRIES * i;
|
||||
var type = data[index];
|
||||
var replacement = data[index + 0x1];
|
||||
var off = STYLE_NUM_ENTRIES * i;
|
||||
var type = data[off];
|
||||
var replacement = -1;
|
||||
if (type == TypedValue.TYPE_ATTRIBUTE) {
|
||||
replacement = theme.getColor(data[index + 0x1]);
|
||||
if (replacement == -1) continue;
|
||||
replacement = theme.getColor(data[off + 0x1]);
|
||||
} else if (type == TypedValue.TYPE_INT_COLOR_ARGB8 || type == TypedValue.TYPE_INT_COLOR_RGB8) {
|
||||
replacement = forcedAttrs.get(data[index + 0x1], -1);
|
||||
if (replacement == -1) continue;
|
||||
replacement = forcedAttrs.get(data[off + 0x1], -1);
|
||||
if (replacement == -1
|
||||
&& ThemesUtils.accentColors.contains(Integer.toHexString(data[off + 0x1]).toLowerCase()))
|
||||
replacement = ThemesUtils.getAccentColor();
|
||||
}
|
||||
else
|
||||
continue;
|
||||
if (replacement == -1) continue;
|
||||
try {
|
||||
data[index] = TypedValue.TYPE_INT_COLOR_RGB8; // type
|
||||
data[index + 0x1] = replacement; // data
|
||||
data[index + 0x2] = 0x0; // asset cookie
|
||||
data[index + 0x3] = 0x0; // resource id
|
||||
data[off] = TypedValue.TYPE_INT_COLOR_RGB8; // type
|
||||
data[off + 0x1] = replacement; // data
|
||||
data[off + 0x2] = 0x0; // asset cookie
|
||||
data[off + 0x3] = 0x0; // resource id
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ru.vtosters.lite.themes.modifiers;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
@@ -20,6 +21,7 @@ public class ImageViewRecolor implements IModifier<View> {
|
||||
switch (attr) {
|
||||
case tint:
|
||||
case androidTint:
|
||||
Log.d("ImageViewRecolor", "setColor");
|
||||
iv.setImageTintList(ColorStateList.valueOf(color));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ public class ToolbarRecolor implements IModifier<View> {
|
||||
public static final int subtitleTextColor = R.attr.subtitleTextColor;
|
||||
public static final int titleTextColor = R.attr.titleTextColor;
|
||||
public static final int textColorPrimary = android.R.attr.textColorPrimary;
|
||||
public static final int background = android.R.attr.background;
|
||||
|
||||
@Override
|
||||
public boolean isModifiable(View target) {
|
||||
|
||||
@@ -2,12 +2,18 @@ package ru.vtosters.lite.themes.proxy;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -38,12 +44,16 @@ public class ProxyResources extends Resources {
|
||||
@NonNull
|
||||
@Override
|
||||
public ColorStateList getColorStateList(int id, @Nullable Resources.Theme theme) throws Resources.NotFoundException {
|
||||
return mOriginalResource.getColorStateList(id, theme);
|
||||
Log.d("getColorStateList", getResourceEntryName(id));
|
||||
return ColorStateList.valueOf(Color.RED);//mOriginalResource.getColorStateList(id, theme);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Drawable getDrawableForDensity(int id, int density, @Nullable Resources.Theme theme) {
|
||||
if (ThemesUtils.isCustomThemeApplied()) {
|
||||
|
||||
}
|
||||
return mOriginalResource.getDrawableForDensity(id, density, theme);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user