forked from upstream-mirrors/OpenTracks
Improve the startup sequence.
- new welcome dialog message. - new check units text. - for US and UK, default to imperial. - for fragments, fix handling of onCancel. No need to handle onCancel at the dialog level.
This commit is contained in:
@@ -71,7 +71,7 @@ public class TrackWidgetProvider
|
||||
private Context context;
|
||||
private String unknown;
|
||||
private TrackObserver trackObserver;
|
||||
private boolean isMetric;
|
||||
private boolean metricUnits;
|
||||
private boolean reportSpeed;
|
||||
private long selectedTrackId;
|
||||
private SharedPreferences sharedPreferences;
|
||||
@@ -218,10 +218,10 @@ public class TrackWidgetProvider
|
||||
}
|
||||
|
||||
TripStatistics stats = track.getStatistics();
|
||||
String distance = StringUtils.formatDistance(context, stats.getTotalDistance(), isMetric);
|
||||
String distance = StringUtils.formatDistance(context, stats.getTotalDistance(), metricUnits);
|
||||
String time = StringUtils.formatElapsedTime(stats.getMovingTime());
|
||||
String speed = StringUtils.formatSpeed(
|
||||
context, stats.getAverageMovingSpeed(), isMetric, reportSpeed);
|
||||
context, stats.getAverageMovingSpeed(), metricUnits, reportSpeed);
|
||||
|
||||
views.setTextViewText(R.id.appwidget_distance_text, distance);
|
||||
views.setTextViewText(R.id.appwidget_time_text, time);
|
||||
@@ -230,14 +230,12 @@ public class TrackWidgetProvider
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
||||
String metricUnitsKey = context.getString(R.string.metric_units_key);
|
||||
if (key == null || key.equals(metricUnitsKey)) {
|
||||
isMetric = prefs.getBoolean(metricUnitsKey, true);
|
||||
if (key == null || key.equals(PreferencesUtils.getMetricUnitsKey(context))) {
|
||||
metricUnits = PreferencesUtils.isMetricUnits(context);
|
||||
}
|
||||
|
||||
String reportSpeedKey = context.getString(R.string.report_speed_key);
|
||||
if (key == null || key.equals(reportSpeedKey)) {
|
||||
reportSpeed = prefs.getBoolean(reportSpeedKey, true);
|
||||
if (key == null || key.equals(PreferencesUtils.getReportSpeedKey(context))) {
|
||||
reportSpeed = PreferencesUtils.isReportSpeed(context);
|
||||
}
|
||||
|
||||
if (key == null || key.equals(PreferencesUtils.getSelectedTrackIdKey(context))) {
|
||||
|
||||
Reference in New Issue
Block a user