Search in sources :

Example 71 with Contact

use of com.applozic.mobicommons.people.contact.Contact in project Applozic-Android-SDK by AppLozic.

the class ContactSelectionFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    bundle = getArguments();
    String jsonString = FileUtils.loadSettingsJsonFile(getActivity().getApplicationContext());
    if (!TextUtils.isEmpty(jsonString)) {
        alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class);
    } else {
        alCustomizationSettings = new AlCustomizationSettings();
    }
    userPreference = MobiComUserPreference.getInstance(getActivity());
    if (bundle != null) {
        channel = (Channel) bundle.getSerializable(CHANNEL_OBJECT);
        disableCheckBox = bundle.getBoolean(CHECK_BOX, false);
        channelName = bundle.getString(CHANNEL);
        imageUrl = bundle.getString(IMAGE_LINK);
        groupType = bundle.getInt(GROUP_TYPE);
        contactsGroupId = userPreference.getContactsGroupId();
    }
    setHasOptionsMenu(true);
    refreshContactsScreenBroadcast = new RefreshContactsScreenBroadcast();
    if (savedInstanceState != null) {
        mSearchTerm = savedInstanceState.getString(SearchManager.QUERY);
        mPreviouslySelectedSearchItem = savedInstanceState.getInt(STATE_PREVIOUSLY_SELECTED_KEY, 0);
    }
    contactDatabase = new ContactDatabase(getContext());
    appContactService = new AppContactService(getActivity());
    mAdapter = new ContactsAdapter(getActivity());
    final Context context = getActivity().getApplicationContext();
    mImageLoader = new ImageLoader(context, getListPreferredItemHeight()) {

        @Override
        protected Bitmap processBitmap(Object data) {
            return appContactService.downloadContactImage(context, (Contact) data);
        }
    };
    // Set a placeholder loading image for the image loader
    mImageLoader.setLoadingImage(R.drawable.applozic_ic_contact_picture_holo_light);
    // Add a cache to the image loader
    mImageLoader.addImageCache(getActivity().getSupportFragmentManager(), 0.1f);
    mImageLoader.setImageFadeIn(false);
    if (contactsGroupId != null) {
        ChannelDatabaseService channelDatabaseService = ChannelDatabaseService.getInstance(context);
        groupContacts = channelDatabaseService.getChannelMemberByName(contactsGroupId, String.valueOf(Channel.GroupType.CONTACT_GROUP.getValue()));
        if (Utils.isInternetAvailable(getContext())) {
            ApplozicGetMemberFromContactGroupTask.GroupMemberListener eventMemberListener = new ApplozicGetMemberFromContactGroupTask.GroupMemberListener() {

                @Override
                public void onSuccess(String[] userIdArray, Context context) {
                    if (isAdded()) {
                        groupContacts = new String[userIdArray.length];
                        groupContacts = userIdArray;
                        getLoaderManager().initLoader(ContactsQuery.QUERY_ID, null, ContactSelectionFragment.this);
                    }
                }

                @Override
                public void onFailure(String response, Context context) {
                }
            };
            // pass GroupId whose contact Members you want to show, contactGroupType
            ApplozicGetMemberFromContactGroupTask applozicGetMemberFromContactGroupTask = new ApplozicGetMemberFromContactGroupTask(getActivity(), contactsGroupId, String.valueOf(Channel.GroupType.CONTACT_GROUP.getValue()), eventMemberListener);
            AlTask.execute(applozicGetMemberFromContactGroupTask);
        } else if (groupContacts != null) {
            getLoaderManager().initLoader(ContactsQuery.QUERY_ID, null, ContactSelectionFragment.this);
        }
    } else if (MobiComUserPreference.getInstance(getContext()).getContactGroupIdList() != null && !MobiComUserPreference.getInstance(getContext()).getContactGroupIdList().isEmpty()) {
        List<String> groupList = new ArrayList<String>();
        groupList.addAll(MobiComUserPreference.getInstance(getContext()).getContactGroupIdList());
        final ProgressDialog progressBar = new ProgressDialog(getContext());
        progressBar.setMessage(getContext().getResources().getString(R.string.processing_please_wait));
        progressBar.show();
        AlGetMembersFromContactGroupListTask.GetMembersFromGroupIdListListener listener = new AlGetMembersFromContactGroupListTask.GetMembersFromGroupIdListListener() {

            @Override
            public void onSuccess(Context context, String response, String[] contactList) {
                progressBar.dismiss();
                groupContacts = contactList;
                getLoaderManager().initLoader(ContactSelectionFragment.ContactsQuery.QUERY_ID, null, ContactSelectionFragment.this);
            }

            @Override
            public void onFailure(Context context, String response, Exception e) {
                progressBar.dismiss();
                Toast.makeText(getContext(), "Failed to load contacts : Response : " + response + "\nException : " + e, Toast.LENGTH_SHORT).show();
            }
        };
        if (MobiComUserPreference.getInstance(getContext()).isContactGroupNameList()) {
            AlTask.execute(new AlGetMembersFromContactGroupListTask(getContext(), listener, null, groupList, "9"));
        } else {
            AlTask.execute(new AlGetMembersFromContactGroupListTask(getContext(), listener, groupList, null, "9"));
        }
    }
}
Also used : Context(android.content.Context) AlCustomizationSettings(com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings) AppContactService(com.applozic.mobicomkit.contact.AppContactService) SpannableString(android.text.SpannableString) ContactDatabase(com.applozic.mobicomkit.contact.database.ContactDatabase) ProgressDialog(android.app.ProgressDialog) ChannelDatabaseService(com.applozic.mobicomkit.channel.database.ChannelDatabaseService) AlGetMembersFromContactGroupListTask(com.applozic.mobicomkit.uiwidgets.async.AlGetMembersFromContactGroupListTask) Contact(com.applozic.mobicommons.people.contact.Contact) ApplozicGetMemberFromContactGroupTask(com.applozic.mobicomkit.uiwidgets.async.ApplozicGetMemberFromContactGroupTask) Bitmap(android.graphics.Bitmap) List(java.util.List) ArrayList(java.util.ArrayList) ImageLoader(com.applozic.mobicommons.commons.image.ImageLoader)

