mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
On ChartView, show either the speed or the pace label depending on the
user preference. On StatsActivity, draw the unit label.
This commit is contained in:
@@ -78,7 +78,7 @@ public class ChartActivity extends Activity implements TrackDataListener {
|
||||
|
||||
// Modes of operation
|
||||
private boolean metricUnits = true;
|
||||
private boolean reportSpeed;
|
||||
private boolean reportSpeed = true;
|
||||
|
||||
/*
|
||||
* UI elements:
|
||||
@@ -466,16 +466,19 @@ public class ChartActivity extends Activity implements TrackDataListener {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("hiding")
|
||||
@Override
|
||||
public boolean onReportSpeedChanged(boolean reportSpeed) {
|
||||
boolean changed = reportSpeed != this.reportSpeed;
|
||||
if (!changed) return false;
|
||||
|
||||
this.reportSpeed = reportSpeed;
|
||||
|
||||
chartView.setReportSpeed(reportSpeed, this);
|
||||
|
||||
return true; // Reload data
|
||||
public boolean onReportSpeedChanged(boolean speed) {
|
||||
if (reportSpeed == speed) {
|
||||
return false;
|
||||
}
|
||||
reportSpeed = speed;
|
||||
chartView.setReportSpeed(speed, this);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
chartView.requestLayout();
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,8 @@ public class StatsActivity extends Activity implements TrackDataListener {
|
||||
sv.setScrollBarStyle(ScrollView.SCROLLBARS_OUTSIDE_INSET);
|
||||
|
||||
showUnknownLocation();
|
||||
|
||||
updateLabels();
|
||||
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
if (metrics.heightPixels > 600) {
|
||||
@@ -153,24 +154,22 @@ public class StatsActivity extends Activity implements TrackDataListener {
|
||||
|
||||
@Override
|
||||
public boolean onUnitsChanged(boolean metric) {
|
||||
// Ignore if unchanged.
|
||||
if (metric == utils.isMetricUnits()) return false;
|
||||
|
||||
if (utils.isMetricUnits() == metric) {
|
||||
return false;
|
||||
}
|
||||
utils.setMetricUnits(metric);
|
||||
updateLabels();
|
||||
|
||||
return true; // Reload data
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onReportSpeedChanged(boolean displaySpeed) {
|
||||
// Ignore if unchanged.
|
||||
if (displaySpeed == utils.isReportSpeed()) return false;
|
||||
|
||||
utils.setReportSpeed(displaySpeed);
|
||||
public boolean onReportSpeedChanged(boolean speed) {
|
||||
if (utils.isReportSpeed() == speed) {
|
||||
return false;
|
||||
}
|
||||
utils.setReportSpeed(speed);
|
||||
updateLabels();
|
||||
|
||||
return true; // Reload data
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateLabels() {
|
||||
|
||||
Reference in New Issue
Block a user