This commit is contained in:
Niels Andriesse 2021-05-14 16:05:35 +10:00
parent 92acb50ea7
commit 9ab58c2f0c
3 changed files with 3 additions and 76 deletions

View File

@ -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() {

View File

@ -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<MaterialColor> colors;
private MaterialColorList(List<MaterialColor> 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;
}
}
}

View File

@ -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) {