Merge branch 'fixUXSharingTab' of s416084/find-my-tutor-android into develop

This commit is contained in:
Marcin Jedyński 2018-12-11 23:10:39 +00:00 committed by Gogs
commit 8e5b33793d
3 changed files with 15 additions and 16 deletions

View File

@ -42,7 +42,7 @@ import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
public class SharingFragment extends PreferenceFragment {
protected Preference locationSharing;
protected Preference locationMode;
protected Preference manualLocationList;
protected ListPreference manualLocationList;
protected PreferenceCategory preferenceCategory;
protected RightButtonPreference manualLocationButton;
protected Preference manualStatus;
@ -66,7 +66,7 @@ public class SharingFragment extends PreferenceFragment {
@Override
public void onSuccess(List<String> strings) {
String[] statusesArray = strings.toArray(new String[strings.size()]);
setListPreferenceData(statusList.getKey(), statusesArray,null);
setListPreferenceData(statusList, statusesArray,null);
}
@Override
@ -94,11 +94,10 @@ public class SharingFragment extends PreferenceFragment {
.filter(v -> v.getSecond().getPredefinedCoordinateId().equals(currentCoordId)).map(IntPair::getFirst).toList();
if(activeId.size() > 0)
setListPreferenceData(manualLocationList.getKey(), stringnames, activeId.get(0));
setListPreferenceData(manualLocationList, stringnames, activeId.get(0));
else{
setListPreferenceData(manualLocationList.getKey(), stringnames,null);
setListPreferenceData(manualLocationList, stringnames,null);
}
Log.d("sharingpref", names.toString());
}
@Override
@ -117,15 +116,14 @@ public class SharingFragment extends PreferenceFragment {
locationSharing = findPreference("key_sharing_enabled");
locationMode = findPreference("key_location_level");
preferenceCategory = (PreferenceCategory) findPreference("category_sharing");
manualLocationList = findPreference("key_manual_location_value");
manualLocationList = (ListPreference) findPreference("key_manual_location_value");
manualLocationButton = (RightButtonPreference) findPreference("manual_location_button");
manualStatus = findPreference("key_manual_status");
statusList = (ListPreference) findPreference("key_status_value");
statusesService = ApiClient.getClient(getApplicationContext()).create(PredefinedStatusesService.class);
disposable = new CompositeDisposable();
getStatuses(disposable);
getLocations(disposable);
getLocations(disposable);
locationLevelMapping = new HashMap<Integer, String>();
locationLevelMapping.put(0, SharingLevel.PRESENCE.toString());
locationLevelMapping.put(1, SharingLevel.APPROXIMATED.toString());
@ -229,9 +227,9 @@ public class SharingFragment extends PreferenceFragment {
return view;
}
protected void setListPreferenceData(String lp_name, String[] entries, Integer activeId) {
protected void setListPreferenceData(ListPreference lp, String[] entries, Integer activeId) {
Log.d("setlistpref",lp.getKey());
try {
ListPreference lp = (ListPreference) findPreference(lp_name);
lp.setEntries(entries);
CharSequence[] entryValues = new CharSequence[entries.length];
@ -244,9 +242,9 @@ public class SharingFragment extends PreferenceFragment {
if(entries.length > 0 && activeId != null)
lp.setValueIndex(activeId);
}catch (Exception e){
// Toast.makeText(getApplicationContext(),
// "duupa", Toast.LENGTH_SHORT).show();
Log.e("Failed to set listPref",e.getMessage());
}
};
@ -254,7 +252,7 @@ public class SharingFragment extends PreferenceFragment {
private void handleResponse(List<String> resp) {
String[] statusesArray = resp.toArray(new String[resp.size()]);
setListPreferenceData(statusList.getKey(), statusesArray,resp.size() - 1);
setListPreferenceData(statusList, statusesArray,resp.size() - 1);
statusList.setValueIndex(resp.size() - 1);
PrefUtils.storeStatus(getApplicationContext(), resp.get(resp.size() - 1));

View File

@ -26,6 +26,7 @@
android:summary="%s"
android:title="@string/title_location_level" />
<ListPreference
android:defaultValue="0"
android:key="key_manual_location_value"
android:summary="%s"
android:title="@string/title_list_manual_location" />

View File

@ -235,9 +235,9 @@
<string name="error_status_fetch">Error handling status fetch</string>
<string name="error_location_fetch">Error handling status fetch</string>
<string name="pref_acra_disabled" translatable="false">Auto reporting on issue is OFF</string>
<string name="pref_acra_enabled" translatable="false">Auto reporting on issue is ON</string>
<string name="pref_disable_acra" translatable="false">ACRA reporting tool</string>
<!--<string name="pref_acra_disabled" translatable="false">Auto reporting on issue is OFF</string>-->
<!--<string name="pref_acra_enabled" translatable="false">Auto reporting on issue is ON</string>-->
<!--<string name="pref_disable_acra" translatable="false">ACRA reporting tool</string>-->
<string name="acra_toast_text" translatable="false">Sorry, the application crashed. A report will be sent to the developers</string>
<string name="notification_text">Sorry, the application crashed. A report will be sent to the developers</string>
<string name="notification_title" translatable="false">FMT Issue</string>