Use different colors for YES_AUTO and NO; increase contrast slightly

pull/849/head
Alinson S. Xavier 5 years ago
parent a95da72e19
commit ee462715de

Binary file not shown.

Before

Width:  |  Height:  |  Size: 623 B

After

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

@ -41,8 +41,6 @@ class NumberPanelViewTest : BaseViewTest() {
@Before
override fun setUp() {
super.setUp()
prefs.isCheckmarkSequenceReversed = false
val checkmarks = doubleArrayOf(
1400.0,
5300.0,
@ -68,11 +66,10 @@ class NumberPanelViewTest : BaseViewTest() {
view.onDetachedFromWindow()
}
// Flaky
// @Test
// fun testRender() {
// assertRenders(view, "$PATH/render.png")
// }
@Test
fun testRender() {
assertRenders(view, "$PATH/render.png")
}
@Test
fun testEdit() {

@ -255,8 +255,8 @@ class FrequencyChart : ScrollableChart {
private fun initColors() {
val res = StyledResources(context)
textColor = res.getColor(R.attr.mediumContrastTextColor)
gridColor = res.getColor(R.attr.lowContrastTextColor)
textColor = res.getColor(R.attr.contrast60)
gridColor = res.getColor(R.attr.contrast20)
colors = IntArray(4)
colors[0] = gridColor
colors[3] = primaryColor

@ -187,7 +187,7 @@ class RingView : View {
pRing!!.textAlign = Paint.Align.CENTER
val res = StyledResources(context)
if (backgroundColor == null) backgroundColor = res.getColor(R.attr.cardBgColor)
if (inactiveColor == null) inactiveColor = res.getColor(R.attr.highContrastTextColor)
if (inactiveColor == null) inactiveColor = res.getColor(R.attr.contrast100)
inactiveColor = setAlpha(inactiveColor!!, 0.1f)
rect = RectF()
}

@ -334,8 +334,8 @@ class ScoreChart : ScrollableChart {
private fun initColors() {
val res = StyledResources(context)
primaryColor = Color.BLACK
textColor = res.getColor(R.attr.mediumContrastTextColor)
gridColor = res.getColor(R.attr.lowContrastTextColor)
textColor = res.getColor(R.attr.contrast60)
gridColor = res.getColor(R.attr.contrast20)
internalBackgroundColor = res.getColor(R.attr.cardBgColor)
}

@ -207,11 +207,11 @@ class StreakChart : View {
colors[3] = primaryColor
colors[2] = Color.argb(192, red, green, blue)
colors[1] = Color.argb(96, red, green, blue)
colors[0] = res.getColor(R.attr.lowContrastTextColor)
colors[0] = res.getColor(R.attr.contrast20)
textColors = IntArray(3)
textColors[2] = res.getColor(R.attr.highContrastReverseTextColor)
textColors[1] = res.getColor(R.attr.mediumContrastTextColor)
textColors[0] = res.getColor(R.attr.lowContrastReverseTextColor)
textColors[2] = res.getColor(R.attr.contrast0)
textColors[1] = res.getColor(R.attr.contrast60)
textColors[0] = res.getColor(R.attr.contrast80)
}
private fun initPaints() {

@ -165,9 +165,9 @@ class TargetChart : View {
paint!!.textAlign = Paint.Align.CENTER
paint!!.isAntiAlias = true
val res = StyledResources(context)
lowContrastTextColor = res.getColor(R.attr.lowContrastTextColor)
mediumContrastTextColor = res.getColor(R.attr.mediumContrastTextColor)
highContrastReverseTextColor = res.getColor(R.attr.highContrastReverseTextColor)
lowContrastTextColor = res.getColor(R.attr.contrast20)
mediumContrastTextColor = res.getColor(R.attr.contrast60)
highContrastReverseTextColor = res.getColor(R.attr.contrast0)
tinyTextSize = getDimension(context, R.dimen.tinyTextSize)
}

@ -33,6 +33,7 @@ import org.isoron.uhabits.core.models.Entry
import org.isoron.uhabits.core.models.Entry.Companion.NO
import org.isoron.uhabits.core.models.Entry.Companion.SKIP
import org.isoron.uhabits.core.models.Entry.Companion.UNKNOWN
import org.isoron.uhabits.core.models.Entry.Companion.YES_AUTO
import org.isoron.uhabits.core.models.Entry.Companion.YES_MANUAL
import org.isoron.uhabits.core.preferences.Preferences
import org.isoron.uhabits.inject.ActivityContext
@ -116,7 +117,8 @@ class CheckmarkButtonView(
private inner class Drawer {
private val rect = RectF()
private val lowContrastColor = sres.getColor(R.attr.lowContrastTextColor)
private val lowContrastColor = sres.getColor(R.attr.contrast40)
private val mediumContrastColor = sres.getColor(R.attr.contrast60)
private val paint = TextPaint().apply {
typeface = getFontAwesome()
@ -128,7 +130,12 @@ class CheckmarkButtonView(
fun draw(canvas: Canvas) {
paint.color = when (value) {
YES_MANUAL -> color
YES_AUTO -> mediumContrastColor
SKIP -> color
NO -> {
if (preferences.areQuestionMarksEnabled()) mediumContrastColor
else lowContrastColor
}
else -> lowContrastColor
}
val id = when (value) {

@ -47,7 +47,7 @@ class EmptyListView(context: Context) : LinearLayout(context) {
typeface = getFontAwesome()
textSize = sp(40.0f)
gravity = CENTER
setTextColor(sres.getColor(R.attr.mediumContrastTextColor))
setTextColor(sres.getColor(R.attr.contrast60))
}
addView(
@ -60,7 +60,7 @@ class EmptyListView(context: Context) : LinearLayout(context) {
text = str(R.string.no_habits_found)
gravity = CENTER
setPadding(0, dp(20.0f).toInt(), 0, 0)
setTextColor(sres.getColor(R.attr.mediumContrastTextColor))
setTextColor(sres.getColor(R.attr.contrast60))
}
addView(
textTextView,

@ -212,7 +212,7 @@ class HabitCardView(
fun getActiveColor(habit: Habit): Int {
return when (habit.isArchived) {
true -> sres.getColor(R.attr.mediumContrastTextColor)
true -> sres.getColor(R.attr.contrast60)
false -> habit.color.toThemedAndroidColor(context)
}
}

@ -108,7 +108,7 @@ class HeaderView(
textSize = dim(R.dimen.tinyTextSize)
textAlign = Paint.Align.CENTER
typeface = Typeface.DEFAULT_BOLD
color = sres.getColor(R.attr.mediumContrastTextColor)
color = sres.getColor(R.attr.contrast60)
}
fun draw(canvas: Canvas) {

@ -128,8 +128,8 @@ class NumberButtonView(
private val rect: RectF = RectF()
private val sr = StyledResources(context)
private val lightGrey: Int
private val darkGrey: Int
private val lowContrast: Int
private val mediumContrast: Int
private val pRegular: TextPaint = TextPaint().apply {
textSize = getDimension(context, R.dimen.smallerTextSize)
@ -147,14 +147,14 @@ class NumberButtonView(
init {
em = pBold.measureText("m")
lightGrey = sr.getColor(R.attr.lowContrastTextColor)
darkGrey = sr.getColor(R.attr.mediumContrastTextColor)
lowContrast = sr.getColor(R.attr.contrast40)
mediumContrast = sr.getColor(R.attr.contrast60)
}
fun draw(canvas: Canvas) {
val activeColor = when {
value <= 0.0 -> lightGrey
value < threshold -> darkGrey
value <= 0.0 -> lowContrast
value < threshold -> mediumContrast
else -> color
}

@ -44,7 +44,7 @@ class OverviewCardView(context: Context, attrs: AttributeSet) : LinearLayout(con
fun setState(state: OverviewCardState) {
val androidColor = state.color.toThemedAndroidColor(context)
val res = StyledResources(context)
val inactiveColor = res.getColor(R.attr.mediumContrastTextColor)
val inactiveColor = res.getColor(R.attr.contrast60)
binding.monthDiffLabel.setTextColor(if (state.scoreMonthDiff >= 0) androidColor else inactiveColor)
binding.monthDiffLabel.text = formatPercentageDiff(state.scoreMonthDiff)
binding.scoreLabel.setTextColor(androidColor)

@ -67,19 +67,19 @@ class CheckmarkWidgetView : HabitWidgetView {
when (entryState) {
YES_MANUAL, SKIP -> {
bgColor = activeColor
fgColor = res.getColor(R.attr.highContrastReverseTextColor)
fgColor = res.getColor(R.attr.contrast0)
setShadowAlpha(0x4f)
backgroundPaint!!.color = bgColor
frame!!.setBackgroundDrawable(background)
}
YES_AUTO, NO, UNKNOWN -> {
bgColor = res.getColor(R.attr.cardBgColor)
fgColor = res.getColor(R.attr.mediumContrastTextColor)
fgColor = res.getColor(R.attr.contrast60)
setShadowAlpha(0x00)
}
else -> {
bgColor = res.getColor(R.attr.cardBgColor)
fgColor = res.getColor(R.attr.mediumContrastTextColor)
fgColor = res.getColor(R.attr.contrast60)
setShadowAlpha(0x00)
}
}

@ -19,8 +19,8 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/highContrastReverseTextColor"/>
<stroke android:width="1dp" android:color="?attr/lowContrastTextColor" />
<solid android:color="?attr/contrast0"/>
<stroke android:width="1dp" android:color="?attr/contrast20" />
<corners android:radius="4dp"/>
<padding
android:left="8dp"

@ -19,8 +19,8 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/highContrastReverseTextColor"/>
<stroke android:width="1dp" android:color="?attr/lowContrastTextColor" />
<solid android:color="?attr/contrast0"/>
<stroke android:width="1dp" android:color="?attr/contrast20" />
<corners android:radius="4dp"/>
<padding
android:left="0dp"

@ -23,6 +23,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/mediumContrastTextColor"
android:fillColor="?attr/contrast60"
android:pathData="M7,10l5,5 5,-5z"/>
</vector>

@ -23,7 +23,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/highContrastReverseTextColor"
android:background="?attr/contrast0"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".activities.habits.edit.EditHabitActivity">
@ -201,7 +201,7 @@
style="@style/FormDropdown"
android:id="@+id/numericalFrequencyPicker"
android:text="@string/every_week"
android:textColor="?attr/highContrastTextColor"
android:textColor="?attr/contrast100"
/>
</LinearLayout>
</FrameLayout>

@ -23,7 +23,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/highContrastReverseTextColor"
android:background="?attr/contrast0"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".activities.habits.edit.EditHabitActivity">

@ -29,6 +29,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="?highContrastTextColor"
android:textColor="?attr/contrast100"
tools:text="This is some example text for the notes" />
</merge>

@ -64,7 +64,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/score"
android:textColor="?mediumContrastTextColor"/>
android:textColor="?attr/contrast60"/>
</LinearLayout>
@ -83,7 +83,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/month"
android:textColor="?mediumContrastTextColor"/>
android:textColor="?attr/contrast60"/>
</LinearLayout>
@ -102,7 +102,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/year"
android:textColor="?mediumContrastTextColor"/>
android:textColor="?attr/contrast60"/>
</LinearLayout>
@ -121,7 +121,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/total"
android:textColor="?mediumContrastTextColor"/>
android:textColor="?attr/contrast60"/>
</LinearLayout>
</LinearLayout>

@ -30,7 +30,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:textColor="?mediumContrastTextColor"
android:textColor="?attr/contrast60"
android:textSize="@dimen/regularTextSize"
tools:text="Have you worked out today?"
/>
@ -48,7 +48,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fa_arrow_circle_up"
android:textColor="?mediumContrastTextColor"
android:textColor="?attr/contrast60"
android:textSize="16sp" />
<TextView
@ -56,7 +56,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="8.5k"
android:textColor="?mediumContrastTextColor"
android:textColor="?attr/contrast60"
android:textSize="@dimen/smallTextSize"
android:layout_marginStart="4dp"
android:layout_marginEnd="16dp"
@ -67,7 +67,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fa_calendar"
android:textColor="?mediumContrastTextColor"
android:textColor="?attr/contrast60"
android:textSize="@dimen/smallTextSize" />
<TextView
@ -75,7 +75,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/every_day"
android:textColor="?mediumContrastTextColor"
android:textColor="?attr/contrast60"
android:layout_marginStart="4dp"
android:layout_marginEnd="16dp"
android:textSize="@dimen/smallTextSize" />
@ -85,7 +85,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fa_bell_o"
android:textColor="?mediumContrastTextColor"
android:textColor="?attr/contrast60"
android:textSize="@dimen/smallTextSize" />
<TextView
@ -93,7 +93,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="1dp"
android:textColor="?mediumContrastTextColor"
android:textColor="?attr/contrast60"
android:text="8:00 AM"
android:layout_marginStart="4dp"
android:textSize="@dimen/smallTextSize" />

@ -26,13 +26,12 @@
<attr name="useHabitColorAsPrimary" format="boolean"/>
<attr name="aboutScreenColor" format="reference"/>
<attr name="highContrastTextColor" format="reference"/>
<attr name="mediumContrastTextColor" format="reference"/>
<attr name="lowContrastTextColor" format="reference"/>
<attr name="highContrastReverseTextColor" format="reference"/>
<attr name="mediumContrastReverseTextColor" format="reference"/>
<attr name="lowContrastReverseTextColor" format="reference"/>
<attr name="contrast0" format="reference"/>
<attr name="contrast20" format="reference"/>
<attr name="contrast40" format="reference"/>
<attr name="contrast60" format="reference"/>
<attr name="contrast80" format="reference"/>
<attr name="contrast100" format="reference"/>
<attr name="iconAdd" format="reference"/>
<attr name="iconArchive" format="reference"/>

@ -285,6 +285,7 @@
<color name="grey_100">#F5F5F5</color>
<color name="grey_200">#EEEEEE</color>
<color name="grey_300">#E0E0E0</color>
<color name="grey_350">#D8D8D8</color>
<color name="grey_400">#BDBDBD</color>
<color name="grey_500">#9E9E9E</color>
<color name="grey_600">#757575</color>

@ -25,7 +25,7 @@
<item name="android:alertDialogTheme">@style/Theme.AppCompat.Light.Dialog</item>
<item name="android:dialogTheme">@style/Theme.AppCompat.Light.Dialog</item>
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
<item name="android:itemBackground">?attr/highContrastReverseTextColor</item>
<item name="android:itemBackground">?attr/contrast0</item>
<item name="android:navigationBarColor">?attr/colorPrimary</item>
<item name="android:textColor">@color/grey_800</item>
<item name="cardBackground">@drawable/card_light_background</item>
@ -35,8 +35,6 @@
<item name="colorPrimaryDark">#303030</item>
<item name="dialogIconChangeColor">@drawable/ic_action_color_light</item>
<item name="headerBackgroundColor">@color/grey_200</item>
<item name="highContrastReverseTextColor">@color/white</item>
<item name="highContrastTextColor">@color/grey_800</item>
<item name="highlightedBackgroundColor">@color/grey_100</item>
<item name="iconAdd">@drawable/ic_action_add_dark</item>
<item name="iconArchive">@drawable/ic_action_archive_dark</item>
@ -45,10 +43,12 @@
<item name="iconEdit">@drawable/ic_action_edit_dark</item>
<item name="iconFilter">@drawable/ic_action_filter_dark</item>
<item name="iconUnarchive">@drawable/ic_action_unarchive_dark</item>
<item name="lowContrastReverseTextColor">@color/grey_700</item>
<item name="lowContrastTextColor">@color/grey_300</item>
<item name="mediumContrastReverseTextColor">@color/grey_500</item>
<item name="mediumContrastTextColor">@color/grey_500</item>
<item name="contrast0">@color/white</item>
<item name="contrast20">@color/grey_300</item>
<item name="contrast40">@color/grey_350</item>
<item name="contrast60">@color/grey_500</item>
<item name="contrast80">@color/grey_700</item>
<item name="contrast100">@color/grey_800</item>
<item name="palette">@array/lightPalette</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="scrollableRecyclerViewStyle">@style/ScrollableRecyclerViewStyle</item>
@ -75,8 +75,6 @@
<item name="colorPrimaryDark">@color/black</item>
<item name="dialogIconChangeColor">@drawable/ic_action_color_dark</item>
<item name="headerBackgroundColor">@color/grey_900</item>
<item name="highContrastReverseTextColor">@color/grey_900</item>
<item name="highContrastTextColor">@color/grey_100</item>
<item name="highlightedBackgroundColor">@color/grey_800</item>
<item name="iconAdd">@drawable/ic_action_add_dark</item>
<item name="iconArchive">@drawable/ic_action_archive_dark</item>
@ -84,10 +82,12 @@
<item name="iconEdit">@drawable/ic_action_edit_dark</item>
<item name="iconFilter">@drawable/ic_action_filter_dark</item>
<item name="iconUnarchive">@drawable/ic_action_unarchive_dark</item>
<item name="lowContrastReverseTextColor">@color/grey_300</item>
<item name="lowContrastTextColor">@color/grey_800</item>
<item name="mediumContrastReverseTextColor">@color/grey_750</item>
<item name="mediumContrastTextColor">@color/grey_500</item>
<item name="contrast0">@color/grey_900</item>
<item name="contrast20">@color/grey_800</item>
<item name="contrast40">@color/grey_750</item>
<item name="contrast60">@color/grey_500</item>
<item name="contrast80">@color/grey_300</item>
<item name="contrast100">@color/grey_100</item>
<item name="palette">@array/darkPalette</item>
<item name="popupMenuBackground">@color/black</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
@ -112,13 +112,12 @@
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="headerBackgroundColor">@color/black</item>
<item name="highContrastReverseTextColor">@color/black</item>
<item name="highContrastTextColor">@color/grey_200</item>
<item name="highlightedBackgroundColor">@color/black</item>
<item name="lowContrastReverseTextColor">@color/grey_700</item>
<item name="lowContrastTextColor">@color/grey_900</item>
<item name="mediumContrastReverseTextColor">@color/grey_900</item>
<item name="mediumContrastTextColor">@color/grey_700</item>
<item name="contrast0">@color/black</item>
<item name="contrast20">@color/grey_900</item>
<item name="contrast60">@color/grey_700</item>
<item name="contrast80">@color/grey_700</item>
<item name="contrast100">@color/grey_200</item>
<item name="selectedBackground">@drawable/selected_box_amoled</item>
<item name="textColorAlertDialogListItem">@color/grey_100</item>
<item name="windowBackgroundColor">@color/black</item>
@ -126,12 +125,11 @@
<style name="WidgetTheme" parent="AppBaseThemeDark">
<item name="cardBgColor">@color/grey_850</item>
<item name="highContrastReverseTextColor">@color/white</item>
<item name="highContrastTextColor">@color/white</item>
<item name="lowContrastReverseTextColor">@color/grey_800</item>
<item name="lowContrastTextColor">@color/white_a0</item>
<item name="mediumContrastReverseTextColor">@color/grey_500</item>
<item name="mediumContrastTextColor">@color/white_aa</item>
<item name="contrast0">@color/white</item>
<item name="contrast20">@color/white_a0</item>
<item name="contrast60">@color/white_aa</item>
<item name="contrast80">@color/grey_800</item>
<item name="contrast100">@color/white</item>
<item name="palette">@array/transparentWidgetPalette</item>
<item name="widgetShadowAlpha">0</item>
</style>
@ -141,7 +139,7 @@
</style>
<style name="SmallSpinner">
<item name="android:textColor">?mediumContrastTextColor</item>
<item name="android:textColor">?attr/contrast60</item>
<item name="android:textSize">@dimen/smallTextSize</item>
</style>
@ -263,7 +261,7 @@
<item name="android:layout_marginStart">8dp</item>
<item name="android:layout_marginTop">-15dp</item>
<item name="android:layout_marginBottom">-4dp</item>
<item name="android:background">?attr/highContrastReverseTextColor</item>
<item name="android:background">?attr/contrast0</item>
<item name="android:paddingStart">8dp</item>
<item name="android:paddingEnd">8dp</item>
<item name="android:textSize">@dimen/smallerTextSize</item>
@ -315,6 +313,6 @@
<style name="FormDivider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">?attr/lowContrastTextColor</item>
<item name="android:background">?attr/contrast20</item>
</style>
</resources>

@ -22,7 +22,7 @@
<style name="dialogFormText">
<item name="android:textSize">@dimen/regularTextSize</item>
<item name="android:textColor">?highContrastTextColor</item>
<item name="android:textColor">?attr/contrast100</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
@ -33,7 +33,7 @@
<item name="android:minWidth">90dp</item>
<item name="android:gravity">left</item>
<item name="android:paddingLeft">6dp</item>
<item name="android:textColor">?mediumContrastTextColor</item>
<item name="android:textColor">?attr/contrast60</item>
</style>
<style name="dialogFormRow">

Loading…
Cancel
Save