From 9ab58c2f0cfef1678ef2b84eeefbb22241ff0619 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Fri, 14 May 2021 16:05:35 +1000 Subject: [PATCH] Clean --- .../utilities/color/MaterialColor.java | 7 +- .../utilities/color/MaterialColors.java | 70 ------------------- .../spans/CenterAlignedRelativeSizeSpan.java | 2 - 3 files changed, 3 insertions(+), 76 deletions(-) delete mode 100644 libsession/src/main/java/org/session/libsession/utilities/color/MaterialColors.java diff --git a/libsession/src/main/java/org/session/libsession/utilities/color/MaterialColor.java b/libsession/src/main/java/org/session/libsession/utilities/color/MaterialColor.java index f68c016f0e..31e99f6632 100644 --- a/libsession/src/main/java/org/session/libsession/utilities/color/MaterialColor.java +++ b/libsession/src/main/java/org/session/libsession/utilities/color/MaterialColor.java @@ -58,7 +58,6 @@ public enum MaterialColor { private final String serialized; - MaterialColor(@ColorRes int mainColor, @ColorRes int tintColor, @ColorRes int shadeColor, String serialized) { this.mainColor = mainColor; this.tintColor = tintColor; @@ -110,9 +109,9 @@ public enum MaterialColor { } public boolean represents(Context context, int colorValue) { - return context.getResources().getColor(mainColor) == colorValue || - context.getResources().getColor(tintColor) == colorValue || - context.getResources().getColor(shadeColor) == colorValue; + return context.getResources().getColor(mainColor) == colorValue + || context.getResources().getColor(tintColor) == colorValue + || context.getResources().getColor(shadeColor) == colorValue; } public String serialize() { diff --git a/libsession/src/main/java/org/session/libsession/utilities/color/MaterialColors.java b/libsession/src/main/java/org/session/libsession/utilities/color/MaterialColors.java deleted file mode 100644 index 4f6b936db1..0000000000 --- a/libsession/src/main/java/org/session/libsession/utilities/color/MaterialColors.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.session.libsession.utilities.color; - -import android.content.Context; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class MaterialColors { - - public static final MaterialColorList CONVERSATION_PALETTE = new MaterialColorList(new ArrayList<>(Arrays.asList( - MaterialColor.PLUM, - MaterialColor.CRIMSON, - MaterialColor.VERMILLION, - MaterialColor.VIOLET, - MaterialColor.BLUE, - MaterialColor.INDIGO, - MaterialColor.FOREST, - MaterialColor.WINTERGREEN, - MaterialColor.TEAL, - MaterialColor.BURLAP, - MaterialColor.TAUPE, - MaterialColor.STEEL - ))); - - public static class MaterialColorList { - - private final List colors; - - private MaterialColorList(List colors) { - this.colors = colors; - } - - public MaterialColor get(int index) { - return colors.get(index); - } - - public int size() { - return colors.size(); - } - - public @Nullable MaterialColor getByColor(Context context, int colorValue) { - for (MaterialColor color : colors) { - if (color.represents(context, colorValue)) { - return color; - } - } - - return null; - } - - public int[] asConversationColorArray(@NonNull Context context) { - int[] results = new int[colors.size()]; - int index = 0; - - for (MaterialColor color : colors) { - results[index++] = color.toConversationColor(context); - } - - return results; - } - - } - - -} - diff --git a/libsession/src/main/java/org/session/libsession/utilities/color/spans/CenterAlignedRelativeSizeSpan.java b/libsession/src/main/java/org/session/libsession/utilities/color/spans/CenterAlignedRelativeSizeSpan.java index cfbb66dd93..9fca16c3c7 100644 --- a/libsession/src/main/java/org/session/libsession/utilities/color/spans/CenterAlignedRelativeSizeSpan.java +++ b/libsession/src/main/java/org/session/libsession/utilities/color/spans/CenterAlignedRelativeSizeSpan.java @@ -1,12 +1,10 @@ package org.session.libsession.utilities.color.spans; - import androidx.annotation.NonNull; import android.text.TextPaint; import android.text.style.MetricAffectingSpan; public class CenterAlignedRelativeSizeSpan extends MetricAffectingSpan { - private final float relativeSize; public CenterAlignedRelativeSizeSpan(float relativeSize) {