Fix scenario when user doesn't have prefs

This commit is contained in:
Mieszko Wrzeszczyński 2019-01-07 00:05:37 +01:00
parent 1ba6cdf6f0
commit d78ae83877

View File

@ -128,15 +128,8 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
preferenceCategory.removePreference(removeManualLocation); preferenceCategory.removePreference(removeManualLocation);
preferenceCategory.removePreference(manualLocationButton); preferenceCategory.removePreference(manualLocationButton);
}else{ }else{
if(predefinedCoordsList.isEmpty()){ if(!predefinedCoordsList.isEmpty()){
locationSharing.setEnabled(false);
locationSharing.setChecked(false);
PrefUtils.disableSharing(getApplicationContext());
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
removeManualLocation.setEnabled(false);
manualLocationList.setEnabled(false);
manualLocationList.setSummary("");
}else{
manualLocationList.setEnabled(true); manualLocationList.setEnabled(true);
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext())); manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
removeManualLocation.setEnabled(true); removeManualLocation.setEnabled(true);
@ -221,12 +214,6 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
if (!predefinedCoordsList.isEmpty()) { if (!predefinedCoordsList.isEmpty()) {
preferenceCategory.addPreference(manualLocationList); preferenceCategory.addPreference(manualLocationList);
preferenceCategory.addPreference(removeManualLocation); preferenceCategory.addPreference(removeManualLocation);
}else{
locationSharing.setEnabled(false);
locationSharing.setChecked(false);
PrefUtils.disableSharing(getApplicationContext());
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
} }
preferenceCategory.addPreference(manualLocationButton); preferenceCategory.addPreference(manualLocationButton);
} else { } else {