Example 72 with Contact

use of com.applozic.mobicommons.people.contact.Contact in project Applozic-Android-SDK by AppLozic.

the class ContactSelectionFragment method onItemClick.

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
    final Cursor cursor = mAdapter.getCursor();
    cursor.moveToPosition(position);
    Contact contact = contactDatabase.getContact(cursor, "_id");
    if (disableCheckBox) {
        isUserPresnt = ChannelService.getInstance(getActivity()).isUserAlreadyPresentInChannel(channel.getKey(), contact.getContactIds());
        if (!isUserPresnt) {
            Intent intent = new Intent();
            intent.putExtra(ChannelInfoActivity.USERID, contact.getUserId());
            getActivity().setResult(getActivity().RESULT_OK, intent);
            getActivity().finish();
        }
    } else {
        AppCompatCheckBox checkBox = (AppCompatCheckBox) view.findViewById(R.id.checkbox);
        checkBox.toggle();
        if (checkBox.isChecked()) {
            userIdList.add(contact.getContactIds());
        } else if (!checkBox.isChecked()) {
            userIdList.remove(contact.getContactIds());
        }
    }
}
Also used : Intent(android.content.Intent) Cursor(android.database.Cursor) Contact(com.applozic.mobicommons.people.contact.Contact) AppCompatCheckBox(androidx.appcompat.widget.AppCompatCheckBox)

Example 73 with Contact

use of com.applozic.mobicommons.people.contact.Contact in project Applozic-Android-SDK by AppLozic.

