public ChannelFeed(Channel group) { this.id = group.getKey(); this.name = group.getName(); }
public static String getChannelTitleName(Channel channel, String loggedInUserId) { if (!TextUtils.isEmpty(loggedInUserId)) { if (Channel.GroupType.SELLER.getValue().equals(channel.getType())) { String[] userIdSplit = new String[1]; if (!TextUtils.isEmpty(channel.getName())) { userIdSplit = channel.getName().split(":"); } if (loggedInUserId.equals(channel.getAdminKey())) { return channel.getName(); } else { return userIdSplit[0]; } } else { return channel.getName(); } } return ""; }
@Override protected void onPostExecute(Channel channel) { super.onPostExecute(channel); if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } if (channel != null) { Intent intent = new Intent(context, ConversationActivity.class); intent.putExtra(ConversationUIService.GROUP_ID, channel.getKey()); intent.putExtra(ConversationUIService.GROUP_NAME, channel.getName()); startActivity(intent); } }
@Override protected void onPostExecute(File file) { super.onPostExecute(file); if (contextWeakReference != null) { Context context = contextWeakReference.get(); if (file != null && file.exists() && context != null) { Uri fileUri = Uri.parse(file.getAbsolutePath()); Intent sendAttachmentIntent = new Intent(context, MobiComAttachmentSelectorActivity.class); if (channel != null) { sendAttachmentIntent.putExtra(MobiComAttachmentSelectorActivity.GROUP_ID, channel.getKey()); sendAttachmentIntent.putExtra(MobiComAttachmentSelectorActivity.GROUP_NAME, channel.getName()); } else if (contact != null) { sendAttachmentIntent.putExtra(MobiComAttachmentSelectorActivity.USER_ID, contact.getUserId()); sendAttachmentIntent.putExtra(MobiComAttachmentSelectorActivity.DISPLAY_NAME, contact.getDisplayName()); } if (fileUri != null) { sendAttachmentIntent.putExtra(MobiComAttachmentSelectorActivity.URI_LIST, fileUri); } context.startActivity(sendAttachmentIntent); } } } }
public void updateChannelList() { if (contactsAdapter != null && channel != null) { channelUserMapperList.clear(); channelUserMapperList = ChannelService.getInstance(this).getListOfUsersFromChannelUserMapper(channel.getKey()); contactsAdapter.notifyDataSetChanged(); Helper.getListViewSize(mainListView); String oldChannelName = channel.getName(); channel = ChannelService.getInstance(this).getChannelByChannelKey(channel.getKey()); if (!oldChannelName.equals(channel.getName())) { mActionBar.setTitle(channel.getName()); collapsingToolbarLayout.setTitle(channel.getName()); } } }
public void addChannelUser(final String userId, final Channel channel) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this). setPositiveButton(R.string.add, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { new ChannelMemberAdd(channel, userId, ChannelInfoActivity.this).execute(); } }); alertDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); String name = ""; String channelName = ""; Contact contact; if (channel != null) { contact = baseContactService.getContactById(userId); name = contact.getDisplayName(); channelName = channel.getName(); } alertDialog.setMessage(getString(R.string.dialog_add_group_user).replace(getString(R.string.user_name_info), name).replace(getString(R.string.group_name_info), channelName)); alertDialog.setCancelable(true); alertDialog.create().show(); }
alertDialog.setMessage(context.getString(R.string.exit_channel_message_info).replace(context.getString(R.string.group_name_info), channel.getName()).replace(context.getString(R.string.groupType_info), Channel.GroupType.BROADCAST.getValue().equals(channel.getType()) ? context.getString(R.string.broadcast_string) : context.getString(R.string.group_string))); alertDialog.setCancelable(true); alertDialog.create().show();
public void deleteChannel(final Channel channel) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this). setPositiveButton(R.string.channel_deleting, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { new ChannelMemberAdd(channel, ChannelInfoActivity.this).execute(); } }); alertDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); if (channel.getType() != null) { alertDialog.setMessage(getString(R.string.delete_channel_messages_and_channel_info).replace(getString(R.string.group_name_info), channel.getName()).replace(getString(R.string.groupType_info), Channel.GroupType.BROADCAST.getValue().equals(channel.getType()) ? getString(R.string.broadcast_string) : getString(R.string.group_string))); } alertDialog.setCancelable(true); alertDialog.create().show(); }
public void removeChannelUser(final Channel channel, final ChannelUserMapper channelUserMapper) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this). setPositiveButton(R.string.remove_member, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { new ChannelMember(channelUserMapper, channel, ChannelInfoActivity.this).execute(); } }); alertDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); String name = ""; String channelName = ""; Contact contact; if (!TextUtils.isEmpty(channelUserMapper.getUserKey())) { contact = baseContactService.getContactById(channelUserMapper.getUserKey()); name = contact.getDisplayName(); channelName = channel.getName(); } alertDialog.setMessage(getString(R.string.dialog_remove_group_user).replace(getString(R.string.user_name_info), name).replace(getString(R.string.group_name_info), channelName)); alertDialog.setCancelable(true); alertDialog.create().show(); }
@Override protected void onActivityResult(int requestCode, int resultCode, final Intent data) { boolean isUserAlreadyPresent; if (data != null) { if (requestCode == REQUEST_CODE_FOR_CONTACT && resultCode == Activity.RESULT_OK) { isUserAlreadyPresent = ChannelService.getInstance(this).isUserAlreadyPresentInChannel(channel.getKey(), data.getExtras().getString(USERID)); if (!isUserAlreadyPresent) { addChannelUser(data.getExtras().getString(USERID), channel); } else { Toast toast = Toast.makeText(this, getString(R.string.user_is_already_exists), Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } } if (requestCode == REQUEST_CODE_FOR_CHANNEL_NEW_NAME && resultCode == Activity.RESULT_OK) { GroupInfoUpdate groupInfoUpdate = (GroupInfoUpdate) GsonUtils.getObjectFromJson(data.getExtras().getString(GROUP_UPDTAE_INFO), GroupInfoUpdate.class); System.out.println("GroupInfoUpdate ::: " + data.getExtras().getString(GROUP_UPDTAE_INFO)); if (channel.getName().equals(groupInfoUpdate.getNewName())) { groupInfoUpdate.setNewName(null); } new ChannelAsync(groupInfoUpdate, ChannelInfoActivity.this).execute(); } } }
public void updateChannelTitle() { if (!Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType())) { Channel newChannel = ChannelService.getInstance(getActivity()).getChannelByChannelKey(channel.getKey()); if (newChannel != null && !TextUtils.isEmpty(channel.getName()) && !channel.getName().equals(newChannel.getName())) { title = ChannelUtils.getChannelTitleName(newChannel, MobiComUserPreference.getInstance(getActivity()).getUserId()); channel = newChannel; if (getActivity() != null) { setToolbarTitle(title); } } } }
intent = new Intent(this, ConversationActivity.class); intent.putExtra(GROUP_ID, channel.getKey()); intent.putExtra(GROUP_NAME, channel.getName()); intent.putExtra(ConversationUIService.DEFAULT_TEXT, intentExtra.getStringExtra(Intent.EXTRA_TEXT)); startActivity(intent); Intent intentImage = new Intent(this, MobiComAttachmentSelectorActivity.class); intentImage.putExtra(MobiComAttachmentSelectorActivity.GROUP_ID, channel.getKey()); intentImage.putExtra(MobiComAttachmentSelectorActivity.GROUP_NAME, channel.getName()); if (fileUri != null) { intentImage.putExtra(MobiComAttachmentSelectorActivity.URI_LIST, fileUri); intent = new Intent(); intent.putExtra(GROUP_ID, channel.getKey()); intent.putExtra(GROUP_NAME, channel.getName()); finishActivity(intent);
public GroupInfoUpdate(Channel channel) { this.newName = channel.getName(); this.groupId = channel.getKey(); this.clientGroupId = channel.getClientGroupId(); this.imageUrl = channel.getImageUrl(); this.localImagePath = channel.getLocalImageUri(); }
alertDialog.setMessage(fragmentActivity.getString(R.string.exit_channel_message_info).replace(fragmentActivity.getString(R.string.group_name_info), channel.getName()).replace(fragmentActivity.getString(R.string.groupType_info), Channel.GroupType.BROADCAST.getValue().equals(channel.getType()) ? fragmentActivity.getString(R.string.broadcast_string) : fragmentActivity.getString(R.string.group_string))); alertDialog.setCancelable(true); alertDialog.create().show();
alertDialog.setMessage(fragmentActivity.getString(R.string.delete_channel_messages_and_channel_info).replace(fragmentActivity.getString(R.string.group_name_info), channel.getName()).replace(fragmentActivity.getString(R.string.groupType_info), Channel.GroupType.BROADCAST.getValue().equals(channel.getType()) ? fragmentActivity.getString(R.string.broadcast_string) : fragmentActivity.getString(R.string.group_string))); alertDialog.setCancelable(true); alertDialog.create().show();
public ContentValues prepareChannelValues(Channel channel) { ContentValues contentValues = new ContentValues(); contentValues.put(MobiComDatabaseHelper.CHANNEL_DISPLAY_NAME, channel.getName()); contentValues.put(MobiComDatabaseHelper.CHANNEL_KEY, channel.getKey()); contentValues.put(MobiComDatabaseHelper.CLIENT_GROUP_ID, channel.getClientGroupId());
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(); } }
@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(); } }
notificationTitle = channel.getName().trim();
public CharSequence getMessageBody(Message message, int count, Channel channel, Contact contact) { String notificationText; if (message.getContentType() == Message.ContentType.LOCATION.getValue()) { notificationText = getText(0); } else if (message.getContentType() == Message.ContentType.AUDIO_MSG.getValue()) { notificationText = getText(1); } else if (message.getContentType() == Message.ContentType.VIDEO_MSG.getValue()) { notificationText = getText(2); } else if (message.hasAttachment() && TextUtils.isEmpty(message.getMessage())) { notificationText = getText(3); } else { notificationText = message.getMessage(); } CharSequence messageBody; Contact messageContactDisplayName = contact != null ? contact : appContactService.getContactById(message.getTo()); if (message.getGroupId() != null) { if (Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType()) || Channel.GroupType.SUPPORT_GROUP.getValue().equals(channel.getType())) { messageBody = Utils.getStyleStringForMessage(notificationText); } else { messageBody = Utils.getStyledStringForChannel(messageContactDisplayName.getDisplayName(), channel.getName(), notificationText); } } else { if (count < 2) { messageBody = Utils.getStyleStringForMessage(notificationText); } else { messageBody = Utils.getStyledStringForContact(messageContactDisplayName.getDisplayName(), notificationText); } } return messageBody; }