Merge branch 'fix-blacklists' of s416084/find-my-tutor-android into develop
This commit is contained in:
commit
ed2ec41d8d
@ -229,13 +229,18 @@ public class BlackList extends AppCompatActivity {
|
||||
userService.addStudentToBlacklist(PrefUtils.getUserId(getApplicationContext()), studentIdModel)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(()->{
|
||||
fetchBlackListedUsersIDs(PrefUtils.getUserId(getApplicationContext()));
|
||||
Toast.makeText(getApplicationContext(), R.string.user_added, Toast.LENGTH_SHORT).show();
|
||||
},this::showError)
|
||||
.subscribe(this::handleAddUser,this::showError)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private void handleAddUser(User user) {
|
||||
blacklistedUsersIDs.clear();
|
||||
blacklistedUsers.clear();
|
||||
blacklistedUsersIDs.addAll(user.getBlacklist());
|
||||
fetchBlackListedUsers();
|
||||
}
|
||||
|
||||
private void showError(Throwable e) {
|
||||
String message;
|
||||
|
||||
|
@ -12,6 +12,7 @@ import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@ -156,6 +157,7 @@ public class WhiteList extends AppCompatActivity {
|
||||
public void onSuccess(User user) {
|
||||
whitelistedUsers.add(user);
|
||||
toggleEmptyNotes();
|
||||
|
||||
if (whitelistedUsers.size() == whitelistedUsersIDs.size()) {
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
@ -216,13 +218,17 @@ public class WhiteList extends AppCompatActivity {
|
||||
userService.addStudentToWhitelist(PrefUtils.getUserId(getApplicationContext()), studentIdModel)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(()->{
|
||||
fetchWhiteListedUsersIDs(PrefUtils.getUserId(getApplicationContext()));
|
||||
Toast.makeText(getApplicationContext(), R.string.user_added, Toast.LENGTH_SHORT).show();
|
||||
},this::showError)
|
||||
.subscribe(this::handleAddUser,this::showError)
|
||||
);
|
||||
}
|
||||
|
||||
private void handleAddUser(User user) {
|
||||
whitelistedUsersIDs.clear();
|
||||
whitelistedUsers.clear();
|
||||
whitelistedUsersIDs.addAll(user.getWhitelist());
|
||||
fetchWhiteListedUsers();
|
||||
}
|
||||
|
||||
private void showError(Throwable e) {
|
||||
String message;
|
||||
|
||||
|
@ -81,7 +81,7 @@ public interface UserService {
|
||||
Completable setTutorBlacklist(@Path("tutorID") String tutorID, @Body IsUsingListBool isUsing);
|
||||
|
||||
@POST("api/users/blacklist/{tutorID}")
|
||||
Completable addStudentToBlacklist(@Path("tutorID") String tutorID, @Body StudentIdModel student);
|
||||
Observable <User> addStudentToBlacklist(@Path("tutorID") String tutorID, @Body StudentIdModel student);
|
||||
|
||||
// @DELETE("api/users/blacklist/{tutorID}")
|
||||
@HTTP(method = "DELETE", path = "api/users/blacklist/{tutorID}", hasBody = true)
|
||||
@ -94,7 +94,7 @@ public interface UserService {
|
||||
Completable setTutorWhitelist(@Path("tutorID") String tutorID, @Body IsUsingListBool isUsing);
|
||||
|
||||
@POST("api/users/whitelist/{tutorID}")
|
||||
Completable addStudentToWhitelist(@Path("tutorID") String tutorID, @Body StudentIdModel student);
|
||||
Observable <User> addStudentToWhitelist(@Path("tutorID") String tutorID, @Body StudentIdModel student);
|
||||
|
||||
// @DELETE("api/users/whitelist/{tutorID}")
|
||||
@HTTP(method = "DELETE", path = "api/users/whitelist/{tutorID}", hasBody = true)
|
||||
|
@ -33,19 +33,7 @@
|
||||
android:layout_marginEnd="0dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/isOnline"-->
|
||||
<!--android:layout_width="48dp"-->
|
||||
<!--android:layout_height="30dp"-->
|
||||
<!--android:layout_below="@+id/firstName"-->
|
||||
<!--android:layout_marginStart="7dp"-->
|
||||
<!--android:layout_marginTop="-10dp"-->
|
||||
<!--android:layout_toEndOf="@+id/firstName"-->
|
||||
<!--android:textColor="@color/note_list_text"-->
|
||||
<!--android:textSize="@dimen/note_list_text" />-->
|
||||
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/removeUserImageButton"
|
||||
@ -54,6 +42,7 @@
|
||||
android:layout_below="@+id/firstName"
|
||||
android:layout_toEndOf="@+id/firstName"
|
||||
android:background="@null"
|
||||
android:layout_alignParentEnd="true"
|
||||
app:srcCompat="@drawable/abc_ic_clear_material" />
|
||||
|
||||
</RelativeLayout>
|
@ -34,19 +34,6 @@
|
||||
android:textColor="@color/note_list_text"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/isOnline"-->
|
||||
<!--android:layout_width="48dp"-->
|
||||
<!--android:layout_height="30dp"-->
|
||||
<!--android:layout_below="@+id/firstName"-->
|
||||
<!--android:layout_marginStart="7dp"-->
|
||||
<!--android:layout_marginTop="-10dp"-->
|
||||
<!--android:layout_toEndOf="@+id/firstName"-->
|
||||
<!--android:textColor="@color/note_list_text"-->
|
||||
<!--android:textSize="@dimen/note_list_text" />-->
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/removeUserImageButton"
|
||||
android:layout_width="wrap_content"
|
||||
|
Loading…
Reference in New Issue
Block a user