Skip to content

Commit 482a1e6

Browse files
Android UI Kit v3.0.0-beta1-2
1 parent 6d981f1 commit 482a1e6

File tree

26 files changed

+1846
-45
lines changed

26 files changed

+1846
-45
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
![GitHub repo size](https://img.shields.io/github/repo-size/cometchat-pro/android-java-chat-app)
1414
![GitHub contributors](https://img.shields.io/github/contributors/cometchat-pro/android-java-chat-app)
1515
![GitHub stars](https://img.shields.io/github/stars/cometchat-pro/android-java-chat-app?style=social)
16-
![Version](https://shields.io/badge/version-v2.1.1--1-orange)
16+
![Version](https://shields.io/badge/version-v3.0.0--beta1--2-orange)
1717
![Twitter Follow](https://img.shields.io/twitter/follow/cometchat?style=social)
1818

1919
<img src="https://files.readme.io/952af91-UI_Kit__1.png"/>
@@ -56,7 +56,7 @@ Build and run the Sample App.
5656

5757
# Learn more about UI-Kit
5858

59-
Learn more about how to integrate [UI Kit](https://github.com/cometchat-pro/android-java-chat-ui-kit/blob/master/README.md) inside your app.
59+
Learn more about how to integrate [UI Kit](https://github.com/cometchat-pro/android-java-chat-ui-kit/blob/v3/README.md) inside your app.
6060
<br/>
6161
<hr/>
6262

app/release/output.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/CometChatStartCallActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ protected void onCreate(Bundle savedInstanceState) {
9191
.build();
9292
Log.e( "startCallActivity: ",sessionID+" "+type);
9393
CometChat.startCall(callSettings, new CometChat.OngoingCallListener() {
94+
9495
@Override
9596
public void onUserListUpdated(List<User> list) {
9697
Log.e( "onUserListUpdated: ",list.toString() );

uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_list/CometChatGroupList.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import androidx.annotation.Nullable;
1111
import androidx.fragment.app.Fragment;
1212
import androidx.recyclerview.widget.RecyclerView;
13+
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
1314

1415
import android.text.Editable;
1516
import android.text.TextWatcher;
@@ -76,6 +77,8 @@ public class CometChatGroupList extends Fragment {
7677

7778
private LinearLayout noGroupLayout;
7879

80+
private SwipeRefreshLayout swipeRefreshLayout;
81+
7982
private List<Group> groupList = new ArrayList<>();
8083

8184
private static final String TAG = "CometChatGroupList";
@@ -95,6 +98,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
9598
noGroupLayout = view.findViewById(R.id.no_group_layout);
9699
etSearch = view.findViewById(R.id.search_bar);
97100
clearSearch = view.findViewById(R.id.clear_search);
101+
swipeRefreshLayout = view.findViewById(R.id.swipeToRefresh);
98102

99103
ivCreateGroup = view.findViewById(R.id.create_group);
100104
ivCreateGroup.setImageTintList(ColorStateList.valueOf(Color.parseColor(UISettings.getColor())));
@@ -183,6 +187,14 @@ public void OnItemClick(Group group, int position) {
183187
event.OnItemClick(group,position);
184188
}
185189
});
190+
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
191+
@Override
192+
public void onRefresh() {
193+
groupsRequest=null;
194+
rvGroupList.clear();
195+
fetchGroup();
196+
}
197+
});
186198
return view;
187199
}
188200

@@ -215,6 +227,8 @@ public void onSuccess(List<Group> groups) {
215227
noGroupLayout.setVisibility(View.GONE);
216228
rvGroupList.setVisibility(View.VISIBLE);
217229
}
230+
if (swipeRefreshLayout.isRefreshing())
231+
swipeRefreshLayout.setRefreshing(false);
218232
}
219233
@Override
220234
public void onError(CometChatException e) {

uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_list/CometChatMessageList.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2173,8 +2173,8 @@ public void onResume() {
21732173
checkOnGoingCall();
21742174
if (!(resultIntentCode== UIKitConstants.RequestCode.GALLERY ||
21752175
resultIntentCode== UIKitConstants.RequestCode.CAMERA ||
2176-
resultIntentCode == UIKitConstants.RequestCode.FILE) ||
2177-
resultIntentCode == UIKitConstants.RequestCode.AUDIO) {
2176+
resultIntentCode == UIKitConstants.RequestCode.FILE ||
2177+
resultIntentCode == UIKitConstants.RequestCode.AUDIO)) {
21782178
rvChatListView.removeItemDecoration(stickyHeaderDecoration);
21792179
messagesRequest = null;
21802180
messageAdapter = null;

uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/thread_message_list/CometChatThreadMessageList.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@ public void onSuccess(List<BaseMessage> baseMessages) {
11901190
initMessageAdapter(baseMessages);
11911191
if (baseMessages.size() != 0) {
11921192
stopHideShimmer();
1193+
noReplyMessages.setVisibility(GONE);
11931194
BaseMessage baseMessage = baseMessages.get(baseMessages.size() - 1);
11941195
markMessageAsRead(baseMessage);
11951196
}
@@ -1696,10 +1697,11 @@ private void scrollToBottom() {
16961697
* @param baseMessage is object of BaseMessage.class. It is message which is been marked as read.
16971698
*/
16981699
private void markMessageAsRead(BaseMessage baseMessage) {
1699-
if (type.equals(CometChatConstants.RECEIVER_TYPE_USER))
1700-
CometChat.markAsRead(baseMessage.getId(), baseMessage.getSender().getUid(), baseMessage.getReceiverType());
1701-
else
1702-
CometChat.markAsRead(baseMessage.getId(), baseMessage.getReceiverUid(), baseMessage.getReceiverType());
1700+
CometChat.markAsRead(baseMessage); // used for v3
1701+
// if (type.equals(CometChatConstants.RECEIVER_TYPE_USER))
1702+
// CometChat.markAsRead(baseMessage.getId(), baseMessage.getSender().getUid(), baseMessage.getReceiverType());
1703+
// else
1704+
// CometChat.markAsRead(baseMessage.getId(), baseMessage.getReceiverUid(), baseMessage.getReceiverType());
17031705
}
17041706

17051707

uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatConversations/CometChatConversationsAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ protected FilterResults performFiltering(CharSequence charSequence) {
359359
conversation.getLastMessage().getCategory().equals(CometChatConstants.CATEGORY_MESSAGE) &&
360360
conversation.getLastMessage().getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)
361361
&& ((TextMessage)conversation.getLastMessage()).getText()!=null
362-
&& ((TextMessage)conversation.getLastMessage()).getText().contains(searchKeyword)) {
362+
&& ((TextMessage)conversation.getLastMessage()).getText().toLowerCase().contains(searchKeyword.toLowerCase())) {
363363
tempFilter.add(conversation);
364364
}
365365
}

uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUsers/CometChatUsersAdapter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ public void onBindViewHolder(@NonNull UserViewHolder userViewHolder, int i) {
9797
}
9898
if (user.getStatus().equals(CometChatConstants.USER_STATUS_ONLINE))
9999
userViewHolder.userListRowBinding.statusIndicator.setVisibility(View.VISIBLE);
100+
else
101+
userViewHolder.userListRowBinding.statusIndicator.setVisibility(View.GONE);
100102

101103
userViewHolder.userListRowBinding.statusIndicator.setUserStatus(user.getStatus());
102104
userViewHolder.userListRowBinding.txtUserName.setText(user.getName());

uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/user_list/CometChatUserList.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import androidx.annotation.Nullable;
3939
import androidx.fragment.app.Fragment;
4040
import androidx.recyclerview.widget.RecyclerView;
41+
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
4142

4243
import com.cometchat.pro.core.CometChat;
4344
import com.cometchat.pro.core.UsersRequest;
@@ -85,8 +86,6 @@ public class CometChatUserList extends Fragment {
8586

8687
private boolean isSearching;
8788

88-
private CometChatUsersAdapter userListAdapter;
89-
9089
private UsersRequest usersRequest; // Use to fetch users
9190

9291
private CometChatUsers rvUserList; // Use to display list of users
@@ -103,6 +102,8 @@ public class CometChatUserList extends Fragment {
103102

104103
private LinearLayout noUserLayout;
105104

105+
private SwipeRefreshLayout swipeRefreshLayout;
106+
106107
private List<User> userList = new ArrayList<>();
107108

108109
public CometChatUserList() {
@@ -116,6 +117,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
116117
View view = inflater.inflate(R.layout.fragment_cometchat_userlist, container, false);
117118
title = view.findViewById(R.id.tv_title);
118119
title.setTypeface(FontUtils.getInstance(getActivity()).getTypeFace(FontUtils.robotoMedium));
120+
swipeRefreshLayout = view.findViewById(R.id.swipeToRefresh);
119121
rvUserList = view.findViewById(R.id.rv_user_list);
120122
noUserLayout = view.findViewById(R.id.no_user_layout);
121123
etSearch = view.findViewById(R.id.search_bar);
@@ -198,6 +200,16 @@ public void OnItemClick(User user, int position) {
198200
events.OnItemClick(user,position);
199201
}
200202
});
203+
204+
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
205+
@Override
206+
public void onRefresh() {
207+
usersRequest=null;
208+
rvUserList.clear();
209+
fetchUsers();
210+
}
211+
});
212+
201213
return view;
202214
}
203215

@@ -248,6 +260,8 @@ public void onSuccess(List<User> users) {
248260
rvUserList.setVisibility(View.VISIBLE);
249261
noUserLayout.setVisibility(View.GONE);
250262
}
263+
if (swipeRefreshLayout.isRefreshing())
264+
swipeRefreshLayout.setRefreshing(false);
251265
}
252266

253267
@Override

uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/CometChatError.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ public static String localized(CometChatException e) {
317317
} else if (e.getCode().equalsIgnoreCase(ERROR_FEATURE_NOT_FOUND_MESSAGE)) {
318318
return new CometChatException(ERROR_FEATURE_NOT_FOUND_MESSAGE,
319319
errorContext.getString(R.string.err_feature_not_found)).getMessage();
320+
} else if (e.getCode().equalsIgnoreCase(ERROR_EXTENSION_NOT_FOUND_MESSAGE)) {
321+
return new CometChatException(ERROR_EXTENSION_NOT_FOUND_MESSAGE,
322+
errorContext.getString(R.string.extension_not_found)).getMessage();
320323
}
321324
// else if (e.getCode().equalsIgnoreCase())
322325
else {
@@ -327,8 +330,7 @@ public static class Extension {
327330
public static String localized(CometChatException e,String extensionId) {
328331
if (e.getCode().equalsIgnoreCase(ERR_EXTENSION_NOT_FOUND)) {
329332
return new CometChatException(ERR_EXTENSION_NOT_FOUND,
330-
String.format(errorContext.getString(R.string.extension_not_found),
331-
extensionId)).getMessage();
333+
extensionId+":"+errorContext.getString(R.string.extension_not_found)).getMessage();
332334
} else if (e.getCode().equalsIgnoreCase(ERR_EXTENSION_NOT_ENABLED)) {
333335
return new CometChatException(ERR_EXTENSION_NOT_ENABLED,
334336
errorContext.getString(R.string.extension_is_not_enabled)).getMessage();

0 commit comments

Comments
 (0)