use of com.applozic.mobicomkit.feed.GroupInfoUpdate in project Applozic-Android-SDK by AppLozic.
the class ChannelInfoActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
boolean isUserPresent = false;
if (channel != null) {
isUserPresent = ChannelService.getInstance(this).processIsUserPresentInChannel(channel.getKey());
}
if (id == R.id.add_member_to_channel) {
if (isUserPresent) {
Utils.toggleSoftKeyBoard(ChannelInfoActivity.this, true);
if (alCustomizationSettings.getTotalRegisteredUserToFetch() > 0 && (alCustomizationSettings.isRegisteredUserContactListCall() || ApplozicSetting.getInstance(this).isRegisteredUsersContactCall()) && !userPreference.getWasContactListServerCallAlreadyDone()) {
processLoadRegisteredUsers();
} else {
Intent addMemberIntent = new Intent(ChannelInfoActivity.this, ContactSelectionActivity.class);
addMemberIntent.putExtra(ContactSelectionActivity.CHECK_BOX, true);
addMemberIntent.putExtra(ContactSelectionActivity.CHANNEL_OBJECT, channel);
startActivityForResult(addMemberIntent, REQUEST_CODE_FOR_CONTACT);
}
} else {
Toast.makeText(this, getString(R.string.channel_add_alert), Toast.LENGTH_SHORT).show();
}
} else if (id == R.id.edit_channel_name) {
if (isUserPresent) {
Intent editChannelNameIntent = new Intent(ChannelInfoActivity.this, ChannelNameActivity.class);
GroupInfoUpdate groupInfoUpdate = new GroupInfoUpdate(channel);
String groupJson = GsonUtils.getJsonFromObject(groupInfoUpdate, GroupInfoUpdate.class);
editChannelNameIntent.putExtra(GROUP_UPDTAE_INFO, groupJson);
startActivityForResult(editChannelNameIntent, REQUEST_CODE_FOR_CHANNEL_NEW_NAME);
} else {
Toast.makeText(this, getString(R.string.channel_edit_alert), Toast.LENGTH_SHORT).show();
}
}
return false;
}
use of com.applozic.mobicomkit.feed.GroupInfoUpdate in project Applozic-Android-SDK by AppLozic.
the class ChannelInfoActivity method onActivityResult.
@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();
}
}
}
use of com.applozic.mobicomkit.feed.GroupInfoUpdate in project Applozic-Android-SDK by AppLozic.
the class ChannelInfoActivity method onContextItemSelected.
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
int position = info.position;
if (channelUserMapperList.size() <= position) {
return true;
}
if (channel == null) {
return true;
}
ChannelUserMapper channelUserMapper = channelUserMapperList.get(position);
switch(item.getItemId()) {
case 0:
Intent startConversationIntent = new Intent(ChannelInfoActivity.this, ConversationActivity.class);
startConversationIntent.putExtra(ConversationUIService.USER_ID, channelUserMapper.getUserKey());
startActivity(startConversationIntent);
finish();
break;
case 1:
removeChannelUser(channel, channelUserMapper);
break;
case 2:
if (Utils.isInternetAvailable(getApplicationContext())) {
GroupInfoUpdate groupInfoUpdate = new GroupInfoUpdate(channelUserMapper.getKey());
List<ChannelUsersFeed> channelUsersFeedList = new ArrayList<>();
ChannelUsersFeed channelUsersFeed = new ChannelUsersFeed();
channelUsersFeed.setUserId(channelUserMapper.getUserKey());
channelUsersFeed.setRole(1);
channelUsersFeedList.add(channelUsersFeed);
groupInfoUpdate.setUsers(channelUsersFeedList);
new ChannelUserRoleAsyncTask(channelUserMapper, groupInfoUpdate, this).execute();
} else {
Toast toast = Toast.makeText(this, getString(R.string.you_dont_have_any_network_access_info), Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
break;
default:
return super.onContextItemSelected(item);
}
return true;
}
Aggregations