Merge branch 'user-search-query-approach' of s416084/find-my-tutor-android into develop

This commit is contained in:
Mieszko Wrzeszczyński 2019-01-03 20:33:46 +00:00 committed by Gogs
commit 6902a62d07
6 changed files with 25 additions and 33 deletions

View File

@ -220,17 +220,12 @@ public abstract class BaseActivity
}
public void handleBackgroundTaskLifeCycle() {
Log.e("Localization", String.valueOf(PrefUtils.isEnableSharingLocalization(getApplicationContext())));
Boolean shouldServiceRun = PrefUtils.isEnableSharingLocalization(getApplicationContext()) && isTutor;
Log.e("Localization", String.valueOf(shouldServiceRun));
if (shouldServiceRun) {
startBackgroundLocalizationTask();
Log.e("Localization", "JEstem i odpalam");
} else {
stopBackgroundLocalizationTask();
Log.e("Localization", "JEstem i nie odpalam");
}
}
@ -304,11 +299,10 @@ public abstract class BaseActivity
}
});
RxSearchObservable.fromView(searchView)
.skip(0)
.map(String::toLowerCase)
.filter(t -> !t.isEmpty())
.debounce(250, TimeUnit.MILLISECONDS)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@ -229,7 +229,7 @@ public class UsersListFragment extends Fragment {
private void fetchAllTutors() {
disposable.add(
(fetchOnlyOnlineUsers ?
userService.getAllOnlineTutors() :
userService.getAllActiveTutors() :
userService.getAllOfflineTutors())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@ -313,12 +313,7 @@ public class UsersListFragment extends Fragment {
message = getString(R.string.network_err);
}
Snackbar snackbar = Snackbar.make(coordinatorLayout, message, Snackbar.LENGTH_LONG);
View view = snackbar.getView();
CoordinatorLayout.LayoutParams params=(CoordinatorLayout.LayoutParams)view.getLayoutParams();
params.gravity = Gravity.TOP;
view.setLayoutParams(params);
snackbar.show();
createSnackbar(message);
}
private void showSearchError(Throwable e) {
@ -332,23 +327,18 @@ public class UsersListFragment extends Fragment {
message = getString(R.string.search_null);
}
/* Snackbar.make(coordinatorLayout, message, Snackbar.LENGTH_LONG)
.show();
*/
createSnackbar(message);
}
Snackbar snackbar = Snackbar.make(coordinatorLayout, message, Snackbar.LENGTH_LONG);
private void createSnackbar(String msg){
Snackbar snackbar = Snackbar.make(coordinatorLayout, msg, Snackbar.LENGTH_LONG);
View view = snackbar.getView();
CoordinatorLayout.LayoutParams params=(CoordinatorLayout.LayoutParams)view.getLayoutParams();
params.gravity = Gravity.TOP;
view.setLayoutParams(params);
snackbar.show();
}
private void toggleEmptyNotes() {
if (tutorsList.size() > 0) {
noNotesView.setVisibility(View.GONE);

View File

@ -19,6 +19,7 @@ import retrofit2.http.HTTP;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface UserService {
@ -34,11 +35,14 @@ public interface UserService {
@GET("api/users/tutors/online")
Single <List<User>> getAllOnlineTutors();
@GET("api/users/tutors/active")
Single <List<User>> getAllActiveTutors();
@GET("api/users/tutors/offline")
Single <List<User>> getAllOfflineTutors();
@GET("api/users/tutors/search/{searchString}")
Single <List<User>> searchUser(@Path("searchString") String searchString );
@GET("api/users/tutors/search")
Single <List<User>> searchUser(@Query(value = "searchString", encoded = true) String searchString);
@POST("api/users")
Completable createUser(@Body User user);

View File

@ -72,4 +72,6 @@
android:text="@string/info_icon_userlist_summary"
android:textColor="@color/half_black"/>
</LinearLayout>

View File

@ -253,9 +253,10 @@
<string name="scrap_tutor_tab">Pobierz dane z WMI</string>
<string name="scrap_tutor_msg">Dane zostały zaktualizwane!</string>
<string name="no_online_users">Brak użytkowników online.</string>
<!--(ENG) Checkbox online users list -->
<string name="no_online_users">Brak aktywnych użytkowników.</string>
<string name="no_offline_users">Brak użytkowników offline.</string>
<string name="only_online_users">Tylko użytkownicy online</string>
<string name="only_online_users">Tylko aktywni użytkownicy</string>
<string name="network_err">Błąd sieci!</string>
<string name="search_null">Brak wyników!</string>

View File

@ -260,7 +260,6 @@
<string name="map_info_text_marker_exact">exact localization (from mobile GPS)</string>
<string name="map_info_text_marker_approximated">approximated localization</string>
<string name="map_info_text_marker_manual">manual localization (manually picked)</string>
<string name="map_info_text_p4">You can search for any tutor on the map by entering his name and surname in the search field.</string>
<!--(ENG) Blacklist info helper-->
<string name="info_icon_blacklist_p1">In this panel you can add users to your blacklist. Users from the blacklist cant see any data that you share - localization, online status, or information about presence.</string>
@ -298,9 +297,7 @@
<string name="info_icon_userlist_tab_level_status_offline">- user is currently offline</string>
<string name="info_icon_userlist_tab_level_status_inactive">- user is inactive </string>
<string name="info_icon_userlist_tab_level_status_inactive_tip">(didnt share any localization data since 7 days)</string>
<string name="info_icon_userlist_summary">After clicking on a name, the tutor tab will pop up, containing details about selected tutor.</string>
<string name="info_icon_userlist_tab_p3">By default, only active users are shown. You can change that in menu (three dots icon).</string>
<string name="info_icon_userlist_tab_p4">You can also search for a tutor directly, by entering name and surname of person that you look for.</string>
<string name="info_icon_userlist_summary">After clicking on a name, the tutor tab will pop up, containing details about selected tutor.\n\nYou can search for any tutor on the map by entering his name and surname in the search field.\n\nBy default, only active users are shown. You can change that in menu (three dots icon).\n\nYou can also search for a tutor directly, by entering name and surname of person that you look for.</string>
<!--(ENG) Blacklist -->
<string name="title_activity_black_list">Blacklist</string>
@ -335,9 +332,13 @@
<string name="off">OFF</string>
<string name="scrap_tutor_tab">Scrap!</string>
<string name="scrap_tutor_msg">Data updated!</string>
<string name="no_online_users">Currently, there are no\nonline users.</string>
<!--(ENG) Checkbox online users list -->
<string name="no_online_users">Currently, there are no\nactive users.</string>
<string name="no_offline_users">Currently, there are no\noffline users.</string>
<string name="only_online_users">Only online users</string>
<string name="only_online_users">Only active users</string>
<string name="network_err">Network Error !</string>
<string name="search_null">Search response is empty!</string>
<string name="modal_manual_hint">Insert a name for this localization.</string>