diff --git a/app/src/main/java/com/kylecorry/trail_sense/shared/UserPreferences.kt b/app/src/main/java/com/kylecorry/trail_sense/shared/UserPreferences.kt index 74416f1e4..a1c64cde8 100644 --- a/app/src/main/java/com/kylecorry/trail_sense/shared/UserPreferences.kt +++ b/app/src/main/java/com/kylecorry/trail_sense/shared/UserPreferences.kt @@ -185,7 +185,11 @@ class UserPreferences(private val context: Context) : IDeclinationPreferences { _theme = value } - val useDynamicColors = false + val useDynamicColors by BooleanPreference( + cache, + context.getString(R.string.pref_use_dynamic_colors), + false + ) // Calibration diff --git a/app/src/main/java/com/kylecorry/trail_sense/shared/views/TileButton.kt b/app/src/main/java/com/kylecorry/trail_sense/shared/views/TileButton.kt index ecf26997d..2922f71d3 100644 --- a/app/src/main/java/com/kylecorry/trail_sense/shared/views/TileButton.kt +++ b/app/src/main/java/com/kylecorry/trail_sense/shared/views/TileButton.kt @@ -11,6 +11,7 @@ import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.view.setPadding import com.kylecorry.andromeda.core.system.Resources import com.kylecorry.trail_sense.R +import com.kylecorry.trail_sense.shared.CustomUiUtils.getColorOnPrimary import com.kylecorry.trail_sense.shared.CustomUiUtils.getPrimaryColor class TileButton(context: Context, attrs: AttributeSet?) : ConstraintLayout(context, attrs) { @@ -51,10 +52,10 @@ class TileButton(context: Context, attrs: AttributeSet?) : ConstraintLayout(cont Resources.getPrimaryColor(icon.context) ) textView.setTextColor( - Resources.color(icon.context, R.color.colorSecondary) + Resources.getColorOnPrimary(icon.context) ) icon.imageTintList = ColorStateList.valueOf( - Resources.color(icon.context, R.color.colorSecondary) + Resources.getColorOnPrimary(icon.context) ) } else { textView.setTextColor(Resources.androidTextColorSecondary(icon.context)) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 2f83ede2f..073294bdb 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -42,7 +42,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" - android:background="?android:colorBackgroundFloating" + android:background="?attr/colorBackgroundFloating" app:itemIconTint="@drawable/selector" app:itemTextColor="?attr/colorOnSurface" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/layout/activity_navigator.xml b/app/src/main/res/layout/activity_navigator.xml index 11bb9b350..bc1ca4aa7 100644 --- a/app/src/main/res/layout/activity_navigator.xml +++ b/app/src/main/res/layout/activity_navigator.xml @@ -104,7 +104,7 @@ android:id="@+id/ruler" android:layout_width="80dp" android:layout_height="0dp" - android:background="?android:colorBackgroundFloating" + android:background="?attr/colorBackgroundFloating" android:elevation="4dp" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" @@ -124,7 +124,7 @@ android:focusable="true" android:tint="?android:textColorSecondary" android:visibility="invisible" - app:backgroundTint="?android:colorBackgroundFloating" + app:backgroundTint="?attr/colorBackgroundFloating" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/linear_compass" app:srcCompat="@drawable/ic_camera" /> diff --git a/app/src/main/res/layout/fragment_map_calibration.xml b/app/src/main/res/layout/fragment_map_calibration.xml index 160ff143e..dd4e81fda 100644 --- a/app/src/main/res/layout/fragment_map_calibration.xml +++ b/app/src/main/res/layout/fragment_map_calibration.xml @@ -57,7 +57,7 @@ android:id="@+id/map_calibration_bottom_panel" android:layout_width="0dp" android:layout_height="wrap_content" - android:background="?android:colorBackgroundFloating" + android:background="?attr/colorBackgroundFloating" android:orientation="vertical" android:padding="16dp" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/layout/fragment_tool_battery.xml b/app/src/main/res/layout/fragment_tool_battery.xml index 4816d9706..a67695043 100644 --- a/app/src/main/res/layout/fragment_tool_battery.xml +++ b/app/src/main/res/layout/fragment_tool_battery.xml @@ -25,7 +25,7 @@ android:layout_marginTop="16dp" android:layout_marginEnd="32dp" android:drawable="@drawable/ic_battery" - android:drawableTint="?android:colorBackgroundFloating" + android:drawableTint="?attr/colorBackgroundFloating" android:progress="0" app:horizontal="false" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/layout/fragment_tool_ruler.xml b/app/src/main/res/layout/fragment_tool_ruler.xml index 35ae1cfb3..4c8356bf6 100644 --- a/app/src/main/res/layout/fragment_tool_ruler.xml +++ b/app/src/main/res/layout/fragment_tool_ruler.xml @@ -45,7 +45,7 @@ android:id="@+id/ruler" android:layout_width="80dp" android:layout_height="0dp" - android:background="?android:colorBackgroundFloating" + android:background="?attr/colorBackgroundFloating" android:elevation="4dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/fragment_tool_triangulate.xml b/app/src/main/res/layout/fragment_tool_triangulate.xml index 4fef4f3a1..5c52361a2 100644 --- a/app/src/main/res/layout/fragment_tool_triangulate.xml +++ b/app/src/main/res/layout/fragment_tool_triangulate.xml @@ -128,7 +128,7 @@ android:layout_marginTop="16dp" android:layout_marginEnd="8dp" android:background="@drawable/rounded_rectangle" - android:backgroundTint="?attr/colorSurface"> + android:backgroundTint="?attr/colorBackgroundFloating"> + android:backgroundTint="?attr/colorBackgroundFloating"> diff --git a/app/src/main/res/layout/view_tile_button.xml b/app/src/main/res/layout/view_tile_button.xml index 525f0f70a..8237cca6d 100644 --- a/app/src/main/res/layout/view_tile_button.xml +++ b/app/src/main/res/layout/view_tile_button.xml @@ -15,7 +15,7 @@ android:padding="32dp" android:elevation="2dp" android:scaleType="fitCenter" - app:backgroundTint="?android:colorBackgroundFloating" + app:backgroundTint="?attr/colorBackgroundFloating" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 28701737f..32a9389ce 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1381,6 +1381,7 @@ pref_clinometer_use_ar Clinometer augmented reality Visualize angles with your camera + pref_use_dynamic_colors %d map %d maps diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 3aafb5d09..fe567f3f0 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -7,6 +7,7 @@ @color/orange_40 @color/orange_10 + ?attr/colorPrimary @color/orange_40_transparent @@ -16,12 +17,6 @@ ?attr/colorOnPrimaryContainer ?attr/colorOnPrimaryContainer - - false - - ?attr/colorBackgroundFloating - - ?attr/colorPrimary @style/AppBottomSheetDialogTheme @style/AlertDialogTheme @style/ThemeOverlay.App.ElevatedButton @@ -89,7 +84,7 @@