the class ContactSelectionFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.Done) {
        if (userIdList != null && userIdList.size() == 0) {
            Toast.makeText(getActivity(), R.string.select_at_least, Toast.LENGTH_SHORT).show();
        } else {
            final ProgressDialog progressDialog = ProgressDialog.show(getActivity(), "", getActivity().getString(TextUtils.isEmpty(channelName) ? R.string.broadcast_creating_info : R.string.group_creating_info), true);
            AlChannelCreateAsyncTask.TaskListenerInterface taskListenerInterface = new AlChannelCreateAsyncTask.TaskListenerInterface() {

                @Override
                public void onSuccess(Channel channel, Context context) {
                    if (progressDialog != null && progressDialog.isShowing()) {
                        progressDialog.dismiss();
                    }
                    if (channel != null) {
                        Intent intent = new Intent(getActivity(), ConversationActivity.class);
                        if (ApplozicClient.getInstance(getActivity().getApplicationContext()).isContextBasedChat()) {
                            intent.putExtra(ConversationUIService.CONTEXT_BASED_CHAT, true);
                        }
                        intent.putExtra(ConversationUIService.GROUP_ID, channel.getKey());
                        intent.putExtra(ConversationUIService.GROUP_NAME, channel.getName());
                        getActivity().startActivity(intent);
                    }
                    if (bundle != null && bundle.getString(CHANNEL) != null) {
                        getActivity().sendBroadcast(new Intent(ChannelCreateActivity.ACTION_FINISH_CHANNEL_CREATE));
                    }
                    if (getActivity() != null) {
                        getActivity().finish();
                    }
                }

                @Override
                public void onFailure(ChannelFeedApiResponse channelFeedApiResponse, Context context) {
                    if (progressDialog != null && progressDialog.isShowing()) {
                        progressDialog.dismiss();
                    }
                    if (channelFeedApiResponse != null) {
                        List<ErrorResponseFeed> error = channelFeedApiResponse.getErrorResponse();
                        if (error != null && error.size() > 0) {
                            ErrorResponseFeed errorResponseFeed = error.get(0);
                            String errorDescription = errorResponseFeed.getDescription();
                            if (!TextUtils.isEmpty(errorDescription)) {
                                if (MobiComKitConstants.GROUP_USER_LIMIT_EXCEED.equalsIgnoreCase(errorDescription)) {
                                    Toast.makeText(context, R.string.group_members_limit_exceeds, Toast.LENGTH_SHORT).show();
                                } else {
                                    Toast.makeText(context, R.string.applozic_server_error, Toast.LENGTH_SHORT).show();
                                }
                            }
                        }
                    } else {
                        Toast.makeText(context, Utils.isInternetAvailable(context) ? R.string.applozic_server_error : R.string.you_dont_have_any_network_access_info, Toast.LENGTH_SHORT).show();
                    }
                }
            };
            if (userIdList != null && userIdList.size() > 0) {
                if (TextUtils.isEmpty(channelName)) {
                    StringBuffer stringBuffer = new StringBuffer();
                    int i = 0;
                    for (String userId : userIdList) {
                        i++;
                        if (i > 10)
                            break;
                        Contact contactDisplayName = appContactService.getContactById(userId);
                        stringBuffer.append(contactDisplayName.getDisplayName()).append(",");
                    }
                    int lastIndex = stringBuffer.lastIndexOf(",");
                    channelName = stringBuffer.replace(lastIndex, lastIndex + 1, "").toString();
                }
                ChannelInfo channelInfo = new ChannelInfo(channelName, userIdList);
                if (!TextUtils.isEmpty(imageUrl)) {
                    channelInfo.setImageUrl(imageUrl);
                }
                if (groupType == Channel.GroupType.BROADCAST.getValue()) {
                    channelInfo.setType(groupType);
                } else if (alCustomizationSettings != null) {
                    channelInfo.setType(alCustomizationSettings.getDefaultGroupType());
                } else {
                    channelInfo.setType(groupType);
                }
                if (MobiComUserPreference.getInstance(getActivity()).getParentGroupKey() != null && MobiComUserPreference.getInstance(getActivity()).getParentGroupKey() != 0) {
                    channelInfo.setParentKey(MobiComUserPreference.getInstance(getActivity()).getParentGroupKey());
                }
                AlChannelCreateAsyncTask alChannelCreateAsyncTask = new AlChannelCreateAsyncTask(getActivity(), channelInfo, taskListenerInterface);
                AlTask.execute(alChannelCreateAsyncTask);
            }
        }
        return true;
    }
    return false;
}
Also used : Context(android.content.Context) ErrorResponseFeed(com.applozic.mobicomkit.feed.ErrorResponseFeed) Channel(com.applozic.mobicommons.people.channel.Channel) Intent(android.content.Intent) ChannelInfo(com.applozic.mobicomkit.api.people.ChannelInfo) SpannableString(android.text.SpannableString) ProgressDialog(android.app.ProgressDialog) SuppressLint(android.annotation.SuppressLint) ChannelFeedApiResponse(com.applozic.mobicomkit.feed.ChannelFeedApiResponse) Contact(com.applozic.mobicommons.people.contact.Contact) AlChannelCreateAsyncTask(com.applozic.mobicomkit.uiwidgets.async.AlChannelCreateAsyncTask)

