Merge branch 'mapManualLocationBug/locationLevel' of s416084/find-my-tutor-android into mapManualLocation
This commit is contained in:
commit
b14052eb21
@ -154,8 +154,11 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void loginProcess(String email, String password) {
|
private void loginProcess(String email, String password) {
|
||||||
ValidateUser user = new ValidateUser(email, password);
|
ValidateUser user = new ValidateUser(email, password);
|
||||||
|
LdapUser fuser = new LdapUser(email,password,"wmi","tutor","henryk","zdzblo",email);
|
||||||
|
|
||||||
disposable.add(ldapService.validate(user)
|
// disposable.add(ldapService.validate(user)
|
||||||
|
|
||||||
|
disposable.add(ldapService.fakeValidate(fuser)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(this::handleResponse, this::handleError));
|
.subscribe(this::handleResponse, this::handleError));
|
||||||
|
@ -95,7 +95,6 @@ public class MapActivity extends BaseActivity
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
myID = PrefUtils.getUserId(getApplicationContext());
|
myID = PrefUtils.getUserId(getApplicationContext());
|
||||||
// fetching coords service
|
// fetching coords service
|
||||||
coordinateService = ApiClient.getClient(getApplicationContext())
|
coordinateService = ApiClient.getClient(getApplicationContext())
|
||||||
@ -269,6 +268,8 @@ public class MapActivity extends BaseActivity
|
|||||||
PrefUtils.getLocationLevel(getApplicationContext())
|
PrefUtils.getLocationLevel(getApplicationContext())
|
||||||
);
|
);
|
||||||
PrefUtils.putManualLocation(this, latLng);
|
PrefUtils.putManualLocation(this, latLng);
|
||||||
|
handleBackgroundTaskLifeCycle();
|
||||||
|
|
||||||
|
|
||||||
// // TODO remove after BG sending
|
// // TODO remove after BG sending
|
||||||
// manualLocStatusChecker = () -> {
|
// manualLocStatusChecker = () -> {
|
||||||
|
@ -70,7 +70,10 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
.subscribeWith(new DisposableSingleObserver<List<String>>() {
|
.subscribeWith(new DisposableSingleObserver<List<String>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<String> strings) {
|
public void onSuccess(List<String> strings) {
|
||||||
setListPreferenceData(statusList.getKey(),strings.toArray(new String[strings.size()]));
|
String[] statusesArray = strings.toArray(new String[strings.size()]);
|
||||||
|
setListPreferenceData(statusList.getKey(), statusesArray);
|
||||||
|
Log.d("GETSTATUSES", Arrays.toString(statusesArray));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -78,6 +81,7 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
Toast.makeText(getApplicationContext(), "Error handling status fetch", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), "Error handling status fetch", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,10 +122,10 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/** Sharing level list **/
|
/** Sharing level list **/
|
||||||
locationMode.setSummary(PrefUtils.getLocationLevel(getApplicationContext()));
|
// locationMode.setSummary(PrefUtils.getLocationLevel(getApplicationContext()));
|
||||||
locationMode.setOnPreferenceChangeListener((preference, newValue) -> {
|
locationMode.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
||||||
if(PrefUtils.getLocationLevel(getApplicationContext()) == "manual"){
|
if (PrefUtils.getLocationLevel(getApplicationContext()).equals("manual") ) {
|
||||||
preferenceCategory.addPreference(manualLocationList);
|
preferenceCategory.addPreference(manualLocationList);
|
||||||
preferenceCategory.addPreference(manualLocationButton);
|
preferenceCategory.addPreference(manualLocationButton);
|
||||||
|
|
||||||
@ -175,6 +179,12 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(this::handleResponse, this::handleError));
|
.subscribe(this::handleResponse, this::handleError));
|
||||||
|
// Log.d("GETSTATUSES", "statusy po dodaniu nowego");
|
||||||
|
// getStatuses(disposable);
|
||||||
|
// CharSequence[] entriesIndexes = statusList.getEntries();
|
||||||
|
//// Log.d("GETENTRIES", Arrays.toString(entriesIndexes));
|
||||||
|
// Log.d("GETENTRIES ostatni w handle response", (String) entriesIndexes[entriesIndexes.length - 1]);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@ -199,6 +209,7 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
return (String) lp.getEntry();
|
return (String) lp.getEntry();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateListPreference(ListPreference lp, Object newValue, String storageKey) {
|
protected void updateListPreference(ListPreference lp, Object newValue, String storageKey) {
|
||||||
CharSequence[] entries = lp.getEntries();
|
CharSequence[] entries = lp.getEntries();
|
||||||
Set<String> defaultEntries = new HashSet(Arrays.asList(entries));
|
Set<String> defaultEntries = new HashSet(Arrays.asList(entries));
|
||||||
@ -229,13 +240,15 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
lp.setDefaultValue("1");
|
lp.setDefaultValue("1");
|
||||||
lp.setEntryValues(entryValues);
|
lp.setEntryValues(entryValues);
|
||||||
}
|
}
|
||||||
private void handleResponse(List<String> resp) {
|
|
||||||
getStatuses(disposable);
|
|
||||||
String newStatus = resp.toArray(new String[resp.size()])[resp.size()-1];
|
|
||||||
// Toast.makeText(getApplicationContext(), newStatus, Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
statusList.setValue(Integer.toString(resp.size()-1));
|
private void handleResponse(List<String> resp) {
|
||||||
statusList.setSummary(newStatus);
|
String newStatus = resp.toArray(new String[resp.size()])[resp.size() - 1];
|
||||||
|
Log.d("GETSTATUSES new status", newStatus);
|
||||||
|
String[] statusesArray = resp.toArray(new String[resp.size()]);
|
||||||
|
setListPreferenceData(statusList.getKey(), statusesArray);
|
||||||
|
// Log.d("GETSTATUSES nowe lokalne", Arrays.toString(statusList.getEntries()));
|
||||||
|
// statusList.setValue(newStatus);
|
||||||
|
statusList.setValueIndex(resp.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleError (Throwable error){
|
private void handleError (Throwable error){
|
||||||
|
@ -159,7 +159,7 @@ public class PrefUtils {
|
|||||||
|
|
||||||
public static void putManualLocation(Context context, LatLng latLng) {
|
public static void putManualLocation(Context context, LatLng latLng) {
|
||||||
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
|
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
|
||||||
|
editor.putString("key_location_level","3");
|
||||||
editor.putString("location_mode", "manual");
|
editor.putString("location_mode", "manual");
|
||||||
editor.putBoolean("key_sharing_enabled", true);
|
editor.putBoolean("key_sharing_enabled", true);
|
||||||
editor.putLong("longitude_manual_location", Double.doubleToRawLongBits(latLng.getLongitude()));
|
editor.putLong("longitude_manual_location", Double.doubleToRawLongBits(latLng.getLongitude()));
|
||||||
|
Loading…
Reference in New Issue
Block a user