Skip to content

Commit

Permalink
Removed heat map density preference as it's no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna Ślimak committed Sep 18, 2020
1 parent 07c8f59 commit dd8d7ba
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 25 deletions.
1 change: 0 additions & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
<string name="average_threshold">Average sounds (dB)</string>
<string name="color_scale">Heat Legend Units</string>
<string name="edit_session">Edit Session</string>
<string name="heat_map_density">CrowdMap grid cell size</string>
<string name="loud_threshold">Loud sounds (dB)</string>
<string name="make_a_note">Make Note</string>
<string name="satellite_view">Satellite map</string>
Expand Down
7 changes: 0 additions & 7 deletions res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@
android:summary="Check to contribute your sessions to the CrowdMap by default"
android:title="Contribute to CrowdMap" />

<android.preference.EditTextPreference
android:defaultValue="20"
android:key="heat_map_density"
android:numeric="integer"
android:summary="@string/heat_map_density_summary"
android:title="@string/heat_map_density" />

<android.preference.EditTextPreference
android:defaultValue="100"
android:key="calibration"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ protected void onCreate(Bundle savedInstanceState) {
sharedPreferences.registerOnSharedPreferenceChangeListener(this);

final CheckBoxPreference alertPreference = (CheckBoxPreference) getPreferenceScreen().findPreference(SettingsHelper.DORMANT_SESSION_ALERT);
final EditTextPreference heatMapDensityPreference = (EditTextPreference) getPreferenceScreen().findPreference(SettingsHelper.HEAT_MAP_DENSITY);

alertPreference.setOnPreferenceChangeListener(new DormantSessionAlertToggleListener());
heatMapDensityPreference.setOnPreferenceChangeListener(new HeatMapDensityPreferenceChangeListener());
}

// preferences screen behaves differently than the others, so we have to use this workaround to add the toolbar
Expand Down Expand Up @@ -130,20 +128,6 @@ public void onSharedPreferenceChanged(SharedPreferences preferences, String key)
}
}

private class HeatMapDensityPreferenceChangeListener implements Preference.OnPreferenceChangeListener {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
int value = Integer.parseInt(newValue.toString());

if (value >= MIN_DENSITY && value <= MAX_DENSITY) {
return true;
} else {
ToastHelper.show(getApplicationContext(), R.string.heat_map_density_warning, Toast.LENGTH_SHORT);
return false;
}
}
}

public class DormantSessionAlertToggleListener implements Preference.OnPreferenceChangeListener {
private HashMap<String, Boolean> mSettings = new HashMap<>();

Expand All @@ -162,4 +146,4 @@ protected Void doInBackground(Void... voids) {
return true;
}
}
}
}

0 comments on commit dd8d7ba

Please sign in to comment.