Search in sources :

Example 1 with MuteNotificationRequest

use of com.applozic.mobicomkit.api.notification.MuteNotificationRequest in project Applozic-Android-SDK by AppLozic.

the class MobiComConversationFragment method umuteGroupChat.

public void umuteGroupChat() {
    Date date = Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime();
    millisecond = date.getTime();
    final MuteNotificationAsync.TaskListener taskListener = new MuteNotificationAsync.TaskListener() {

        @Override
        public void onSuccess(ApiResponse apiResponse) {
            if (menu != null) {
                menu.findItem(R.id.unmuteGroup).setVisible(false);
                menu.findItem(R.id.muteGroup).setVisible(true);
            }
        }

        @Override
        public void onFailure(ApiResponse apiResponse, Exception exception) {
        }

        @Override
        public void onCompletion() {
        }
    };
    muteNotificationRequest = new MuteNotificationRequest(channel.getKey(), millisecond);
    MuteNotificationAsync muteNotificationAsync = new MuteNotificationAsync(getContext(), taskListener, muteNotificationRequest);
    AlTask.execute(muteNotificationAsync);
}
Also used : MuteNotificationRequest(com.applozic.mobicomkit.api.notification.MuteNotificationRequest) Date(java.util.Date) MuteNotificationAsync(com.applozic.mobicomkit.api.notification.MuteNotificationAsync) ApiResponse(com.applozic.mobicomkit.feed.ApiResponse) ApplozicException(com.applozic.mobicomkit.exception.ApplozicException) PatternSyntaxException(java.util.regex.PatternSyntaxException)

Example 2 with MuteNotificationRequest

use of com.applozic.mobicomkit.api.notification.MuteNotificationRequest in project Applozic-Android-SDK by AppLozic.

the class MobiComConversationFragment method muteGroupChat.

public void muteGroupChat() {
    final CharSequence[] items = { ApplozicService.getContext(getContext()).getString(R.string.eight_Hours), ApplozicService.getContext(getContext()).getString(R.string.one_week), ApplozicService.getContext(getContext()).getString(R.string.one_year) };
    Date date = Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime();
    millisecond = date.getTime();
    final MuteNotificationAsync.TaskListener taskListener = new MuteNotificationAsync.TaskListener() {

        @Override
        public void onSuccess(ApiResponse apiResponse) {
            if (menu != null) {
                menu.findItem(R.id.muteGroup).setVisible(false);
                menu.findItem(R.id.unmuteGroup).setVisible(true);
            }
        }

        @Override
        public void onFailure(ApiResponse apiResponse, Exception exception) {
        }

        @Override
        public void onCompletion() {
        }
    };
    AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).setTitle(ApplozicService.getContext(getContext()).getString(R.string.mute_group_for)).setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, final int selectedItem) {
            if (selectedItem == 0) {
                millisecond = millisecond + 28800000;
            } else if (selectedItem == 1) {
                millisecond = millisecond + 604800000;
            } else if (selectedItem == 2) {
                millisecond = millisecond + 31558000000L;
            }
            muteNotificationRequest = new MuteNotificationRequest(channel.getKey(), millisecond);
            MuteNotificationAsync muteNotificationAsync = new MuteNotificationAsync(getContext(), taskListener, muteNotificationRequest);
            AlTask.execute(muteNotificationAsync);
            dialog.dismiss();
        }
    });
    AlertDialog alertdialog = builder.create();
    alertdialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) MessageBuilder(com.applozic.mobicomkit.api.conversation.MessageBuilder) Date(java.util.Date) ApiResponse(com.applozic.mobicomkit.feed.ApiResponse) ApplozicException(com.applozic.mobicomkit.exception.ApplozicException) PatternSyntaxException(java.util.regex.PatternSyntaxException) Collections.disjoint(java.util.Collections.disjoint) MuteNotificationRequest(com.applozic.mobicomkit.api.notification.MuteNotificationRequest) MuteNotificationAsync(com.applozic.mobicomkit.api.notification.MuteNotificationAsync)

Aggregations

MuteNotificationAsync (com.applozic.mobicomkit.api.notification.MuteNotificationAsync)2 MuteNotificationRequest (com.applozic.mobicomkit.api.notification.MuteNotificationRequest)2 ApplozicException (com.applozic.mobicomkit.exception.ApplozicException)2 ApiResponse (com.applozic.mobicomkit.feed.ApiResponse)2 Date (java.util.Date)2 PatternSyntaxException (java.util.regex.PatternSyntaxException)2 AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1 MessageBuilder (com.applozic.mobicomkit.api.conversation.MessageBuilder)1 Collections.disjoint (java.util.Collections.disjoint)1