Skip to content

Commit

Permalink
Android UI Kit v2.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
darshanbhanushali committed Nov 16, 2020
1 parent f236088 commit 5cdad5c
Show file tree
Hide file tree
Showing 79 changed files with 2,941 additions and 546 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,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.3'
implementation 'com.cometchat:pro-android-chat-sdk:2.1.4'
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.cometchat.pro.constants.CometChatConstants;
import com.cometchat.pro.core.CometChat;
import com.cometchat.pro.exceptions.CometChatException;
import com.cometchat.pro.uikit.UIKitSettings;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.snackbar.Snackbar;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.cometchat.pro.exceptions.CometChatException;
import com.cometchat.pro.androiduikit.constants.AppConfig;
import com.cometchat.pro.helpers.Logger;
import com.cometchat.pro.uikit.Settings.UIKitSettings;

import constant.StringContract;
import listeners.CometChatCallListener;
Expand All @@ -38,7 +39,8 @@ public void onCreate() {
new CometChat.CallbackListener<String>() {
@Override
public void onSuccess(String s) {
StringContract.AppInfo.API_KEY = AppConfig.AppDetails.API_KEY;
UIKitSettings.setAppID(AppConfig.AppDetails.APP_ID);
UIKitSettings.setAPIKey(AppConfig.AppDetails.API_KEY);
CometChat.setSource("ui-kit","android","java");
Log.d(TAG, "onSuccess: "+s);
}
Expand Down Expand Up @@ -68,6 +70,11 @@ public void onConnecting() {
public void onDisconnected() {
Toast.makeText(getBaseContext(),"You have been disconnected.",Toast.LENGTH_LONG).show();
}

@Override
public void onFeatureThrottled() {

}
});
}

