forked from upstream-mirrors/OpenTracks
ChartView: is not configurable anymore.
This commit is contained in:
@@ -257,9 +257,8 @@ public abstract class ChartFragment extends Fragment implements TrackDataListene
|
|||||||
}
|
}
|
||||||
reportSpeed = speed;
|
reportSpeed = speed;
|
||||||
chartView.setReportSpeed(reportSpeed);
|
chartView.setReportSpeed(reportSpeed);
|
||||||
boolean chartShowSpeed = PreferencesUtils.shouldChartShowSpeed(getActivity());
|
setSeriesEnabled(ChartView.SPEED_SERIES, reportSpeed);
|
||||||
setSeriesEnabled(ChartView.SPEED_SERIES, chartShowSpeed && reportSpeed);
|
setSeriesEnabled(ChartView.PACE_SERIES, !reportSpeed);
|
||||||
setSeriesEnabled(ChartView.PACE_SERIES, chartShowSpeed && !reportSpeed);
|
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -296,26 +295,14 @@ public abstract class ChartFragment extends Fragment implements TrackDataListene
|
|||||||
*/
|
*/
|
||||||
private void checkChartSettings() {
|
private void checkChartSettings() {
|
||||||
boolean needUpdate = false;
|
boolean needUpdate = false;
|
||||||
if (setSeriesEnabled(ChartView.ELEVATION_SERIES, PreferencesUtils.shouldChartShowElevation(getActivity()))) {
|
|
||||||
|
if (setSeriesEnabled(ChartView.SPEED_SERIES, reportSpeed)) {
|
||||||
|
needUpdate = true;
|
||||||
|
}
|
||||||
|
if (setSeriesEnabled(ChartView.PACE_SERIES, !reportSpeed)) {
|
||||||
needUpdate = true;
|
needUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean chartShowSpeed = PreferencesUtils.shouldChartShowSpeed(getActivity());
|
|
||||||
if (setSeriesEnabled(ChartView.SPEED_SERIES, chartShowSpeed && reportSpeed)) {
|
|
||||||
needUpdate = true;
|
|
||||||
}
|
|
||||||
if (setSeriesEnabled(ChartView.PACE_SERIES, chartShowSpeed && !reportSpeed)) {
|
|
||||||
needUpdate = true;
|
|
||||||
}
|
|
||||||
if (setSeriesEnabled(ChartView.POWER_SERIES, PreferencesUtils.shouldChartShowPower(getActivity()))) {
|
|
||||||
needUpdate = true;
|
|
||||||
}
|
|
||||||
if (setSeriesEnabled(ChartView.CADENCE_SERIES, PreferencesUtils.shouldChartShowCadence(getActivity()))) {
|
|
||||||
needUpdate = true;
|
|
||||||
}
|
|
||||||
if (setSeriesEnabled(ChartView.HEART_RATE_SERIES, PreferencesUtils.shouldChartShowHeartRate(getActivity()))) {
|
|
||||||
needUpdate = true;
|
|
||||||
}
|
|
||||||
if (needUpdate) {
|
if (needUpdate) {
|
||||||
chartView.postInvalidate();
|
chartView.postInvalidate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,14 +73,6 @@ public class SettingsActivity extends AppCompatActivity implements ChooseActivit
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (PreferencesUtils.isKey(getActivity(), R.string.stats_rate_key, key)) {
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
updateSpeed();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -104,7 +96,6 @@ public class SettingsActivity extends AppCompatActivity implements ChooseActivit
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
PreferencesUtils.getSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
PreferencesUtils.getSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
||||||
updateSpeed();
|
|
||||||
updateUnits();
|
updateUnits();
|
||||||
updateReset();
|
updateReset();
|
||||||
updateBluetooth();
|
updateBluetooth();
|
||||||
@@ -150,11 +141,6 @@ public class SettingsActivity extends AppCompatActivity implements ChooseActivit
|
|||||||
resetPreference.setEnabled(!isRecording);
|
resetPreference.setEnabled(!isRecording);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSpeed() {
|
|
||||||
Preference speedCheckBoxPreference = findPreference(getString(R.string.chart_show_speed_key));
|
|
||||||
speedCheckBoxPreference.setTitle(PreferencesUtils.isReportSpeed(getActivity()) ? R.string.stats_speed : R.string.stats_pace);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateBluetooth() {
|
private void updateBluetooth() {
|
||||||
// Disable Bluetooth preference if device does not have Bluetooth
|
// Disable Bluetooth preference if device does not have Bluetooth
|
||||||
BluetoothLePreference bluetoothPreference = findPreference(getString(R.string.settings_sensor_bluetooth_heart_rate_key));
|
BluetoothLePreference bluetoothPreference = findPreference(getString(R.string.settings_sensor_bluetooth_heart_rate_key));
|
||||||
|
|||||||
@@ -265,31 +265,6 @@ public class PreferencesUtils {
|
|||||||
return PreferencesUtils.getString(context, R.string.settings_sensor_bluetooth_heart_rate_key, getBluetoothHeartRateSensorAddressNone(context));
|
return PreferencesUtils.getString(context, R.string.settings_sensor_bluetooth_heart_rate_key, getBluetoothHeartRateSensorAddressNone(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean shouldChartShowCadence(Context context) {
|
|
||||||
final boolean CHART_SHOW_CADENCE = context.getResources().getBoolean(R.bool.chart_show_cadence_default);
|
|
||||||
return PreferencesUtils.getBoolean(context, R.string.chart_show_cadence_key, CHART_SHOW_CADENCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean shouldChartShowElevation(Context context) {
|
|
||||||
final boolean CHART_SHOW_ELEVATION = context.getResources().getBoolean(R.bool.chart_show_elevation_default);
|
|
||||||
return PreferencesUtils.getBoolean(context, R.string.chart_show_elevation_key, CHART_SHOW_ELEVATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean shouldChartShowHeartRate(Context context) {
|
|
||||||
final boolean CHART_SHOW_HEARTRATE = context.getResources().getBoolean(R.bool.chart_show_heart_rate_default);
|
|
||||||
return PreferencesUtils.getBoolean(context, R.string.chart_show_heart_rate_key, CHART_SHOW_HEARTRATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean shouldChartShowPower(Context context) {
|
|
||||||
final boolean CHART_SHOW_POWER = context.getResources().getBoolean(R.bool.chart_show_power_default);
|
|
||||||
return PreferencesUtils.getBoolean(context, R.string.chart_show_power_key, CHART_SHOW_POWER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean shouldChartShowSpeed(Context context) {
|
|
||||||
final boolean CHART_SHOW_SPEED = context.getResources().getBoolean(R.bool.chart_show_speed_default);
|
|
||||||
return PreferencesUtils.getBoolean(context, R.string.chart_show_speed_key, CHART_SHOW_SPEED);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean shouldShowStatsOnLockscreen(Context context) {
|
public static boolean shouldShowStatsOnLockscreen(Context context) {
|
||||||
final boolean STATS_SHOW_ON_LOCKSCREEN_DEFAULT = context.getResources().getBoolean(R.bool.stats_show_on_lockscreen_while_recording_default);
|
final boolean STATS_SHOW_ON_LOCKSCREEN_DEFAULT = context.getResources().getBoolean(R.bool.stats_show_on_lockscreen_while_recording_default);
|
||||||
return getBoolean(context, R.string.stats_show_on_lockscreen_while_recording_key, STATS_SHOW_ON_LOCKSCREEN_DEFAULT);
|
return getBoolean(context, R.string.stats_show_on_lockscreen_while_recording_key, STATS_SHOW_ON_LOCKSCREEN_DEFAULT);
|
||||||
|
|||||||
@@ -1,21 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- Do not translate anything in this file directly. -->
|
<!-- Do not translate anything in this file directly. -->
|
||||||
<string name="chart_show_cadence_key" translatable="false">chartShowCadence</string>
|
|
||||||
<bool name="chart_show_cadence_default" translatable="false">true</bool>
|
|
||||||
|
|
||||||
<string name="chart_show_elevation_key" translatable="false">chartShowElevation</string>
|
|
||||||
<bool name="chart_show_elevation_default" translatable="false">true</bool>
|
|
||||||
|
|
||||||
<string name="chart_show_heart_rate_key" translatable="false">chartShowHeartRate</string>
|
|
||||||
<bool name="chart_show_heart_rate_default" translatable="false">true</bool>
|
|
||||||
|
|
||||||
<string name="chart_show_power_key" translatable="false">chartShowPower</string>
|
|
||||||
<bool name="chart_show_power_default" translatable="false">true</bool>
|
|
||||||
|
|
||||||
<string name="chart_show_speed_key" translatable="false">chartShowSpeed</string>
|
|
||||||
<bool name="chart_show_speed_default" translatable="false">true</bool>
|
|
||||||
|
|
||||||
<string name="stats_show_coordinate_key" translatable="false">statsShowCoordinate</string>
|
<string name="stats_show_coordinate_key" translatable="false">statsShowCoordinate</string>
|
||||||
<bool name="stats_show_coordinate_default" translatable="false">false</bool>
|
<bool name="stats_show_coordinate_default" translatable="false">false</bool>
|
||||||
|
|
||||||
|
|||||||
@@ -37,4 +37,19 @@
|
|||||||
<item>-50</item>
|
<item>-50</item>
|
||||||
<item>-100</item>
|
<item>-100</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string name="chart_show_cadence_key" translatable="false">chartShowCadence</string>
|
||||||
|
<bool name="chart_show_cadence_default" translatable="false">true</bool>
|
||||||
|
|
||||||
|
<string name="chart_show_elevation_key" translatable="false">chartShowElevation</string>
|
||||||
|
<bool name="chart_show_elevation_default" translatable="false">true</bool>
|
||||||
|
|
||||||
|
<string name="chart_show_heart_rate_key" translatable="false">chartShowHeartRate</string>
|
||||||
|
<bool name="chart_show_heart_rate_default" translatable="false">true</bool>
|
||||||
|
|
||||||
|
<string name="chart_show_power_key" translatable="false">chartShowPower</string>
|
||||||
|
<bool name="chart_show_power_default" translatable="false">true</bool>
|
||||||
|
|
||||||
|
<string name="chart_show_speed_key" translatable="false">chartShowSpeed</string>
|
||||||
|
<bool name="chart_show_speed_default" translatable="false">true</bool>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -53,21 +53,6 @@ limitations under the License.
|
|||||||
android:title="@string/settings_stats_coordinate" />
|
android:title="@string/settings_stats_coordinate" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/track_detail_chart_tab">
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:key="@string/chart_show_elevation_key"
|
|
||||||
android:title="@string/stats_elevation" />
|
|
||||||
<!-- title set in code -->
|
|
||||||
<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" />
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/settings_recording">
|
<PreferenceCategory android:title="@string/settings_recording">
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="@bool/stats_show_on_lockscreen_while_recording_default"
|
android:defaultValue="@bool/stats_show_on_lockscreen_while_recording_default"
|
||||||
|
|||||||
Reference in New Issue
Block a user