forked from upstream-mirrors/OpenTracks
Merge to head
This commit is contained in:
+6
-3
@@ -44,7 +44,8 @@ public class DynamicSpeedTrackPathDescriptor
|
||||
|
||||
public DynamicSpeedTrackPathDescriptor(Context context){
|
||||
this.context = context;
|
||||
SharedPreferences prefs = context.getSharedPreferences(Constants.SETTINGS_NAME, 0);
|
||||
SharedPreferences prefs = context.getSharedPreferences(
|
||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
|
||||
if (prefs == null) {
|
||||
speedMargin = 25;
|
||||
@@ -83,7 +84,8 @@ public class DynamicSpeedTrackPathDescriptor
|
||||
|| !key.equals(context.getString(R.string.track_color_mode_dynamic_speed_variation_key))) {
|
||||
return;
|
||||
}
|
||||
SharedPreferences prefs = context.getSharedPreferences(Constants.SETTINGS_NAME, 0);
|
||||
SharedPreferences prefs = context.getSharedPreferences(
|
||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
|
||||
if (prefs == null) {
|
||||
speedMargin = 25;
|
||||
@@ -98,7 +100,8 @@ public class DynamicSpeedTrackPathDescriptor
|
||||
|
||||
@Override
|
||||
public boolean needsRedraw() {
|
||||
SharedPreferences prefs = context.getSharedPreferences(Constants.SETTINGS_NAME, 0);
|
||||
SharedPreferences prefs = context.getSharedPreferences(
|
||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
long currentTrackId = prefs.getLong(context.getString(R.string.selected_track_key), -1);
|
||||
if(currentTrackId == -1) {
|
||||
// Could not find track.
|
||||
|
||||
+6
-5
@@ -39,15 +39,15 @@ public class FixedSpeedTrackPathDescriptor implements TrackPathDescriptor, OnSha
|
||||
public FixedSpeedTrackPathDescriptor(Context context) {
|
||||
|
||||
this.context = context;
|
||||
context.getSharedPreferences(Constants.SETTINGS_NAME, 0)
|
||||
.registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
SharedPreferences prefs = context.getSharedPreferences(Constants.SETTINGS_NAME, 0);
|
||||
SharedPreferences prefs = context.getSharedPreferences(
|
||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
if (prefs == null) {
|
||||
slowSpeed = 9;
|
||||
normalSpeed = 17;
|
||||
return;
|
||||
}
|
||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
try {
|
||||
slowSpeed = Integer.parseInt(prefs.getString(context.getString(
|
||||
R.string.track_color_mode_fixed_speed_slow_key), "9"));
|
||||
@@ -87,7 +87,8 @@ public class FixedSpeedTrackPathDescriptor implements TrackPathDescriptor, OnSha
|
||||
&& !key.equals(context.getString(R.string.track_color_mode_fixed_speed_medium_key)))) {
|
||||
return;
|
||||
}
|
||||
SharedPreferences prefs = context.getSharedPreferences(Constants.SETTINGS_NAME, 0);
|
||||
SharedPreferences prefs = context.getSharedPreferences(
|
||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
if (prefs == null) {
|
||||
slowSpeed = 9;
|
||||
normalSpeed = 17;
|
||||
|
||||
@@ -40,8 +40,8 @@ public class TrackPathPainterFactory {
|
||||
* @return The TrackPathPainter that corresponds to the track color mode setting.
|
||||
*/
|
||||
public static TrackPathPainter getTrackPathPainter(Context context) {
|
||||
SharedPreferences prefs =
|
||||
context.getSharedPreferences(Constants.SETTINGS_NAME, 0);
|
||||
SharedPreferences prefs = context.getSharedPreferences(
|
||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
if (prefs == null) {
|
||||
return new SingleColorTrackPathPainter(context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user