Expand Down
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.3'
compileOnly 'com.cometchat:pro-android-chat-sdk:2.1.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.0"
}
repositories {
Expand Down
1 change: 0 additions & 1 deletion uikit/src/main/java/adapter/BlockedListAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public void onBindViewHolder(@NonNull BlockedViewHolder blockedViewHolder, int i
blockedViewHolder.userListRowBinding.tvSeprator.setVisibility(View.VISIBLE);
}
blockedViewHolder.userListRowBinding.txtUserName.setText(user.getName());
blockedViewHolder.userListRowBinding.avUser.setBackgroundColor(context.getResources().getColor(R.color.colorPrimary));
blockedViewHolder.userListRowBinding.getRoot().setTag(R.string.user, user);
blockedViewHolder.userListRowBinding.txtUserScope.setVisibility(View.GONE);
blockedViewHolder.userListRowBinding.unblockUser.setVisibility(View.VISIBLE);
Expand Down
13 changes: 10 additions & 3 deletions uikit/src/main/java/adapter/CallListAdapter.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package adapter;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
Expand All @@ -13,7 +14,6 @@
import com.cometchat.pro.constants.CometChatConstants;
import com.cometchat.pro.core.Call;
import com.cometchat.pro.core.CometChat;
import com.cometchat.pro.exceptions.CometChatException;
import com.cometchat.pro.models.BaseMessage;
import com.cometchat.pro.models.Conversation;
import com.cometchat.pro.models.Group;
Expand All @@ -22,10 +22,10 @@
import com.cometchat.pro.uikit.databinding.CallListRowBinding;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import utils.FontUtils;
import com.cometchat.pro.uikit.Settings.UISettings;
import utils.Utils;

/**
Expand Down Expand Up @@ -190,6 +190,13 @@ public void onBindViewHolder(@NonNull CallViewHolder callViewHolder, int positio
callViewHolder.callListRowBinding.calltimeTv.setText(Utils.getLastMessageDate(call.getInitiatedAt()));
callViewHolder.callListRowBinding.callMessage.setText(callMessageText);
callViewHolder.callListRowBinding.getRoot().setTag(R.string.call, call);
if (UISettings.isEnableVoiceCalling())
callViewHolder.callListRowBinding.callIv.setVisibility(View.VISIBLE);
else
callViewHolder.callListRowBinding.callIv.setVisibility(View.GONE);

callViewHolder.callListRowBinding.callIv.setImageTintList(
ColorStateList.valueOf(Color.parseColor(UISettings.getColor())));

}

Expand Down
6 changes: 5 additions & 1 deletion uikit/src/main/java/adapter/ConversationListAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;

import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -29,6 +30,7 @@

import utils.Extensions;
import utils.FontUtils;
import com.cometchat.pro.uikit.Settings.UISettings;
import utils.Utils;

/**
Expand Down Expand Up @@ -162,7 +164,9 @@ public void onBindViewHolder(@NonNull ConversationViewHolder conversationViewHol

conversationViewHolder.conversationListRowBinding.messageCount.setCount(conversation.getUnreadMessageCount());
conversationViewHolder.conversationListRowBinding.txtUserName.setText(name);
conversationViewHolder.conversationListRowBinding.avUser.setBackgroundColor(context.getResources().getColor(R.color.colorPrimary));
conversationViewHolder.conversationListRowBinding.avUser.setBackgroundColor(Color.parseColor(UISettings.getColor()));
conversationViewHolder.conversationListRowBinding.messageCount.setCountBackground(Color.parseColor(UISettings.getColor()));


if (avatar != null && !avatar.isEmpty()) {
conversationViewHolder.conversationListRowBinding.avUser.setAvatar(avatar);
Expand Down
4 changes: 3 additions & 1 deletion uikit/src/main/java/adapter/GroupListAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.ViewGroup;

Expand All @@ -11,6 +12,7 @@

import com.cometchat.pro.constants.CometChatConstants;
import com.cometchat.pro.uikit.R;
import com.cometchat.pro.uikit.Settings.UISettings;
import com.cometchat.pro.uikit.databinding.GroupListRowBinding;
import com.cometchat.pro.models.Group;

Expand Down Expand Up @@ -94,7 +96,7 @@ else if (group.getGroupType().equals(CometChatConstants.GROUP_TYPE_PASSWORD))
groupViewHolder.groupListRowBinding.txtUserName.setCompoundDrawablesWithIntrinsicBounds(0,0,0,0);

groupViewHolder.groupListRowBinding.executePendingBindings();
groupViewHolder.groupListRowBinding.avGroup.setBackgroundColor(context.getResources().getColor(R.color.colorPrimary));
groupViewHolder.groupListRowBinding.avGroup.setBackgroundColor(Color.parseColor(UISettings.getColor()));
groupViewHolder.groupListRowBinding.getRoot().setTag(R.string.group, group);
groupViewHolder.groupListRowBinding.txtUserMessage.setTypeface(fontUtils.getTypeFace(FontUtils.robotoRegular));
groupViewHolder.groupListRowBinding.txtUserName.setTypeface(fontUtils.getTypeFace(FontUtils.robotoMedium));
Expand Down
15 changes: 15 additions & 0 deletions uikit/src/main/java/adapter/GroupMemberAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.cometchat.pro.core.CometChat;
import com.cometchat.pro.models.GroupMember;
import com.cometchat.pro.models.TypingIndicator;
import com.cometchat.pro.models.User;
import com.cometchat.pro.uikit.R;
import com.cometchat.pro.uikit.databinding.UserListRowBinding;

Expand Down Expand Up @@ -121,6 +122,11 @@ public void onBindViewHolder(@NonNull GroupMemberViewHolder groupMemberViewHolde
else
groupMemberViewHolder.userListRowBinding.avUser.setAvatar(groupMember.getAvatar());

if (groupMember.getStatus().equalsIgnoreCase(CometChatConstants.USER_STATUS_ONLINE))
groupMemberViewHolder.userListRowBinding.statusIndicator.setVisibility(View.VISIBLE);

groupMemberViewHolder.userListRowBinding.statusIndicator.setUserStatus(groupMember.getStatus());

if (Utils.isDarkMode(context))
{
groupMemberViewHolder.userListRowBinding.txtUserName.setTextColor(context.getResources().getColor(R.color.textColorWhite));
Expand Down Expand Up @@ -210,6 +216,15 @@ public void updateMember(GroupMember groupMember) {
}
}

public void updateMemberByStatus(User user) {
for (GroupMember groupMember : groupMemberList) {
if (groupMember.getUid().equalsIgnoreCase(user.getUid())) {
int index = groupMemberList.indexOf(groupMember);
groupMember.setStatus(user.getStatus());
notifyItemChanged(index);
}
}
}
public void resetAdapter() {
groupMemberList.clear();
notifyDataSetChanged();
Expand Down
Loading

0 comments on commit 5cdad5c

Please sign in to comment.