mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-11 13:33:07 +02:00
Code cleanup. Rename stats_total_distance to stats_distance.
This commit is contained in:
@@ -18,12 +18,12 @@ limitations under the License.
|
|||||||
<!-- Total distance -->
|
<!-- Total distance -->
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/stats_total_distance"
|
android:text="@string/stats_distance"
|
||||||
style="@style/StatsLabel" />
|
style="@style/StatsLabel" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_total_distance_value"
|
android:id="@+id/stats_distance_value"
|
||||||
style="@style/StatsValue" />
|
style="@style/StatsValue" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<!-- Total time/moving time -->
|
<!-- Total time/moving time -->
|
||||||
|
|||||||
@@ -2226,8 +2226,8 @@ limitations under the License.
|
|||||||
Character limit: ~23 (1 line)">
|
Character limit: ~23 (1 line)">
|
||||||
Speed
|
Speed
|
||||||
</string>
|
</string>
|
||||||
<string name="stats_total_distance"
|
<string name="stats_distance"
|
||||||
translation_description="In the 'Stats' page, the total distance.">
|
translation_description="In the 'Stats' page, the distance.">
|
||||||
Distance
|
Distance
|
||||||
</string>
|
</string>
|
||||||
<string name="stats_total_time"
|
<string name="stats_total_time"
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class StatsUtils {
|
|||||||
|
|
||||||
// Set total distance
|
// Set total distance
|
||||||
double totalDistance = tripStatistics == null ? Double.NaN : tripStatistics.getTotalDistance();
|
double totalDistance = tripStatistics == null ? Double.NaN : tripStatistics.getTotalDistance();
|
||||||
setDistanceValue(activity, R.id.stats_total_distance_value, totalDistance, metricUnits);
|
setDistanceValue(activity, R.id.stats_distance_value, totalDistance, metricUnits);
|
||||||
|
|
||||||
// Set total time
|
// Set total time
|
||||||
setTimeValue(activity, R.id.stats_total_time_value,
|
setTimeValue(activity, R.id.stats_total_time_value,
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ public class TrackWidgetConfigActivity extends Activity {
|
|||||||
this, R.string.report_speed_key, PreferencesUtils.REPORT_SPEED_DEFAULT);
|
this, R.string.report_speed_key, PreferencesUtils.REPORT_SPEED_DEFAULT);
|
||||||
|
|
||||||
List<CharSequence> list = new ArrayList<CharSequence>();
|
List<CharSequence> list = new ArrayList<CharSequence>();
|
||||||
addItem(list, R.string.stats_total_distance);
|
addItem(list, R.string.stats_distance);
|
||||||
addItem(list, R.string.stats_total_time);
|
addItem(list, R.string.stats_total_time);
|
||||||
addItem(list, reportSpeed ? R.string.stats_average_speed : R.string.stats_average_pace);
|
addItem(list, reportSpeed ? R.string.stats_average_speed : R.string.stats_average_pace);
|
||||||
addItem(list, R.string.stats_moving_time);
|
addItem(list, R.string.stats_moving_time);
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public class TrackWidgetProvider extends AppWidgetProvider {
|
|||||||
boolean reportSpeed) {
|
boolean reportSpeed) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 0:
|
case 0:
|
||||||
updateTotalDistance(context, remoteViews, ids, tripStatistics, metricUnits);
|
updateDistance(context, remoteViews, ids, tripStatistics, metricUnits);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
updateTotalTime(context, remoteViews, ids, tripStatistics, isRecording, isPaused);
|
updateTotalTime(context, remoteViews, ids, tripStatistics, isRecording, isPaused);
|
||||||
@@ -236,7 +236,7 @@ public class TrackWidgetProvider extends AppWidgetProvider {
|
|||||||
context, remoteViews, ids, tripStatistics, metricUnits, reportSpeed);
|
context, remoteViews, ids, tripStatistics, metricUnits, reportSpeed);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
updateTotalDistance(context, remoteViews, ids, tripStatistics, metricUnits);
|
updateDistance(context, remoteViews, ids, tripStatistics, metricUnits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -271,7 +271,7 @@ public class TrackWidgetProvider extends AppWidgetProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates total distance.
|
* Updates distance.
|
||||||
*
|
*
|
||||||
* @param context the context
|
* @param context the context
|
||||||
* @param remoteViews the remote views
|
* @param remoteViews the remote views
|
||||||
@@ -279,11 +279,11 @@ public class TrackWidgetProvider extends AppWidgetProvider {
|
|||||||
* @param tripStatistics the trip statistics
|
* @param tripStatistics the trip statistics
|
||||||
* @param metricUnits true to use metric units
|
* @param metricUnits true to use metric units
|
||||||
*/
|
*/
|
||||||
private static void updateTotalDistance(Context context, RemoteViews remoteViews, int[] ids,
|
private static void updateDistance(Context context, RemoteViews remoteViews, int[] ids,
|
||||||
TripStatistics tripStatistics, boolean metricUnits) {
|
TripStatistics tripStatistics, boolean metricUnits) {
|
||||||
double totalDistance = tripStatistics == null ? Double.NaN : tripStatistics.getTotalDistance();
|
double totalDistance = tripStatistics == null ? Double.NaN : tripStatistics.getTotalDistance();
|
||||||
String[] totalDistanceParts = StringUtils.getDistanceParts(context, totalDistance, metricUnits);
|
String[] totalDistanceParts = StringUtils.getDistanceParts(context, totalDistance, metricUnits);
|
||||||
remoteViews.setTextViewText(ids[0], context.getString(R.string.stats_total_distance));
|
remoteViews.setTextViewText(ids[0], context.getString(R.string.stats_distance));
|
||||||
remoteViews.setTextViewText(ids[1], totalDistanceParts[0]);
|
remoteViews.setTextViewText(ids[1], totalDistanceParts[0]);
|
||||||
remoteViews.setTextViewText(ids[2], totalDistanceParts[1]);
|
remoteViews.setTextViewText(ids[2], totalDistanceParts[1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class MenuItemsTest extends ActivityInstrumentationTestCase2<TrackListAct
|
|||||||
// Menu in TrackListActivity.
|
// Menu in TrackListActivity.
|
||||||
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_aggregated_statistics),
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_aggregated_statistics),
|
||||||
true);
|
true);
|
||||||
EndToEndTestUtils.SOLO.waitForText(activityMyTracks.getString(R.string.stats_total_distance));
|
EndToEndTestUtils.SOLO.waitForText(activityMyTracks.getString(R.string.stats_distance));
|
||||||
EndToEndTestUtils.SOLO.goBack();
|
EndToEndTestUtils.SOLO.goBack();
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
EndToEndTestUtils.createTrackIfEmpty(1, false);
|
EndToEndTestUtils.createTrackIfEmpty(1, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user