info pop ups with info #83
@ -143,6 +143,9 @@ public class SharingFragment extends PreferenceFragment {
|
||||
statusMapping.put(1, "consultation");
|
||||
statusMapping.put(2, "busy");
|
||||
|
||||
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
|
||||
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
||||
// manualLocationList.setSummary(PrefUtils.getManualLocation(getApplicationContext()));
|
||||
/** Main sharing switch**/
|
||||
locationSharing.setOnPreferenceChangeListener((buttonView, newValue) -> {
|
||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) newValue);
|
||||
@ -176,11 +179,12 @@ public class SharingFragment extends PreferenceFragment {
|
||||
/** Custom manual location list change listener **/
|
||||
manualLocationList.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
ListPreference lp = (ListPreference) preference;
|
||||
|
||||
CharSequence[] entries = lp.getEntries();
|
||||
PredefinedCoordViewModel temp = Stream.of(predefinedCoordsList).filter(p -> p.getName().equals(lp.getEntries()[Integer.parseInt((String) newValue)].toString())).toList().get(0);
|
||||
|
||||
PrefUtils.putManualLocation(getApplicationContext(), temp.getGeoData(), temp.getApproximatedLocation() );
|
||||
PrefUtils.putCurrentManualLocation(getApplicationContext(),temp.getPredefinedCoordinateId());
|
||||
PrefUtils.putCurrentManualLocationName(getApplicationContext(), (String )lp.getEntries()[Integer.parseInt((String) newValue)]);
|
||||
lp.setSummary(lp.getEntries()[Integer.parseInt((String) newValue)]);
|
||||
|
||||
return true;
|
||||
});
|
||||
@ -198,7 +202,7 @@ public class SharingFragment extends PreferenceFragment {
|
||||
ListPreference lp = (ListPreference) preference;
|
||||
CharSequence[] entries = lp.getEntries();
|
||||
PrefUtils.storeStatus(getApplicationContext(), (String) entries[Integer.parseInt((String) newValue)]);
|
||||
|
||||
lp.setSummary(entries[Integer.parseInt((String) newValue)]);
|
||||
return true;
|
||||
});
|
||||
/** Custom status list change listener **/
|
||||
|
@ -188,5 +188,13 @@ public class PrefUtils {
|
||||
public static String getCurrentManualLocation(Context context) {
|
||||
return getSharedPreferences(context).getString("current_manual_location", null);
|
||||
}
|
||||
public static void putCurrentManualLocationName(Context context, String locationName) {
|
||||
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
|
||||
editor.putString("current_manual_location_name", locationName);
|
||||
editor.apply();
|
||||
}
|
||||
public static String getCurrentManualLocationName(Context context) {
|
||||
return getSharedPreferences(context).getString("current_manual_location_name", null);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user