Example 74 with Contact

use of com.applozic.mobicommons.people.contact.Contact in project Applozic-Android-SDK by AppLozic.

the class ProfileFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View view = inflater.inflate(R.layout.al_activity_profile, container, false);
    img_profile = (ImageView) view.findViewById(R.id.applozic_user_profile);
    statusEdit = (ImageView) view.findViewById(R.id.status_edit_btn);
    displayNameEdit = (ImageView) view.findViewById(R.id.displayName_edit_btn);
    contactEdit = (ImageView) view.findViewById(R.id.contact_edit_btn);
    selectImageProfileIcon = (ImageView) view.findViewById(R.id.applozic_user_profile_camera);
    logoutbtn = (Button) view.findViewById(R.id.applozic_profile_logout);
    displayNameText = (TextView) view.findViewById(R.id.applozic_profile_displayname);
    statusText = (TextView) view.findViewById(R.id.applozic_profile_status);
    contactNumberText = (TextView) view.findViewById(R.id.applozic_profile_contact);
    applozicProfileContactLayout = (RelativeLayout) view.findViewById(R.id.applozic_profile_contact_section_rl);
    setupDeviderView(view, R.id.applozic_profile_section_rl, R.id.applozic_profile_verticalline_rl);
    setupDeviderView(view, R.id.applozic_datausage_section_rl, R.id.applozic_datausage_verticalline_rl);
    setupDeviderView(view, R.id.applozic_notification_section_rl, R.id.applozic_notification_verticalline_rl);
    Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.my_toolbar);
    toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
    toolbarTitle.setText(R.string.applozic_user_profile_heading);
    ObjectAnimator animation = ObjectAnimator.ofFloat(toolbarTitle, "translationY", 0f);
    animation.setDuration(10);
    animation.start();
    toolbar.setClickable(false);
    // toolbar.setTitle(getString(R.string.applozic_user_profile_heading));
    // toolbar.setSubtitle("");
    setHasOptionsMenu(true);
    contactService = new AppContactService(getActivity());
    userContact = contactService.getContactById(MobiComUserPreference.getInstance(getActivity()).getUserId());
    if (!TextUtils.isEmpty(userContact.getDisplayName())) {
        displayNameText.setText(userContact.getDisplayName());
    }
    if (!TextUtils.isEmpty(userContact.getStatus())) {
        statusText.setText(userContact.getStatus());
    }
    if (!TextUtils.isEmpty(userContact.getContactNumber())) {
        contactNumberText.setText(userContact.getContactNumber());
    } else {
        applozicProfileContactLayout.setVisibility(View.GONE);
    }
    final Context context = getActivity().getApplicationContext();
    mImageLoader = new ImageLoader(context, img_profile.getHeight()) {

        @Override
        protected Bitmap processBitmap(Object data) {
            return contactService.downloadContactImage(context, (Contact) data);
        }
    };
    // For profile image
    selectImageProfileIcon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            processPhotoOption();
        }
    });
    logoutbtn.setVisibility(View.GONE);
    logoutbtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Applozic.logoutUser(getContext(), new AlLogoutHandler() {

                @Override
                public void onSuccess(Context context) {
                    try {
                        final String logoutActivity = ApplozicSetting.getInstance(getActivity()).getActivityCallback(ApplozicSetting.RequestCode.USER_LOOUT);
                        if (logoutActivity != null && getActivity() != null) {
                            Intent intent = new Intent(getActivity(), Class.forName(logoutActivity));
                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
                            startActivity(intent);
                            getActivity().finish();
                        }
                    } catch (ClassNotFoundException e) {
                        e.printStackTrace();
                    }
                }

                @Override
                public void onFailure(Exception exception) {
                }
            });
        }
    });
    statusEdit.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
            builder.setTitle(R.string.status);
            final EditText input = new EditText(getContext());
            input.setInputType(InputType.TYPE_CLASS_TEXT);
            builder.setView(input);
            builder.setPositiveButton(R.string.ok_alert, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    changedStatusString = input.getText().toString();
                    Contact contact = new Contact();
                    contact.setStatus(changedStatusString);
                    AlTask.execute(new ProfilePictureUpload(contact, getActivity(), null, statusText, null));
                }
            });
            builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                }
            });
            builder.show();
        }
    });
    displayNameEdit.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
            builder.setTitle(getString(R.string.display_name));
            final EditText input = new EditText(getContext());
            input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
            builder.setView(input);
            builder.setPositiveButton(getString(R.string.ok_alert), new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    displayName = input.getText().toString();
                    if (!displayName.trim().isEmpty() && !TextUtils.isEmpty(displayName)) {
                        Contact contact = new Contact();
                        contact.setFullName(displayName);
                        AlTask.execute(new ProfilePictureUpload(contact, getActivity(), displayNameText, null, null));
                    }
                }
            });
            builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                }
            });
            builder.show();
        }
    });
    contactEdit.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
            builder.setTitle(getString(R.string.profile_contact));
            final EditText input = new EditText(getContext());
            input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_CLASS_PHONE);
            builder.setView(input);
            builder.setPositiveButton(getString(R.string.ok_alert), new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    contactNumber = input.getText().toString();
                    if (!contactNumber.trim().isEmpty() && !TextUtils.isEmpty(contactNumber)) {
                        Contact contact = new Contact();
                        contact.setContactNumber(contactNumber);
                        AlTask.execute(new ProfilePictureUpload(contact, getActivity(), null, null, contactNumberText));
                    }
                }
            });
            builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                }
            });
            builder.show();
        }
    });
    mImageLoader.setImageFadeIn(false);
    mImageLoader.setLoadingImage(R.drawable.applozic_ic_contact_picture_180_holo_light);
    mImageLoader.loadImage(userContact, img_profile);
    return view;
}
Also used : Context(android.content.Context) AlertDialog(androidx.appcompat.app.AlertDialog) EditText(android.widget.EditText) AppContactService(com.applozic.mobicomkit.contact.AppContactService) DialogInterface(android.content.DialogInterface) ObjectAnimator(android.animation.ObjectAnimator) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) Contact(com.applozic.mobicommons.people.contact.Contact) Bitmap(android.graphics.Bitmap) AlLogoutHandler(com.applozic.mobicomkit.listners.AlLogoutHandler) ImageLoader(com.applozic.mobicommons.commons.image.ImageLoader) Toolbar(androidx.appcompat.widget.Toolbar)

