forked from upstream-mirrors/OpenTracks
Move chart settings to ChartSettingsActivity.
This commit is contained in:
@@ -208,6 +208,7 @@ limitations under the License.
|
|||||||
<activity android:name="com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity" />
|
<activity android:name="com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity" />
|
||||||
<activity android:name="com.google.android.apps.mytracks.io.sendtogoogle.UploadServiceChooserActivity" />
|
<activity android:name="com.google.android.apps.mytracks.io.sendtogoogle.UploadServiceChooserActivity" />
|
||||||
<activity android:name="com.google.android.apps.mytracks.settings.BackupSettingsActivity" />
|
<activity android:name="com.google.android.apps.mytracks.settings.BackupSettingsActivity" />
|
||||||
|
<activity android:name="com.google.android.apps.mytracks.settings.ChartSettingsActivity" />
|
||||||
<activity android:name="com.google.android.apps.mytracks.settings.MapSettingsActivity" />
|
<activity android:name="com.google.android.apps.mytracks.settings.MapSettingsActivity" />
|
||||||
<activity android:name="com.google.android.apps.mytracks.settings.RecordingSettingsActivity" />
|
<activity android:name="com.google.android.apps.mytracks.settings.RecordingSettingsActivity" />
|
||||||
<activity android:name="com.google.android.apps.mytracks.settings.SensorSettingsActivity" />
|
<activity android:name="com.google.android.apps.mytracks.settings.SensorSettingsActivity" />
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 286 B |
Binary file not shown.
|
Before Width: | Height: | Size: 275 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -1,66 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright 2009 Google Inc.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
style="@style/ScrollView" >
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="8dp" >
|
|
||||||
<TextView
|
|
||||||
android:drawableLeft="@drawable/x_axis"
|
|
||||||
android:text="@string/chart_settings_x_axis"
|
|
||||||
style="@style/TextLarge.WithIcon" />
|
|
||||||
<RadioGroup
|
|
||||||
android:id="@+id/chart_settings_x"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content" >
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/chart_settings_by_distance"
|
|
||||||
android:text="@string/chart_settings_by_distance"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/chart_settings_by_time"
|
|
||||||
android:text="@string/chart_settings_by_time"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
</RadioGroup>
|
|
||||||
<TextView
|
|
||||||
android:drawableLeft="@drawable/y_axis"
|
|
||||||
android:text="@string/chart_settings_y_axis"
|
|
||||||
style="@style/TextLarge.WithIcon" />
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/chart_settings_elevation"
|
|
||||||
android:text="@string/stats_elevation"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/chart_settings_speed"
|
|
||||||
android:text="@string/stats_speed"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/chart_settings_power"
|
|
||||||
android:text="@string/sensor_state_power"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/chart_settings_cadence"
|
|
||||||
android:text="@string/sensor_state_cadence"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/chart_settings_heart_rate"
|
|
||||||
android:text="@string/sensor_state_heart_rate"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
</LinearLayout>
|
|
||||||
</ScrollView>
|
|
||||||
@@ -84,10 +84,6 @@ limitations under the License.
|
|||||||
android:icon="@drawable/menu_sensor_state"
|
android:icon="@drawable/menu_sensor_state"
|
||||||
android:id="@+id/track_detail_sensor_state"
|
android:id="@+id/track_detail_sensor_state"
|
||||||
android:title="@string/menu_sensor_state"/>
|
android:title="@string/menu_sensor_state"/>
|
||||||
<item
|
|
||||||
android:icon="@drawable/menu_chart_settings"
|
|
||||||
android:id="@+id/track_detail_chart_settings"
|
|
||||||
android:title="@string/menu_chart_settings"/>
|
|
||||||
<item
|
<item
|
||||||
android:icon="@drawable/menu_settings"
|
android:icon="@drawable/menu_settings"
|
||||||
android:id="@+id/track_detail_settings"
|
android:id="@+id/track_detail_settings"
|
||||||
|
|||||||
@@ -25,6 +25,12 @@ limitations under the License.
|
|||||||
<string name="auto_resume_track_current_retry_key">autoResumeTrackCurrentRetry</string>
|
<string name="auto_resume_track_current_retry_key">autoResumeTrackCurrentRetry</string>
|
||||||
<string name="auto_resume_track_timeout_key">autoResumeTrackTimeout</string>
|
<string name="auto_resume_track_timeout_key">autoResumeTrackTimeout</string>
|
||||||
<string name="bluetooth_sensor_key">bluetoothSensor</string>
|
<string name="bluetooth_sensor_key">bluetoothSensor</string>
|
||||||
|
<string name="chart_by_distance_key">chartByDistance</string>
|
||||||
|
<string name="chart_show_cadence_key">chartShowCadence</string>
|
||||||
|
<string name="chart_show_elevation_key">chartShowElevation</string>
|
||||||
|
<string name="chart_show_heart_rate_key">chartShowHeartRate</string>
|
||||||
|
<string name="chart_show_power_key">chartShowPower</string>
|
||||||
|
<string name="chart_show_speed_key">chartShowSpeed</string>
|
||||||
<string name="default_activity_key">defaultActivity</string>
|
<string name="default_activity_key">defaultActivity</string>
|
||||||
<string name="default_map_public_key">defaultMapPublic</string>
|
<string name="default_map_public_key">defaultMapPublic</string>
|
||||||
<string name="max_recording_distance_key">maxRecordingDistance</string>
|
<string name="max_recording_distance_key">maxRecordingDistance</string>
|
||||||
@@ -55,11 +61,11 @@ limitations under the License.
|
|||||||
<string name="track_color_mode_slow_key">trackColorModeSlow</string>
|
<string name="track_color_mode_slow_key">trackColorModeSlow</string>
|
||||||
<string name="track_color_mode_key">trackColorMode</string>
|
<string name="track_color_mode_key">trackColorMode</string>
|
||||||
<string name="track_name_key">trackName</string>
|
<string name="track_name_key">trackName</string>
|
||||||
|
|
||||||
<!-- Keys for non-persisted preferences. Sorted alphabetically. DO NOT TRANSLATE. -->
|
<!-- Keys for non-persisted preferences. Sorted alphabetically. DO NOT TRANSLATE. -->
|
||||||
<string name="backup_to_sd_key">backupToSd</string>
|
<string name="backup_to_sd_key">backupToSd</string>
|
||||||
<string name="restore_from_sd_key">restoreFromSd</string>
|
<string name="restore_from_sd_key">restoreFromSd</string>
|
||||||
<string name="settings_backup_key">settingsBackup</string>
|
<string name="settings_backup_key">settingsBackup</string>
|
||||||
|
<string name="settings_chart_key">settingsChart</string>
|
||||||
<string name="settings_map_key">settingsMap</string>
|
<string name="settings_map_key">settingsMap</string>
|
||||||
<string name="settings_map_medium_display_key">settingsMapMediumDisplay</string>
|
<string name="settings_map_medium_display_key">settingsMapMediumDisplay</string>
|
||||||
<string name="settings_map_percentage_display_key">settingsMapPercentageDisplay</string>
|
<string name="settings_map_percentage_display_key">settingsMapPercentageDisplay</string>
|
||||||
|
|||||||
@@ -416,30 +416,6 @@ limitations under the License.
|
|||||||
Record and share your GPS tracks with My Tracks.
|
Record and share your GPS tracks with My Tracks.
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<!-- Chart Settings -->
|
|
||||||
<string name="chart_settings_by_distance"
|
|
||||||
translation_description="In the 'Chart settings' dialog, under the 'X axis' section, the radio
|
|
||||||
option to show the charts by distance. The other radio option is to show by time. User can
|
|
||||||
only choose one of the options.">
|
|
||||||
By distance
|
|
||||||
</string>
|
|
||||||
<string name="chart_settings_by_time"
|
|
||||||
translation_description="In the 'Chart settings' dialog, under the 'X axis' section, the radio
|
|
||||||
option to show the charts by time. The other radio option is to show by distance. User can
|
|
||||||
only choose one of the options.">
|
|
||||||
By time
|
|
||||||
</string>
|
|
||||||
<string name="chart_settings_x_axis"
|
|
||||||
translation_description="In the 'Chart settings' dialog, the section label for configuring the X
|
|
||||||
axis.">
|
|
||||||
X axis
|
|
||||||
</string>
|
|
||||||
<string name="chart_settings_y_axis"
|
|
||||||
translation_description="In the 'Chart settings' dialog, the section label for configuring the Y
|
|
||||||
axis.">
|
|
||||||
Y axis
|
|
||||||
</string>
|
|
||||||
|
|
||||||
<!-- Description -->
|
<!-- Description -->
|
||||||
<string name="description_activity_type"
|
<string name="description_activity_type"
|
||||||
translation_description="Activity type description.
|
translation_description="Activity type description.
|
||||||
@@ -1034,10 +1010,6 @@ limitations under the License.
|
|||||||
translation_description="In the menu, to go to the aggregated statistics page.">
|
translation_description="In the menu, to go to the aggregated statistics page.">
|
||||||
Aggregated statistics
|
Aggregated statistics
|
||||||
</string>
|
</string>
|
||||||
<string name="menu_chart_settings"
|
|
||||||
translation_description="In the menu, to change the chart settings.">
|
|
||||||
Chart settings
|
|
||||||
</string>
|
|
||||||
<string name="menu_delete_all"
|
<string name="menu_delete_all"
|
||||||
translation_description="In the menu, to delete all the tracks.">
|
translation_description="In the menu, to delete all the tracks.">
|
||||||
Delete all
|
Delete all
|
||||||
@@ -1521,6 +1493,22 @@ limitations under the License.
|
|||||||
Restore all tracks and settings from the SD card.
|
Restore all tracks and settings from the SD card.
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
<!-- Settings Chart -->
|
||||||
|
<string name="settings_chart_by_distance"
|
||||||
|
translation_description="In the 'Chart' settings, the option to display the x axis by
|
||||||
|
distance.">
|
||||||
|
By distance
|
||||||
|
</string>
|
||||||
|
<string name="settings_chart_by_time"
|
||||||
|
translation_description="In the 'Chart' settings, the option to display the x axis by time.">
|
||||||
|
By time
|
||||||
|
</string>
|
||||||
|
<string name="settings_chart_x_axis"
|
||||||
|
translation_description="In the 'Chart' setttings, the option to change the x axis display,
|
||||||
|
either by distance or by time.">
|
||||||
|
X axis
|
||||||
|
</string>
|
||||||
|
|
||||||
<!-- Settings Map -->
|
<!-- Settings Map -->
|
||||||
<string name="settings_map_medium"
|
<string name="settings_map_medium"
|
||||||
translation_description="In the 'Map' settings, under the 'Fixed thresholds' configurations, the
|
translation_description="In the 'Map' settings, under the 'Fixed thresholds' configurations, the
|
||||||
@@ -1574,6 +1562,10 @@ limitations under the License.
|
|||||||
</string>
|
</string>
|
||||||
|
|
||||||
<!-- Settings Others -->
|
<!-- Settings Others -->
|
||||||
|
<string name="settings_show"
|
||||||
|
translation_description="In settings, the section label to show additional values.">
|
||||||
|
Show
|
||||||
|
</string>
|
||||||
<string name="settings_not_while_recording"
|
<string name="settings_not_while_recording"
|
||||||
translation_description="In settings, the summary for an option that is not available during a
|
translation_description="In settings, the summary for an option that is not available during a
|
||||||
track recording.">
|
track recording.">
|
||||||
@@ -1986,10 +1978,6 @@ limitations under the License.
|
|||||||
either speed (mi/hr) or pace (hr/mi).">
|
either speed (mi/hr) or pace (hr/mi).">
|
||||||
Preferred Rate
|
Preferred Rate
|
||||||
</string>
|
</string>
|
||||||
<string name="settings_stats_show"
|
|
||||||
translation_description="In the 'Stats' settings, the section label to show additional stats.">
|
|
||||||
Show
|
|
||||||
</string>
|
|
||||||
<string name="settings_stats_time_title"
|
<string name="settings_stats_time_title"
|
||||||
translation_description="In the 'Stats' settings, the option to change the time measurement,
|
translation_description="In the 'Stats' settings, the option to change the time measurement,
|
||||||
either total time or moving time.">
|
either total time or moving time.">
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2012 Google Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:title="@string/track_detail_chart_tab" >
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="@string/chart_by_distance_key"
|
||||||
|
android:summaryOff="@string/settings_chart_by_time"
|
||||||
|
android:summaryOn="@string/settings_chart_by_distance"
|
||||||
|
android:title="@string/settings_chart_x_axis" />
|
||||||
|
<PreferenceCategory android:title="@string/settings_show" >
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="@string/chart_show_elevation_key"
|
||||||
|
android:title="@string/stats_elevation" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="@string/chart_show_speed_key" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="@string/chart_show_heart_rate_key"
|
||||||
|
android:title="@string/sensor_state_heart_rate" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="@string/chart_show_cadence_key"
|
||||||
|
android:title="@string/sensor_state_cadence" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="@string/chart_show_power_key"
|
||||||
|
android:title="@string/sensor_state_power" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
</PreferenceScreen>
|
||||||
@@ -20,6 +20,10 @@ limitations under the License.
|
|||||||
android:key="@string/settings_map_key"
|
android:key="@string/settings_map_key"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/track_detail_map_tab" />
|
android:title="@string/track_detail_map_tab" />
|
||||||
|
<Preference
|
||||||
|
android:key="@string/settings_chart_key"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/track_detail_chart_tab" />
|
||||||
<Preference
|
<Preference
|
||||||
android:key="@string/settings_stats_key"
|
android:key="@string/settings_stats_key"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ limitations under the License.
|
|||||||
android:summaryOff="@string/stats_total_time"
|
android:summaryOff="@string/stats_total_time"
|
||||||
android:summaryOn="@string/stats_moving_time"
|
android:summaryOn="@string/stats_moving_time"
|
||||||
android:title="@string/settings_stats_time_title" />
|
android:title="@string/settings_stats_time_title" />
|
||||||
<PreferenceCategory android:title="@string/settings_stats_show" >
|
<PreferenceCategory android:title="@string/settings_show" >
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="@string/stats_show_elevation_key"
|
android:key="@string/stats_show_elevation_key"
|
||||||
|
|||||||
@@ -156,12 +156,7 @@ public class ChartView extends View {
|
|||||||
private boolean metricUnits = true;
|
private boolean metricUnits = true;
|
||||||
private boolean showPointer = false;
|
private boolean showPointer = false;
|
||||||
|
|
||||||
/** Display chart versus distance or time */
|
private boolean chartByDistance = true;
|
||||||
public enum Mode {
|
|
||||||
BY_DISTANCE, BY_TIME
|
|
||||||
}
|
|
||||||
|
|
||||||
private Mode mode = Mode.BY_DISTANCE;
|
|
||||||
|
|
||||||
public ChartView(Context context) {
|
public ChartView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@@ -394,22 +389,17 @@ public class ChartView extends View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current display mode (by distance, by time)
|
* Sets chart by distance value. It is expected that after changing this
|
||||||
|
* value, data will be reloaded.
|
||||||
|
*
|
||||||
|
* @param value true for by distance, false for by time.
|
||||||
*/
|
*/
|
||||||
public Mode getMode() {
|
public void setChartByDistance(boolean value) {
|
||||||
return mode;
|
this.chartByDistance = value;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the display mode (by distance, by time).
|
|
||||||
* It is expected that after the mode change, data will be reloaded.
|
|
||||||
*/
|
|
||||||
public void setMode(Mode mode) {
|
|
||||||
this.mode = mode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getWaypointX(Waypoint waypoint) {
|
private int getWaypointX(Waypoint waypoint) {
|
||||||
if (mode == Mode.BY_DISTANCE) {
|
if (chartByDistance) {
|
||||||
double lenghtInKm = waypoint.getLength() * UnitConversions.M_TO_KM;
|
double lenghtInKm = waypoint.getLength() * UnitConversions.M_TO_KM;
|
||||||
return getX(metricUnits ? lenghtInKm : lenghtInKm * UnitConversions.KM_TO_MI);
|
return getX(metricUnits ? lenghtInKm : lenghtInKm * UnitConversions.KM_TO_MI);
|
||||||
} else {
|
} else {
|
||||||
@@ -813,8 +803,7 @@ public class ChartView extends View {
|
|||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String s =
|
String s = chartByDistance
|
||||||
(mode == Mode.BY_DISTANCE)
|
|
||||||
? (shortFormat ? X_SHORT_FORMAT.format(x) : X_FORMAT.format(x))
|
? (shortFormat ? X_SHORT_FORMAT.format(x) : X_FORMAT.format(x))
|
||||||
: StringUtils.formatElapsedTime((long) x);
|
: StringUtils.formatElapsedTime((long) x);
|
||||||
c.drawText(s,
|
c.drawText(s,
|
||||||
@@ -841,7 +830,7 @@ public class ChartView extends View {
|
|||||||
final int y = effectiveHeight + topBorder;
|
final int y = effectiveHeight + topBorder;
|
||||||
canvas.drawLine(leftBorder, y, rightEdge, y, borderPaint);
|
canvas.drawLine(leftBorder, y, rightEdge, y, borderPaint);
|
||||||
Context c = getContext();
|
Context c = getContext();
|
||||||
String s = mode == Mode.BY_DISTANCE
|
String s = chartByDistance
|
||||||
? (metricUnits ? c.getString(R.string.unit_kilometer) : c.getString(R.string.unit_mile))
|
? (metricUnits ? c.getString(R.string.unit_kilometer) : c.getString(R.string.unit_mile))
|
||||||
: c.getString(R.string.unit_minute);
|
: c.getString(R.string.unit_minute);
|
||||||
canvas.drawText(s, rightEdge, effectiveHeight + .2f * UNIT_BORDER + topBorder, labelPaint);
|
canvas.drawText(s, rightEdge, effectiveHeight + .2f * UNIT_BORDER + topBorder, labelPaint);
|
||||||
@@ -875,17 +864,6 @@ public class ChartView extends View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether a given time series is enabled for drawing.
|
|
||||||
*
|
|
||||||
* @param index the time series, one of {@link #ELEVATION_SERIES},
|
|
||||||
* {@link #SPEED_SERIES}, {@link #POWER_SERIES}, etc.
|
|
||||||
* @return true if drawn, false otherwise
|
|
||||||
*/
|
|
||||||
public boolean isChartValueSeriesEnabled(int index) {
|
|
||||||
return series[index].isEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether a given time series will be enabled for drawing.
|
* Sets whether a given time series will be enabled for drawing.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import com.google.android.apps.mytracks.content.TrackDataHub;
|
|||||||
import com.google.android.apps.mytracks.content.Waypoint;
|
import com.google.android.apps.mytracks.content.Waypoint;
|
||||||
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
|
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
|
||||||
import com.google.android.apps.mytracks.fragments.ChartFragment;
|
import com.google.android.apps.mytracks.fragments.ChartFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.ChartSettingsDialogFragment;
|
|
||||||
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.InstallEarthDialogFragment;
|
import com.google.android.apps.mytracks.fragments.InstallEarthDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.MapFragment;
|
import com.google.android.apps.mytracks.fragments.MapFragment;
|
||||||
@@ -231,8 +230,6 @@ public class TrackDetailActivity extends AbstractMyTracksActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
String currentTabTag = tabHost.getCurrentTabTag();
|
String currentTabTag = tabHost.getCurrentTabTag();
|
||||||
menu.findItem(R.id.track_detail_chart_settings).setVisible(
|
|
||||||
ChartFragment.CHART_FRAGMENT_TAG.equals(currentTabTag));
|
|
||||||
MenuItem satelliteMode = menu.findItem(R.id.track_detail_satellite_mode)
|
MenuItem satelliteMode = menu.findItem(R.id.track_detail_satellite_mode)
|
||||||
.setVisible(MapFragment.MAP_FRAGMENT_TAG.equals(currentTabTag));
|
.setVisible(MapFragment.MAP_FRAGMENT_TAG.equals(currentTabTag));
|
||||||
|
|
||||||
@@ -347,10 +344,6 @@ public class TrackDetailActivity extends AbstractMyTracksActivity {
|
|||||||
intent = IntentUtils.newIntent(this, SensorStateActivity.class);
|
intent = IntentUtils.newIntent(this, SensorStateActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_chart_settings:
|
|
||||||
new ChartSettingsDialogFragment().show(
|
|
||||||
getSupportFragmentManager(), ChartSettingsDialogFragment.CHART_SETTINGS_DIALOG_TAG);
|
|
||||||
return true;
|
|
||||||
case R.id.track_detail_settings:
|
case R.id.track_detail_settings:
|
||||||
intent = IntentUtils.newIntent(this, SettingsActivity.class);
|
intent = IntentUtils.newIntent(this, SettingsActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package com.google.android.apps.mytracks.fragments;
|
package com.google.android.apps.mytracks.fragments;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.ChartView;
|
import com.google.android.apps.mytracks.ChartView;
|
||||||
import com.google.android.apps.mytracks.ChartView.Mode;
|
|
||||||
import com.google.android.apps.mytracks.Constants;
|
import com.google.android.apps.mytracks.Constants;
|
||||||
import com.google.android.apps.mytracks.MyTracksApplication;
|
import com.google.android.apps.mytracks.MyTracksApplication;
|
||||||
import com.google.android.apps.mytracks.content.MyTracksLocation;
|
import com.google.android.apps.mytracks.content.MyTracksLocation;
|
||||||
@@ -31,6 +30,7 @@ import com.google.android.apps.mytracks.content.Waypoint;
|
|||||||
import com.google.android.apps.mytracks.stats.DoubleBuffer;
|
import com.google.android.apps.mytracks.stats.DoubleBuffer;
|
||||||
import com.google.android.apps.mytracks.stats.TripStatisticsBuilder;
|
import com.google.android.apps.mytracks.stats.TripStatisticsBuilder;
|
||||||
import com.google.android.apps.mytracks.util.LocationUtils;
|
import com.google.android.apps.mytracks.util.LocationUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
import com.google.android.apps.mytracks.util.UnitConversions;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
@@ -76,6 +76,9 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
private boolean metricUnits = true;
|
private boolean metricUnits = true;
|
||||||
private boolean reportSpeed = true;
|
private boolean reportSpeed = true;
|
||||||
|
|
||||||
|
private boolean chartByDistance = true;
|
||||||
|
private boolean[] chartShow = new boolean[] {true, true, true, true, true};
|
||||||
|
|
||||||
// UI elements
|
// UI elements
|
||||||
private ChartView chartView;
|
private ChartView chartView;
|
||||||
private ZoomControls zoomControls;
|
private ZoomControls zoomControls;
|
||||||
@@ -143,6 +146,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
resumeTrackDataHub();
|
resumeTrackDataHub();
|
||||||
|
checkChartSettings();
|
||||||
getActivity().runOnUiThread(updateChart);
|
getActivity().runOnUiThread(updateChart);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,58 +163,6 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
layout.removeView(chartView);
|
layout.removeView(chartView);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the chart view mode.
|
|
||||||
*
|
|
||||||
* @param mode the chart view mode
|
|
||||||
*/
|
|
||||||
public void setMode(Mode mode) {
|
|
||||||
if (chartView.getMode() != mode) {
|
|
||||||
chartView.setMode(mode);
|
|
||||||
reloadTrackDataHub();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the chart view mode.
|
|
||||||
*/
|
|
||||||
public Mode getMode() {
|
|
||||||
return chartView.getMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables or disables the chart value series.
|
|
||||||
*
|
|
||||||
* @param index the index of the series
|
|
||||||
* @param enabled true to enable, false to disable
|
|
||||||
*/
|
|
||||||
public void setChartValueSeriesEnabled(int index, boolean enabled) {
|
|
||||||
chartView.setChartValueSeriesEnabled(index, enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the chart value series is enabled.
|
|
||||||
*
|
|
||||||
* @param index the index of the series
|
|
||||||
*/
|
|
||||||
public boolean isChartValueSeriesEnabled(int index) {
|
|
||||||
return chartView.isChartValueSeriesEnabled(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true to report speed instead of pace.
|
|
||||||
*/
|
|
||||||
public boolean isReportSpeed() {
|
|
||||||
return reportSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the chart.
|
|
||||||
*/
|
|
||||||
public void update() {
|
|
||||||
chartView.postInvalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProviderStateChange(ProviderState state) {
|
public void onProviderStateChange(ProviderState state) {
|
||||||
// We don't care.
|
// We don't care.
|
||||||
@@ -338,6 +290,60 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the chart settings.
|
||||||
|
*/
|
||||||
|
private void checkChartSettings() {
|
||||||
|
boolean needUpdate = false;
|
||||||
|
if (chartByDistance != PreferencesUtils.getBoolean(getActivity(),
|
||||||
|
R.string.chart_by_distance_key, PreferencesUtils.CHART_BY_DISTANCE_DEFAULT)) {
|
||||||
|
chartByDistance = !chartByDistance;
|
||||||
|
chartView.setChartByDistance(chartByDistance);
|
||||||
|
reloadTrackDataHub();
|
||||||
|
needUpdate = true;
|
||||||
|
}
|
||||||
|
if (setSeriesEnabled(ChartView.ELEVATION_SERIES, PreferencesUtils.getBoolean(getActivity(),
|
||||||
|
R.string.chart_show_elevation_key, PreferencesUtils.CHART_SHOW_ELEVATION_DEFAULT))) {
|
||||||
|
needUpdate = true;
|
||||||
|
}
|
||||||
|
if (setSeriesEnabled(ChartView.SPEED_SERIES, PreferencesUtils.getBoolean(
|
||||||
|
getActivity(), R.string.chart_show_speed_key, PreferencesUtils.CHART_SHOW_SPEED_DEFAULT))) {
|
||||||
|
needUpdate = true;
|
||||||
|
}
|
||||||
|
if (setSeriesEnabled(ChartView.POWER_SERIES, PreferencesUtils.getBoolean(
|
||||||
|
getActivity(), R.string.chart_show_power_key, PreferencesUtils.CHART_SHOW_POWER_DEFAULT))) {
|
||||||
|
needUpdate = true;
|
||||||
|
}
|
||||||
|
if (setSeriesEnabled(ChartView.CADENCE_SERIES, PreferencesUtils.getBoolean(getActivity(),
|
||||||
|
R.string.chart_show_cadence_key, PreferencesUtils.CHART_SHOW_CADENCE_DEFAULT))) {
|
||||||
|
needUpdate = true;
|
||||||
|
}
|
||||||
|
if (setSeriesEnabled(ChartView.HEART_RATE_SERIES, PreferencesUtils.getBoolean(getActivity(),
|
||||||
|
R.string.chart_show_heart_rate_key, PreferencesUtils.CHART_SHOW_HEART_RATE_DEFAULT))) {
|
||||||
|
needUpdate = true;
|
||||||
|
}
|
||||||
|
if (needUpdate) {
|
||||||
|
chartView.postInvalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the series enabled value.
|
||||||
|
*
|
||||||
|
* @param index the series index
|
||||||
|
* @param value the value
|
||||||
|
* @return true if changed
|
||||||
|
*/
|
||||||
|
private boolean setSeriesEnabled(int index, boolean value) {
|
||||||
|
if (chartShow[index] != value) {
|
||||||
|
chartShow[index] = value;
|
||||||
|
chartView.setChartValueSeriesEnabled(index, value);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resumes the trackDataHub. Needs to be synchronized because trackDataHub can be
|
* Resumes the trackDataHub. Needs to be synchronized because trackDataHub can be
|
||||||
* accessed by multiple threads.
|
* accessed by multiple threads.
|
||||||
@@ -354,8 +360,8 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pauses the trackDataHub. Needs to be synchronized because trackDataHub can be
|
* Pauses the trackDataHub. Needs to be synchronized because trackDataHub can
|
||||||
* accessed by multiple threads.
|
* be accessed by multiple threads.
|
||||||
*/
|
*/
|
||||||
private synchronized void pauseTrackDataHub() {
|
private synchronized void pauseTrackDataHub() {
|
||||||
trackDataHub.unregisterTrackDataListener(this);
|
trackDataHub.unregisterTrackDataListener(this);
|
||||||
@@ -420,7 +426,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
double heartRate = Double.NaN;
|
double heartRate = Double.NaN;
|
||||||
|
|
||||||
// TODO: Use TripStatisticsBuilder
|
// TODO: Use TripStatisticsBuilder
|
||||||
if (chartView.getMode() == Mode.BY_DISTANCE) {
|
if (chartByDistance) {
|
||||||
if (lastLocation != null) {
|
if (lastLocation != null) {
|
||||||
double distance = lastLocation.distanceTo(location) * UnitConversions.M_TO_KM;
|
double distance = lastLocation.distanceTo(location) * UnitConversions.M_TO_KM;
|
||||||
if (metricUnits) {
|
if (metricUnits) {
|
||||||
@@ -512,4 +518,8 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
void setReportSpeed(boolean value) {
|
void setReportSpeed(boolean value) {
|
||||||
reportSpeed = value;
|
reportSpeed = value;
|
||||||
}
|
}
|
||||||
|
@VisibleForTesting
|
||||||
|
void setChartByDistance(boolean value) {
|
||||||
|
chartByDistance = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-84
@@ -1,84 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012 Google Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
||||||
* use this file except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing permissions and limitations under
|
|
||||||
* the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.google.android.apps.mytracks.fragments;
|
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.ChartView;
|
|
||||||
import com.google.android.maps.mytracks.R;
|
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.RadioGroup;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A DialogFragment to show chart settings.
|
|
||||||
*
|
|
||||||
* @author Jimmy Shih
|
|
||||||
*/
|
|
||||||
public class ChartSettingsDialogFragment extends DialogFragment {
|
|
||||||
|
|
||||||
public static final String CHART_SETTINGS_DIALOG_TAG = "chartSettingsDialog";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
||||||
final ChartFragment chartFragment = (ChartFragment) getActivity()
|
|
||||||
.getSupportFragmentManager().findFragmentByTag(ChartFragment.CHART_FRAGMENT_TAG);
|
|
||||||
View view = getActivity().getLayoutInflater().inflate(R.layout.chart_settings, null);
|
|
||||||
final RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.chart_settings_x);
|
|
||||||
radioGroup.check(chartFragment.getMode() == ChartView.Mode.BY_DISTANCE
|
|
||||||
? R.id.chart_settings_by_distance : R.id.chart_settings_by_time);
|
|
||||||
|
|
||||||
final CheckBox[] checkBoxes = new CheckBox[ChartView.NUM_SERIES];
|
|
||||||
checkBoxes[ChartView.ELEVATION_SERIES] = (CheckBox) view.findViewById(
|
|
||||||
R.id.chart_settings_elevation);
|
|
||||||
checkBoxes[ChartView.SPEED_SERIES] = (CheckBox) view.findViewById(R.id.chart_settings_speed);
|
|
||||||
checkBoxes[ChartView.POWER_SERIES] = (CheckBox) view.findViewById(R.id.chart_settings_power);
|
|
||||||
checkBoxes[ChartView.CADENCE_SERIES] = (CheckBox) view.findViewById(
|
|
||||||
R.id.chart_settings_cadence);
|
|
||||||
checkBoxes[ChartView.HEART_RATE_SERIES] = (CheckBox) view.findViewById(
|
|
||||||
R.id.chart_settings_heart_rate);
|
|
||||||
|
|
||||||
// set checkboxes values
|
|
||||||
for (int i = 0; i < ChartView.NUM_SERIES; i++) {
|
|
||||||
checkBoxes[i].setChecked(chartFragment.isChartValueSeriesEnabled(i));
|
|
||||||
}
|
|
||||||
checkBoxes[ChartView.SPEED_SERIES].setText(chartFragment.isReportSpeed()
|
|
||||||
? R.string.stats_speed : R.string.stats_pace);
|
|
||||||
|
|
||||||
return new AlertDialog.Builder(getActivity())
|
|
||||||
.setNegativeButton(R.string.generic_cancel, null)
|
|
||||||
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
chartFragment.setMode(
|
|
||||||
radioGroup.getCheckedRadioButtonId() == R.id.chart_settings_by_distance
|
|
||||||
? ChartView.Mode.BY_DISTANCE : ChartView.Mode.BY_TIME);
|
|
||||||
for (int i = 0; i < ChartView.NUM_SERIES; i++) {
|
|
||||||
chartFragment.setChartValueSeriesEnabled(i, checkBoxes[i].isChecked());
|
|
||||||
}
|
|
||||||
chartFragment.update();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setTitle(R.string.menu_chart_settings)
|
|
||||||
.setView(view)
|
|
||||||
.create();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012 Google Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of
|
||||||
|
* the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations under
|
||||||
|
* the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.android.apps.mytracks.settings;
|
||||||
|
|
||||||
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.CheckBoxPreference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An activity for accessing chart settings.
|
||||||
|
*
|
||||||
|
* @author Jimmy Shih
|
||||||
|
*/
|
||||||
|
public class ChartSettingsActivity extends AbstractSettingsActivity {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle bundle) {
|
||||||
|
super.onCreate(bundle);
|
||||||
|
addPreferencesFromResource(R.xml.chart_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
updateUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private void updateUi() {
|
||||||
|
CheckBoxPreference speedCheckBoxPreference = (CheckBoxPreference) findPreference(
|
||||||
|
getString(R.string.chart_show_speed_key));
|
||||||
|
boolean reportSpeed = PreferencesUtils.getBoolean(
|
||||||
|
this, R.string.report_speed_key, PreferencesUtils.REPORT_SPEED_DEFAULT);
|
||||||
|
speedCheckBoxPreference.setTitle(reportSpeed ? R.string.stats_speed
|
||||||
|
: R.string.stats_pace);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,6 +62,16 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Preference chartPreference = findPreference(getString(R.string.settings_chart_key));
|
||||||
|
chartPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
|
Intent intent = IntentUtils.newIntent(SettingsActivity.this, ChartSettingsActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Preference statsPreference = findPreference(getString(R.string.settings_stats_key));
|
Preference statsPreference = findPreference(getString(R.string.settings_stats_key));
|
||||||
statsPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
statsPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -42,6 +42,14 @@ public class PreferencesUtils {
|
|||||||
public static final int AUTO_RESUME_TRACK_TIMEOUT_NEVER = 0;
|
public static final int AUTO_RESUME_TRACK_TIMEOUT_NEVER = 0;
|
||||||
|
|
||||||
public static final String BLUETOOTH_SENSOR_DEFAULT = "";
|
public static final String BLUETOOTH_SENSOR_DEFAULT = "";
|
||||||
|
|
||||||
|
public static final boolean CHART_BY_DISTANCE_DEFAULT = true;
|
||||||
|
public static final boolean CHART_SHOW_CADENCE_DEFAULT = true;
|
||||||
|
public static final boolean CHART_SHOW_ELEVATION_DEFAULT = true;
|
||||||
|
public static final boolean CHART_SHOW_HEART_RATE_DEFAULT = true;
|
||||||
|
public static final boolean CHART_SHOW_POWER_DEFAULT = true;
|
||||||
|
public static final boolean CHART_SHOW_SPEED_DEFAULT = true;
|
||||||
|
|
||||||
public static final String DEFAULT_ACTIVITY_DEFAULT = "";
|
public static final String DEFAULT_ACTIVITY_DEFAULT = "";
|
||||||
public static final boolean DEFAULT_MAP_PUBLIC_DEFAULT = true;
|
public static final boolean DEFAULT_MAP_PUBLIC_DEFAULT = true;
|
||||||
public static final int MAX_RECORDING_DISTANCE_DEFAULT = 200;
|
public static final int MAX_RECORDING_DISTANCE_DEFAULT = 200;
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class ChartFragmentTest extends AndroidTestCase {
|
|||||||
*/
|
*/
|
||||||
public void testFillDataPoint_distanceMetric() {
|
public void testFillDataPoint_distanceMetric() {
|
||||||
// By distance.
|
// By distance.
|
||||||
chartFragment.getChartView().setMode(ChartView.Mode.BY_DISTANCE);
|
chartFragment.setChartByDistance(true);
|
||||||
// Resets last location and writes first location.
|
// Resets last location and writes first location.
|
||||||
MyTracksLocation myTracksLocation1 = TrackStubUtils.createMyTracksLocation();
|
MyTracksLocation myTracksLocation1 = TrackStubUtils.createMyTracksLocation();
|
||||||
double[] point = fillDataPointTestHelper(myTracksLocation1);
|
double[] point = fillDataPointTestHelper(myTracksLocation1);
|
||||||
@@ -160,6 +160,8 @@ public class ChartFragmentTest extends AndroidTestCase {
|
|||||||
* {@link ChartFragment#fillDataPoint(Location, double[])}.
|
* {@link ChartFragment#fillDataPoint(Location, double[])}.
|
||||||
*/
|
*/
|
||||||
public void testFillDataPoint_distanceImperial() {
|
public void testFillDataPoint_distanceImperial() {
|
||||||
|
// By distance.
|
||||||
|
chartFragment.setChartByDistance(true);
|
||||||
// Setups to use imperial.
|
// Setups to use imperial.
|
||||||
chartFragment.setMetricUnits(false);
|
chartFragment.setMetricUnits(false);
|
||||||
|
|
||||||
@@ -204,7 +206,7 @@ public class ChartFragmentTest extends AndroidTestCase {
|
|||||||
*/
|
*/
|
||||||
public void testFillDataPoint_time() {
|
public void testFillDataPoint_time() {
|
||||||
// By time
|
// By time
|
||||||
chartFragment.getChartView().setMode(ChartView.Mode.BY_TIME);
|
chartFragment.setChartByDistance(false);
|
||||||
MyTracksLocation myTracksLocation1 = TrackStubUtils.createMyTracksLocation();
|
MyTracksLocation myTracksLocation1 = TrackStubUtils.createMyTracksLocation();
|
||||||
double[] point = fillDataPointTestHelper(myTracksLocation1);
|
double[] point = fillDataPointTestHelper(myTracksLocation1);
|
||||||
assertEquals(0.0, point[0]);
|
assertEquals(0.0, point[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user