Skip to content

Commit

Permalink
Invert text color on route point approach
Browse files Browse the repository at this point in the history
  • Loading branch information
andreynovikov committed Feb 25, 2024
1 parent 1249b9b commit 8f77688
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 21 deletions.
12 changes: 3 additions & 9 deletions app/src/main/java/mobi/maptrek/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2376,9 +2376,7 @@ private void updateNavigationGauges(boolean updateRoutePanels) {
@DrawableRes int sign = RouteInformation.getSignDrawable(mNavigationService.getSign());
Drawable signDrawable = AppCompatResources.getDrawable(MainActivity.this, sign);
mViews.navigationSign.setImageDrawable(signDrawable);
int color = getResources().getColor(R.color.panelBackground, getTheme());
mViews.routePoint.setBackgroundColor(color);
mViews.routeSignBackground.setBackgroundColor(color);
mViews.navigationPanel.setActivated(false);
mViews.navigationSign.setTag(false);
}
mViews.routePointDistance.setText(StringFormatter.distanceH(mNavigationService.getPointDistance()));
Expand All @@ -2390,15 +2388,11 @@ private void updateNavigationGauges(boolean updateRoutePanels) {
mViews.routePointEte.setText(StringFormatter.timeH(ete));
if (ete <= 1) {
if (!Boolean.TRUE.equals(mViews.navigationSign.getTag())) {
int color = getResources().getColor(R.color.panelAccentBackground, getTheme());
mViews.routePoint.setBackgroundColor(color);
mViews.routeSignBackground.setBackgroundColor(color);
mViews.navigationPanel.setActivated(true);
mViews.navigationSign.setTag(true);
}
} else if (Boolean.TRUE.equals(mViews.navigationSign.getTag())) {
int color = getResources().getColor(R.color.panelBackground, getTheme());
mViews.routePoint.setBackgroundColor(color);
mViews.routeSignBackground.setBackgroundColor(color);
mViews.navigationPanel.setActivated(false);
mViews.navigationSign.setTag(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:color="@color/panelAccentBackground" />
<item android:color="@color/panelBackground" />
</selector>
5 changes: 5 additions & 0 deletions app/src/main/res/color/inverted_text_color_selector.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:color="@color/textColorPrimaryInverted" />
<item android:color="@color/textColorPrimary" />
</selector>
10 changes: 6 additions & 4 deletions app/src/main/res/layout-land/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
android:id="@+id/routeSignBackground"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/panelBackground"
android:background="@color/activated_background_color_selector"
app:layout_constraintBottom_toBottomOf="@+id/route_navigation_barrier"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/route_sign_barrier"
Expand All @@ -134,7 +134,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/route_sign_barrier"
app:layout_constraintTop_toTopOf="parent"
app:tint="@color/textColorPrimary"
app:tint="@color/inverted_text_color_selector"
tools:ignore="ContentDescription"
tools:src="@drawable/instruction_turn_right" />

Expand All @@ -147,7 +147,7 @@
android:paddingBottom="@dimen/gauge_padding"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/textColorPrimary"
android:textColor="@color/inverted_text_color_selector"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/route_sign_barrier"
Expand All @@ -163,6 +163,7 @@
android:paddingBottom="@dimen/gauge_padding"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearance"
android:textColor="@color/inverted_text_color_selector"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/route_sign_barrier"
app:layout_constraintTop_toBottomOf="@+id/routePointDistance"
Expand All @@ -172,10 +173,11 @@
android:id="@+id/routePoint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/panelBackground"
android:background="@color/activated_background_color_selector"
android:padding="@dimen/gauge_padding"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/inverted_text_color_selector"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/route_sign_barrier"
app:layout_constraintStart_toStartOf="parent"
Expand Down
12 changes: 7 additions & 5 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
android:id="@+id/routeSignBackground"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/panelBackground"
android:background="@color/activated_background_color_selector"
app:layout_constraintBottom_toBottomOf="@+id/route_navigation_barrier"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/route_sign_barrier"
Expand All @@ -135,7 +135,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/route_sign_barrier"
app:layout_constraintTop_toTopOf="parent"
app:tint="@color/textColorPrimary"
app:tint="@color/inverted_text_color_selector"
tools:ignore="ContentDescription"
tools:src="@drawable/instruction_turn_right" />

Expand All @@ -148,7 +148,7 @@
android:paddingBottom="@dimen/gauge_padding"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/textColorPrimary"
android:textColor="@color/inverted_text_color_selector"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/route_sign_barrier"
Expand All @@ -164,6 +164,7 @@
android:paddingBottom="@dimen/gauge_padding"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearance"
android:textColor="@color/inverted_text_color_selector"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/route_sign_barrier"
app:layout_constraintTop_toBottomOf="@+id/routePointDistance"
Expand All @@ -173,10 +174,11 @@
android:id="@+id/routePoint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/panelBackground"
android:background="@color/activated_background_color_selector"
android:padding="@dimen/gauge_padding"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/inverted_text_color_selector"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/route_sign_barrier"
app:layout_constraintStart_toStartOf="parent"
Expand Down Expand Up @@ -421,8 +423,8 @@
app:layout_constraintBottom_toTopOf="@+id/actionPanel"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/guideline"
app:layout_constraintWidth="match_constraint"
app:layout_constraintVertical_bias="1"
app:layout_constraintWidth="match_constraint"
tools:ignore="KeyboardInaccessibleWidget" />

<ProgressBar
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@
<color name="colorSplashBackground">#222222</color>
<color name="textColorPrimary">#a1a1a1</color>
<color name="textColorPrimaryDisabled">#80a1a1a1</color>
<color name="textColorPrimaryInverted">#212121</color>
<color name="textColorSecondary">#525252</color>
<color name="textColorSecondaryDisabled">#80525252</color>
<color name="textColorTertiary">#626262</color>
<color name="textColorTertiaryDisabled">#80626262</color>
<color name="accentBackground">#33e96238</color>
<color name="panelBackground">#99333333</color>
<color name="panelAccentBackground">#99e96238</color>
<color name="panelAccentBackground">#aae96238</color>
<color name="panelSolidBackground">@color/colorBackground</color>
<color name="panelExtendedBackground">#cc333333</color>
<color name="colorNavigationBackground">#000000</color>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-notnight/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@
<color name="colorSplashBackground">#eeeeee</color>
<color name="textColorPrimary">#212121</color>
<color name="textColorPrimaryDisabled">#80212121</color>
<color name="textColorPrimaryInverted">#f5f5f5</color>
<color name="textColorSecondary">#727272</color>
<color name="textColorSecondaryDisabled">#80727272</color>
<color name="textColorTertiary">#626262</color>
<color name="textColorTertiaryDisabled">#80626262</color>
<color name="accentBackground">#33ff5722</color>
<color name="panelBackground">#99ffffff</color>
<color name="panelAccentBackground">#99ff5722</color>
<color name="panelAccentBackground">#aaff5722</color>
<color name="panelSolidBackground">@color/colorBackground</color>
<color name="panelExtendedBackground">#cc999999</color>
<color name="colorControlActivated">#e0e0e0</color>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@
<color name="colorSplashBackground">#eeeeee</color>
<color name="textColorPrimary">#212121</color>
<color name="textColorPrimaryDisabled">#80212121</color>
<color name="textColorPrimaryInverted">#f5f5f5</color>
<color name="textColorSecondary">#727272</color>
<color name="textColorSecondaryDisabled">#80727272</color>
<color name="textColorTertiary">#929292</color>
<color name="textColorTertiaryDisabled">#80929292</color>
<color name="accentBackground">#33ff5722</color>
<color name="panelBackground">#99ffffff</color>
<color name="panelAccentBackground">#99ff5722</color>
<color name="panelAccentBackground">#aaff5722</color>
<color name="panelSolidBackground">@color/colorBackground</color>
<color name="panelExtendedBackground">#cc999999</color>
<color name="colorNavigationBackground">#000000</color>
Expand Down

0 comments on commit 8f77688

Please sign in to comment.