use of com.applozic.mobicommons.people.channel.Conversation in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method updateContextBasedGroup.
public void updateContextBasedGroup() {
if (channel != null) {
Channel channelInfo = ChannelService.getInstance(getActivity()).getChannelInfo(channel.getKey());
if ((Channel.GroupType.GROUPOFTWO.getValue().equals(channelInfo.getType())) && channel.isContextBasedChat()) {
Conversation conversation = new Conversation();
TopicDetail topic = new TopicDetail();
topic.setTitle(channelInfo.getMetadata().get(Channel.GroupMetaDataType.TITLE.getValue()));
topic.setSubtitle(channelInfo.getMetadata().get(Channel.GroupMetaDataType.PRICE.getValue()));
topic.setLink(channelInfo.getMetadata().get(Channel.GroupMetaDataType.LINK.getValue()));
conversation.setTopicDetail(topic.getJson());
conversationList.get(0).setTopicDetail(topic.getJson());
applozicContextSpinnerAdapter.notifyDataSetChanged();
}
}
}
use of com.applozic.mobicommons.people.channel.Conversation in project Applozic-Android-SDK by AppLozic.
the class MainActivity method buildConversation.
private Conversation buildConversation() {
Conversation conversation = new Conversation();
conversation.setUserId("usertest2");
conversation.setTopicId("Topic#Id#Test");
TopicDetail topic = new TopicDetail();
topic.setTitle(getResources().getString(R.string.TestTopic2));
topic.setSubtitle(getResources().getString(R.string.Topic_1));
topic.setLink("https://www.applozic.com/resources/sidebox/images/applozic.png");
topic.setKey1(getResources().getString(R.string.Qty));
topic.setValue1("1000");
topic.setKey2(getResources().getString(R.string.Price));
topic.setValue2(getResources().getString(R.string.rs));
conversation.setSenderSmsFormat(MobiComUserPreference.getInstance(this).getUserId(), "SENDER SMS FORMAT");
conversation.setReceiverSmsFormat("usertest2", "RECEIVER SMS FORMAT");
conversation.setTopicDetail(topic.getJson());
return conversation;
}
use of com.applozic.mobicommons.people.channel.Conversation in project Applozic-Android-SDK by AppLozic.
the class ConversationActivity method processCall.
public void processCall(Contact contactObj, Integer conversationId) {
this.contact = baseContactService.getContactById(contactObj.getContactIds());
this.currentConversationId = conversationId;
try {
if (ApplozicClient.getInstance(getApplicationContext()).isIPCallEnabled()) {
if (Utils.hasMarshmallow() && !PermissionsUtils.checkPermissionForCameraAndMicrophone(this)) {
applozicPermission.checkRuntimePermissionForCameraAndAudioRecording();
return;
}
// Audio Call
String activityName = ApplozicSetting.getInstance(this).getActivityCallback(ApplozicSetting.RequestCode.AUDIO_CALL);
Class activityToOpen = Class.forName(activityName);
Intent intent = new Intent(this, activityToOpen);
intent.putExtra("CONTACT_ID", contact.getUserId());
startActivity(intent);
return;
}
if (activityToOpenOnClickOfCallButton != null) {
Intent callIntent = new Intent(this, Class.forName(activityToOpenOnClickOfCallButton));
if (currentConversationId != null) {
Conversation conversation = ConversationService.getInstance(this).getConversationByConversationId(currentConversationId);
callIntent.putExtra(ConversationUIService.TOPIC_ID, conversation.getTopicId());
}
callIntent.putExtra(ConversationUIService.CONTACT, contact);
startActivity(callIntent);
} else {
snackbar = Snackbar.make(layout, R.string.phone_call_permission_not_granted, Snackbar.LENGTH_SHORT);
snackbar.show();
}
} catch (Exception e) {
Utils.printLog(this, "ConversationActivity", "Call permission is not added in androidManifest");
}
}
use of com.applozic.mobicommons.people.channel.Conversation in project Applozic-Android-SDK by AppLozic.
the class ApplozicContextSpinnerAdapter method getCustomView.
public View getCustomView(int position, View convertView, ViewGroup parent) {
Conversation conversation = (Conversation) getItem(position);
ApplozicProductViewHolder viewHolder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.applozic_context_based_layout, parent, false);
viewHolder = new ApplozicProductViewHolder();
viewHolder.productImage = (ImageView) convertView.findViewById(R.id.productImage);
viewHolder.titleTextView = (TextView) convertView.findViewById(R.id.title);
viewHolder.subTitleTextView = (TextView) convertView.findViewById(R.id.subTitle);
viewHolder.key1TextView = (TextView) convertView.findViewById(R.id.qtyTitleTextView);
viewHolder.value1TextView = (TextView) convertView.findViewById(R.id.qtyValueTextView);
viewHolder.key2TextView = (TextView) convertView.findViewById(R.id.priceTitleTextView);
viewHolder.value2TextView = (TextView) convertView.findViewById(R.id.priceValueTextview);
convertView.setTag(viewHolder);
} else {
viewHolder = (ApplozicProductViewHolder) convertView.getTag();
}
try {
if (conversation != null) {
String topicId = conversation.getTopicId();
String topicDetailJson = conversation.getTopicDetail();
if (!TextUtils.isEmpty(topicDetailJson)) {
TopicDetail topicDetail = (TopicDetail) GsonUtils.getObjectFromJson(topicDetailJson, TopicDetail.class);
if (!TextUtils.isEmpty(topicDetail.getLink())) {
Glide.with(context).load(topicDetail.getLink()).into(viewHolder.productImage);
}
if (!TextUtils.isEmpty(topicDetail.getTitle())) {
viewHolder.titleTextView.setText(topicDetail.getTitle());
}
if (!TextUtils.isEmpty(topicDetail.getSubtitle())) {
viewHolder.subTitleTextView.setText(topicDetail.getSubtitle());
}
if (!TextUtils.isEmpty(topicDetail.getKey1())) {
viewHolder.key1TextView.setText(topicDetail.getKey1());
}
if (!TextUtils.isEmpty(topicDetail.getValue1())) {
viewHolder.value1TextView.setText(":" + topicDetail.getValue1());
}
if (!TextUtils.isEmpty(topicDetail.getKey2())) {
viewHolder.key2TextView.setText(topicDetail.getKey2());
}
if (!TextUtils.isEmpty(topicDetail.getValue2())) {
viewHolder.value2TextView.setText(":" + topicDetail.getValue2());
}
} else {
viewHolder.productImage.setVisibility(View.GONE);
viewHolder.titleTextView.setVisibility(View.GONE);
viewHolder.subTitleTextView.setVisibility(View.GONE);
viewHolder.key1TextView.setVisibility(View.GONE);
viewHolder.value1TextView.setVisibility(View.GONE);
viewHolder.key2TextView.setVisibility(View.GONE);
viewHolder.value2TextView.setVisibility(View.GONE);
}
}
} catch (Exception e) {
}
return convertView;
}
Aggregations