Skip to content

Commit d9542ae

Browse files
Merge pull request #466 from Kommunicate-io/CM-1766
[CM-1766] Fixed message status icon colour customisation issue
2 parents 77e31a2 + 5ecec9b commit d9542ae

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
The changelog for [Kommunicate-Android-Chat-SDK](https://github.com/Kommunicate-io/Kommunicate-Android-Chat-SDK). Also see the
44
[releases](https://github.com/Kommunicate-io/Kommunicate-Android-Chat-SDK/releases) on Github.
55

6+
## Unreleased
7+
1) Fixed message status icon color customisation
68
## Kommunicate Android SDK 2.8.9
79
1) Fixed typing indicator for welcome message
810
2) Fixed "no conversations" showing sometimes for the first time when conversation is created

app/src/main/assets/applozic-settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"sentContactMessageTextColor:": "#5fba7d",
1111
"chatBackgroundColorOrDrawable": "#FFFFFF",
1212
"receivedContactMessageTextColor": "#646262",
13-
"messageStatusIconColor": "#5c5aa7",
13+
"messageStatusIconColor": "",
1414
"sentMessageTextColor": "#FFFFFFFF",
1515
"receivedMessageTextColor": "#646262",
1616
"messageEditTextTextColor": "#000000",

kommunicateui/src/main/java/com/applozic/mobicomkit/uiwidgets/conversation/adapter/DetailedConversationAdapter.java

+16-8
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,18 @@ public void setStoragePermissionListener(KmStoragePermissionListener storagePerm
201201
}
202202

203203
public DetailedConversationAdapter(final Context context, int textViewResourceId, List<Message> messageList, Channel channel, Class messageIntentClass, EmojiconHandler emojiconHandler) {
204-
this(context, textViewResourceId, messageList, null, channel, messageIntentClass, emojiconHandler);
204+
this(context, textViewResourceId, messageList, null, channel, messageIntentClass, emojiconHandler, null);
205205
}
206206

207207
public DetailedConversationAdapter(final Context context, int textViewResourceId, List<Message> messageList, Contact contact, Class messageIntentClass, EmojiconHandler emojiconHandler) {
208-
this(context, textViewResourceId, messageList, contact, null, messageIntentClass, emojiconHandler);
208+
this(context, textViewResourceId, messageList, contact, null, messageIntentClass, emojiconHandler, null);
209209
}
210210

211211
public void setLastSentMessage(Message message) {
212212
this.lastSentMessage = message;
213213
}
214214

