mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 18:52:45 +01:00
Adjust colors of grades in dark theme (#143)
This commit is contained in:
parent
b8a31c3faf
commit
083765b020
@ -49,29 +49,29 @@ public final class GradeUtils {
|
|||||||
public static int getValueColor(String value) {
|
public static int getValueColor(String value) {
|
||||||
Matcher m1 = validGradePattern.matcher(value);
|
Matcher m1 = validGradePattern.matcher(value);
|
||||||
if (!m1.find()) {
|
if (!m1.find()) {
|
||||||
return R.color.default_grade;
|
return R.color.grade_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matcher m2 = simpleGradeValuePattern.matcher(m1.group());
|
Matcher m2 = simpleGradeValuePattern.matcher(m1.group());
|
||||||
if (!m2.find()) {
|
if (!m2.find()) {
|
||||||
return R.color.default_grade;
|
return R.color.grade_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Integer.parseInt(m2.group())) {
|
switch (Integer.parseInt(m2.group())) {
|
||||||
case 6:
|
case 6:
|
||||||
return R.color.six_grade;
|
return R.color.grade_six;
|
||||||
case 5:
|
case 5:
|
||||||
return R.color.five_grade;
|
return R.color.grade_five;
|
||||||
case 4:
|
case 4:
|
||||||
return R.color.four_grade;
|
return R.color.grade_four;
|
||||||
case 3:
|
case 3:
|
||||||
return R.color.three_grade;
|
return R.color.grade_three;
|
||||||
case 2:
|
case 2:
|
||||||
return R.color.two_grade;
|
return R.color.grade_two;
|
||||||
case 1:
|
case 1:
|
||||||
return R.color.one_grade;
|
return R.color.grade_one;
|
||||||
default:
|
default:
|
||||||
return R.color.default_grade;
|
return R.color.grade_default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/app_name"
|
android:text="@string/app_name"
|
||||||
|
android:textColor="@color/grade_text"
|
||||||
|
android:background="@color/grade_default"
|
||||||
android:textSize="30sp" />
|
android:textSize="30sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLength="5"
|
android:maxLength="5"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="@color/grade_text"
|
||||||
|
android:background="@color/grade_default"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -4,13 +4,15 @@
|
|||||||
<color name="colorPrimaryDark">#9a0007</color>
|
<color name="colorPrimaryDark">#9a0007</color>
|
||||||
<color name="colorPrimaryLight">#ff6659</color>
|
<color name="colorPrimaryLight">#ff6659</color>
|
||||||
<color name="colorBackgroundBottomNav">#f0f0f0</color>
|
<color name="colorBackgroundBottomNav">#f0f0f0</color>
|
||||||
<color name="six_grade">#92b53d</color>
|
|
||||||
<color name="five_grade">#66B266</color>
|
<color name="grade_text">#ffffff</color>
|
||||||
<color name="four_grade">#55BBDB</color>
|
<color name="grade_six">#91b43c</color>
|
||||||
<color name="three_grade">#FFE68C</color>
|
<color name="grade_five">#2cbd92</color>
|
||||||
<color name="two_grade">#CE9AD2</color>
|
<color name="grade_four">#50b6d6</color>
|
||||||
<color name="one_grade">#d32f2f</color>
|
<color name="grade_three">#d2ab24</color>
|
||||||
<color name="default_grade">#cdcdcd</color>
|
<color name="grade_two">#9071b3</color>
|
||||||
|
<color name="grade_one">#d65757</color>
|
||||||
|
<color name="grade_default">#3d5f9c</color>
|
||||||
|
|
||||||
<color name="secondary_text">#4c4c4c</color>
|
<color name="secondary_text">#4c4c4c</color>
|
||||||
<color name="second_text_color">#333</color>
|
<color name="second_text_color">#333</color>
|
||||||
|
@ -62,18 +62,18 @@ public class GradeUtilsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getValueColorTest() {
|
public void getValueColorTest() {
|
||||||
assertEquals(R.color.six_grade, GradeUtils.getValueColor("-6"));
|
assertEquals(R.color.grade_six, GradeUtils.getValueColor("-6"));
|
||||||
assertEquals(R.color.five_grade, GradeUtils.getValueColor("--5"));
|
assertEquals(R.color.grade_five, GradeUtils.getValueColor("--5"));
|
||||||
assertEquals(R.color.four_grade, GradeUtils.getValueColor("=4"));
|
assertEquals(R.color.grade_four, GradeUtils.getValueColor("=4"));
|
||||||
assertEquals(R.color.three_grade, GradeUtils.getValueColor("3-"));
|
assertEquals(R.color.grade_three, GradeUtils.getValueColor("3-"));
|
||||||
assertEquals(R.color.two_grade, GradeUtils.getValueColor("2--"));
|
assertEquals(R.color.grade_two, GradeUtils.getValueColor("2--"));
|
||||||
assertEquals(R.color.two_grade, GradeUtils.getValueColor("2="));
|
assertEquals(R.color.grade_two, GradeUtils.getValueColor("2="));
|
||||||
assertEquals(R.color.one_grade, GradeUtils.getValueColor("1+"));
|
assertEquals(R.color.grade_one, GradeUtils.getValueColor("1+"));
|
||||||
assertEquals(R.color.one_grade, GradeUtils.getValueColor("+1"));
|
assertEquals(R.color.grade_one, GradeUtils.getValueColor("+1"));
|
||||||
assertEquals(R.color.default_grade, GradeUtils.getValueColor("6 (.XI)"));
|
assertEquals(R.color.grade_default, GradeUtils.getValueColor("6 (.XI)"));
|
||||||
assertEquals(R.color.default_grade, GradeUtils.getValueColor("Np"));
|
assertEquals(R.color.grade_default, GradeUtils.getValueColor("Np"));
|
||||||
assertEquals(R.color.default_grade, GradeUtils.getValueColor("7"));
|
assertEquals(R.color.grade_default, GradeUtils.getValueColor("7"));
|
||||||
assertEquals(R.color.default_grade, GradeUtils.getValueColor(""));
|
assertEquals(R.color.grade_default, GradeUtils.getValueColor(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user