Skip to content

Commit

Permalink
Android UI Kit v2.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
darshanbhanushali committed Feb 3, 2021
1 parent 392e717 commit d5c3f60
Show file tree
Hide file tree
Showing 28 changed files with 414 additions and 121 deletions.
6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

[![Platform](https://img.shields.io/badge/Platform-Android-brightgreen.svg)](#)
[![Platform](https://img.shields.io/badge/Language-Java-yellowgreen.svg)](#)
![GitHub repo size](https://img.shields.io/github/repo-size/cometchat-pro/android-kotlin-chat-app)
![GitHub contributors](https://img.shields.io/github/contributors/cometchat-pro/android-kotlin-chat-app)
![GitHub repo size](https://img.shields.io/github/repo-size/cometchat-pro/android-java-chat-app)
![GitHub contributors](https://img.shields.io/github/contributors/cometchat-pro/android-java-chat-app)
![GitHub stars](https://img.shields.io/github/stars/cometchat-pro/android-java-chat-app?style=social)
![Twitter Follow](https://img.shields.io/twitter/follow/cometchat?style=social)

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ dependencies {
implementation 'com.google.android.material:material:1.2.0-alpha05'
implementation 'com.facebook.shimmer:shimmer:0.4.0'
//
implementation 'com.cometchat:pro-android-chat-sdk:2.1.7-beta2'
implementation 'com.cometchat:pro-android-chat-sdk:2.1.7-beta3'
}
2 changes: 1 addition & 1 deletion uikit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
//cometchat
compileOnly 'com.cometchat:pro-android-chat-sdk:2.1.7-beta2'
compileOnly 'com.cometchat:pro-android-chat-sdk:2.1.7-beta3'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.0'
}
repositories {
Expand Down
132 changes: 94 additions & 38 deletions uikit/src/main/java/adapter/MessageAdapter.java

Large diffs are not rendered by default.

77 changes: 46 additions & 31 deletions uikit/src/main/java/adapter/ThreadAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -745,13 +745,17 @@ private void setDeleteData(DeleteMessageViewHolder viewHolder, int i) {
private void showMessageTime(RecyclerView.ViewHolder viewHolder, BaseMessage baseMessage) {

if (viewHolder instanceof TextMessageViewHolder) {
setStatusIcon(((TextMessageViewHolder) viewHolder).txtTime, baseMessage);
setStatusIcon(((TextMessageViewHolder) viewHolder).progressBar,((TextMessageViewHolder) viewHolder).txtTime, baseMessage);
} else if (viewHolder instanceof LinkMessageViewHolder) {
setStatusIcon(((LinkMessageViewHolder) viewHolder).txtTime, baseMessage);
setStatusIcon(((LinkMessageViewHolder) viewHolder).progressBar,((LinkMessageViewHolder) viewHolder).txtTime, baseMessage);
} else if (viewHolder instanceof ImageMessageViewHolder) {
setStatusIcon(((ImageMessageViewHolder) viewHolder).txtTime, baseMessage);
setStatusIcon(((ImageMessageViewHolder) viewHolder).progressBar,((ImageMessageViewHolder) viewHolder).txtTime, baseMessage);
} else if (viewHolder instanceof FileMessageViewHolder) {
setStatusIcon(((FileMessageViewHolder) viewHolder).txtTime, baseMessage);
setStatusIcon(((FileMessageViewHolder) viewHolder).progressBar,((FileMessageViewHolder) viewHolder).txtTime, baseMessage);
} else if (viewHolder instanceof VideoMessageViewHolder) {
setStatusIcon(((VideoMessageViewHolder) viewHolder).progressBar,((TextMessageViewHolder) viewHolder).txtTime,baseMessage);
} else if (viewHolder instanceof AudioMessageViewHolder) {
setStatusIcon(((AudioMessageViewHolder) viewHolder).progressBar,((AudioMessageViewHolder) viewHolder).txtTime,baseMessage);
}

}
Expand All @@ -765,20 +769,30 @@ private void showMessageTime(RecyclerView.ViewHolder viewHolder, BaseMessage bas
* @param baseMessage is a object of BaseMessage used to identify baseMessage sender.
* @see BaseMessage
*/
private void setStatusIcon(TextView txtTime, BaseMessage baseMessage) {
private void setStatusIcon(ProgressBar progressBar,TextView txtTime, BaseMessage baseMessage) {
if (baseMessage.getSender().getUid().equals(loggedInUser.getUid())) {
if (progressBar!=null)
progressBar.setVisibility(View.GONE);
if (baseMessage.getReadAt() != 0) {
txtTime.setText(Utils.getHeaderDate(baseMessage.getReadAt() * 1000));
// txtTime.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_double_tick, 0);
txtTime.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_double_tick, 0);
txtTime.setCompoundDrawablePadding(10);
} else if (baseMessage.getDeliveredAt() != 0) {
txtTime.setText(Utils.getHeaderDate(baseMessage.getDeliveredAt() * 1000));
// txtTime.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_done_all_black_24dp, 0);
txtTime.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_done_all_black_24dp, 0);
txtTime.setCompoundDrawablePadding(10);
} else {
} else if (baseMessage.getSentAt()>0){
txtTime.setText(Utils.getHeaderDate(baseMessage.getSentAt() * 1000));
// txtTime.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_check_black_24dp, 0);
txtTime.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_check_black_24dp, 0);
txtTime.setCompoundDrawablePadding(10);
} else if (baseMessage.getSentAt()==-1) {
txtTime.setText("");
txtTime.setCompoundDrawablesWithIntrinsicBounds(0,0,R.drawable.ic_info_red,0);
} else {
txtTime.setCompoundDrawablesWithIntrinsicBounds(0,0,0,0);
txtTime.setText("");
if (progressBar!=null)
progressBar.setVisibility(View.VISIBLE);
}
} else {
txtTime.setText(Utils.getHeaderDate(baseMessage.getSentAt() * 1000));
Expand Down Expand Up @@ -1296,6 +1310,21 @@ public void addMessage(BaseMessage baseMessage) {
notifyItemInserted(messageList.size()-1);
}

/**
* THis method is used to update the old message with the new message
* @param baseMessage
*/
public void updateChangedMessage(BaseMessage baseMessage) {
for (int i = messageList.size() - 1; i >= 0; i--) {
String muid = messageList.get(i).getMuid();
if (muid!=null && muid.equals(baseMessage.getMuid())) {
messageList.remove(i);
messageList.add(i,baseMessage);
notifyItemChanged(i);
}
}
}

/**
* This method is used to update previous message with new message in messageList of adapter.
*
Expand Down Expand Up @@ -1366,17 +1395,6 @@ public ImageMessageViewHolder(@NonNull View view) {
}
}

public class ActionMessageViewHolder extends RecyclerView.ViewHolder {

private TextView textView;

public ActionMessageViewHolder(@NonNull View view) {
super(view);
int type = (int) view.getTag();
textView = view.findViewById(R.id.go_txt_message);
}
}

class VideoMessageViewHolder extends RecyclerView.ViewHolder {

private ImageView imageView;
Expand Down Expand Up @@ -1414,6 +1432,7 @@ public class FileMessageViewHolder extends RecyclerView.ViewHolder {
private Avatar ivUser;
private RelativeLayout rlMessageBubble;
private ChipGroup reactionLayout;
private ProgressBar progressBar;

FileMessageViewHolder(@NonNull View itemView) {
super(itemView);
Expand All @@ -1425,6 +1444,7 @@ public class FileMessageViewHolder extends RecyclerView.ViewHolder {
fileName = itemView.findViewById(R.id.tvFileName);
rlMessageBubble = itemView.findViewById(R.id.rl_message);
reactionLayout = itemView.findViewById(R.id.reactions_layout);
progressBar = itemView.findViewById(R.id.progress_bar);
this.view = itemView;
}
}
Expand Down Expand Up @@ -1472,7 +1492,7 @@ public class TextMessageViewHolder extends RecyclerView.ViewHolder {
private RelativeLayout sentimentVw;
private TextView viewSentimentMessage;
private ChipGroup reactionLayout;

private ProgressBar progressBar;
TextMessageViewHolder(@NonNull View view) {
super(view);

Expand All @@ -1490,6 +1510,7 @@ public class TextMessageViewHolder extends RecyclerView.ViewHolder {
sentimentVw = view.findViewById(R.id.sentiment_layout);
viewSentimentMessage = view.findViewById(R.id.view_sentiment);
reactionLayout = view.findViewById(R.id.reactions_layout);
progressBar = view.findViewById(R.id.progress_bar);
this.view = view;

}
Expand Down Expand Up @@ -1567,6 +1588,7 @@ public class AudioMessageViewHolder extends RecyclerView.ViewHolder {
private RelativeLayout rlMessageBubble;
private TextView txtTime;
private ChipGroup reactionLayout;
private ProgressBar progressBar;
public AudioMessageViewHolder(@NonNull View itemView) {
super(itemView);
type = (int)itemView.getTag();
Expand All @@ -1577,6 +1599,7 @@ public AudioMessageViewHolder(@NonNull View itemView) {
ivUser = itemView.findViewById(R.id.iv_user);
txtTime = itemView.findViewById(R.id.txt_time);
reactionLayout = itemView.findViewById(R.id.reactions_layout);
progressBar = itemView.findViewById(R.id.progress_bar);
}
}
public class LinkMessageViewHolder extends RecyclerView.ViewHolder {
Expand All @@ -1596,6 +1619,7 @@ public class LinkMessageViewHolder extends RecyclerView.ViewHolder {
private Avatar ivUser;
private RelativeLayout rlMessageBubble;
private ChipGroup reactionLayout;
private ProgressBar progressBar;

LinkMessageViewHolder(@NonNull View view) {
super(view);
Expand All @@ -1614,20 +1638,11 @@ public class LinkMessageViewHolder extends RecyclerView.ViewHolder {
ivUser = view.findViewById(R.id.iv_user);
rlMessageBubble = view.findViewById(R.id.rl_message);
reactionLayout = view.findViewById(R.id.reactions_layout);
progressBar = view.findViewById(R.id.progress_bar);
this.view = view;
}
}

public class DateItemHolder extends RecyclerView.ViewHolder {

TextView txtMessageDate;

DateItemHolder(@NonNull View itemView) {
super(itemView);
txtMessageDate = itemView.findViewById(R.id.txt_message_date);
}
}

public interface OnMessageLongClick
{
void setLongMessageClick(List<BaseMessage> baseMessage);
Expand Down
2 changes: 1 addition & 1 deletion uikit/src/main/java/screen/CometChatMediaViewActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected void onCreate(Bundle savedInstanceState) {
toolbar = findViewById(R.id.toolbar);
toolbar.getNavigationIcon().setTint(getResources().getColor(R.color.textColorWhite));
toolbar.setTitle(senderName);
toolbar.setSubtitle(Utils.getMessageDate(sentAt));
toolbar.setSubtitle(Utils.getLastMessageDate(sentAt));
imageMessage = findViewById(R.id.image_message);
videoMessage = findViewById(R.id.video_message);
audioMessage = findViewById(R.id.audio_message);
Expand Down
Loading

0 comments on commit d5c3f60

Please sign in to comment.