added recolor to accent methods
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package ru.vtosters.lite.themes;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
@@ -28,7 +31,6 @@ public class Recolor {
|
||||
private static final List<IModifier> recolors = new ArrayList<>();
|
||||
|
||||
static {
|
||||
com.vtosters.lite.R.id
|
||||
recolors.add(new FloatingActionButtonRecolor());
|
||||
recolors.add(new ImageViewRecolor());
|
||||
recolors.add(new ProgressBarRecolor());
|
||||
@@ -52,8 +54,6 @@ public class Recolor {
|
||||
}
|
||||
|
||||
private static void recolorView(View target, ViewModel viewModel) {
|
||||
if (target instanceof Toolbar && target.getId() == com.vtosters.lite.R.id.toolbar)
|
||||
((Toolbar) target).setBackgroundColor(Color.RED);
|
||||
for (var recolor : recolors) {
|
||||
if (!recolor.isModifiable(target)) continue;
|
||||
for (var attr : viewModel.attrs) {
|
||||
@@ -73,4 +73,13 @@ public class Recolor {
|
||||
if (ThemesUtils.isCustomThemeApplied())
|
||||
toolbar.setBackgroundColor(ThemesUtils.getHeaderBackground());
|
||||
}
|
||||
|
||||
public static void recolorIconToAccent(ImageView iv) {
|
||||
if (ThemesUtils.isCustomThemeApplied())
|
||||
iv.setImageTintList(ColorStateList.valueOf(VTLColors.getAccentColor()));
|
||||
}
|
||||
|
||||
public static void recolorTextToAccent(TextView iv) {
|
||||
iv.setTextColor(VTLColors.getAccentColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import static ru.vtosters.lite.utils.ThemesUtils.isCustomThemeApplied;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.isDarkTheme;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.core.util.ContextExtKt;
|
||||
@@ -13,6 +14,8 @@ import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.themes.managers.ThemesManager;
|
||||
import ru.vtosters.lite.themes.models.ThemeModel;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class VTLColors {
|
||||
private static final ThemesManager themesManager = ThemesManager.getInstance();
|
||||
@@ -72,12 +75,20 @@ public class VTLColors {
|
||||
|
||||
public static int getColor(int attr) {
|
||||
if (isCustomThemeApplied()) {
|
||||
return currentTheme.getColor(attr);
|
||||
int color = currentTheme.getColor(attr);
|
||||
if (color != -1)
|
||||
return color;
|
||||
}
|
||||
return VKThemeHelper.d(attr);
|
||||
}
|
||||
|
||||
public static int getColor(Context context, int colorId) {
|
||||
Log.d("VTLColors", String.format("getColor(Landroid/content/Context;I): %s", AndroidUtils.getResources().getResourceEntryName(colorId)));
|
||||
if (ThemesUtils.isCustomThemeApplied()) {
|
||||
int color = currentTheme.getColor(colorId);
|
||||
if (color != -1)
|
||||
return color;
|
||||
}
|
||||
return ContextExtKt.h(context, colorId);
|
||||
}
|
||||
//endregion
|
||||
|
||||
@@ -984,6 +984,8 @@
|
||||
|
||||
iput-object p2, p0, Lcom/vk/catalog2/core/holders/friends/FriendsItemListVh;->f:Landroid/widget/ImageView;
|
||||
|
||||
invoke-static/range {p2 .. p2}, Lru/vtosters/lite/themes/Recolor;->recolorIconToAccent(Landroid/widget/ImageView;)V
|
||||
|
||||
.line 11
|
||||
sget p2, Lcom/vk/catalog2/core/q;->close_button:I
|
||||
|
||||
|
||||
Reference in New Issue
Block a user