Search in sources :

Example 6 with AlCallback

use of com.applozic.mobicomkit.listners.AlCallback in project Applozic-Android-SDK by AppLozic.

the class AlLinkPreview method createView.

public void createView() {
    AlLinkPreviewModel existingLinkModel = getUrlMetaModel();
    if (existingLinkModel != null) {
        updateViews(existingLinkModel);
    } else {
        urlLoadLayout.setVisibility(View.GONE);
        AlTask.execute(new UrlLoader(context, message, new AlCallback() {

            @Override
            public void onSuccess(Object response) {
                updateViews((AlLinkPreviewModel) response);
            }

            @Override
            public void onError(Object error) {
            }
        }));
    }
}
Also used : AlLinkPreviewModel(com.applozic.mobicomkit.uiwidgets.conversation.richmessaging.models.AlLinkPreviewModel) AlCallback(com.applozic.mobicomkit.listners.AlCallback)

Example 7 with AlCallback

use of com.applozic.mobicomkit.listners.AlCallback in project Applozic-Android-SDK by AppLozic.

the class ApplozicClient method disableChatForUser.

public ApplozicClient disableChatForUser(final boolean disable, final AlCallback callback) {
    Map<String, String> userMetadata;
    Contact contact = new AppContactService(context).getContactById(MobiComUserPreference.getInstance(context).getUserId());
    if (contact != null && contact.getMetadata() != null) {
        userMetadata = contact.getMetadata();
        userMetadata.putAll(contact.getMetadata());
    } else {
        userMetadata = new HashMap<>();
    }
    userMetadata.put(Contact.DISABLE_CHAT_WITH_USER, String.valueOf(disable));
    User user = new User();
    user.setMetadata(userMetadata);
    UserService.getInstance(context).updateUser(user, new AlCallback() {

        @Override
        public void onSuccess(Object response) {
            sharedPreferences.edit().putBoolean(Contact.DISABLE_CHAT_WITH_USER, disable).commit();
            if (callback != null) {
                callback.onSuccess(response);
            }
        }

        @Override
        public void onError(Object error) {
            if (callback != null) {
                callback.onError(error);
            }
        }
    });
    return this;
}
Also used : User(com.applozic.mobicomkit.api.account.user.User) AppContactService(com.applozic.mobicomkit.contact.AppContactService) JSONObject(org.json.JSONObject) AlCallback(com.applozic.mobicomkit.listners.AlCallback) Contact(com.applozic.mobicommons.people.contact.Contact)

Aggregations

AlCallback (com.applozic.mobicomkit.listners.AlCallback)7 Uri (android.net.Uri)4 ProgressDialog (android.app.ProgressDialog)3 Intent (android.content.Intent)3 AttachmentFilteringListener (com.applozic.mobicomkit.listners.AttachmentFilteringListener)3 ConversationActivity (com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity)2 PatternSyntaxException (java.util.regex.PatternSyntaxException)2 Context (android.content.Context)1 Configuration (android.content.res.Configuration)1 View (android.view.View)1 ViewConfiguration (android.view.ViewConfiguration)1 GridView (android.widget.GridView)1 ImageView (android.widget.ImageView)1 NonNull (androidx.annotation.NonNull)1 User (com.applozic.mobicomkit.api.account.user.User)1 FileMeta (com.applozic.mobicomkit.api.attachment.FileMeta)1 AlGroupOfTwoCreateTask (com.applozic.mobicomkit.api.conversation.AlGroupOfTwoCreateTask)1 AlMessageReportTask (com.applozic.mobicomkit.api.conversation.AlMessageReportTask)1 Message (com.applozic.mobicomkit.api.conversation.Message)1 MessageDeleteTask (com.applozic.mobicomkit.api.conversation.MessageDeleteTask)1