Skip to content

Commit

Permalink
Preference: "GPS disabled"-warning is now configurable.
Browse files Browse the repository at this point in the history
Fixes #2058.
  • Loading branch information
dennisguse committed Feb 18, 2025
1 parent caf882e commit dc3e7d2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@ private void onGpsStatusChanged(GpsStatusValue gpsStatusValue) {
return;
}

if (!PreferencesUtils.shouldShowGpsDisabledWarning()) {
return;
}

snackbar = Snackbar
.make(viewBinding.trackRecordingCoordinatorLayout,
getString(R.string.gps_recording_status, getString(gpsStatusValue.message), getString(R.string.gps_recording_without_signal)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ public static boolean shouldUseFullscreen() {
return getBoolean(R.string.stats_fullscreen_while_recording_key, DEFAULT);
}

public static boolean shouldShowGpsDisabledWarning() {
final boolean DEFAULT = resources.getBoolean(R.bool.stats_show_gps_disabled_warnings_default);
return getBoolean(R.string.stats_show_gps_disabled_warnings_key, DEFAULT);
}

public static boolean shouldShowElevation() {
final boolean DEFAULT = resources.getBoolean(R.bool.chart_display_elevation_default);
return getBoolean(R.string.chart_display_elevation_key, DEFAULT);
Expand Down
3 changes: 3 additions & 0 deletions src/main/res/values/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@
<string name="stats_fullscreen_while_recording_key" translatable="false">trackdetail_fullscreen_while_recording</string>
<bool name="stats_fullscreen_while_recording_default" translatable="false">false</bool>

<string name="stats_show_gps_disabled_warnings_key" translatable="false">trackdetail_show_gps_disabled_warnings</string>
<bool name="stats_show_gps_disabled_warnings_default" translatable="false">true</bool>

<!-- Chart Settings -->
<string name="chart_display_elevation_key" translatable="false">chart_display_elevation</string>
<bool name="chart_display_elevation_default" translatable="false">true</bool>
Expand Down
2 changes: 2 additions & 0 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ limitations under the License.
<string name="settings_recording_keep_screen_on_while_recording_summary">While recording, keep the screen on.</string>
<string name="settings_recording_fullscreen_on_while_recording_title">Fullscreen</string>
<string name="settings_recording_fullscreen_on_while_recording_summary">While recording, present in fullscreen.</string>
<string name="settings_recording_show_gps_disabled_warning_title">GPS disabled warning</string>
<string name="settings_recording_show_gps_disabled_warning_summary">While recording, show a warning if GPS is disabled.</string>
<string name="settings_recording_default_activity_title">Default activity type</string>
<string name="settings_recording_location_frequency_summary">%1$s between location checks</string>
<string name="settings_recording_max_recording_distance_summary">A new segment is created if the distance between two locations is greater than %1$s</string>
Expand Down
6 changes: 6 additions & 0 deletions src/main/res/xml/settings_user_interface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
android:key="@string/stats_fullscreen_while_recording_key"
android:summary="@string/settings_recording_fullscreen_on_while_recording_summary"
android:title="@string/settings_recording_fullscreen_on_while_recording_title" />

<SwitchPreferenceCompat
android:defaultValue="@bool/stats_show_gps_disabled_warnings_default"
android:key="@string/stats_show_gps_disabled_warnings_key"
android:summary="@string/settings_recording_show_gps_disabled_warning_summary"
android:title="@string/settings_recording_show_gps_disabled_warning_title" />
</PreferenceCategory>

<PreferenceCategory app:title="@string/settings_charts_title">
Expand Down

0 comments on commit dc3e7d2

Please sign in to comment.