remove junk code
This commit is contained in:
@@ -12,46 +12,21 @@ import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.core.util.ContextExtKt;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import ru.vtosters.lite.res.colors.AccentColors;
|
||||
import ru.vtosters.lite.res.colors.BackgroundColors;
|
||||
import ru.vtosters.lite.res.colors.BarColors;
|
||||
import ru.vtosters.lite.res.colors.ConventionColors;
|
||||
import ru.vtosters.lite.res.colors.IColor;
|
||||
import ru.vtosters.lite.res.colors.ModalConversationColors;
|
||||
|
||||
public class VTLColors {
|
||||
|
||||
public static final List<IColor> colors = Arrays.asList(
|
||||
new AccentColors(), new BackgroundColors(),
|
||||
new BarColors(), new ConventionColors(),
|
||||
new ModalConversationColors()
|
||||
);
|
||||
|
||||
public static int getAccentColor() {
|
||||
return isCustomThemeApplied()
|
||||
? getColor(R.attr.accent, R.attr.accentColor, R.attr.colorAccent, R.attr.vk_accent)
|
||||
: getColorFromAttr(R.attr.accent);
|
||||
return getColor(R.attr.accent, R.attr.accentColor, R.attr.colorAccent, R.attr.vk_accent);
|
||||
}
|
||||
|
||||
public static int getTextPrimaryColor() {
|
||||
return isCustomThemeApplied()
|
||||
? getColor(R.attr.text_primary)
|
||||
: getColorFromAttr(R.attr.text_primary);
|
||||
return getColor(R.attr.text_primary);
|
||||
}
|
||||
|
||||
public static int getTextSecondaryColor() {
|
||||
return isCustomThemeApplied()
|
||||
? getColor(R.attr.text_secondary)
|
||||
: getColorFromAttr(R.attr.text_secondary);
|
||||
return getColor(R.attr.text_secondary);
|
||||
}
|
||||
|
||||
public static int getTabbarBackground() {
|
||||
return isCustomThemeApplied()
|
||||
? getColor(R.attr.tabbar_background)
|
||||
: getColorFromAttr(R.attr.tabbar_background);
|
||||
return getColor(R.attr.tabbar_background);
|
||||
}
|
||||
|
||||
public static int getTabbarActiveColor() {
|
||||
@@ -94,30 +69,11 @@ public class VTLColors {
|
||||
|
||||
//region Hooks
|
||||
|
||||
public static boolean hasColor(int attr) {
|
||||
for (var color : colors) {
|
||||
if (color.has(attr))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getColor(int... attrs) {
|
||||
for (var color : colors) {
|
||||
for (var attr : attrs) {
|
||||
if (color.has(attr))
|
||||
return color.get(attr);
|
||||
}
|
||||
}
|
||||
return getColorFromAttr(attrs[0]);
|
||||
}
|
||||
|
||||
public static int getColor(int attr) {
|
||||
// for (var color : colors) {
|
||||
// if (color.has(attr))
|
||||
// return color.get(attr);
|
||||
// }
|
||||
// return getColorFromAttr(attr);
|
||||
return VKThemeHelper.d(attr);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package ru.vtosters.lite.res.colors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
public class AccentColors implements IColor {
|
||||
|
||||
public static final List<Integer> attrs = Arrays.asList(
|
||||
R.attr.accent,
|
||||
R.attr.colorAccent,
|
||||
R.attr.counter_primary_background,
|
||||
R.attr.header_tab_active_indicator,
|
||||
R.attr.header_tint,
|
||||
R.attr.im_attach_tint,
|
||||
R.attr.im_dropdown_icon_color,
|
||||
R.attr.im_text_name,
|
||||
R.attr.link_alternate,
|
||||
R.attr.text_link,
|
||||
R.attr.vkim_colorPrimary
|
||||
);
|
||||
|
||||
@Override
|
||||
public boolean has(int attr) {
|
||||
return attrs.contains(attr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int get(int attr) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package ru.vtosters.lite.res.colors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
public class BackgroundColors implements IColor {
|
||||
|
||||
public static final List<Integer> attrs = Arrays.asList(
|
||||
R.attr.background_content,
|
||||
R.attr.background_page,
|
||||
R.attr.background_light,
|
||||
R.attr.background_suggestions,
|
||||
R.attr.boxBackgroundColor,
|
||||
R.attr.colorPrimaryDark,
|
||||
R.attr.content_tint_background,
|
||||
R.attr.control_background,
|
||||
R.attr.im_history_banner_bg_color,
|
||||
R.attr.im_history_banner_bg_color,
|
||||
R.attr.im_toolbar_voice_msg_background,
|
||||
R.attr.input_background,
|
||||
R.attr.posting_input_background,
|
||||
R.attr.vk_landing_background,
|
||||
R.attr.input_border,
|
||||
R.attr.vk_background_content,
|
||||
R.attr.landing_background
|
||||
);
|
||||
|
||||
@Override
|
||||
public boolean has(int attr) {
|
||||
return attrs.contains(attr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int get(int attr) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package ru.vtosters.lite.res.colors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
public class BarColors implements IColor {
|
||||
|
||||
public static final List<Integer> attrs = Arrays.asList(
|
||||
R.attr.header_alternate_background,
|
||||
R.attr.header_background,
|
||||
R.attr.search_bar_background,
|
||||
R.attr.statusBarColorBack,
|
||||
R.attr.statusBarColorFront,
|
||||
R.attr.statusbar_alternate_legacy_background,
|
||||
R.attr.tabbar_background,
|
||||
R.attr.tabbar_tablet_background,
|
||||
R.attr.toolbar_attach_background_from,
|
||||
R.attr.toolbar_attach_background_to
|
||||
);
|
||||
|
||||
@Override
|
||||
public boolean has(int attr) {
|
||||
return attrs.contains(attr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int get(int attr) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package ru.vtosters.lite.res.colors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
public class ConventionColors implements IColor {
|
||||
|
||||
public static final List<Integer> attrs = Arrays.asList(
|
||||
R.attr.im_bg_chat,
|
||||
R.attr.im_bubble_incoming,
|
||||
R.attr.im_bubble_outgoing,
|
||||
R.attr.im_bubble_wallpaper_incoming,
|
||||
R.attr.im_bubble_wallpaper_outgoing
|
||||
);
|
||||
|
||||
@Override
|
||||
public boolean has(int attr) {
|
||||
return attrs.contains(attr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int get(int attr) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package ru.vtosters.lite.res.colors;
|
||||
|
||||
public interface IColor {
|
||||
|
||||
boolean has(int attr);
|
||||
|
||||
// need call has function before calling
|
||||
int get(int attr);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package ru.vtosters.lite.res.colors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
public class ModalConversationColors implements IColor {
|
||||
|
||||
public static final List<Integer> attrs = Arrays.asList(
|
||||
R.attr.modal_card_background,
|
||||
R.attr.header_background
|
||||
);
|
||||
|
||||
@Override
|
||||
public boolean has(int attr) {
|
||||
return attrs.contains(attr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int get(int attr) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user