Skip to content

Commit

Permalink
Merge pull request #899 from opoto/simplifypath_prefs_updates
Browse files Browse the repository at this point in the history
Few fixes/enhancements on path simplification preferences:
  • Loading branch information
gerhardol authored Apr 7, 2020
2 parents 2def6ae + 33ea4a0 commit b5f8e61
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions app/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
<string name="mm31kz513sg5" translatable="false">mm(31);kz(5,13);sg(5)</string>
<string name="_sign_plus" translatable="false">+</string>
<string name="_sign_minus" translatable="false">-</string>
<string name="path_simplification_default_tolerance" translatable="false">3</string>
</resources>
6 changes: 3 additions & 3 deletions app/src/main/org/runnerup/db/PathSimplifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ public PathSimplifier(Context context) {

// get user settings

// tolerance in meters (default to 3)
// tolerance in meters (default to R.string.path_simplification_default_tolerance)
double tolerance;
try {
tolerance = Double.parseDouble(prefs.getString(
res.getString(R.string.pref_path_simplification_tolerance), "3"));
res.getString(R.string.pref_path_simplification_tolerance), res.getString(R.string.path_simplification_default_tolerance)));
} catch (Exception ex) {
tolerance = 3;
tolerance = Double.parseDouble(res.getString(R.string.path_simplification_default_tolerance));
}
// squared tolerance in meters has to be transformed to tolerance in degrees
this.toleranceDeg = tolerance / ONE_DEGREE;
Expand Down
8 changes: 2 additions & 6 deletions app/src/main/org/runnerup/view/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,11 @@
import android.support.v7.app.AlertDialog;
import android.util.Log;

import org.runnerup.BuildConfig;
import org.runnerup.R;
import org.runnerup.db.DBHelper;
import org.runnerup.tracker.component.TrackerCadence;
import org.runnerup.tracker.component.TrackerPressure;
import org.runnerup.tracker.component.TrackerTemperature;
import org.runnerup.util.FileUtil;

import java.io.IOException;


public class SettingsActivity extends PreferenceActivity
Expand Down Expand Up @@ -99,8 +95,8 @@ public void onCreate(Bundle savedInstanceState) {
Preference pref = findPreference(this.getString(R.string.pref_use_pressure_sensor));
pref.setEnabled(false);
}
CheckBoxPreference simplifyOnSave = (CheckBoxPreference) findPreference("pref_path_simplification_on_save");
CheckBoxPreference simplifyOnExport = (CheckBoxPreference) findPreference("pref_path_simplification_on_export");
CheckBoxPreference simplifyOnSave = (CheckBoxPreference) findPreference(getString(R.string.pref_path_simplification_on_save));
CheckBoxPreference simplifyOnExport = (CheckBoxPreference) findPreference(getString(R.string.pref_path_simplification_on_export));
if (simplifyOnSave.isChecked()) {
simplifyOnExport.setChecked(true);
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/org/runnerup/widget/TextPreference.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ protected void onDialogClosed(boolean ok) {
if (this.getKey().equals(res.getString(R.string.pref_mapbox_default_style))) {
val = res.getString(R.string.mapboxDefaultStyle);
super.setText(val);
} else if (this.getKey().equals(res.getString(R.string.pref_path_simplification_tolerance))) {
val = res.getString(R.string.path_simplification_default_tolerance);
super.setText(val);
}
}
super.setSummary(val);
Expand Down

0 comments on commit b5f8e61

Please sign in to comment.