@Override public void onClick(DialogInterface dialogInterface, int i) { blockUserProcess(withUserContact.getUserId(), block, isFromChannel); } });
public boolean isMsgForConversation(Message message) { if (BroadcastService.isContextBasedChatEnabled() && message.getConversationId() != null) { return isMessageForCurrentConversation(message) && compareConversationId(message); } return isMessageForCurrentConversation(message); }
public void showScheduleMessageToast() { if (this.getActivity() == null) { return; } getActivity().runOnUiThread(new Runnable() { public void run() { Toast.makeText(getActivity(), R.string.info_message_scheduled, Toast.LENGTH_SHORT).show(); } }); }
@Override protected Bitmap processBitmap(Object data) { return fileClientService.loadThumbnailImage(getContext(), (Message) data, getImageLayoutParam(false).width, getImageLayoutParam(false).height); } };
@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(); }
if (getActivity() != null) { setToolbarSubtitle(""); setToolbarImage(contact, channel); setContact(contact); setChannel(channel); unregisterForContextMenu(recyclerView); if (ApplozicClient.getInstance(getActivity()).isNotificationStacking()) { NotificationManagerCompat nMgr = NotificationManagerCompat.from(getActivity()); nMgr.cancel(NotificationService.NOTIFICATION_ID); } else { if (!TextUtils.isEmpty(contact.getContactIds())) { NotificationManager notificationManager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancel(contact.getContactIds().hashCode()); (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancel(String.valueOf(channel.getKey()).hashCode()); clearList(); updateTitle(); swipeLayout.setEnabled(true); loadMore = true; recyclerDetailConversationAdapter = new DetailedConversationAdapter(getActivity(), R.layout.mobicom_message_row_view, messageList, contact, messageIntentClass, emojiIconHandler); recyclerDetailConversationAdapter.setAlCustomizationSettings(alCustomizationSettings);
if (channel != null) { if (Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType())) { String userId = ChannelService.getInstance(getActivity()).getGroupOfTwoReceiverUserId(channel.getKey()); if (!TextUtils.isEmpty(userId)) { userBlockDialog(true, appContactService.getContactById(userId), true); userBlockDialog(true, contact, false); if (channel != null) { if (Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType())) { String userId = ChannelService.getInstance(getActivity()).getGroupOfTwoReceiverUserId(channel.getKey()); if (!TextUtils.isEmpty(userId)) { userBlockDialog(false, appContactService.getContactById(userId), true); userBlockDialog(false, contact, false); if (contact != null) { if (contact.isBlocked()) { userBlockDialog(false, contact, false); } else { ((ConversationActivity) getActivity()).processCall(contact, currentConversationId); deleteConversationThread(); return true; if (contact != null) { if (contact.isBlocked()) { userBlockDialog(false, contact, false); } else {
case 0: if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(message.getMessage()); } else { android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); android.content.ClipData clip = android.content.ClipData.newPlainText(getContext().getString(R.string.copied_message), message.getMessage()); clipboard.setPrimaryClip(clip); messageToResend.setCreatedAtTime(System.currentTimeMillis() + MobiComUserPreference.getInstance(getActivity()).getDeviceTimeOffset()); conversationService.sendMessage(messageToResend, messageIntentClass); break; String messageKeyString = message.getKeyString(); new DeleteConversationAsyncTask(conversationService, message, contact).execute(); deleteMessageFromDeviceList(messageKeyString); break; case 4: Uri shareUri = null; if (Utils.hasNougat()) { shareUri = FileProvider.getUriForFile(getActivity(), Utils.getMetaDataValue(getActivity(), MobiComKitConstants.PACKAGE_NAME) + ".provider", new File(message.getFilePaths().get(0))); } else { shareUri = Uri.fromFile(new File(message.getFilePaths().get(0))); startActivity(Intent.createChooser(shareIntent, getString(R.string.send_message_to))); break; Configuration config = getActivity().getResources().getConfiguration();
@Override public void onResume() { super.onResume(); if (MobiComUserPreference.getInstance(getActivity()).isChannelDeleted()) { MobiComUserPreference.getInstance(getActivity()).setDeleteChannel(false); if (getActivity().getSupportFragmentManager() != null) { getActivity().getSupportFragmentManager().popBackStack(); ((ConversationActivity) getActivity()).setChildFragmentLayoutBGToTransparent(); if (contact != null || channel != null) { BroadcastService.currentUserId = contact != null ? contact.getContactIds() : String.valueOf(channel.getKey()); BroadcastService.currentConversationId = currentConversationId; if (BroadcastService.currentUserId != null) { NotificationManagerCompat nMgr = NotificationManagerCompat.from(getActivity()); if (ApplozicClient.getInstance(getActivity()).isNotificationStacking()) { nMgr.cancel(NotificationService.NOTIFICATION_ID); } else { Intent intent = new Intent(getActivity(), ApplozicMqttIntentService.class); intent.putExtra(ApplozicMqttIntentService.CHANNEL, channel); intent.putExtra(ApplozicMqttIntentService.SUBSCRIBE_TO_TYPING, true); ApplozicMqttIntentService.enqueueWork(getActivity(), intent); if (channel != null && !ChannelService.getInstance(getActivity()).processIsUserPresentInChannel(channel.getKey())) { Channel newChannel = ChannelService.getInstance(getActivity()).getChannelByChannelKey(channel.getKey()); if (newChannel != null && newChannel.getType() != null && Channel.GroupType.OPEN.getValue().equals(newChannel.getType())) { MobiComUserPreference.getInstance(getActivity()).setNewMessageFlag(true); loadConversation(contact, channel, currentConversationId, null); } else if (MobiComUserPreference.getInstance(getActivity()).getNewMessageFlag()) {
public void updateChannelSubTitle() { channelUserMapperList = ChannelService.getInstance(getActivity()).getListOfUsersFromChannelUserMapper(channel.getKey()); if (channelUserMapperList != null && channelUserMapperList.size() > 0) { if (Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType())) { String userId = ChannelService.getInstance(getActivity()).getGroupOfTwoReceiverUserId(channel.getKey()); if (!TextUtils.isEmpty(userId)) { Contact withUserContact = appContactService.getContactById(userId); if (withUserContact != null) { if (withUserContact.isBlocked()) { if (getActivity() != null) { setToolbarSubtitle(""); if (withUserContact.isConnected() && getActivity() != null) { setToolbarSubtitle(getActivity().getString(R.string.user_online)); setToolbarImage(null, channel); } else if (withUserContact.getLastSeenAt() != 0 && getActivity() != null) { setToolbarSubtitle(getActivity().getString(R.string.subtitle_last_seen_at_time) + " " + DateUtils.getDateAndTimeForLastSeen(getContext(), withUserContact.getLastSeenAt(), R.string.JUST_NOW, R.plurals.MINUTES_AGO, R.plurals.HOURS_AGO, R.string.YESTERDAY)); setToolbarImage(null, channel); } else if (getActivity() != null) { setToolbarSubtitle(""); setToolbarImage(null, channel); contactDisplayName = appContactService.getContactById(channelUserMapper.getUserKey()); if (!TextUtils.isEmpty(channelUserMapper.getUserKey())) { if (MobiComUserPreference.getInstance(getActivity()).getUserId().equals(channelUserMapper.getUserKey())) { youString = getString(R.string.you_string); } else { stringBuffer.append(contactDisplayName.getDisplayName()).append(","); if (getActivity() != null) {
@Override public void run() { boolean added = updateMessageList(message, false); if (added) { Intent intent = new Intent(getActivity(), UserIntentService.class); intent.putExtra(UserIntentService.SINGLE_MESSAGE_READ, true); intent.putExtra(UserIntentService.CONTACT, contact); intent.putExtra(UserIntentService.CHANNEL, channel); UserIntentService.enqueueWork(getActivity(), intent); } catch (Exception e) { Utils.printLog(getContext(), TAG, "Got exception while read"); createTemplateMessages(); selfDestructMessage(message);
sendOpenGroupMessage(messageEditText.getText().toString().trim()); } else { sendMessage(messageEditText.getText().toString().trim()); showScheduleMessageToast(); final AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()). setPositiveButton(R.string.ok_alert, new DialogInterface.OnClickListener() { @Override
audioRecordIconImageView.setImageResource(R.drawable.applozic_audio_record); ApplozicAudioManager.getInstance(getContext()).audiostop(); params.leftMargin = dp(30); slideTextLinearlayout.setLayoutParams(params); ApplozicAudioRecordAnimation.setAlpha(slideTextLinearlayout, 1); timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); audioFileName = "AUD_" + timeStamp + "_" + ".m4a"; outputFile = FileClientService.getFilePath(audioFileName, getContext().getApplicationContext(), "audio/m4a").getAbsolutePath(); applozicAudioRecordManager.setTimeStamp(timeStamp); applozicAudioRecordManager.setAudioFileName(audioFileName); applozicAudioRecordManager.setOutputFile(outputFile); vibrate(); if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.RECORD_AUDIO}, 10); } else {
public void makePaymentForBooking(ALRichMessageModel model) { Intent intent = new Intent(getActivity(), PaymentActivity.class); intent.putExtra("formData", model.getFormData()); intent.putExtra("formAction", model.getFormAction()); getContext().startActivity(intent); } }
if ((messageTemplate.getTextMessageList() != null && !messageTemplate.getTextMessageList().getMessageList().isEmpty() && messageTemplate.getTextMessageList().isSendMessageOnClick() && "text".equals(getMessageType(lastMessage))) || (messageTemplate.getImageMessageList() != null && !messageTemplate.getImageMessageList().getMessageList().isEmpty() && messageTemplate.getImageMessageList().isSendMessageOnClick() && "image".equals(getMessageType(lastMessage))) || (messageTemplate.getVideoMessageList() != null && !messageTemplate.getVideoMessageList().getMessageList().isEmpty() && messageTemplate.getVideoMessageList().isSendMessageOnClick() && "video".equals(getMessageType(lastMessage))) || (messageTemplate.getLocationMessageList() != null && !messageTemplate.getLocationMessageList().getMessageList().isEmpty() && messageTemplate.getLocationMessageList().isSendMessageOnClick() && "location".equals(getMessageType(lastMessage))) || (messageTemplate.getContactMessageList() != null && !messageTemplate.getContactMessageList().getMessageList().isEmpty() && messageTemplate.getContactMessageList().isSendMessageOnClick() && "contact".equals(getMessageType(lastMessage))) || (messageTemplate.getAudioMessageList() != null && !messageTemplate.getAudioMessageList().getMessageList().isEmpty() && messageTemplate.getAudioMessageList().isSendMessageOnClick() && "audio".equals(getMessageType(lastMessage))) || messageTemplate.getSendMessageOnClick()) { sendMessage(message); metadata.put("isDoneWithClicking", "true"); lastMessage.setMetadata(metadata); new AlMessageMetadataUpdateTask(getContext(), lastMessage.getKeyString(), lastMessage.getMetadata(), listener1).execute(); intent.putExtra("templateMessage", message); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); getActivity().sendBroadcast(intent);
public void updateChannelTitleAndSubTitle() { if (channel != null) { Channel channelInfo = ChannelService.getInstance(getActivity()).getChannelInfo(channel.getKey()); userNotAbleToChatLayout.setVisibility(VISIBLE); userNotAbleToChatTextView.setText(R.string.group_has_been_deleted_text); if (channel != null && !ChannelService.getInstance(getContext()).isUserAlreadyPresentInChannel(channel.getKey(), MobiComUserPreference.getInstance(getContext()).getUserId()) && messageTemplate != null && messageTemplate.isEnabled() && templateAdapter != null) { templateAdapter.removeTemplates(); if ((!ChannelService.getInstance(getActivity()).processIsUserPresentInChannel(channel.getKey()) && userNotAbleToChatLayout != null && !Channel.GroupType.OPEN.getValue().equals(channel.getType()))) { templateAdapter.removeTemplates(); } else if (ChannelService.getInstance(getActivity()).processIsUserPresentInChannel(channel.getKey()) && userNotAbleToChatLayout != null && !Channel.GroupType.OPEN.getValue().equals(channel.getType())) { updateChannelTitle(); updateChannelSubTitle();
final View list = inflater.inflate(R.layout.mobicom_message_list, container, false); recyclerView = (RecyclerView) list.findViewById(R.id.messageList); linearLayoutManager = new LinearLayoutManager(getActivity()); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setHasFixedSize(true); recyclerViewPositionHelper = new RecyclerViewPositionHelper(recyclerView, linearLayoutManager); ((ConversationActivity) getActivity()).setChildFragmentLayoutBGToTransparent(); getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); toolbar = (Toolbar) getActivity().findViewById(R.id.my_toolbar); toolbar.setClickable(true); mainEditTextLinearLayout = (LinearLayout) list.findViewById(R.id.main_edit_text_linear_layout); messageTemplateView = (RecyclerView) list.findViewById(R.id.mobicomMessageTemplateView); applozicLabel = list.findViewById(R.id.applozicLabel); Configuration config = getResources().getConfiguration(); recordButtonWeakReference = new WeakReference<ImageButton>(recordButton); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { if (MobiComUserPreference.getInstance(getContext()).getPricingPackage() == 1) { applozicLabel.setVisibility(VISIBLE); audioRecordIconImageView = (ImageView) list.findViewById(R.id.audio_record_icon_image_view); recordTimeTextView = (TextView) list.findViewById(R.id.recording_time_text_view); mDetector = new GestureDetectorCompat(getContext(), this); adapterView = new AdapterView.OnItemSelectedListener() { @Override
public void muteUserChat() { final CharSequence[] items = {getString(R.string.eight_Hours), getString(R.string.one_week), getString(R.string.one_year)}; Date date = Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime(); millisecond = date.getTime(); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()) .setTitle(getResources().getString(R.string.mute_user_for)) .setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
@Override public void onLongPress(MotionEvent event) { if (contact != null && contact.isBlocked()) { userBlockDialog(false, contact, false); return; } if (getActivity() instanceof ALStoragePermissionListener) { if (((ALStoragePermissionListener) getActivity()).isPermissionGranted()) { startRecording(); } else { ((ALStoragePermissionListener) getActivity()).checkPermission(new ALStoragePermission() { @Override public void onAction(boolean didGrant) { } }); } } }
public void updateTitleForOpenGroup() { try { if (channel != null) { Channel newChannel = ChannelService.getInstance(getActivity()).getChannelByChannelKey(channel.getKey()); if (getActivity() != null) { setToolbarTitle(newChannel.getName()); } } updateChannelSubTitle(); } catch (Exception e) { e.printStackTrace(); } }