Example 75 with Contact

use of com.applozic.mobicommons.people.contact.Contact in project Applozic-Android-SDK by AppLozic.

the class MobiComConversationFragment method onCreateOptionsMenu.

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    this.menu = menu;
    if (contact != null && contact.isDeleted()) {
        menu.findItem(R.id.dial).setVisible(false);
        menu.findItem(R.id.refresh).setVisible(false);
        menu.removeItem(R.id.conversations);
        menu.findItem(R.id.userBlock).setVisible(false);
        menu.findItem(R.id.userUnBlock).setVisible(false);
        menu.findItem(R.id.dial).setVisible(false);
        return;
    }
    String contactNumber = contact != null ? contact.getContactNumber() : null;
    ApplozicClient setting = ApplozicClient.getInstance(getActivity());
    if ((setting.isHandleDial() && !TextUtils.isEmpty(contactNumber) && contactNumber.length() > 2) || (setting.isIPCallEnabled())) {
        if (setting.isIPCallEnabled()) {
            menu.findItem(R.id.dial).setVisible(true);
            menu.findItem(R.id.video_call).setVisible(true);
        }
        if (setting.isHandleDial()) {
            menu.findItem(R.id.dial).setVisible(true);
        }
    } else {
        menu.findItem(R.id.video_call).setVisible(false);
        menu.findItem(R.id.dial).setVisible(false);
    }
    if (channel != null) {
        menu.findItem(R.id.dial).setVisible(false);
        menu.findItem(R.id.video_call).setVisible(false);
        if (Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType())) {
            String userId = ChannelService.getInstance(getActivity()).getGroupOfTwoReceiverUserId(channel.getKey());
            if (!TextUtils.isEmpty(userId) && alCustomizationSettings.isBlockOption()) {
                Contact withUserContact = appContactService.getContactById(userId);
                if (withUserContact.isBlocked()) {
                    menu.findItem(R.id.userUnBlock).setVisible(true);
                } else {
                    menu.findItem(R.id.userBlock).setVisible(true);
                }
            }
        } else {
            menu.findItem(R.id.userBlock).setVisible(false);
            menu.findItem(R.id.userUnBlock).setVisible(false);
            if (alCustomizationSettings.isMuteOption() && !Channel.GroupType.BROADCAST.getValue().equals(channel.getType())) {
                menu.findItem(R.id.unmuteGroup).setVisible(!Channel.GroupType.OPEN.getValue().equals(channel.getType()) && !channel.isDeleted() && channel.isNotificationMuted());
                menu.findItem(R.id.muteGroup).setVisible(!Channel.GroupType.OPEN.getValue().equals(channel.getType()) && !channel.isDeleted() && !channel.isNotificationMuted());
            }
        }
    } else if (contact != null) {
        if (alCustomizationSettings.isMuteUserChatOption()) {
            menu.findItem(R.id.unmuteGroup).setVisible(!contact.isDeleted() && contact.isNotificationMuted());
            menu.findItem(R.id.muteGroup).setVisible(!contact.isDeleted() && !contact.isNotificationMuted());
        }
        if (alCustomizationSettings.isBlockOption()) {
            if (contact.isBlocked()) {
                menu.findItem(R.id.userUnBlock).setVisible(true);
            } else {
                menu.findItem(R.id.userBlock).setVisible(true);
            }
        }
    }
    menu.removeItem(R.id.menu_search);
    menu.removeItem(R.id.start_new);
    if (channel != null && channel.isDeleted()) {
        menu.findItem(R.id.refresh).setVisible(false);
        menu.findItem(R.id.deleteConversation).setVisible(false);
    } else {
        menu.findItem(R.id.refresh).setVisible(alCustomizationSettings.isRefreshOption());
        if (channel != null && Channel.GroupType.OPEN.getValue().equals(channel.getType())) {
            menu.findItem(R.id.deleteConversation).setVisible(false);
        } else {
            menu.findItem(R.id.deleteConversation).setVisible(alCustomizationSettings.isDeleteOption() || ApplozicSetting.getInstance(getContext()).isDeleteConversationOption());
        }
    }
    menu.removeItem(R.id.conversations);
}
Also used : ApplozicClient(com.applozic.mobicomkit.ApplozicClient) Contact(com.applozic.mobicommons.people.contact.Contact)

