revered sharing tab UI disabling to wait for api response
This commit is contained in:
parent
065fff7867
commit
2d93b23197
@ -29,7 +29,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -123,7 +123,26 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
List<String> predefinedLocationsNames = Stream.of(coords).map(PredefinedCoordViewModel::getName).toList();
|
||||
List<String> predefinedLocationsUUIDs = Stream.of(coords).map(PredefinedCoordViewModel::getPredefinedCoordinateId).toList();
|
||||
predefinedCoordsList.addAll(coords);
|
||||
|
||||
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
|
||||
preferenceCategory.removePreference(manualLocationList);
|
||||
preferenceCategory.removePreference(removeManualLocation);
|
||||
preferenceCategory.removePreference(manualLocationButton);
|
||||
}else{
|
||||
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.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
||||
removeManualLocation.setEnabled(true);
|
||||
locationSharing.setEnabled(true);
|
||||
}
|
||||
}
|
||||
String[] stringnames = predefinedLocationsNames.toArray(new String[0]);
|
||||
predefinedLocationsList = new ArrayList<>(Arrays.asList(stringnames));
|
||||
List<Integer> activesId = Stream.of(coords).indexed()
|
||||
@ -180,26 +199,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
statusMapping.put(0, "available");
|
||||
statusMapping.put(1, "consultation");
|
||||
statusMapping.put(2, "busy");
|
||||
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
|
||||
preferenceCategory.removePreference(manualLocationList);
|
||||
preferenceCategory.removePreference(removeManualLocation);
|
||||
preferenceCategory.removePreference(manualLocationButton);
|
||||
}else{
|
||||
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.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
||||
removeManualLocation.setEnabled(true);
|
||||
locationSharing.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
|
||||
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
||||
|
||||
@ -214,10 +214,18 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
|
||||
/** Sharing level list **/
|
||||
locationMode.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
||||
|
||||
// if(PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString()) && predefinedCoordsList.isEmpty()){
|
||||
/* Log.d("OTSOCHOZI","pyklo");
|
||||
}else{
|
||||
Log.d("OTSOCHOZI","niepyklo");*/
|
||||
|
||||
((MapActivity) getActivity()).stopBackgroundLocalizationTask();
|
||||
((MapActivity) getActivity()).startBackgroundLocalizationTask();
|
||||
// }
|
||||
|
||||
|
||||
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
||||
if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
|
||||
if (!predefinedCoordsList.isEmpty()) {
|
||||
preferenceCategory.addPreference(manualLocationList);
|
||||
|
Loading…
Reference in New Issue
Block a user