215-
public DetailedConversationAdapter(final Context context, int textViewResourceId, List<Message> messageList, final Contact contact, Channel channel, Class messageIntentClass, EmojiconHandler emojiconHandler) {
215+
public DetailedConversationAdapter(final Context context, int textViewResourceId, List<Message> messageList, final Contact contact, Channel channel, Class messageIntentClass, EmojiconHandler emojiconHandler, AlCustomizationSettings alCustomizationSettings) {
216216
//super(context, textViewResourceId, messageList);
217217
this.messageIntentClass = messageIntentClass;
218218
this.context = context;
@@ -226,6 +226,7 @@ public DetailedConversationAdapter(final Context context, int textViewResourceId
226226
this.contactService = new AppContactService(context);
227227
this.imageCache = ImageCache.getInstance(((FragmentActivity) context).getSupportFragmentManager(), 0.1f);
228228
this.messageList = messageList;
229+
this.alCustomizationSettings = alCustomizationSettings;
229230
geoApiKey = Applozic.getInstance(context).getGeoApiKey();
230231
contactImageLoader = new ImageLoader(context, ImageUtils.getLargestScreenDimension((Activity) context)) {
231232
@Override
@@ -254,7 +255,7 @@ protected Bitmap processBitmap(Object data) {
254255
imageThumbnailLoader.setImageFadeIn(false);
255256
imageThumbnailLoader.addImageCache(((FragmentActivity) context).getSupportFragmentManager(), 0.1f);
256257

257-
if(useInnerTimeStampDesign) {
258+
if(useInnerTimeStampDesign || (alCustomizationSettings != null && !TextUtils.isEmpty(alCustomizationSettings.getMessageStatusIconColor()))) {
258259
sentIcon = context.getResources().getDrawable(R.drawable.km_sent_icon_c);
259260
deliveredIcon = context.getResources().getDrawable(R.drawable.km_delivered_icon_c);
260261
readIcon = context.getResources().getDrawable(R.drawable.km_read_icon_c);
@@ -1729,14 +1730,21 @@ public MyViewHolder(final View customView) {
17291730
messageRootLayout = (RelativeLayout) customView.findViewById(R.id.messageLayout);
17301731
emailLayout = customView.findViewById(R.id.emailLayout);
17311732
viaEmailView = customView.findViewById(R.id.via_email_text_view);
1733+
statusIconBackground = customView.findViewById(R.id.statusIconBackground);
17321734

17331735
if(useInnerTimeStampDesign) {
1734-
statusIconBackground = customView.findViewById(R.id.statusIconBackground);
1735-
if (statusIconBackground != null) {
1736-
KmUtils.setGradientSolidColor(statusIconBackground, themeHelper.getMessageStatusIconColor());
1737-
}
1736+
if (statusIconBackground != null) {
1737+
KmUtils.setGradientSolidColor(statusIconBackground, themeHelper.getMessageStatusIconColor());
1738+
}
17381739
}
17391740
else {
1741+
if(statusIconBackground != null){
1742+
if (!TextUtils.isEmpty(alCustomizationSettings.getMessageStatusIconColor())) {
1743+
KmUtils.setGradientSolidColor(statusIconBackground, themeHelper.getMessageStatusIconColor());
1744+
} else {
1745+
statusIconBackground.setVisibility(GONE);
1746+
}
1747+
}
17401748
timestampLayout = customView.findViewById(R.id.timestampLayout);
17411749
statusImageView = customView.findViewById(R.id.statusImageView);
17421750
}

kommunicateui/src/main/java/com/applozic/mobicomkit/uiwidgets/conversation/fragment/MobiComConversationFragment.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ public void fetchBotType(Contact contact, KmCallback kmCallback) {
415415
}
416416

417417
protected DetailedConversationAdapter getConversationAdapter(Activity activity,
418-
int rowViewId, List<Message> messageList, Contact contact, Channel channel, Class messageIntentClass, EmojiconHandler emojiIconHandler) {
419-
return new DetailedConversationAdapter(activity, rowViewId, messageList, contact, channel, messageIntentClass, emojiIconHandler);
418+
int rowViewId, List<Message> messageList, Contact contact, Channel channel, Class messageIntentClass, EmojiconHandler emojiIconHandler, AlCustomizationSettings alCustomizationSettings) {
419+
return new DetailedConversationAdapter(activity, rowViewId, messageList, contact, channel, messageIntentClass, emojiIconHandler, alCustomizationSettings);
420420
}
421421

422422
@Override
@@ -707,7 +707,7 @@ public void onNothingSelected(AdapterView<?> adapterView) {
707707
emptyTextView.setTextColor(Color.parseColor(alCustomizationSettings.getNoConversationLabelTextColor().trim()));
708708
emoticonsBtn.setOnClickListener(this);
709709
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
710-
if(alCustomizationSettings.getInnerTimestampDesign()) {
710+
if(alCustomizationSettings.getInnerTimestampDesign() || !TextUtils.isEmpty(alCustomizationSettings.getMessageStatusIconColor())) {
711711
sentIcon = getResources().getDrawable(R.drawable.km_sent_icon_c);
712712
deliveredIcon = getResources().getDrawable(R.drawable.km_delivered_icon_c);
713713
readIcon = getResources().getDrawable(R.drawable.km_read_icon_c);
@@ -2068,7 +2068,7 @@ public void loadConversation(final Contact contact, final Channel channel, final
20682068
selfDestructMessageSpinner.setSelection(0);
20692069
}
20702070
recyclerDetailConversationAdapter = getConversationAdapter(getActivity(),
2071-
R.layout.mobicom_message_row_view, messageList, contact, channel, messageIntentClass, emojiIconHandler);
2071+
R.layout.mobicom_message_row_view, messageList, contact, channel, messageIntentClass, emojiIconHandler, alCustomizationSettings);
20722072
recyclerDetailConversationAdapter.setAlCustomizationSettings(alCustomizationSettings);
20732073
recyclerDetailConversationAdapter.setContextMenuClickListener(this);
20742074
recyclerDetailConversationAdapter.setRichMessageCallbackListener(richMessageActionProcessor.getRichMessageListener());

kommunicateui/src/main/res/layout/km_sent_message_list_view.xml

+7
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@
150150
android:layout_height="12dp"
151151
android:visibility="visible"
152152
android:layout_gravity="center" />
153+
154+
<View
155+
android:id="@+id/statusIconBackground"
156+
android:layout_width="13dp"
157+
android:layout_height="13dp"
158+
android:background="@drawable/km_status_icon_background" />
159+
153160
<ImageView
154161
android:id="@+id/statusImageView"
155162
android:layout_width="12dp"

0 commit comments

Comments
 (0)