use of com.applozic.mobicomkit.api.account.user.UserBlockTask in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method blockUserProcess.
public void blockUserProcess(final String userId, final boolean block, final boolean isFromChannel) {
final ProgressDialog progressDialog = ProgressDialog.show(getActivity(), "", ApplozicService.getContext(getContext()).getString(R.string.please_wait_info), true);
UserBlockTask.TaskListener listener = new UserBlockTask.TaskListener() {
@Override
public void onSuccess(ApiResponse apiResponse) {
if (block && typingStarted) {
if (getActivity() != null) {
setToolbarSubtitle("");
}
Applozic.publishTypingStatus(getActivity(), null, contact, false);
}
menu.findItem(R.id.userBlock).setVisible(!block);
menu.findItem(R.id.userUnBlock).setVisible(block);
}
@Override
public void onFailure(ApiResponse apiResponse, Exception exception) {
String error = getString(Utils.isInternetAvailable(getActivity()) ? R.string.applozic_server_error : R.string.you_need_network_access_for_block_or_unblock);
Toast toast = Toast.makeText(getActivity(), error, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
@Override
public void onCompletion() {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
if (!isFromChannel) {
contact = appContactService.getContactById(userId);
}
}
};
AlTask.execute(new UserBlockTask(getActivity(), listener, userId, block));
}
use of com.applozic.mobicomkit.api.account.user.UserBlockTask in project Applozic-Android-SDK by AppLozic.
the class AppContactFragment method blockUserProcess.
public void blockUserProcess(final Contact contact, final boolean block) {
final ProgressDialog progressDialog = ProgressDialog.show(getActivity(), "", getActivity().getString(R.string.please_wait_info), true);
UserBlockTask.TaskListener listener = new UserBlockTask.TaskListener() {
@Override
public void onSuccess(ApiResponse apiResponse) {
getLoaderManager().restartLoader(ContactsQuery.QUERY_ID, null, AppContactFragment.this);
}
@Override
public void onFailure(ApiResponse apiResponse, Exception exception) {
String error = getString(Utils.isInternetAvailable(getActivity()) ? R.string.applozic_server_error : R.string.you_need_network_access_for_block_or_unblock);
Toast toast = Toast.makeText(getActivity(), error, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
@Override
public void onCompletion() {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
}
};
AlTask.execute(new UserBlockTask(getActivity(), listener, contact.getUserId(), block));
}
Aggregations