Aggregations

Contact (com.applozic.mobicommons.people.contact.Contact)107 Channel (com.applozic.mobicommons.people.channel.Channel)26 Message (com.applozic.mobicomkit.api.conversation.Message)18 Intent (android.content.Intent)17 AppContactService (com.applozic.mobicomkit.contact.AppContactService)17 ArrayList (java.util.ArrayList)15 ApplozicException (com.applozic.mobicomkit.exception.ApplozicException)14 UserDetail (com.applozic.mobicomkit.api.account.user.UserDetail)12 Test (org.junit.Test)12 Bitmap (android.graphics.Bitmap)11 MobiComUserPreference (com.applozic.mobicomkit.api.account.user.MobiComUserPreference)10 Context (android.content.Context)9 SpannableString (android.text.SpannableString)8 NonNull (androidx.annotation.NonNull)8 FileMeta (com.applozic.mobicomkit.api.attachment.FileMeta)8 ApiResponse (com.applozic.mobicomkit.feed.ApiResponse)8 SyncBlockUserApiResponse (com.applozic.mobicomkit.feed.SyncBlockUserApiResponse)8 FileClientService (com.applozic.mobicomkit.api.attachment.FileClientService)7 ContactDatabase (com.applozic.mobicomkit.contact.database.ContactDatabase)7 RegisteredUsersApiResponse (com.applozic.mobicomkit.feed.RegisteredUsersApiResponse)7