0.9.1-alpha - Code Version 9 -Fix minor bugs with manual location #57
@ -10,8 +10,8 @@ android {
|
|||||||
applicationId "com.uam.wmi.findmytutor"
|
applicationId "com.uam.wmi.findmytutor"
|
||||||
minSdkVersion 22
|
minSdkVersion 22
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 3
|
versionCode 8
|
||||||
versionName "0.9.0-alpha"
|
versionName "0.9.1-alpha"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation 'com.android.support:preference-v7:27.1.1'
|
implementation 'com.android.support:preference-v7:27.1.1'
|
||||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
implementation 'com.android.support:design:27.1.1'
|
implementation 'com.android.support:design:27.1.1'
|
||||||
@ -43,18 +43,18 @@ dependencies {
|
|||||||
implementation 'com.google.code.gson:gson:2.8.5'
|
implementation 'com.google.code.gson:gson:2.8.5'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
|
||||||
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.6.5'
|
||||||
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'
|
||||||
implementation "com.jakewharton:butterknife:8.8.1"
|
implementation 'com.jakewharton:butterknife:8.8.1'
|
||||||
annotationProcessor "com.jakewharton:butterknife-compiler:8.8.1"
|
annotationProcessor "com.jakewharton:butterknife-compiler:8.8.1"
|
||||||
implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"
|
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
|
||||||
implementation "com.squareup.okhttp3:okhttp:3.11.0"
|
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
|
||||||
implementation "com.squareup.okhttp3:okhttp-urlconnection:3.10.0"
|
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
|
||||||
implementation "com.squareup.okhttp3:logging-interceptor:3.11.0"
|
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
|
||||||
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
||||||
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'
|
||||||
@ -62,5 +62,5 @@ dependencies {
|
|||||||
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:4.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'
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,19 @@ import android.support.v7.app.ActionBarDrawerToggle;
|
|||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.SearchView;
|
import android.support.v7.widget.SearchView;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.mapbox.mapboxsdk.Mapbox;
|
||||||
import com.uam.wmi.findmytutor.R;
|
import com.uam.wmi.findmytutor.R;
|
||||||
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
|
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
|
||||||
import com.uam.wmi.findmytutor.utils.ActiveFragment;
|
import com.uam.wmi.findmytutor.utils.ActiveFragment;
|
||||||
import com.uam.wmi.findmytutor.utils.FeedbackUtils;
|
import com.uam.wmi.findmytutor.utils.FeedbackUtils;
|
||||||
|
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.RxSearchObservable;
|
import com.uam.wmi.findmytutor.utils.RxSearchObservable;
|
||||||
|
|
||||||
@ -38,10 +42,15 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.ObservableSource;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.functions.Function;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
|
|
||||||
|
import static com.uam.wmi.findmytutor.utils.Consts.deafultMapZoom;
|
||||||
|
import static com.uam.wmi.findmytutor.utils.Consts.searchMapZoom;
|
||||||
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
|
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
|
||||||
|
|
||||||
|
|
||||||
@ -49,7 +58,6 @@ public abstract class BaseActivity
|
|||||||
extends AppCompatActivity
|
extends AppCompatActivity
|
||||||
implements BottomNavigationView.OnNavigationItemSelectedListener {
|
implements BottomNavigationView.OnNavigationItemSelectedListener {
|
||||||
|
|
||||||
protected static final int REQUEST_PERMISSIONS = 100;
|
|
||||||
private final static int REQUEST_CODE_ASK_PERMISSIONS = 1;
|
private final static int REQUEST_CODE_ASK_PERMISSIONS = 1;
|
||||||
private static final String[] REQUIRED_SDK_PERMISSIONS = new String[]{
|
private static final String[] REQUIRED_SDK_PERMISSIONS = new String[]{
|
||||||
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS};
|
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS};
|
||||||
@ -201,7 +209,7 @@ public abstract class BaseActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handleBackgroundTaskLifeCycle() {
|
public void handleBackgroundTaskLifeCycle() {
|
||||||
Boolean shouldServiceRun = PrefUtils.isEnableSharingLocalization(getApplicationContext());
|
Boolean shouldServiceRun = PrefUtils.isEnableSharingLocalization(getApplicationContext()) && isTutor;
|
||||||
|
|
||||||
if (shouldServiceRun) {
|
if (shouldServiceRun) {
|
||||||
startBackgroundLocalizationTask();
|
startBackgroundLocalizationTask();
|
||||||
@ -267,16 +275,21 @@ public abstract class BaseActivity
|
|||||||
searchView.setOnQueryTextFocusChangeListener((v, hasFocus) -> {
|
searchView.setOnQueryTextFocusChangeListener((v, hasFocus) -> {
|
||||||
if (!hasFocus && activeFragment.equals(ActiveFragment.NONE)) {
|
if (!hasFocus && activeFragment.equals(ActiveFragment.NONE)) {
|
||||||
restoreMapMarkers();
|
restoreMapMarkers();
|
||||||
|
adjustMapToSearch(deafultMapZoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hasFocus && activeFragment.equals(ActiveFragment.NONE)){
|
||||||
|
adjustMapToSearch(searchMapZoom);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
RxSearchObservable.fromView(searchView)
|
RxSearchObservable.fromView(searchView)
|
||||||
|
.skip(0)
|
||||||
.map(String::toLowerCase)
|
.map(String::toLowerCase)
|
||||||
.debounce(300, TimeUnit.MILLISECONDS)
|
.debounce(250, TimeUnit.MILLISECONDS)
|
||||||
.distinctUntilChanged()
|
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.switchMap((Function<String, ObservableSource<String>>) Observable::just)
|
||||||
.subscribe(this::executeSearch);
|
.subscribe(this::executeSearch);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -285,16 +298,17 @@ public abstract class BaseActivity
|
|||||||
private void executeSearch(String input) {
|
private void executeSearch(String input) {
|
||||||
if (activeFragment.equals(ActiveFragment.USER_LIST)) {
|
if (activeFragment.equals(ActiveFragment.USER_LIST)) {
|
||||||
((UsersListFragment) userListFragment).searchUser(input);
|
((UsersListFragment) userListFragment).searchUser(input);
|
||||||
|
|
||||||
} else if (activeFragment.equals(ActiveFragment.NONE)) {
|
} else if (activeFragment.equals(ActiveFragment.NONE)) {
|
||||||
searchUser(input);
|
searchUser(input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void searchUser(String textToSearch) {
|
abstract void searchUser(String textToSearch);
|
||||||
}
|
|
||||||
|
|
||||||
public void restoreMapMarkers() {
|
abstract void restoreMapMarkers();
|
||||||
}
|
|
||||||
|
abstract void adjustMapToSearch(Integer zoom);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
@ -10,14 +10,11 @@ import android.os.Bundle;
|
|||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Switch;
|
|
||||||
|
|
||||||
import com.auth0.android.jwt.Claim;
|
import com.auth0.android.jwt.Claim;
|
||||||
import com.auth0.android.jwt.JWT;
|
import com.auth0.android.jwt.JWT;
|
||||||
@ -44,7 +41,6 @@ import okhttp3.ResponseBody;
|
|||||||
|
|
||||||
public class LoginActivity extends AppCompatActivity {
|
public class LoginActivity extends AppCompatActivity {
|
||||||
|
|
||||||
// UI references.
|
|
||||||
private AutoCompleteTextView mLoginNameView;
|
private AutoCompleteTextView mLoginNameView;
|
||||||
private EditText mPasswordView;
|
private EditText mPasswordView;
|
||||||
private View mProgressView;
|
private View mProgressView;
|
||||||
@ -151,12 +147,10 @@ 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,"tutor","tutor","mieszko","nocny","szmsdsdsdsdare@wmi.pl");
|
|
||||||
// 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));
|
||||||
|
@ -4,7 +4,6 @@ import android.Manifest;
|
|||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@ -25,6 +24,7 @@ import com.getbase.floatingactionbutton.FloatingActionButton;
|
|||||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||||
import com.mapbox.android.core.permissions.PermissionsListener;
|
import com.mapbox.android.core.permissions.PermissionsListener;
|
||||||
import com.mapbox.android.core.permissions.PermissionsManager;
|
import com.mapbox.android.core.permissions.PermissionsManager;
|
||||||
|
import com.mapbox.geojson.Point;
|
||||||
import com.mapbox.mapboxsdk.Mapbox;
|
import com.mapbox.mapboxsdk.Mapbox;
|
||||||
import com.mapbox.mapboxsdk.annotations.Icon;
|
import com.mapbox.mapboxsdk.annotations.Icon;
|
||||||
import com.mapbox.mapboxsdk.annotations.IconFactory;
|
import com.mapbox.mapboxsdk.annotations.IconFactory;
|
||||||
@ -46,13 +46,13 @@ import com.uam.wmi.findmytutor.network.ApiClient;
|
|||||||
import com.uam.wmi.findmytutor.service.CoordinateService;
|
import com.uam.wmi.findmytutor.service.CoordinateService;
|
||||||
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
|
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
|
||||||
import com.uam.wmi.findmytutor.service.UserService;
|
import com.uam.wmi.findmytutor.service.UserService;
|
||||||
import com.uam.wmi.findmytutor.utils.FeedbackUtils;
|
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
||||||
import com.uam.wmi.findmytutor.utils.ManualLocationUtils;
|
import com.uam.wmi.findmytutor.utils.ManualLocationUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.MapMarker;
|
import com.uam.wmi.findmytutor.utils.MapMarker;
|
||||||
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.RestApiHelper;
|
||||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||||
import com.uam.wmi.findmytutor.utils.mapUtils;
|
import com.uam.wmi.findmytutor.utils.MapUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -99,6 +99,7 @@ public class MapActivity extends BaseActivity
|
|||||||
private int tiltParam = 30;
|
private int tiltParam = 30;
|
||||||
private String myId;
|
private String myId;
|
||||||
private boolean isTutor;
|
private boolean isTutor;
|
||||||
|
private ApproximatedLocalization approximatedLocalization;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -121,6 +122,7 @@ 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));
|
Mapbox.getInstance(this, getString(R.string.access_token));
|
||||||
@ -131,6 +133,7 @@ public class MapActivity extends BaseActivity
|
|||||||
//start background task
|
//start background task
|
||||||
handleBackgroundTaskLifeCycle();
|
handleBackgroundTaskLifeCycle();
|
||||||
manualLocationUtils = new ManualLocationUtils(MapActivity.this);
|
manualLocationUtils = new ManualLocationUtils(MapActivity.this);
|
||||||
|
approximatedLocalization = new ApproximatedLocalization(MapUtils.loadJsonFromAsset(getApplicationContext(), "building.geojson"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -151,7 +154,7 @@ public class MapActivity extends BaseActivity
|
|||||||
stopBackgroundLocalizationTask();
|
stopBackgroundLocalizationTask();
|
||||||
|
|
||||||
removeLocationButton.setVisibility(View.GONE);
|
removeLocationButton.setVisibility(View.GONE);
|
||||||
Toast.makeText(MapActivity.this, "Your marker will disappear in next couple minutes", Toast.LENGTH_SHORT).show();
|
Toast.makeText(MapActivity.this, R.string.manual_marker_info, Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -161,28 +164,13 @@ public class MapActivity extends BaseActivity
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
setToggleMapBoundsArea();
|
|
||||||
|
|
||||||
if (isTutor) {
|
if (isTutor) {
|
||||||
setOnMapLongClickListener();
|
setOnMapLongClickListener();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void setToggleMapBoundsArea() {
|
|
||||||
|
|
||||||
mapUtils.setMapBoundsArea(getApplicationContext(), mapboxMap, mapView, true);
|
setOnMapClickListener();
|
||||||
|
MapUtils.setMapBoundsArea(getApplicationContext(), mapboxMap, mapView, true);
|
||||||
FloatingActionButton toggleBoundsAreaFab = findViewById(R.id.fab_toggle_bound_area);
|
|
||||||
toggleBoundsAreaFab.setOnClickListener(view -> {
|
|
||||||
if (toggleBoundsAreaFab.getTitle().equals("Bounds OFF")) {
|
|
||||||
toggleBoundsAreaFab.setTitle("Bounds ON");
|
|
||||||
mapUtils.setMapBoundsArea(getApplicationContext(), mapboxMap, mapView, false);
|
|
||||||
} else {
|
|
||||||
toggleBoundsAreaFab.setTitle("Bounds OFF");
|
|
||||||
mapUtils.setMapBoundsArea(getApplicationContext(), mapboxMap, mapView, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUserHashMap(String userId, Long markerId) {
|
private void updateUserHashMap(String userId, Long markerId) {
|
||||||
@ -238,63 +226,22 @@ public class MapActivity extends BaseActivity
|
|||||||
private void showError(Throwable e) {
|
private void showError(Throwable e) {
|
||||||
String message;
|
String message;
|
||||||
|
|
||||||
|
Log.e("ERR",e.toString());
|
||||||
|
|
||||||
if (e instanceof HttpException) {
|
if (e instanceof HttpException) {
|
||||||
ResponseBody responseBody = ((HttpException) e).response().errorBody();
|
ResponseBody responseBody = ((HttpException) e).response().errorBody();
|
||||||
message = RestApiHelper.getErrorMessage(responseBody);
|
message = RestApiHelper.getErrorMessage(responseBody);
|
||||||
} else {
|
} else {
|
||||||
message = "Network Error!";
|
message = getString(R.string.network_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
Toast.makeText(MapActivity.this, message, Toast.LENGTH_SHORT).show();
|
Toast.makeText(MapActivity.this, message, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setOnMapClickListener() {
|
||||||
/* private void setOnMapLongClickListener() {
|
mapboxMap.addOnMapClickListener(e -> removeLocationButton.setVisibility(View.GONE));
|
||||||
|
|
||||||
mapboxMap.addOnMapLongClickListener((LatLng latLng) -> {
|
|
||||||
selectLocationButton.setVisibility(View.VISIBLE);
|
|
||||||
removeLocationButton.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
if (tmpLocalMarker == null) {
|
|
||||||
|
|
||||||
String sharingLevel = SharingLevel.MANUAL.toString();
|
|
||||||
Icon defaultIcon = getMapIcon(sharingLevel, myId);
|
|
||||||
|
|
||||||
MarkerOptions markerOptions = new MarkerOptions()
|
|
||||||
.setIcon(defaultIcon)
|
|
||||||
.position(latLng);
|
|
||||||
|
|
||||||
tmpLocalMarker = mapboxMap.addMarker(markerOptions);
|
|
||||||
MapMarker marker = new MapMarker(tmpLocalMarker, markerOptions, defaultIcon, sharingLevel);
|
|
||||||
|
|
||||||
markerHash.put(myId, marker);
|
|
||||||
updateUserHashMap(myId, marker.getMarker().getId());
|
|
||||||
|
|
||||||
} else {
|
|
||||||
ValueAnimator markerAnimator = ObjectAnimator.ofObject(tmpLocalMarker, "position",
|
|
||||||
new mapUtils.LatLngEvaluator(), tmpLocalMarker.getPosition(), latLng);
|
|
||||||
markerAnimator.setDuration(2000);
|
|
||||||
markerAnimator.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selectLocationButton.setOnClickListener((View view) -> {
|
|
||||||
if (tmpLocalMarker != null) {
|
|
||||||
try {
|
|
||||||
manualLocationUtils.showLocationDialog("Name the location", latLng);
|
|
||||||
startBackgroundLocalizationTask();
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
Timber.e(String.valueOf(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
selectLocationButton.setVisibility(View.GONE);
|
|
||||||
mapboxMap.removeMarker(tmpLocalMarker);
|
|
||||||
tmpLocalMarker = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private void setOnMapLongClickListener() {
|
private void setOnMapLongClickListener() {
|
||||||
|
|
||||||
mapboxMap.addOnMapLongClickListener((LatLng latLng) -> {
|
mapboxMap.addOnMapLongClickListener((LatLng latLng) -> {
|
||||||
@ -310,14 +257,11 @@ public class MapActivity extends BaseActivity
|
|||||||
.position(latLng);
|
.position(latLng);
|
||||||
|
|
||||||
tmpLocalMarker = mapboxMap.addMarker(markerOptions);
|
tmpLocalMarker = mapboxMap.addMarker(markerOptions);
|
||||||
MapMarker marker = new MapMarker(tmpLocalMarker, markerOptions, defaultIcon, sharingLevel);
|
new MapMarker(tmpLocalMarker, markerOptions, defaultIcon, sharingLevel);
|
||||||
|
|
||||||
updateUserHashMap(myId, marker.getMarker().getId());
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ValueAnimator markerAnimator = ObjectAnimator.ofObject(tmpLocalMarker, "position",
|
ValueAnimator markerAnimator = ObjectAnimator.ofObject(tmpLocalMarker, "position",
|
||||||
new mapUtils.LatLngEvaluator(), tmpLocalMarker.getPosition(), latLng);
|
new MapUtils.LatLngEvaluator(), tmpLocalMarker.getPosition(), latLng);
|
||||||
markerAnimator.setDuration(2000);
|
markerAnimator.setDuration(2000);
|
||||||
markerAnimator.start();
|
markerAnimator.start();
|
||||||
}
|
}
|
||||||
@ -325,21 +269,22 @@ public class MapActivity extends BaseActivity
|
|||||||
selectLocationButton.setOnClickListener((View view) -> {
|
selectLocationButton.setOnClickListener((View view) -> {
|
||||||
if (tmpLocalMarker != null) {
|
if (tmpLocalMarker != null) {
|
||||||
|
|
||||||
|
String approximatedLocation = approximatedLocalization.getNameOfBuildingPart(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
droppedMarkercoordinate = new Coordinate(
|
droppedMarkercoordinate = new Coordinate(
|
||||||
latLng.getLatitude(),
|
latLng.getLatitude(),
|
||||||
latLng.getLongitude(),
|
latLng.getLongitude(),
|
||||||
latLng.getAltitude(),
|
latLng.getAltitude(),
|
||||||
"approx",
|
approximatedLocation,
|
||||||
PrefUtils.getUserFirstName(getApplicationContext()) + " " + PrefUtils.getUserLastName(getApplicationContext()),
|
PrefUtils.getUserFirstName(getApplicationContext()) + " " + PrefUtils.getUserLastName(getApplicationContext()),
|
||||||
PrefUtils.getUserId(getApplicationContext()),
|
PrefUtils.getUserId(getApplicationContext()),
|
||||||
PrefUtils.getLocationLevel(getApplicationContext())
|
PrefUtils.getLocationLevel(getApplicationContext())
|
||||||
);
|
);
|
||||||
|
|
||||||
PrefUtils.putManualLocation(this, latLng);
|
PrefUtils.putManualLocation(this, latLng, approximatedLocation);
|
||||||
handleBackgroundTaskLifeCycle();
|
|
||||||
|
|
||||||
|
handleBackgroundTaskLifeCycle();
|
||||||
|
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Timber.e(String.valueOf(e));
|
Timber.e(String.valueOf(e));
|
||||||
@ -347,7 +292,7 @@ public class MapActivity extends BaseActivity
|
|||||||
|
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
MapActivity.this,
|
MapActivity.this,
|
||||||
"Manual Locations selected!" + latLng,
|
getString(R.string.manual_location_selected),
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show();
|
).show();
|
||||||
|
|
||||||
@ -392,7 +337,6 @@ public class MapActivity extends BaseActivity
|
|||||||
Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.modal_location_hint), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.modal_location_hint), Toast.LENGTH_SHORT).show();
|
||||||
modalUserInput.requestFocus();
|
modalUserInput.requestFocus();
|
||||||
} else {
|
} else {
|
||||||
PrefUtils.putManualLocation(getApplicationContext(), latLng);
|
|
||||||
sendLocation(body, latLng);
|
sendLocation(body, latLng);
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
}
|
}
|
||||||
@ -400,34 +344,35 @@ public class MapActivity extends BaseActivity
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void sendLocation(String body, LatLng latLng) {
|
private void sendLocation(String body, LatLng latLng) {
|
||||||
|
PredefinedStatusesService predefinedStatusesService = ApiClient.getClient(getApplicationContext()).create(PredefinedStatusesService.class);
|
||||||
|
|
||||||
PredefinedCoordViewModel droppedMarkercoordinate = new PredefinedCoordViewModel(
|
PredefinedCoordViewModel droppedMarkercoordinate = new PredefinedCoordViewModel(
|
||||||
latLng.getLatitude(),
|
latLng.getLatitude(),
|
||||||
latLng.getLongitude(),
|
latLng.getLongitude(),
|
||||||
latLng.getAltitude(),
|
latLng.getAltitude(),
|
||||||
PrefUtils.getUserId(getApplicationContext()),
|
PrefUtils.getUserId(getApplicationContext()),
|
||||||
"string",
|
approximatedLocalization.getNameOfBuildingPart(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())),
|
||||||
"predefined",
|
SharingLevel.PREDEFINED.toString(),
|
||||||
body
|
body
|
||||||
);
|
);
|
||||||
|
|
||||||
PredefinedStatusesService predefinedStatusesService = ApiClient.getClient(getApplicationContext()).create(PredefinedStatusesService.class);
|
|
||||||
CompositeDisposable disposable = new CompositeDisposable();
|
CompositeDisposable disposable = new CompositeDisposable();
|
||||||
disposable.add(predefinedStatusesService.postUserPredefinedCoord(PrefUtils.getUserId(getApplicationContext()), droppedMarkercoordinate)
|
disposable.add(
|
||||||
|
predefinedStatusesService.postUserPredefinedCoord(PrefUtils.getUserId(getApplicationContext()), droppedMarkercoordinate)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(this::handleResponse, this::handleError));
|
.subscribe(this::SaveCurrentManualLocation, this::handleError)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleResponse(List<PredefinedCoordViewModel> resp) {
|
private void SaveCurrentManualLocation(PredefinedCoordViewModel resp) {
|
||||||
Toast.makeText(getApplicationContext(), "Location saved!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), R.string.location_saved, Toast.LENGTH_SHORT).show();
|
||||||
|
PrefUtils.putCurrentManualLocation(getApplicationContext(),resp.getPredefinedCoordinateId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchTopCoords() {
|
private void fetchTopCoords() {
|
||||||
@ -436,12 +381,13 @@ public class MapActivity extends BaseActivity
|
|||||||
coordinateService.getOnlineCoordinates()
|
coordinateService.getOnlineCoordinates()
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.map(tutors -> Stream.of(tutors).
|
||||||
|
filterNot(t -> t.getDisplayMode().equals(SharingLevel.PRESENCE.toString())).toList())
|
||||||
.subscribeWith(new DisposableSingleObserver<List<Coordinate>>() {
|
.subscribeWith(new DisposableSingleObserver<List<Coordinate>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<Coordinate> coordsList) {
|
public void onSuccess(List<Coordinate> coordsList) {
|
||||||
|
|
||||||
|
|
||||||
if (tmpLocalMarker != null && coordsList.isEmpty()) {
|
if (tmpLocalMarker != null && coordsList.isEmpty()) {
|
||||||
Timber.e("200 empty []");
|
Timber.e("200 empty []");
|
||||||
mapboxMap.clear();
|
mapboxMap.clear();
|
||||||
@ -495,7 +441,7 @@ public class MapActivity extends BaseActivity
|
|||||||
LatLng toDestination = new LatLng(element.getLatitude(), element.getLongitude());
|
LatLng toDestination = new LatLng(element.getLatitude(), element.getLongitude());
|
||||||
// TODO fix flickiering markers
|
// TODO fix flickiering markers
|
||||||
ValueAnimator markerAnimator = ObjectAnimator.ofObject(marker, "position",
|
ValueAnimator markerAnimator = ObjectAnimator.ofObject(marker, "position",
|
||||||
new mapUtils.LatLngEvaluator(),
|
new MapUtils.LatLngEvaluator(),
|
||||||
marker.getPosition(),
|
marker.getPosition(),
|
||||||
toDestination);
|
toDestination);
|
||||||
markerAnimator.setDuration(2000);
|
markerAnimator.setDuration(2000);
|
||||||
@ -617,7 +563,7 @@ public class MapActivity extends BaseActivity
|
|||||||
|
|
||||||
Location lastKnownLocation = locationComponent.getLastKnownLocation();
|
Location lastKnownLocation = locationComponent.getLastKnownLocation();
|
||||||
if (lastKnownLocation != null) {
|
if (lastKnownLocation != null) {
|
||||||
mapUtils.makeNewCamera(mapboxMap,
|
MapUtils.makeNewCamera(mapboxMap,
|
||||||
lastKnownLocation.getLatitude(),
|
lastKnownLocation.getLatitude(),
|
||||||
lastKnownLocation.getLongitude(),
|
lastKnownLocation.getLongitude(),
|
||||||
zoomParam,
|
zoomParam,
|
||||||
@ -775,4 +721,8 @@ public class MapActivity extends BaseActivity
|
|||||||
|
|
||||||
mapboxMap.getMarkerViewManager().update();
|
mapboxMap.getMarkerViewManager().update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void adjustMapToSearch(Integer zoom) {
|
||||||
|
MapUtils.setZoom(mapboxMap,zoom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||||||
languagesList.setDefaultValue(1);
|
languagesList.setDefaultValue(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
languagesList.setOnPreferenceChangeListener((preference, newValue) -> {
|
languagesList.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
|
||||||
if (!newValue.toString().equals("0")){
|
if (!newValue.toString().equals("0")){
|
||||||
|
@ -13,6 +13,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.annimon.stream.IntPair;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
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;
|
||||||
@ -65,12 +66,12 @@ 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);
|
setListPreferenceData(statusList.getKey(), statusesArray,strings.size() -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
Toast.makeText(getApplicationContext(), "Error handling status fetch", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), R.string.error_status_fetch, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
}));
|
}));
|
||||||
@ -87,14 +88,21 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
List<String> names = Stream.of(coords).map(PredefinedCoordViewModel::getName).collect(com.annimon.stream.Collectors.toList());
|
List<String> names = Stream.of(coords).map(PredefinedCoordViewModel::getName).collect(com.annimon.stream.Collectors.toList());
|
||||||
predefinedCoordsList.addAll(coords);
|
predefinedCoordsList.addAll(coords);
|
||||||
String[] stringnames = names.toArray(new String[0]);
|
String[] stringnames = names.toArray(new String[0]);
|
||||||
|
String currentCoordId = PrefUtils.getCurrentManualLocation(getApplicationContext());
|
||||||
|
|
||||||
setListPreferenceData(manualLocationList.getKey(), stringnames);
|
List<Integer> activeId = Stream.of(coords).indexed()
|
||||||
|
.filter(v -> v.getSecond().getPredefinedCoordinateId().equals(currentCoordId)).map(IntPair::getFirst).toList();
|
||||||
|
|
||||||
|
if(activeId.size() > 0)
|
||||||
|
setListPreferenceData(manualLocationList.getKey(), stringnames, activeId.get(0));
|
||||||
|
else{
|
||||||
|
setListPreferenceData(manualLocationList.getKey(), stringnames,null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
Toast.makeText(getApplicationContext(), "Error handling status fetch", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), R.string.manual_status_error, Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@ -161,13 +169,15 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
preferenceCategory.removePreference(manualLocationList);
|
preferenceCategory.removePreference(manualLocationList);
|
||||||
preferenceCategory.removePreference(manualLocationButton);
|
preferenceCategory.removePreference(manualLocationButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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;
|
||||||
|
|
||||||
PredefinedCoordViewModel temp = Stream.of(predefinedCoordsList).filter(p -> p.getName().equals(lp.getEntries()[Integer.parseInt((String) newValue)].toString())).single();
|
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());
|
PrefUtils.putManualLocation(getApplicationContext(), temp.getGeoData(), temp.getApproximatedLocation() );
|
||||||
|
PrefUtils.putCurrentManualLocation(getApplicationContext(),temp.getPredefinedCoordinateId());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@ -210,8 +220,7 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setListPreferenceData(String lp_name, String[] entries) {
|
protected void setListPreferenceData(String lp_name, String[] entries, Integer activeId) {
|
||||||
//todo bug z pustym statusem
|
|
||||||
ListPreference lp = (ListPreference) findPreference(lp_name);
|
ListPreference lp = (ListPreference) findPreference(lp_name);
|
||||||
lp.setEntries(entries);
|
lp.setEntries(entries);
|
||||||
CharSequence[] entryValues = new CharSequence[entries.length];
|
CharSequence[] entryValues = new CharSequence[entries.length];
|
||||||
@ -220,13 +229,17 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
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)
|
||||||
|
lp.setValueIndex(activeId);
|
||||||
|
};
|
||||||
|
|
||||||
private void handleResponse(List<String> resp) {
|
private void handleResponse(List<String> resp) {
|
||||||
String[] statusesArray = resp.toArray(new String[resp.size()]);
|
String[] statusesArray = resp.toArray(new String[resp.size()]);
|
||||||
setListPreferenceData(statusList.getKey(), statusesArray);
|
|
||||||
|
setListPreferenceData(statusList.getKey(), statusesArray,resp.size() - 1);
|
||||||
|
|
||||||
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));
|
||||||
|
@ -69,12 +69,10 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
.subscribeWith(new DisposableSingleObserver<TutorTabViewModel>() {
|
.subscribeWith(new DisposableSingleObserver<TutorTabViewModel>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(TutorTabViewModel tutorTabViewModel) {
|
public void onSuccess(TutorTabViewModel tutorTabViewModel) {
|
||||||
// newTab = tutorTabViewModel;
|
|
||||||
// Log.d("TUTORTAB onsuc toPost",newTab.toString());
|
|
||||||
|
|
||||||
List<String> dutyHoursList = Stream.of(tutorTabViewModel.getDutyHours())
|
List<String> dutyHoursList = Stream.of(tutorTabViewModel.getDutyHours())
|
||||||
.map(DutyHourViewModel::getSummary).toList();
|
.map(DutyHourViewModel::getSummary).toList();
|
||||||
Log.d("TUTORTAB", Arrays.toString(dutyHoursList.toArray()));
|
|
||||||
userRoom.setText(String.format("%s: %s", getString(R.string.userRoom), tutorTabViewModel.getRoom()));
|
userRoom.setText(String.format("%s: %s", getString(R.string.userRoom), tutorTabViewModel.getRoom()));
|
||||||
userEmail.setText(String.format("%s: %s", getString(R.string.userEmail), tutorTabViewModel.getEmailTutorTab()));
|
userEmail.setText(String.format("%s: %s", getString(R.string.userEmail), tutorTabViewModel.getEmailTutorTab()));
|
||||||
if (!tutorTabViewModel.getNote().equals("")) {
|
if (!tutorTabViewModel.getNote().equals("")) {
|
||||||
@ -115,10 +113,6 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
newTab = new TutorTabViewModel(PrefUtils.getUserId(getApplicationContext()),note.getText().toString());
|
newTab = new TutorTabViewModel(PrefUtils.getUserId(getApplicationContext()),note.getText().toString());
|
||||||
Log.d("TUTORTAB button",note.getText().toString());
|
|
||||||
Log.d("TUTORTAB toPost",newTab.toString());
|
|
||||||
//topost jest nullem
|
|
||||||
// toPost.setNote(note.getText().toString());
|
|
||||||
putUserTab(newTab);
|
putUserTab(newTab);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -147,7 +141,6 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
} else {
|
} else {
|
||||||
Toast.makeText(getApplicationContext(),
|
Toast.makeText(getApplicationContext(),
|
||||||
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
Log.d("FEEDBACK", error.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import android.support.v7.app.AlertDialog;
|
|||||||
import android.support.v7.widget.DefaultItemAnimator;
|
import android.support.v7.widget.DefaultItemAnimator;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -31,9 +32,12 @@ import com.uam.wmi.findmytutor.utils.MyDividerItemDecoration;
|
|||||||
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
|
import com.uam.wmi.findmytutor.utils.RecyclerTouchListener;
|
||||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||||
|
|
||||||
|
import java.text.Collator;
|
||||||
|
import java.text.Normalizer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
@ -61,6 +65,7 @@ public class UsersListFragment extends Fragment {
|
|||||||
private TutorsListAdapter mAdapter;
|
private TutorsListAdapter mAdapter;
|
||||||
private List<User> tutorsList = new ArrayList<>();
|
private List<User> tutorsList = new ArrayList<>();
|
||||||
private List<User> tutorsFiltered = new ArrayList<>();
|
private List<User> tutorsFiltered = new ArrayList<>();
|
||||||
|
private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL"));
|
||||||
|
|
||||||
public UsersListFragment() {
|
public UsersListFragment() {
|
||||||
}
|
}
|
||||||
@ -108,6 +113,7 @@ public class UsersListFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void searchUser(String textToSearch) {
|
public void searchUser(String textToSearch) {
|
||||||
|
|
||||||
tutorsFiltered.clear();
|
tutorsFiltered.clear();
|
||||||
tutorsFiltered.addAll(Stream.of(tutorsList).filter(t ->
|
tutorsFiltered.addAll(Stream.of(tutorsList).filter(t ->
|
||||||
t.toSearchAbleString().toLowerCase().contains(textToSearch.toLowerCase())).toList());
|
t.toSearchAbleString().toLowerCase().contains(textToSearch.toLowerCase())).toList());
|
||||||
@ -212,7 +218,7 @@ public class UsersListFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
private int sortByUserName(User t1, User t2) {
|
private int sortByUserName(User t1, User t2) {
|
||||||
return t1.getFirstName().compareTo(t2.getFirstName());
|
return plCollator.compare(t1.getLastName(),t2.getLastName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showError(Throwable e) {
|
private void showError(Throwable e) {
|
||||||
|
@ -14,8 +14,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class Coordinate extends BaseResponse {
|
public class Coordinate extends BaseResponse {
|
||||||
Range<Double> latitudeRange = Range.create(52.466709, 52.467007);
|
Range<Double> latitudeRange = Range.create(52.46598, 52.467545);
|
||||||
Range<Double> longtitudeRange = Range.create(16.926159, 16.926976);
|
Range<Double> longtitudeRange = Range.create(16.926099, 16.927794);
|
||||||
|
|
||||||
@SerializedName("coordinateId")
|
@SerializedName("coordinateId")
|
||||||
private UUID coordinateId = null;
|
private UUID coordinateId = null;
|
||||||
@ -45,8 +45,8 @@ public class Coordinate extends BaseResponse {
|
|||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
public Coordinate (Double latitude, Double longitude, Double altitude, String approximatedLocation, String label, String userId, String displayMode) {
|
public Coordinate (Double latitude, Double longitude, Double altitude, String approximatedLocation, String label, String userId, String displayMode) {
|
||||||
//if (!latitudeRange.contains(latitude)) throw new IllegalArgumentException("Inappropriate latitude value" + latitude);
|
if (!latitudeRange.contains(latitude)) throw new IllegalArgumentException("Inappropriate latitude value" + latitude);
|
||||||
//if (!longtitudeRange.contains(longitude)) throw new IllegalArgumentException("Inappropriate longitude value" + longitude);
|
if (!longtitudeRange.contains(longitude)) throw new IllegalArgumentException("Inappropriate longitude value" + longitude);
|
||||||
//if (approximatedLocation == null) throw new IllegalArgumentException("Inappropriate approximatedLocation");
|
//if (approximatedLocation == null) throw new IllegalArgumentException("Inappropriate approximatedLocation");
|
||||||
|
|
||||||
this.latitude = latitude;
|
this.latitude = latitude;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package com.uam.wmi.findmytutor.model;
|
package com.uam.wmi.findmytutor.model;
|
||||||
|
|
||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
@ -8,18 +8,53 @@ public class Feedback {
|
|||||||
@SerializedName("isAnonymous")
|
@SerializedName("isAnonymous")
|
||||||
@Expose
|
@Expose
|
||||||
private Boolean isAnonymous;
|
private Boolean isAnonymous;
|
||||||
@SerializedName("header")
|
@SerializedName("type")
|
||||||
@Expose
|
@Expose
|
||||||
private String header;
|
private String type;
|
||||||
|
@SerializedName("user")
|
||||||
|
@Expose
|
||||||
|
private String user;
|
||||||
|
@SerializedName("deviceOS")
|
||||||
|
@Expose
|
||||||
|
private String deviceOS;
|
||||||
|
@SerializedName("appVersion")
|
||||||
|
@Expose
|
||||||
|
private String appVersion;
|
||||||
|
@SerializedName("deviceModel")
|
||||||
|
@Expose
|
||||||
|
private String deviceModel;
|
||||||
@SerializedName("body")
|
@SerializedName("body")
|
||||||
@Expose
|
@Expose
|
||||||
private String body;
|
private String body;
|
||||||
|
|
||||||
public Feedback(boolean isAnonymous, String header, String body){
|
/**
|
||||||
|
* No args constructor for use in serialization
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public Feedback() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param body
|
||||||
|
* @param appVersion
|
||||||
|
* @param deviceModel
|
||||||
|
* @param type
|
||||||
|
* @param isAnonymous
|
||||||
|
* @param user
|
||||||
|
* @param deviceOS
|
||||||
|
*/
|
||||||
|
public Feedback(Boolean isAnonymous, String type, String user, String deviceOS, String appVersion, String deviceModel, String body) {
|
||||||
|
super();
|
||||||
this.isAnonymous = isAnonymous;
|
this.isAnonymous = isAnonymous;
|
||||||
this.header = header;
|
this.type = type;
|
||||||
|
this.user = user;
|
||||||
|
this.deviceOS = deviceOS;
|
||||||
|
this.appVersion = appVersion;
|
||||||
|
this.deviceModel = deviceModel;
|
||||||
this.body = body;
|
this.body = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getIsAnonymous() {
|
public Boolean getIsAnonymous() {
|
||||||
return isAnonymous;
|
return isAnonymous;
|
||||||
}
|
}
|
||||||
@ -28,12 +63,74 @@ public class Feedback {
|
|||||||
this.isAnonymous = isAnonymous;
|
this.isAnonymous = isAnonymous;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHeader() {
|
public Feedback withIsAnonymous(Boolean isAnonymous) {
|
||||||
return header;
|
this.isAnonymous = isAnonymous;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHeader(String header) {
|
public String getType() {
|
||||||
this.header = header;
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Feedback withType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(String user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Feedback withUser(String user) {
|
||||||
|
this.user = user;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceOS() {
|
||||||
|
return deviceOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceOS(String deviceOS) {
|
||||||
|
this.deviceOS = deviceOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Feedback withDeviceOS(String deviceOS) {
|
||||||
|
this.deviceOS = deviceOS;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppVersion() {
|
||||||
|
return appVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppVersion(String appVersion) {
|
||||||
|
this.appVersion = appVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Feedback withAppVersion(String appVersion) {
|
||||||
|
this.appVersion = appVersion;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceModel() {
|
||||||
|
return deviceModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceModel(String deviceModel) {
|
||||||
|
this.deviceModel = deviceModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Feedback withDeviceModel(String deviceModel) {
|
||||||
|
this.deviceModel = deviceModel;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBody() {
|
public String getBody() {
|
||||||
@ -44,4 +141,38 @@ public class Feedback {
|
|||||||
this.body = body;
|
this.body = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Feedback withBody(String body) {
|
||||||
|
this.body = body;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return Boolean.toString(this.isAnonymous) + this.type + this.user+this.deviceOS+this.appVersion+this.deviceModel+this.body;
|
||||||
|
}
|
||||||
|
// @Override
|
||||||
|
// public String toString() {
|
||||||
|
// return new ToStringBuilder(this).append("isAnonymous", isAnonymous).append("type", type).append("user", user).append("deviceOS", deviceOS).append("appVersion", appVersion).append("deviceModel", deviceModel).append("body", body).toString();
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// private Boolean isAnonymous;
|
||||||
|
// @SerializedName("type")
|
||||||
|
// @Expose
|
||||||
|
// private String type;
|
||||||
|
// @SerializedName("user")
|
||||||
|
// @Expose
|
||||||
|
// private String user;
|
||||||
|
// @SerializedName("deviceOS")
|
||||||
|
// @Expose
|
||||||
|
// private String deviceOS;
|
||||||
|
// @SerializedName("appVersion")
|
||||||
|
// @Expose
|
||||||
|
// private String appVersion;
|
||||||
|
// @SerializedName("deviceModel")
|
||||||
|
// @Expose
|
||||||
|
// private String deviceModel;
|
||||||
|
// @SerializedName("body")
|
||||||
|
// @Expose
|
||||||
|
// private String body;
|
@ -8,7 +8,7 @@ public class PredefinedCoordViewModel {
|
|||||||
|
|
||||||
@SerializedName("predefinedCoordinateId")
|
@SerializedName("predefinedCoordinateId")
|
||||||
@Expose
|
@Expose
|
||||||
private UUID predefinedCoordinateId;
|
private String predefinedCoordinateId;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* (Required)
|
* (Required)
|
||||||
@ -67,7 +67,6 @@ public class PredefinedCoordViewModel {
|
|||||||
* @param longitude
|
* @param longitude
|
||||||
* @param latitude
|
* @param latitude
|
||||||
* @param approximatedLocation
|
* @param approximatedLocation
|
||||||
* @param predefinedCoordinateId
|
|
||||||
*/
|
*/
|
||||||
public PredefinedCoordViewModel(Double latitude, Double longitude, Double altitude, String userId, String approximatedLocation, String displayMode, String name) {
|
public PredefinedCoordViewModel(Double latitude, Double longitude, Double altitude, String userId, String approximatedLocation, String displayMode, String name) {
|
||||||
super();
|
super();
|
||||||
@ -80,11 +79,11 @@ public class PredefinedCoordViewModel {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getPredefinedCoordinateId() {
|
public String getPredefinedCoordinateId() {
|
||||||
return predefinedCoordinateId;
|
return predefinedCoordinateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPredefinedCoordinateId(UUID predefinedCoordinateId) {
|
public void setPredefinedCoordinateId(String predefinedCoordinateId) {
|
||||||
this.predefinedCoordinateId = predefinedCoordinateId;
|
this.predefinedCoordinateId = predefinedCoordinateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,23 +701,18 @@ public class User extends BaseResponse {
|
|||||||
return Objects.hash(isOnline, isUsingBlacklist, isUsingWhitelist, blacklist, whitelist, department, ldapLogin, title, firstName, lastName, isActive, tutorTab, coordinates, id, userName, normalizedUserName, email, normalizedEmail, emailConfirmed, passwordHash, securityStamp, concurrencyStamp, phoneNumber, phoneNumberConfirmed, twoFactorEnabled, lockoutEnd, lockoutEnabled, accessFailedCount);
|
return Objects.hash(isOnline, isUsingBlacklist, isUsingWhitelist, blacklist, whitelist, department, ldapLogin, title, firstName, lastName, isActive, tutorTab, coordinates, id, userName, normalizedUserName, email, normalizedEmail, emailConfirmed, passwordHash, securityStamp, concurrencyStamp, phoneNumber, phoneNumberConfirmed, twoFactorEnabled, lockoutEnd, lockoutEnabled, accessFailedCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String toSearchAbleString() {
|
public String toSearchAbleString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append(getFirstName()).append(" ");
|
|
||||||
sb.append(getLastName()).append(" ");
|
|
||||||
sb.append(getDepartment()).append(" ");
|
|
||||||
sb.append(getEmail());
|
|
||||||
|
|
||||||
return sb.toString();
|
return getFirstName() + " " +
|
||||||
|
getLastName() + " " +
|
||||||
|
getDepartment() + " " +
|
||||||
|
getEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toSearchAbleUserName(){
|
public String toSearchAbleUserName(){
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append(getFirstName());
|
|
||||||
sb.append(getLastName());
|
|
||||||
|
|
||||||
return sb.toString();
|
return getFirstName() +
|
||||||
|
getLastName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public class ApiClient {
|
|||||||
private static Retrofit retrofit = null;
|
private static Retrofit retrofit = null;
|
||||||
private static int REQUEST_TIMEOUT = 60;
|
private static int REQUEST_TIMEOUT = 60;
|
||||||
private static OkHttpClient okHttpClient;
|
private static OkHttpClient okHttpClient;
|
||||||
private static final String BASE_URL = "https://s416084.projektstudencki.pl/develop/";
|
private static final String BASE_URL = "https://s416084.projektstudencki.pl/master/";
|
||||||
|
|
||||||
public static Retrofit getClient(Context context) {
|
public static Retrofit getClient(Context context) {
|
||||||
|
|
||||||
@ -51,9 +51,7 @@ public class ApiClient {
|
|||||||
|
|
||||||
httpClient.addInterceptor(interceptor);
|
httpClient.addInterceptor(interceptor);
|
||||||
|
|
||||||
httpClient.addInterceptor(new Interceptor() {
|
httpClient.addInterceptor(chain -> {
|
||||||
@Override
|
|
||||||
public Response intercept(Chain chain) throws IOException {
|
|
||||||
Request original = chain.request();
|
Request original = chain.request();
|
||||||
Request.Builder requestBuilder = original.newBuilder()
|
Request.Builder requestBuilder = original.newBuilder()
|
||||||
.addHeader("Accept", "application/json")
|
.addHeader("Accept", "application/json")
|
||||||
@ -68,7 +66,6 @@ public class ApiClient {
|
|||||||
|
|
||||||
Request request = requestBuilder.build();
|
Request request = requestBuilder.build();
|
||||||
return chain.proceed(request);
|
return chain.proceed(request);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
okHttpClient = httpClient.build();
|
okHttpClient = httpClient.build();
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
package com.uam.wmi.findmytutor.network;
|
|
||||||
|
|
||||||
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.logging.HttpLoggingInterceptor;
|
|
||||||
import retrofit2.Retrofit;
|
|
||||||
import retrofit2.converter.gson.GsonConverterFactory;
|
|
||||||
|
|
||||||
public class RetrofitClientInstance {
|
|
||||||
|
|
||||||
private static final String BASE_URL = "https://s416084.projektstudencki.pl/develop/";
|
|
||||||
|
|
||||||
private static Retrofit.Builder builder
|
|
||||||
= new Retrofit.Builder()
|
|
||||||
.baseUrl(BASE_URL)
|
|
||||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
|
||||||
.addConverterFactory(GsonConverterFactory.create());
|
|
||||||
|
|
||||||
private static Retrofit retrofit = builder.build();
|
|
||||||
|
|
||||||
private static OkHttpClient.Builder httpClient
|
|
||||||
= new OkHttpClient.Builder();
|
|
||||||
|
|
||||||
private static HttpLoggingInterceptor logging
|
|
||||||
= new HttpLoggingInterceptor()
|
|
||||||
.setLevel(HttpLoggingInterceptor.Level.BASIC);
|
|
||||||
|
|
||||||
public static <S> S createService(Class<S> serviceClass) {
|
|
||||||
if (!httpClient.interceptors().contains(logging)) {
|
|
||||||
httpClient.addInterceptor(logging);
|
|
||||||
builder.client(httpClient.build());
|
|
||||||
retrofit = builder.build();
|
|
||||||
}
|
|
||||||
return retrofit.create(serviceClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <S> S createService(Class<S> serviceClass, final String token) {
|
|
||||||
if (token != null) {
|
|
||||||
httpClient.interceptors().clear();
|
|
||||||
httpClient.addInterceptor(chain -> {
|
|
||||||
Request original = chain.request();
|
|
||||||
Request.Builder builder1 = original.newBuilder()
|
|
||||||
.header("Authorization", "Bearer " + token);
|
|
||||||
Request request = builder1.build();
|
|
||||||
return chain.proceed(request);
|
|
||||||
});
|
|
||||||
builder.client(httpClient.build());
|
|
||||||
retrofit = builder.build();
|
|
||||||
}
|
|
||||||
return retrofit.create(serviceClass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -34,11 +34,10 @@ import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
|||||||
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.RestApiHelper;
|
||||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||||
import com.uam.wmi.findmytutor.utils.mapUtils;
|
import com.uam.wmi.findmytutor.utils.MapUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
@ -50,7 +49,7 @@ import timber.log.Timber;
|
|||||||
|
|
||||||
import static com.uam.wmi.findmytutor.utils.Consts.presenceApproximatedName;
|
import static com.uam.wmi.findmytutor.utils.Consts.presenceApproximatedName;
|
||||||
import static com.uam.wmi.findmytutor.utils.Consts.presenceLatitude;
|
import static com.uam.wmi.findmytutor.utils.Consts.presenceLatitude;
|
||||||
import static com.uam.wmi.findmytutor.utils.Consts.presencelongitude;
|
import static com.uam.wmi.findmytutor.utils.Consts.presenceLongitude;
|
||||||
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
|
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
|
||||||
|
|
||||||
public class BackgroundLocalizationService extends Service {
|
public class BackgroundLocalizationService extends Service {
|
||||||
@ -58,11 +57,11 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
private static final String TAG = "MyLocationService";
|
private static final String TAG = "MyLocationService";
|
||||||
private static final int LOCATION_INTERVAL = 1000;
|
private static final int LOCATION_INTERVAL = 1000;
|
||||||
private static final float LOCATION_DISTANCE = 5f;
|
private static final float LOCATION_DISTANCE = 5f;
|
||||||
|
public static String str_receiver = "background.location.broadcast";
|
||||||
private static long notify_interval = 10000;
|
private static long notify_interval = 10000;
|
||||||
Location mLastLocation;
|
Location mLastLocation;
|
||||||
Boolean stopService = false;
|
Boolean stopService = false;
|
||||||
Intent intent;
|
Intent intent;
|
||||||
public static String str_receiver = "background.location.broadcast";
|
|
||||||
ArrayList<String> providers = new ArrayList<String>();
|
ArrayList<String> providers = new ArrayList<String>();
|
||||||
LocationListener[] mLocationListeners;
|
LocationListener[] mLocationListeners;
|
||||||
|
|
||||||
@ -148,21 +147,20 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
|
|
||||||
if (!stopService) {
|
if (!stopService) {
|
||||||
|
|
||||||
Timer mTimer = new Timer();
|
|
||||||
mTimer.schedule(new TimerTaskToGetLocation(), 20, notify_interval);
|
|
||||||
intent = new Intent(str_receiver);
|
|
||||||
|
|
||||||
|
mStatusChecker = () -> {
|
||||||
|
try {
|
||||||
fn_getlocation();
|
fn_getlocation();
|
||||||
|
} finally {
|
||||||
|
mHandler.postDelayed(mStatusChecker, notify_interval);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
AsyncTask.execute(mStatusChecker);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TimerTaskToGetLocation extends TimerTask {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mHandler.post(BackgroundLocalizationService.this::fn_getlocation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
@ -260,6 +258,13 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TimerTaskToGetLocation extends TimerTask {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mHandler.post(BackgroundLocalizationService.this::fn_getlocation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class LocationListener implements android.location.LocationListener {
|
private class LocationListener implements android.location.LocationListener {
|
||||||
|
|
||||||
public LocationListener(String provider) {
|
public LocationListener(String provider) {
|
||||||
@ -291,7 +296,7 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
private class Task extends AsyncTask {
|
private class Task extends AsyncTask {
|
||||||
ApproximatedLocalization approximatedLocalization;
|
private ApproximatedLocalization approximatedLocalization;
|
||||||
private Double latitude;
|
private Double latitude;
|
||||||
private Double longitude;
|
private Double longitude;
|
||||||
private Double altitude;
|
private Double altitude;
|
||||||
@ -304,7 +309,7 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
latitude = location.getLatitude();
|
latitude = location.getLatitude();
|
||||||
longitude = location.getLongitude();
|
longitude = location.getLongitude();
|
||||||
altitude = location.getAltitude();
|
altitude = location.getAltitude();
|
||||||
approximatedLocalization = new ApproximatedLocalization(mapUtils.loadJsonFromAsset(getApplicationContext(), "building.geojson"));
|
approximatedLocalization = new ApproximatedLocalization(MapUtils.loadJsonFromAsset(getApplicationContext(), "building.geojson"));
|
||||||
approximatedBuildingPart = approximatedLocalization.getNameOfBuildingPart(Point.fromLngLat(longitude, latitude));
|
approximatedBuildingPart = approximatedLocalization.getNameOfBuildingPart(Point.fromLngLat(longitude, latitude));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +320,7 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
|
|
||||||
if (locationLevel.equals(SharingLevel.PRESENCE.toString())) {
|
if (locationLevel.equals(SharingLevel.PRESENCE.toString())) {
|
||||||
latitude = presenceLatitude;
|
latitude = presenceLatitude;
|
||||||
longitude = presencelongitude;
|
longitude = presenceLongitude;
|
||||||
approximatedBuildingPart = presenceApproximatedName;
|
approximatedBuildingPart = presenceApproximatedName;
|
||||||
} else if (locationLevel.equals(SharingLevel.APPROXIMATED.toString())) {
|
} else if (locationLevel.equals(SharingLevel.APPROXIMATED.toString())) {
|
||||||
List<Double> points = approximatedLocalization.getMiddlePointOfBuildingPart(approximatedBuildingPart);
|
List<Double> points = approximatedLocalization.getMiddlePointOfBuildingPart(approximatedBuildingPart);
|
||||||
@ -325,6 +330,7 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
LatLng latLng = PrefUtils.getManualLocation(getApplicationContext());
|
LatLng latLng = PrefUtils.getManualLocation(getApplicationContext());
|
||||||
latitude = latLng.getLatitude();
|
latitude = latLng.getLatitude();
|
||||||
longitude = latLng.getLongitude();
|
longitude = latLng.getLongitude();
|
||||||
|
approximatedBuildingPart = PrefUtils.getManualLocationApproximation(getApplicationContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -10,8 +10,8 @@ import retrofit2.http.POST;
|
|||||||
|
|
||||||
public interface FeedbackService {
|
public interface FeedbackService {
|
||||||
@POST("api/Feedback")
|
@POST("api/Feedback")
|
||||||
Observable<Response<Void>> postFeedback(@Body Feedback feedback);
|
Observable<Void> postFeedback(@Body Feedback feedback);
|
||||||
|
|
||||||
@GET("api/Feedback")
|
@GET("api/Feedback")
|
||||||
Single<Feedback> getFeedback();
|
Observable<Void> getFeedback();
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public interface PredefinedStatusesService {
|
|||||||
Single<List<PredefinedCoordViewModel>> getUserPredefinedCoords(@Path("tutorId") String tutorId);
|
Single<List<PredefinedCoordViewModel>> getUserPredefinedCoords(@Path("tutorId") String tutorId);
|
||||||
|
|
||||||
@POST("api/users/predefined/coordinate/{tutorId}")
|
@POST("api/users/predefined/coordinate/{tutorId}")
|
||||||
Single<List<PredefinedCoordViewModel>> postUserPredefinedCoord(@Path("tutorId") String tutorId, @Body PredefinedCoordViewModel coord);
|
Single <PredefinedCoordViewModel> postUserPredefinedCoord(@Path("tutorId") String tutorId, @Body PredefinedCoordViewModel coord);
|
||||||
|
|
||||||
@DELETE("api/users/predefined/coordinate/{tutorId}")
|
@DELETE("api/users/predefined/coordinate/{tutorId}")
|
||||||
Single<List<PredefinedCoordViewModel>> deleteUserPredefinedCoord(@Path("tutorId") String tutorId, @Body PredefinedCoordViewModel coord);
|
Single<List<PredefinedCoordViewModel>> deleteUserPredefinedCoord(@Path("tutorId") String tutorId, @Body PredefinedCoordViewModel coord);
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
package com.uam.wmi.findmytutor.utils;
|
package com.uam.wmi.findmytutor.utils;
|
||||||
|
|
||||||
|
import android.util.Range;
|
||||||
|
|
||||||
public class Consts {
|
public class Consts {
|
||||||
public final static Double presenceLatitude = 65.600244;
|
public final static Integer deafultMapZoom = 17;
|
||||||
public final static Double presencelongitude = 480.032153;
|
public final static Integer searchMapZoom = 13;
|
||||||
|
public final static Double presenceLatitude = 52.466365;
|
||||||
|
public final static Double presenceLongitude = 16.926792;
|
||||||
public final static String presenceApproximatedName = "unknown";
|
public final static String presenceApproximatedName = "unknown";
|
||||||
|
public final static Range<Double> latitudeRange = Range.create(52.466709, 52.467007);
|
||||||
|
public final static Range<Double> longtitudeRange = Range.create(16.926159, 16.926976);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import retrofit2.Response;
|
|||||||
|
|
||||||
public class FeedbackUtils {
|
public class FeedbackUtils {
|
||||||
private Context activityContext;
|
private Context activityContext;
|
||||||
|
AlertDialog.Builder alertDialogBuilderUserInput;
|
||||||
public FeedbackUtils(Context context){
|
public FeedbackUtils(Context context){
|
||||||
activityContext = context;
|
activityContext = context;
|
||||||
}
|
}
|
||||||
@ -37,7 +38,7 @@ public class FeedbackUtils {
|
|||||||
|
|
||||||
LayoutInflater layoutInflaterAndroid = LayoutInflater.from(activityContext);
|
LayoutInflater layoutInflaterAndroid = LayoutInflater.from(activityContext);
|
||||||
View view = layoutInflaterAndroid.inflate(R.layout.feedback_modal, null);
|
View view = layoutInflaterAndroid.inflate(R.layout.feedback_modal, null);
|
||||||
AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(activityContext);
|
alertDialogBuilderUserInput = new AlertDialog.Builder(activityContext);
|
||||||
alertDialogBuilderUserInput.setView(view).setPositiveButton(activityContext.getString(R.string.modal_feedback_send),null);
|
alertDialogBuilderUserInput.setView(view).setPositiveButton(activityContext.getString(R.string.modal_feedback_send),null);
|
||||||
final AlertDialog alertDialog = alertDialogBuilderUserInput.create();
|
final AlertDialog alertDialog = alertDialogBuilderUserInput.create();
|
||||||
|
|
||||||
@ -77,31 +78,42 @@ public class FeedbackUtils {
|
|||||||
private void sendFeedback(String header, String body, boolean mode) {
|
private void sendFeedback(String header, String body, boolean mode) {
|
||||||
String appVersion = null;
|
String appVersion = null;
|
||||||
String metadata = null;
|
String metadata = null;
|
||||||
|
Feedback userFeedback= null;
|
||||||
try {
|
try {
|
||||||
appVersion = activityContext.getPackageManager().getPackageInfo(activityContext.getPackageName(), 0).versionName;
|
appVersion = activityContext.getPackageManager().getPackageInfo(activityContext.getPackageName(), 0).versionName;
|
||||||
if( !mode ){
|
if( !mode ){
|
||||||
metadata = "\n-----------------------------\n" +
|
body = PrefUtils.getUserFirstName(activityContext) + " " + PrefUtils.getUserLastName(activityContext) + "\n" + body;
|
||||||
"User ID: " + PrefUtils.getUserId(activityContext) + "\n" +
|
userFeedback = new Feedback(mode,
|
||||||
"Device OS: Android\n" +
|
header,
|
||||||
"Device OS version: " + Build.VERSION.RELEASE + "\n" +
|
PrefUtils.getUserId(activityContext),
|
||||||
"App Version: " + appVersion + "\n" +
|
"Android "+ Build.VERSION.RELEASE,
|
||||||
"Device Model: " + Build.MODEL + "\n" +
|
appVersion,
|
||||||
"Device Manufacturer: " + Build.MANUFACTURER + "\n" +
|
Build.MODEL,
|
||||||
"-----------------------------\n";
|
body);
|
||||||
body = metadata + body;
|
Log.d("FEEDBACK non anon", userFeedback.toString());
|
||||||
header = header + " - " + PrefUtils.getUserFirstName(activityContext) + " " + PrefUtils.getUserLastName(activityContext);
|
|
||||||
|
}else{
|
||||||
|
userFeedback = new Feedback(mode,
|
||||||
|
header,
|
||||||
|
"anonymous",
|
||||||
|
"Android "+ Build.VERSION.RELEASE,
|
||||||
|
appVersion,
|
||||||
|
Build.MODEL,
|
||||||
|
body);
|
||||||
|
Log.d("FEEDBACK anon",userFeedback.toString());
|
||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
FeedbackService feedbackService = ApiClient.getClient(activityContext).create(FeedbackService.class);
|
FeedbackService feedbackService = ApiClient.getClient(activityContext).create(FeedbackService.class);
|
||||||
Feedback userFeedback = new Feedback(mode,header,body);
|
|
||||||
CompositeDisposable disposable = new CompositeDisposable();
|
CompositeDisposable disposable = new CompositeDisposable();
|
||||||
disposable.add(feedbackService.postFeedback(userFeedback)
|
disposable.add(feedbackService.postFeedback(userFeedback)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(this::handleResponse, this::handleError));
|
.subscribe(this::handleResponse, this::handleError));
|
||||||
}
|
}
|
||||||
private void handleResponse(Response<Void> resp) {
|
private void handleResponse( Void resp) {
|
||||||
Toast.makeText(activityContext, activityContext.getString(R.string.modal_feedback_thankyou), Toast.LENGTH_SHORT).show();
|
Toast.makeText(activityContext, activityContext.getString(R.string.modal_feedback_thankyou), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,9 +125,9 @@ public class FeedbackUtils {
|
|||||||
RestApiHelper.getErrorMessage(responseBody), Toast.LENGTH_SHORT).show();
|
RestApiHelper.getErrorMessage(responseBody), Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(activityContext,
|
// Toast.makeText(activityContext,
|
||||||
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
// "Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
Log.d("FEEDBACK",error.getMessage());
|
Log.d("FEEDBACK handerr ",error.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.uam.wmi.findmytutor.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
|
public class LocaleUtils {
|
||||||
|
public static String getCurrentLocale(Context context){
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
|
||||||
|
return String.valueOf(context.getResources().getConfiguration().getLocales().get(0));
|
||||||
|
} else{
|
||||||
|
//noinspection deprecation
|
||||||
|
return String.valueOf(context.getResources().getConfiguration().locale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ package com.uam.wmi.findmytutor.utils;
|
|||||||
import android.animation.TypeEvaluator;
|
import android.animation.TypeEvaluator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.location.Location;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
@ -18,16 +19,20 @@ import com.mapbox.mapboxsdk.maps.MapView;
|
|||||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||||
import com.mapbox.mapboxsdk.style.layers.FillLayer;
|
import com.mapbox.mapboxsdk.style.layers.FillLayer;
|
||||||
import com.mapbox.mapboxsdk.style.layers.Layer;
|
import com.mapbox.mapboxsdk.style.layers.Layer;
|
||||||
|
import com.uam.wmi.findmytutor.model.Coordinate;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
public class mapUtils {
|
import static com.uam.wmi.findmytutor.utils.Consts.latitudeRange;
|
||||||
|
import static com.uam.wmi.findmytutor.utils.Consts.longtitudeRange;
|
||||||
|
|
||||||
|
public class MapUtils {
|
||||||
|
|
||||||
// Boundires
|
// Boundires
|
||||||
private static final LatLngBounds WMI_BOUNDS = new LatLngBounds.Builder()
|
private static final LatLngBounds WMI_BOUNDS = new LatLngBounds.Builder()
|
||||||
.include(new LatLng(52.467886048833094, 16.92912980245876))
|
.include(new LatLng(52.46588041661952, 16.92543089389801))
|
||||||
.include(new LatLng(52.46548540224137, 16.925255680881094))
|
.include(new LatLng(52.467824943492374, 16.928574442863464))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Map Bounds Area
|
// Map Bounds Area
|
||||||
@ -38,43 +43,16 @@ public class mapUtils {
|
|||||||
mapboxMap.setLatLngBoundsForCameraTarget(WMI_BOUNDS);
|
mapboxMap.setLatLngBoundsForCameraTarget(WMI_BOUNDS);
|
||||||
makeNewCamera(mapboxMap, 52.466799, 16.927002, 17, 0, 0, 4000);
|
makeNewCamera(mapboxMap, 52.466799, 16.927002, 17, 0, 0, 4000);
|
||||||
mapboxMap.setMinZoomPreference(16); // TODO export to map config
|
mapboxMap.setMinZoomPreference(16); // TODO export to map config
|
||||||
drawBoundsArea(context, mapboxMap, mapView, check);
|
|
||||||
} else {
|
} else {
|
||||||
mapboxMap.setLatLngBoundsForCameraTarget(null);
|
mapboxMap.setLatLngBoundsForCameraTarget(null);
|
||||||
mapboxMap.setMinZoomPreference(2);
|
mapboxMap.setMinZoomPreference(2);
|
||||||
drawBoundsArea(context, mapboxMap, mapView, check);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove b4 release
|
// Map Bounds Area
|
||||||
private static final PolygonOptions boundsArea = new PolygonOptions()
|
public static void setZoom(MapboxMap mapboxMap, Integer zoom) {
|
||||||
.add(WMI_BOUNDS.getNorthWest())
|
makeNewCamera(mapboxMap, 52.466799, 16.927002, zoom, 0, 0, 1000);
|
||||||
.add(WMI_BOUNDS.getNorthEast())
|
mapboxMap.setMinZoomPreference(16); // TODO export to map config
|
||||||
.add(WMI_BOUNDS.getSouthEast())
|
|
||||||
.add(WMI_BOUNDS.getSouthWest())
|
|
||||||
.alpha(0.1f)
|
|
||||||
.fillColor(Color.YELLOW);
|
|
||||||
// For adding and removing
|
|
||||||
private static Polygon polygon;
|
|
||||||
private static View crosshair;
|
|
||||||
|
|
||||||
private static void drawBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) {
|
|
||||||
|
|
||||||
|
|
||||||
if (check) {
|
|
||||||
// Visualise bounds area
|
|
||||||
// showBoundsArea
|
|
||||||
polygon = mapboxMap.addPolygon(boundsArea);
|
|
||||||
// showCrosshair
|
|
||||||
crosshair = new View(context);
|
|
||||||
crosshair.setLayoutParams(new FrameLayout.LayoutParams(15, 15, Gravity.CENTER));
|
|
||||||
crosshair.setBackgroundColor(Color.GREEN);
|
|
||||||
mapView.addView(crosshair);
|
|
||||||
} else {
|
|
||||||
mapboxMap.removePolygon(polygon);
|
|
||||||
mapView.removeView(crosshair);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void makeNewCamera(MapboxMap mapboxMap, double lat, double lon, int zoomParam, int bearingParam, int tiltParam, int duration) {
|
public static void makeNewCamera(MapboxMap mapboxMap, double lat, double lon, int zoomParam, int bearingParam, int tiltParam, int duration) {
|
||||||
@ -106,6 +84,10 @@ public class mapUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Boolean checkIfCoordinateIsValid(Location coordinate){
|
||||||
|
return (!latitudeRange.contains(coordinate.getLatitude()) && !longtitudeRange.contains(coordinate.getLongitude()));
|
||||||
|
}
|
||||||
|
|
||||||
// Function for marker animation
|
// Function for marker animation
|
||||||
public static class LatLngEvaluator implements TypeEvaluator<LatLng> {
|
public static class LatLngEvaluator implements TypeEvaluator<LatLng> {
|
||||||
// Method is used to interpolate the marker animation.
|
// Method is used to interpolate the marker animation.
|
@ -144,7 +144,7 @@ public class PrefUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getLocale(Context context) {
|
public static String getLocale(Context context) {
|
||||||
return getSharedPreferences(context).getString("LOCALE", "en");
|
return getSharedPreferences(context).getString("LOCALE", LocaleUtils.getCurrentLocale(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean isBackgroundLocationServiceRunning(Context context) {
|
public static Boolean isBackgroundLocationServiceRunning(Context context) {
|
||||||
@ -157,14 +157,14 @@ public class PrefUtils {
|
|||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void putManualLocation(Context context, LatLng latLng) {
|
public static void putManualLocation(Context context, LatLng latLng, String approximatedLocation) {
|
||||||
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
|
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
|
||||||
editor.putString("key_location_level","3");
|
editor.putString("key_location_level","3");
|
||||||
editor.putString("location_mode", "manual");
|
editor.putString("location_mode", "manual");
|
||||||
|
editor.putString("approx_manual_loc", approximatedLocation);
|
||||||
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()));
|
||||||
editor.putLong("latitude_manual_location", Double.doubleToRawLongBits(latLng.getLatitude()));
|
editor.putLong("latitude_manual_location", Double.doubleToRawLongBits(latLng.getLatitude()));
|
||||||
Log.d("SAVE_COORD","zapisane");
|
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,4 +175,18 @@ public class PrefUtils {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getManualLocationApproximation(Context context) {
|
||||||
|
return getSharedPreferences(context).getString("approx_manual_loc", "unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void putCurrentManualLocation(Context context,String manualId) {
|
||||||
|
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
|
||||||
|
editor.putString("current_manual_location", manualId);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCurrentManualLocation(Context context) {
|
||||||
|
return getSharedPreferences(context).getString("current_manual_location", null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -23,7 +23,7 @@ public class RestApiHelper extends Activity {
|
|||||||
JSONObject jsonObject = new JSONObject(responseBody.string());
|
JSONObject jsonObject = new JSONObject(responseBody.string());
|
||||||
return jsonObject.getString("message");
|
return jsonObject.getString("message");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return e.getMessage();
|
return "Something went wrong!";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/imageView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="180dp"
|
android:layout_height="120dp"
|
||||||
android:contentDescription="@string/logo_find_my_tutor"
|
android:contentDescription="@string/logo_find_my_tutor"
|
||||||
app:srcCompat="@drawable/logo_design_black2" />
|
app:srcCompat="@drawable/logo_design_black2" />
|
||||||
|
|
||||||
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:id="@+id/login_form"
|
android:id="@+id/login_form"
|
||||||
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
@ -58,47 +58,6 @@
|
|||||||
app:fab_colorNormal="@color/mapboxGray"
|
app:fab_colorNormal="@color/mapboxGray"
|
||||||
app:pressedTranslationZ="12dp" />
|
app:pressedTranslationZ="12dp" />
|
||||||
|
|
||||||
<com.getbase.floatingactionbutton.FloatingActionsMenu
|
|
||||||
android:id="@+id/multiple_actions_parent_fab"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="end|bottom"
|
|
||||||
android:layout_margin="16dp"
|
|
||||||
fab:fab_addButtonColorNormal="@color/mapboxRed"
|
|
||||||
fab:fab_addButtonColorPressed="@color/mapboxWhite"
|
|
||||||
fab:fab_addButtonPlusIconColor="@color/mapboxWhite"
|
|
||||||
fab:fab_labelStyle="@style/menu_labels_style"
|
|
||||||
tools:layout_editor_absoluteX="200dp"
|
|
||||||
tools:layout_editor_absoluteY="255dp">
|
|
||||||
|
|
||||||
<com.getbase.floatingactionbutton.FloatingActionButton
|
|
||||||
android:id="@+id/fab_toggle_hotels"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
fab:fab_colorNormal="@color/mapboxBlue"
|
|
||||||
fab:fab_colorPressed="@color/mapboxWhite"
|
|
||||||
fab:fab_size="mini"
|
|
||||||
fab:fab_title="@string/fab_title_hotels" />
|
|
||||||
|
|
||||||
<com.getbase.floatingactionbutton.FloatingActionButton
|
|
||||||
android:id="@+id/fab_toggle_parks"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
fab:fab_colorNormal="@color/mapboxGreen"
|
|
||||||
fab:fab_colorPressed="@color/mapboxWhite"
|
|
||||||
fab:fab_size="mini"
|
|
||||||
fab:fab_title="@string/fab_title_parks" />
|
|
||||||
|
|
||||||
<com.getbase.floatingactionbutton.FloatingActionButton
|
|
||||||
android:id="@+id/fab_toggle_bound_area"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
fab:fab_colorNormal="@color/mapboxRed"
|
|
||||||
fab:fab_colorPressed="@color/mapboxWhite"
|
|
||||||
fab:fab_size="mini"
|
|
||||||
fab:fab_title="@string/fab_title_bound_area" />
|
|
||||||
</com.getbase.floatingactionbutton.FloatingActionsMenu>
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/select_location_button"
|
android:id="@+id/select_location_button"
|
||||||
|
@ -4,10 +4,6 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/settings_category_general">
|
<PreferenceCategory android:title="@string/settings_category_general">
|
||||||
<SwitchPreference
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:key="@string/key_notifications_enabled"
|
|
||||||
android:title="@string/title_notification" />
|
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="0"
|
android:defaultValue="0"
|
||||||
|
@ -146,10 +146,19 @@
|
|||||||
<string name="modal_feedback_thankyou">Dziękujemy za przesłanie feedbacku.</string>
|
<string name="modal_feedback_thankyou">Dziękujemy za przesłanie feedbacku.</string>
|
||||||
<string name="remove_manual_location">Usuń manualną lokację</string>
|
<string name="remove_manual_location">Usuń manualną lokację</string>
|
||||||
<string name="title_activity_tutor_tab">Profil</string>
|
<string name="title_activity_tutor_tab">Profil</string>
|
||||||
<string name="saveButton">Zapisz</string>
|
<string name="saveButton">Zapisz!</string>
|
||||||
<string name="tutorTabHint">Tutaj możesz dodać swoją notatkę.\\nBędzie widoczna dla innych użytkowników.</string>
|
<string name="tutorTabHint">Tutaj możesz dodać swoją notatkę. Będzie widoczna dla innych użytkowników.</string>
|
||||||
<string name="modal_location_send">WYŚLIJ</string>
|
<string name="modal_location_send">WYŚLIJ</string>
|
||||||
<string name="modal_location_hint">Proszę nazwać wybraną lokację.</string>
|
<string name="modal_location_hint">Proszę nazwać wybraną lokację.</string>
|
||||||
|
<string name="manual_modal_title">Czy chcesz zapisać tę lokalizację?</string>
|
||||||
|
<string name="lbl_ok">Zapisz!</string>
|
||||||
|
<string name="lbl_cancel">Zakończ!</string>
|
||||||
|
<string name="manual_marker_info">Twój marker zniknie w ciągu kilku minut.</string>
|
||||||
|
<string name="manual_location_selected">Lokalizacja manualna wybrana!</string>
|
||||||
|
<string name="location_saved">Lokacja zapisana!</string>
|
||||||
|
<string name="network_error">Błąd sieci!</string>
|
||||||
|
<string name="manual_status_error">Błąd podczas pobierania danych.</string>
|
||||||
|
<string name="error_status_fetch">Błąd podczas pobierania statusów.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
<string name="settings_description">Descrition</string>
|
<string name="settings_description">Descrition</string>
|
||||||
<string name="saveButton">Save</string>
|
<string name="saveButton">Save</string>
|
||||||
<string name="tutorTabHint">Here you can add your note.\nIt will be visible to the other users.</string>
|
<string name="tutorTabHint">Here you can add your note. It will be visible to the other users.</string>
|
||||||
|
|
||||||
<string name="key_description">key_description</string>
|
<string name="key_description">key_description</string>
|
||||||
|
|
||||||
@ -222,6 +222,10 @@
|
|||||||
<string name="manual_modal_title">Do you want to save this localization?</string>
|
<string name="manual_modal_title">Do you want to save this localization?</string>
|
||||||
<string name="lbl_ok">Save!</string>
|
<string name="lbl_ok">Save!</string>
|
||||||
<string name="lbl_cancel">Cancel!</string>
|
<string name="lbl_cancel">Cancel!</string>
|
||||||
|
<string name="manual_marker_info">Your marker will disappear in next couple minutes</string>
|
||||||
|
<string name="manual_location_selected">Manual Locations selected!</string>
|
||||||
|
<string name="location_saved">Location saved!</string>
|
||||||
|
<string name="network_error">Network Error!</string>
|
||||||
|
<string name="manual_status_error">Error handling status fetch</string>
|
||||||
|
<string name="error_status_fetch">Error handling status fetch</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user