Merge branch 'develop' of s416084/find-my-tutor-android into master
This commit is contained in:
commit
caa60e6f25
@ -10,7 +10,7 @@ android {
|
|||||||
applicationId "com.uam.wmi.findmytutor"
|
applicationId "com.uam.wmi.findmytutor"
|
||||||
minSdkVersion 22
|
minSdkVersion 22
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 1
|
versionCode 17
|
||||||
versionName "0.9.2-alpha"
|
versionName "0.9.2-alpha"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
@ -52,7 +52,8 @@ dependencies {
|
|||||||
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
|
||||||
implementation 'io.swagger:swagger-annotations:1.5.15'
|
implementation 'io.swagger:swagger-annotations:1.5.15'
|
||||||
implementation 'org.threeten:threetenbp:1.3.5'
|
implementation 'org.threeten:threetenbp:1.3.5'
|
||||||
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.6.5'
|
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.7.2'
|
||||||
|
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:4.0.0'
|
||||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
|
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
|
||||||
implementation 'com.android.support:recyclerview-v7:27.1.1'
|
implementation 'com.android.support:recyclerview-v7:27.1.1'
|
||||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
|
||||||
@ -66,7 +67,6 @@ dependencies {
|
|||||||
implementation 'com.auth0.android:jwtdecode:1.1.1'
|
implementation 'com.auth0.android:jwtdecode:1.1.1'
|
||||||
implementation 'com.annimon:stream:1.2.1'
|
implementation 'com.annimon:stream:1.2.1'
|
||||||
implementation 'com.google.android.gms:play-services-location:16.0.0'
|
implementation 'com.google.android.gms:play-services-location:16.0.0'
|
||||||
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:4.0.0'
|
|
||||||
// FloatingBarMenu
|
// FloatingBarMenu
|
||||||
implementation 'com.getbase:floatingactionbutton:1.10.1'
|
implementation 'com.getbase:floatingactionbutton:1.10.1'
|
||||||
implementation 'org.apache.commons:commons-collections4:4.0'
|
implementation 'org.apache.commons:commons-collections4:4.0'
|
||||||
|
Binary file not shown.
@ -21,6 +21,7 @@ import com.auth0.android.jwt.JWT;
|
|||||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||||
import com.uam.wmi.findmytutor.R;
|
import com.uam.wmi.findmytutor.R;
|
||||||
import com.uam.wmi.findmytutor.model.JwtToken;
|
import com.uam.wmi.findmytutor.model.JwtToken;
|
||||||
|
import com.uam.wmi.findmytutor.model.LdapUser;
|
||||||
import com.uam.wmi.findmytutor.model.User;
|
import com.uam.wmi.findmytutor.model.User;
|
||||||
import com.uam.wmi.findmytutor.model.ValidateUser;
|
import com.uam.wmi.findmytutor.model.ValidateUser;
|
||||||
import com.uam.wmi.findmytutor.network.ApiClient;
|
import com.uam.wmi.findmytutor.network.ApiClient;
|
||||||
@ -148,8 +149,9 @@ 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 fakeUser = new LdapUser(email, password,"wmi","tutor",email,"Fałszywy",email);
|
||||||
disposable.add(ldapService.validate(user)
|
disposable.add(ldapService.validate(user)
|
||||||
|
//disposable.add(ldapService.fakeValidate(fakeUser)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(this::handleResponse, this::handleError));
|
.subscribe(this::handleResponse, this::handleError));
|
||||||
|
@ -126,7 +126,6 @@ public class MapActivity extends BaseActivity
|
|||||||
|
|
||||||
selectLocationButton = findViewById(R.id.select_location_button);
|
selectLocationButton = findViewById(R.id.select_location_button);
|
||||||
removeLocationButton = findViewById(R.id.remove_location_button);
|
removeLocationButton = findViewById(R.id.remove_location_button);
|
||||||
Mapbox.getInstance(this, getString(R.string.access_token));
|
|
||||||
mapView = findViewById(R.id.mapView);
|
mapView = findViewById(R.id.mapView);
|
||||||
mapView.onCreate(savedInstanceState);
|
mapView.onCreate(savedInstanceState);
|
||||||
mapView.getMapAsync(this);
|
mapView.getMapAsync(this);
|
||||||
@ -339,6 +338,7 @@ public class MapActivity extends BaseActivity
|
|||||||
modalUserInput.requestFocus();
|
modalUserInput.requestFocus();
|
||||||
} else {
|
} else {
|
||||||
sendLocation(body, latLng);
|
sendLocation(body, latLng);
|
||||||
|
PrefUtils.putCurrentManualLocationName(getApplicationContext(),body);
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -637,6 +637,7 @@ public class MapActivity extends BaseActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getContentViewId() {
|
protected int getContentViewId() {
|
||||||
|
Mapbox.getInstance(this, getString(R.string.access_token));
|
||||||
return R.layout.activity_map;
|
return R.layout.activity_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<String> strings) {
|
public void onSuccess(List<String> strings) {
|
||||||
String[] statusesArray = strings.toArray(new String[strings.size()]);
|
String[] statusesArray = strings.toArray(new String[strings.size()]);
|
||||||
setListPreferenceData(statusList.getKey(), statusesArray,strings.size() -1);
|
setListPreferenceData(statusList.getKey(), statusesArray,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,11 +98,12 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
else{
|
else{
|
||||||
setListPreferenceData(manualLocationList.getKey(), stringnames,null);
|
setListPreferenceData(manualLocationList.getKey(), stringnames,null);
|
||||||
}
|
}
|
||||||
|
Log.d("sharingpref", names.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
Toast.makeText(getApplicationContext(), R.string.manual_status_error, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), R.string.error_location_fetch, Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@ -120,14 +121,10 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
manualLocationButton = (RightButtonPreference) findPreference("manual_location_button");
|
manualLocationButton = (RightButtonPreference) findPreference("manual_location_button");
|
||||||
manualStatus = findPreference("key_manual_status");
|
manualStatus = findPreference("key_manual_status");
|
||||||
statusList = (ListPreference) findPreference("key_status_value");
|
statusList = (ListPreference) findPreference("key_status_value");
|
||||||
|
|
||||||
statusesService = ApiClient.getClient(getApplicationContext()).create(PredefinedStatusesService.class);
|
statusesService = ApiClient.getClient(getApplicationContext()).create(PredefinedStatusesService.class);
|
||||||
disposable = new CompositeDisposable();
|
disposable = new CompositeDisposable();
|
||||||
getStatuses(disposable);
|
getStatuses(disposable);
|
||||||
|
getLocations(disposable);
|
||||||
if (PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
|
|
||||||
getLocations(disposable);
|
|
||||||
}
|
|
||||||
|
|
||||||
locationLevelMapping = new HashMap<Integer, String>();
|
locationLevelMapping = new HashMap<Integer, String>();
|
||||||
locationLevelMapping.put(0, SharingLevel.PRESENCE.toString());
|
locationLevelMapping.put(0, SharingLevel.PRESENCE.toString());
|
||||||
@ -140,6 +137,9 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
statusMapping.put(1, "consultation");
|
statusMapping.put(1, "consultation");
|
||||||
statusMapping.put(2, "busy");
|
statusMapping.put(2, "busy");
|
||||||
|
|
||||||
|
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
|
||||||
|
manualLocationList.setSummary(PrefUtils.getCurrentManualLocationName(getApplicationContext()));
|
||||||
|
// manualLocationList.setSummary(PrefUtils.getManualLocation(getApplicationContext()));
|
||||||
/** Main sharing switch**/
|
/** Main sharing switch**/
|
||||||
locationSharing.setOnPreferenceChangeListener((buttonView, newValue) -> {
|
locationSharing.setOnPreferenceChangeListener((buttonView, newValue) -> {
|
||||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) newValue);
|
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) newValue);
|
||||||
@ -152,9 +152,10 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
||||||
if (PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
|
if (PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
|
||||||
|
if(!predefinedCoordsList.isEmpty()){
|
||||||
|
preferenceCategory.addPreference(manualLocationList);
|
||||||
|
}
|
||||||
|
|
||||||
preferenceCategory.addPreference(manualLocationList);
|
|
||||||
getLocations(disposable);
|
|
||||||
preferenceCategory.addPreference(manualLocationButton);
|
preferenceCategory.addPreference(manualLocationButton);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -168,16 +169,23 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
|
if (!PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")) {
|
||||||
preferenceCategory.removePreference(manualLocationList);
|
preferenceCategory.removePreference(manualLocationList);
|
||||||
preferenceCategory.removePreference(manualLocationButton);
|
preferenceCategory.removePreference(manualLocationButton);
|
||||||
|
}else{
|
||||||
|
// if(predefinedCoordsList.isEmpty()){
|
||||||
|
//// preferenceCategory.removePreference(manualLocationList);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Custom manual location list change listener **/
|
/** Custom manual location list change listener **/
|
||||||
manualLocationList.setOnPreferenceChangeListener((preference, newValue) -> {
|
manualLocationList.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
ListPreference lp = (ListPreference) preference;
|
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);
|
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.putManualLocation(getApplicationContext(), temp.getGeoData(), temp.getApproximatedLocation() );
|
||||||
PrefUtils.putCurrentManualLocation(getApplicationContext(),temp.getPredefinedCoordinateId());
|
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;
|
return true;
|
||||||
});
|
});
|
||||||
@ -195,7 +203,7 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
ListPreference lp = (ListPreference) preference;
|
ListPreference lp = (ListPreference) preference;
|
||||||
CharSequence[] entries = lp.getEntries();
|
CharSequence[] entries = lp.getEntries();
|
||||||
PrefUtils.storeStatus(getApplicationContext(), (String) entries[Integer.parseInt((String) newValue)]);
|
PrefUtils.storeStatus(getApplicationContext(), (String) entries[Integer.parseInt((String) newValue)]);
|
||||||
|
lp.setSummary(entries[Integer.parseInt((String) newValue)]);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
/** Custom status list change listener **/
|
/** Custom status list change listener **/
|
||||||
@ -210,6 +218,7 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -221,19 +230,25 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void setListPreferenceData(String lp_name, String[] entries, Integer activeId) {
|
protected void setListPreferenceData(String lp_name, String[] entries, Integer activeId) {
|
||||||
ListPreference lp = (ListPreference) findPreference(lp_name);
|
try {
|
||||||
lp.setEntries(entries);
|
ListPreference lp = (ListPreference) findPreference(lp_name);
|
||||||
CharSequence[] entryValues = new CharSequence[entries.length];
|
lp.setEntries(entries);
|
||||||
|
CharSequence[] entryValues = new CharSequence[entries.length];
|
||||||
|
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
entryValues[i] = Integer.toString(i);
|
entryValues[i] = Integer.toString(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
lp.setDefaultValue(0);
|
lp.setDefaultValue(0);
|
||||||
lp.setEntryValues(entryValues);
|
lp.setEntryValues(entryValues);
|
||||||
|
|
||||||
|
if(entries.length > 0 && activeId != null)
|
||||||
|
lp.setValueIndex(activeId);
|
||||||
|
}catch (Exception e){
|
||||||
|
// Toast.makeText(getApplicationContext(),
|
||||||
|
// "duupa", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
if(entries.length > 0 && activeId != null)
|
|
||||||
lp.setValueIndex(activeId);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private void handleResponse(List<String> resp) {
|
private void handleResponse(List<String> resp) {
|
||||||
@ -243,6 +258,8 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
statusList.setValueIndex(resp.size() - 1);
|
statusList.setValueIndex(resp.size() - 1);
|
||||||
PrefUtils.storeStatus(getApplicationContext(), resp.get(resp.size() - 1));
|
PrefUtils.storeStatus(getApplicationContext(), resp.get(resp.size() - 1));
|
||||||
|
statusList.setSummary(PrefUtils.getUserStatus(getApplicationContext()));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,6 +210,7 @@ public class UsersListFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<User> users) {
|
public void onSuccess(List<User> users) {
|
||||||
tutorsList.clear();
|
tutorsList.clear();
|
||||||
|
tutorsFiltered.clear();
|
||||||
tutorsList.addAll(users);
|
tutorsList.addAll(users);
|
||||||
tutorsFiltered.addAll(users);
|
tutorsFiltered.addAll(users);
|
||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
|
@ -20,9 +20,6 @@ public class Coordinate extends BaseResponse {
|
|||||||
private Range<Double> longtitudeRange = Const.buildingLongitudeRange;
|
private Range<Double> longtitudeRange = Const.buildingLongitudeRange;
|
||||||
private List<String> allowedApproximatedLocations = Const.validApproximatedLocations;
|
private List<String> allowedApproximatedLocations = Const.validApproximatedLocations;
|
||||||
|
|
||||||
@SerializedName("coordinateId")
|
|
||||||
private UUID coordinateId = null;
|
|
||||||
|
|
||||||
@SerializedName("latitude")
|
@SerializedName("latitude")
|
||||||
private Double latitude;
|
private Double latitude;
|
||||||
|
|
||||||
@ -66,23 +63,9 @@ public class Coordinate extends BaseResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Coordinate coordinateId(UUID coordinateId) {
|
public Coordinate coordinateId(UUID coordinateId) {
|
||||||
this.coordinateId = coordinateId;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get coordinateId
|
|
||||||
* @return coordinateId
|
|
||||||
**/
|
|
||||||
@ApiModelProperty(required = true, value = "")
|
|
||||||
public UUID getCoordinateId() {
|
|
||||||
return coordinateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCoordinateId(UUID coordinateId) {
|
|
||||||
this.coordinateId = coordinateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Coordinate latitude(Double latitude) {
|
public Coordinate latitude(Double latitude) {
|
||||||
this.latitude = latitude;
|
this.latitude = latitude;
|
||||||
return this;
|
return this;
|
||||||
@ -236,8 +219,7 @@ public class Coordinate extends BaseResponse {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Coordinate coordinate = (Coordinate) o;
|
Coordinate coordinate = (Coordinate) o;
|
||||||
return Objects.equals(this.coordinateId, coordinate.coordinateId) &&
|
return Objects.equals(this.latitude, coordinate.latitude) &&
|
||||||
Objects.equals(this.latitude, coordinate.latitude) &&
|
|
||||||
Objects.equals(this.longitude, coordinate.longitude) &&
|
Objects.equals(this.longitude, coordinate.longitude) &&
|
||||||
Objects.equals(this.altitude, coordinate.altitude) &&
|
Objects.equals(this.altitude, coordinate.altitude) &&
|
||||||
Objects.equals(this.userId, coordinate.userId) &&
|
Objects.equals(this.userId, coordinate.userId) &&
|
||||||
@ -249,7 +231,7 @@ public class Coordinate extends BaseResponse {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(coordinateId, latitude, longitude, altitude, userId, approximatedLocation, displayMode, timeStamp, label);
|
return Objects.hash( latitude, longitude, altitude, userId, approximatedLocation, displayMode, timeStamp, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -258,7 +240,6 @@ public class Coordinate extends BaseResponse {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("class Coordinate {\n");
|
sb.append("class Coordinate {\n");
|
||||||
|
|
||||||
sb.append(" coordinateId: ").append(toIndentedString(coordinateId)).append("\n");
|
|
||||||
sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n");
|
sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n");
|
||||||
sb.append(" longitude: ").append(toIndentedString(longitude)).append("\n");
|
sb.append(" longitude: ").append(toIndentedString(longitude)).append("\n");
|
||||||
sb.append(" altitude: ").append(toIndentedString(altitude)).append("\n");
|
sb.append(" altitude: ").append(toIndentedString(altitude)).append("\n");
|
||||||
|
@ -25,6 +25,7 @@ import android.util.Log;
|
|||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||||
import com.google.android.gms.location.LocationServices;
|
import com.google.android.gms.location.LocationServices;
|
||||||
|
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||||
import com.mapbox.geojson.Point;
|
import com.mapbox.geojson.Point;
|
||||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||||
import com.uam.wmi.findmytutor.model.Coordinate;
|
import com.uam.wmi.findmytutor.model.Coordinate;
|
||||||
@ -32,6 +33,7 @@ import com.uam.wmi.findmytutor.network.ApiClient;
|
|||||||
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
||||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
import com.uam.wmi.findmytutor.utils.MapUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
|
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||||
|
|
||||||
import org.apache.commons.collections4.queue.CircularFifoQueue;
|
import org.apache.commons.collections4.queue.CircularFifoQueue;
|
||||||
@ -42,8 +44,10 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||||||
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
|
import io.reactivex.observers.DisposableCompletableObserver;
|
||||||
import io.reactivex.observers.DisposableSingleObserver;
|
import io.reactivex.observers.DisposableSingleObserver;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
import static com.uam.wmi.findmytutor.utils.Const.offlineBackgroundLocationInterval;
|
import static com.uam.wmi.findmytutor.utils.Const.offlineBackgroundLocationInterval;
|
||||||
import static com.uam.wmi.findmytutor.utils.Const.onlineBackgroundLocationInterval;
|
import static com.uam.wmi.findmytutor.utils.Const.onlineBackgroundLocationInterval;
|
||||||
@ -51,6 +55,7 @@ import static com.uam.wmi.findmytutor.utils.Const.presenceApproximatedName;
|
|||||||
import static com.uam.wmi.findmytutor.utils.Const.presenceLatitude;
|
import static com.uam.wmi.findmytutor.utils.Const.presenceLatitude;
|
||||||
import static com.uam.wmi.findmytutor.utils.Const.presenceLongitude;
|
import static com.uam.wmi.findmytutor.utils.Const.presenceLongitude;
|
||||||
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
|
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
|
||||||
|
import static java.lang.String.valueOf;
|
||||||
|
|
||||||
public class BackgroundLocalizationService extends Service {
|
public class BackgroundLocalizationService extends Service {
|
||||||
|
|
||||||
@ -353,18 +358,21 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
|
|
||||||
disposable.add(
|
disposable.add(
|
||||||
coordinateService
|
coordinateService
|
||||||
.postCoordinate(coordinate)
|
.putCoordinate(coordinate, PrefUtils.getUserId(getApplicationContext()))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribeWith(new DisposableSingleObserver<Coordinate>() {
|
.subscribeWith(new DisposableCompletableObserver() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Coordinate coordinate) {
|
public void onComplete() {
|
||||||
Log.e(TAG, String.valueOf(coordinate));
|
Log.e(TAG, "CoordinateSuccess");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
Log.e(TAG, e.getMessage());
|
|
||||||
|
Log.e(TAG,"onErr" + valueOf(e));
|
||||||
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
|
@ -3,6 +3,7 @@ package com.uam.wmi.findmytutor.service;
|
|||||||
import com.uam.wmi.findmytutor.model.Coordinate;
|
import com.uam.wmi.findmytutor.model.Coordinate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.Completable;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.DELETE;
|
import retrofit2.http.DELETE;
|
||||||
@ -36,9 +37,9 @@ public interface CoordinateService {
|
|||||||
Single <Coordinate> postCoordinate(@Body Coordinate coordinate);
|
Single <Coordinate> postCoordinate(@Body Coordinate coordinate);
|
||||||
|
|
||||||
@PUT("api/coordinates/{id}")
|
@PUT("api/coordinates/{id}")
|
||||||
Single<Coordinate> putCoordinatesById(@Path("id") String id);
|
Completable putCoordinate(@Body Coordinate coordinate, @Path("id") String id);
|
||||||
|
|
||||||
@DELETE("api/coordinates/{id}")
|
@DELETE("api/coordinates/{id}")
|
||||||
Single<Coordinate> deleteCoordinatesById(@Path("id") String id);
|
Completable deleteCoordinatesById(@Path("id") String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class PrefUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getUserStatus(Context context) {
|
public static String getUserStatus(Context context) {
|
||||||
return getSharedPreferences(context).getString("status_entry", "Available");
|
return getSharedPreferences(context).getString("status_entry", "Dostępny");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void storeStatus(Context context, String status) {
|
public static void storeStatus(Context context, String status) {
|
||||||
@ -188,5 +188,13 @@ public class PrefUtils {
|
|||||||
public static String getCurrentManualLocation(Context context) {
|
public static String getCurrentManualLocation(Context context) {
|
||||||
return getSharedPreferences(context).getString("current_manual_location", null);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -15,5 +15,12 @@
|
|||||||
android:summary="%s"
|
android:summary="%s"
|
||||||
android:title="@string/title_language" />
|
android:title="@string/title_language" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="acra.disable"
|
||||||
|
android:title="@string/pref_disable_acra"
|
||||||
|
android:summaryOn="@string/pref_acra_disabled"
|
||||||
|
android:summaryOff="@string/pref_acra_enabled"
|
||||||
|
android:defaultValue="false"/>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@ -26,8 +26,6 @@
|
|||||||
android:title="@string/title_location_level" />
|
android:title="@string/title_location_level" />
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="key_manual_location_value"
|
android:key="key_manual_location_value"
|
||||||
android:entries="@array/manual_location_entries"
|
|
||||||
android:entryValues="@array/manual_location_values"
|
|
||||||
android:summary="%s"
|
android:summary="%s"
|
||||||
android:title="@string/title_list_manual_location" />
|
android:title="@string/title_list_manual_location" />
|
||||||
<com.uam.wmi.findmytutor.utils.RightButtonPreference
|
<com.uam.wmi.findmytutor.utils.RightButtonPreference
|
||||||
@ -43,10 +41,8 @@
|
|||||||
android:persistent="true"
|
android:persistent="true"
|
||||||
android:title="@string/status_switch_title"/>
|
android:title="@string/status_switch_title"/>
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="1"
|
android:defaultValue="2"
|
||||||
android:key="@string/key_status_value"
|
android:key="@string/key_status_value"
|
||||||
android:entries="@array/status_entries"
|
|
||||||
android:entryValues="@array/status_values"
|
|
||||||
android:summary="%s"
|
android:summary="%s"
|
||||||
android:title="@string/status_list_title" />
|
android:title="@string/status_list_title" />
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
|
@ -160,7 +160,7 @@
|
|||||||
<string name="manual_status_error">Błąd podczas pobierania danych.</string>
|
<string name="manual_status_error">Błąd podczas pobierania danych.</string>
|
||||||
<string name="error_status_fetch">Błąd podczas pobierania statusów.</string>
|
<string name="error_status_fetch">Błąd podczas pobierania statusów.</string>
|
||||||
<string name="notification_text">Upss. Coś poszło nie tak. Pracujemy nad tym!</string>
|
<string name="notification_text">Upss. Coś poszło nie tak. Pracujemy nad tym!</string>
|
||||||
<string name="lack_duty_hours">Brak informacji o dyzurze.</string>
|
<string name="lack_duty_hours">Brak informacji o dyżurze.</string>
|
||||||
<string name="lack_note">Brak notatki.</string>
|
<string name="lack_note">Brak notatki.</string>
|
||||||
<string name="search">Wyszukiwarka</string>
|
<string name="search">Wyszukiwarka</string>
|
||||||
<string name="description_notdisturb">Nie przeszkadzać</string>
|
<string name="description_notdisturb">Nie przeszkadzać</string>
|
||||||
|
@ -233,10 +233,14 @@
|
|||||||
<string name="network_error">Network Error!</string>
|
<string name="network_error">Network Error!</string>
|
||||||
<string name="manual_status_error">Error handling status fetch</string>
|
<string name="manual_status_error">Error handling status fetch</string>
|
||||||
<string name="error_status_fetch">Error handling status fetch</string>
|
<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="acra_toast_text" translatable="false">Sorry, the application crashed. A report will be sent to the developers</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_text">Sorry, the application crashed. A report will be sent to the developers</string>
|
||||||
<string name="notification_title" translatable="false">FMT Crash</string>
|
<string name="notification_title" translatable="false">FMT Issue</string>
|
||||||
<string name="notification_channel" translatable="false">FMT</string>
|
<string name="notification_channel" translatable="false">FMT</string>
|
||||||
<string name="lack_duty_hours">Lack information about duty hours</string>
|
<string name="lack_duty_hours">Lack information about duty hours</string>
|
||||||
<string name="lack_note">No note.</string>
|
<string name="lack_note">No note.</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user