Fix BG & markers filter & boundaries

This commit is contained in:
Mieszko Wrzeszczyński 2018-11-29 22:31:47 +01:00
parent f6cfb7f352
commit 79d48bb269
9 changed files with 37 additions and 35 deletions

View File

@ -30,7 +30,7 @@ repositories {
}
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:appcompat-v7: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.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation "io.swagger:swagger-annotations:1.5.15"
implementation "org.threeten:threetenbp:1.3.5"
implementation 'io.swagger:swagger-annotations:1.5.15'
implementation 'org.threeten:threetenbp:1.3.5'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.6.5'
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'
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"
implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"
implementation "com.squareup.okhttp3:okhttp:3.11.0"
implementation "com.squareup.okhttp3:okhttp-urlconnection:3.10.0"
implementation "com.squareup.okhttp3:logging-interceptor:3.11.0"
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.auth0.android:jwtdecode:1.1.1'
implementation 'com.annimon:stream:1.2.1'
@ -63,5 +63,4 @@ dependencies {
// FloatingBarMenu
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'org.apache.commons:commons-collections4:4.0'
}

View File

@ -20,6 +20,7 @@ import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -38,7 +39,10 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
@ -201,7 +205,7 @@ public abstract class BaseActivity
}
public void handleBackgroundTaskLifeCycle() {
Boolean shouldServiceRun = PrefUtils.isEnableSharingLocalization(getApplicationContext());
Boolean shouldServiceRun = PrefUtils.isEnableSharingLocalization(getApplicationContext()) && isTutor;
if (shouldServiceRun) {
startBackgroundLocalizationTask();
@ -270,13 +274,13 @@ public abstract class BaseActivity
}
});
RxSearchObservable.fromView(searchView)
.skip(0)
.map(String::toLowerCase)
.debounce(300, TimeUnit.MILLISECONDS)
.distinctUntilChanged()
.debounce(250, TimeUnit.MILLISECONDS)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.switchMap((Function<String, ObservableSource<String>>) Observable::just)
.subscribe(this::executeSearch);
return true;
@ -285,16 +289,15 @@ public abstract class BaseActivity
private void executeSearch(String input) {
if (activeFragment.equals(ActiveFragment.USER_LIST)) {
((UsersListFragment) userListFragment).searchUser(input);
} else if (activeFragment.equals(ActiveFragment.NONE)) {
searchUser(input);
}
}
public void searchUser(String textToSearch) {
}
abstract void searchUser(String textToSearch);
public void restoreMapMarkers() {
}
abstract void restoreMapMarkers();
@Override
public boolean onOptionsItemSelected(MenuItem item) {

View File

@ -21,6 +21,7 @@ import com.auth0.android.jwt.JWT;
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
import com.uam.wmi.findmytutor.R;
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.ValidateUser;
import com.uam.wmi.findmytutor.network.ApiClient;
@ -147,7 +148,6 @@ public class LoginActivity extends AppCompatActivity {
}
private void loginProcess(String email, String password) {
ValidateUser user = new ValidateUser(email, password);
disposable.add(ldapService.validate(user)

View File

@ -132,6 +132,7 @@ public class MapActivity extends BaseActivity
//start background task
handleBackgroundTaskLifeCycle();
manualLocationUtils = new ManualLocationUtils(MapActivity.this);
}
@Override
@ -163,6 +164,7 @@ public class MapActivity extends BaseActivity
});
setOnMapLongClickListener();
mapUtils.setMapBoundsArea(getApplicationContext(), mapboxMap, mapView, true);
}
private void updateUserHashMap(String userId, Long markerId) {

View File

@ -9,6 +9,7 @@ import android.support.v7.app.AlertDialog;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
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.RestApiHelper;
import java.text.Collator;
import java.text.Normalizer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
@ -61,6 +65,7 @@ public class UsersListFragment extends Fragment {
private TutorsListAdapter mAdapter;
private List<User> tutorsList = new ArrayList<>();
private List<User> tutorsFiltered = new ArrayList<>();
private Collator plCollator = Collator.getInstance(Locale.forLanguageTag("pl-PL"));
public UsersListFragment() {
}
@ -108,6 +113,7 @@ public class UsersListFragment extends Fragment {
}
public void searchUser(String textToSearch) {
tutorsFiltered.clear();
tutorsFiltered.addAll(Stream.of(tutorsList).filter(t ->
t.toSearchAbleString().toLowerCase().contains(textToSearch.toLowerCase())).toList());
@ -212,7 +218,7 @@ public class UsersListFragment extends Fragment {
private int sortByUserName(User t1, User t2) {
return t1.getLastName().compareToIgnoreCase(t2.getLastName());
return plCollator.compare(t1.getLastName(),t2.getLastName());
}
private void showError(Throwable e) {

View File

@ -47,7 +47,7 @@ public class Coordinate extends BaseResponse {
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 (!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.longitude = longitude;

View File

@ -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);
}
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(){
StringBuilder sb = new StringBuilder();
sb.append(getFirstName());
sb.append(getLastName());
return sb.toString();
return getFirstName() +
getLastName();
}

View File

@ -166,11 +166,8 @@ public class BackgroundLocalizationService extends Service {
}
};
AsyncTask.execute(mStatusChecker);
}
}

View File

@ -41,7 +41,7 @@ public class mapUtils {
if (check) {
// Set bounds to WMI
mapboxMap.setLatLngBoundsForCameraTarget(WMI_BOUNDS);
makeNewCamera(mapboxMap, 52.466799, 16.927002, 17, 0, 0, 4000);
makeNewCamera(mapboxMap, 52.466799, 16.927002, 16, 0, 0, 4000);
mapboxMap.setMinZoomPreference(16); // TODO export to map config
} else {
mapboxMap.setLatLngBoundsForCameraTarget(null);