mirror of
https://github.com/russok/FitoTrack.git
synced 2025-10-28 16:22:12 -07:00
Hint when changing themes, dark mode fixes
This commit is contained in:
parent
5adc2a0536
commit
6cf233a5ea
@ -63,6 +63,11 @@ public class SettingsActivity extends FitoTrackSettingsActivity {
|
|||||||
bindPreferenceSummaryToValue(findPreference("unitSystem"));
|
bindPreferenceSummaryToValue(findPreference("unitSystem"));
|
||||||
bindPreferenceSummaryToValue(findPreference("mapStyle"));
|
bindPreferenceSummaryToValue(findPreference("mapStyle"));
|
||||||
bindPreferenceSummaryToValue(findPreference("themeSetting"));
|
bindPreferenceSummaryToValue(findPreference("themeSetting"));
|
||||||
|
findPreference("themeSetting").setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference, newValue);
|
||||||
|
Toast.makeText(SettingsActivity.this, R.string.hintRestart, Toast.LENGTH_LONG).show();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
findPreference("weight").setOnPreferenceClickListener(preference -> {
|
findPreference("weight").setOnPreferenceClickListener(preference -> {
|
||||||
showWeightPicker();
|
showWeightPicker();
|
||||||
|
|||||||
@ -20,7 +20,6 @@
|
|||||||
package de.tadris.fitness.util;
|
package de.tadris.fitness.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import androidx.annotation.StyleRes;
|
import androidx.annotation.StyleRes;
|
||||||
@ -30,9 +29,8 @@ import de.tadris.fitness.data.WorkoutType;
|
|||||||
|
|
||||||
public class FitoTrackThemes {
|
public class FitoTrackThemes {
|
||||||
|
|
||||||
private static final int THEME_SETTING_AUTO = 0;
|
private static final int THEME_SETTING_LIGHT = 0;
|
||||||
private static final int THEME_SETTING_LIGHT = 1;
|
private static final int THEME_SETTING_DARK = 1;
|
||||||
private static final int THEME_SETTING_DARK = 2;
|
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
@ -61,8 +59,6 @@ public class FitoTrackThemes {
|
|||||||
private boolean shouldUseLightMode() {
|
private boolean shouldUseLightMode() {
|
||||||
switch (getThemeSetting()) {
|
switch (getThemeSetting()) {
|
||||||
default:
|
default:
|
||||||
case THEME_SETTING_AUTO:
|
|
||||||
return !isSystemNightModeEnabled();
|
|
||||||
case THEME_SETTING_LIGHT:
|
case THEME_SETTING_LIGHT:
|
||||||
return true;
|
return true;
|
||||||
case THEME_SETTING_DARK:
|
case THEME_SETTING_DARK:
|
||||||
@ -71,14 +67,9 @@ public class FitoTrackThemes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getThemeSetting() {
|
private int getThemeSetting() {
|
||||||
String setting = PreferenceManager.getDefaultSharedPreferences(context).getString("themeSetting", String.valueOf(THEME_SETTING_AUTO));
|
String setting = PreferenceManager.getDefaultSharedPreferences(context).getString("themeSetting", String.valueOf(THEME_SETTING_LIGHT));
|
||||||
assert setting != null;
|
assert setting != null;
|
||||||
return Integer.parseInt(setting);
|
return Integer.parseInt(setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSystemNightModeEnabled() {
|
|
||||||
int nightModeFlags = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
|
||||||
return nightModeFlags == Configuration.UI_MODE_NIGHT_YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,6 +61,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|center"
|
android:layout_gravity="bottom|center"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
|
android:textColor="@color/textColorLight"
|
||||||
android:text="@string/OpenStreetMapAttribution" />
|
android:text="@string/OpenStreetMapAttribution" />
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +83,7 @@
|
|||||||
android:fontFamily="sans-serif-black"
|
android:fontFamily="sans-serif-black"
|
||||||
android:text="0:44:08"
|
android:text="0:44:08"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="30sp"
|
android:textSize="30sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -124,7 +125,7 @@
|
|||||||
android:text="2,06 km"
|
android:text="2,06 km"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -144,7 +145,7 @@
|
|||||||
android:text="30 kcal"
|
android:text="30 kcal"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -175,7 +176,7 @@
|
|||||||
android:text="7 km/h"
|
android:text="7 km/h"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@ -195,7 +196,7 @@
|
|||||||
android:text="30 kcal"
|
android:text="30 kcal"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
|||||||
@ -173,4 +173,5 @@
|
|||||||
<string name="info">Info</string>
|
<string name="info">Info</string>
|
||||||
<string name="OpenStreetMapAttribution">© OpenStreetMap contributors</string>
|
<string name="OpenStreetMapAttribution">© OpenStreetMap contributors</string>
|
||||||
<string name="theme">Theme</string>
|
<string name="theme">Theme</string>
|
||||||
|
<string name="hintRestart">Please restart the app to apply changes</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@ -24,8 +24,6 @@
|
|||||||
<item name="android:colorPrimary">@color/colorPrimary</item>
|
<item name="android:colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="android:colorAccent">@color/colorAccent</item>
|
<item name="android:colorAccent">@color/colorAccent</item>
|
||||||
|
|
||||||
<item name="android:textAppearanceMedium">@style/MediumTextLight</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Running" parent="AppTheme">
|
<style name="Running" parent="AppTheme">
|
||||||
@ -49,8 +47,6 @@
|
|||||||
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="android:colorAccent">@color/colorAccent</item>
|
<item name="android:colorAccent">@color/colorAccent</item>
|
||||||
<item name="android:windowBackground">@android:color/black</item>
|
<item name="android:windowBackground">@android:color/black</item>
|
||||||
|
|
||||||
<item name="android:textAppearanceMedium">@style/MediumTextDark</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="RunningDark" parent="AppThemeDark">
|
<style name="RunningDark" parent="AppThemeDark">
|
||||||
@ -69,15 +65,4 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<style name="MediumTextLight" parent="android:TextAppearance.Material.Medium">
|
|
||||||
<item name="android:textColor">@color/textLighterBlack</item>
|
|
||||||
<item name="android:textSize">22sp</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="MediumTextDark" parent="android:TextAppearance.Material.Medium.Inverse">
|
|
||||||
<item name="android:textColor">@color/textDarkerWhite</item>
|
|
||||||
<item name="android:textSize">22sp</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@ -20,7 +20,6 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string-array name="pref_theme_setting">
|
<string-array name="pref_theme_setting">
|
||||||
<item>System</item>
|
|
||||||
<item>Light</item>
|
<item>Light</item>
|
||||||
<item>Dark</item>
|
<item>Dark</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
@ -28,7 +27,6 @@
|
|||||||
<string-array name="pref_theme_setting_values">
|
<string-array name="pref_theme_setting_values">
|
||||||
<item>0</item>
|
<item>0</item>
|
||||||
<item>1</item>
|
<item>1</item>
|
||||||
<item>2</item>
|
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
x
Reference in New Issue
Block a user