Skip to content

Commit

Permalink
v4.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekCometChat committed Apr 23, 2024
1 parent a5f0398 commit b481315
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.cometchat.javasampleapp"
minSdk 21
targetSdk 33
versionCode 8
versionName "4.3.3"
versionCode 9
versionName "4.3.5"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [file_provider: "com.cometchat.javasampleapp"]
Expand Down
26 changes: 17 additions & 9 deletions app/src/main/java/com/cometchat/javasampleapp/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ public class Application extends android.app.Application {
@Override
public void onCreate() {
super.onCreate();
LISTENER_ID = System.currentTimeMillis() + "";
if(AppUtils.isNightMode(this)){
Palette.getInstance(this).mode(CometChatTheme.MODE.DARK);
addCallListener();
if (AppUtils.isNightMode(this)) {
Palette.getInstance().mode(CometChatTheme.MODE.DARK);
}
}

public static void addCallListener(Context context) {
private void addCallListener() {
LISTENER_ID = System.currentTimeMillis() + "";
CometChat.addCallListener(LISTENER_ID, new CometChat.CallListener() {
@Override
public void onIncomingCallReceived(Call call) {
CometChatCallActivity.launchIncomingCallScreen(context, call, null);
CometChatCallActivity.launchIncomingCallScreen(getApplicationContext(), call, null);
}

@Override
Expand All @@ -50,13 +51,20 @@ public void onIncomingCallCancelled(Call call) {
});
}


@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if(AppUtils.isNightMode(this)){
Palette.getInstance(this).mode(CometChatTheme.MODE.DARK);
}else{
Palette.getInstance(this).mode(CometChatTheme.MODE.LIGHT);
setTheme();
}

private void setTheme() {
if (AppUtils.isNightMode(this)) {
Palette.getInstance().mode(CometChatTheme.MODE.DARK);
AppUtils.switchDarkMode();
} else {
Palette.getInstance().mode(CometChatTheme.MODE.LIGHT);
AppUtils.switchLightMode();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ protected void onCreate(Bundle savedInstanceState) {
public void onSuccess(String s) {
CometChat.setDemoMetaInfo(getAppMetadata());
if (CometChatUIKit.getLoggedInUser() != null) {
Application.addCallListener(MainActivity.this);
AppUtils.fetchDefaultObjects();
startActivity(new Intent(MainActivity.this, HomeActivity.class));
finish();
Expand Down Expand Up @@ -103,7 +102,6 @@ private void login(String uid) {
CometChatUIKit.login(uid, new CometChat.CallbackListener<User>() {
@Override
public void onSuccess(User user) {
Application.addCallListener(MainActivity.this);
AppUtils.fetchDefaultObjects();
startActivity(new Intent(MainActivity.this, HomeActivity.class));
finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import androidx.fragment.app.Fragment;

import com.cometchat.chatuikit.shared.resources.theme.Palette;
import com.cometchat.chatuikit.shared.views.CometChatImageBubble.CometChatImageBubble;
import com.cometchat.chatuikit.shared.views.CometChatImageBubble.ImageBubbleStyle;
import com.cometchat.javasampleapp.R;
Expand All @@ -19,7 +20,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

CometChatImageBubble imageBubble = view.findViewById(R.id.image_bubble);
imageBubble.setImageUrl("https://data-us.cometchat.io/2379614bd4db65dd/media/1682517838_2050398854_08d684e835e3c003f70f2478f937ed57.jpeg", R.drawable.ic_launcher_background, false);
imageBubble.setStyle(new ImageBubbleStyle().setCornerRadius(18).setTextColor(getResources().getColor(R.color.black)).setBackground(getResources().getColor(com.cometchat.chatuikit.R.color.cometchat_accent100)));
imageBubble.setStyle(new ImageBubbleStyle().setCornerRadius(18).setTextColor(Palette.getInstance().getAccent(getContext())).setBackground(Palette.getInstance().getBackground(getContext())));
imageBubble.setCaption("This is a simple representation of CometChat Image Bubble");
return view;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import com.cometchat.chatuikit.shared.cometchatuikit.CometChatUIKit;
import com.cometchat.chatuikit.shared.resources.theme.CometChatTheme;
import com.cometchat.chatuikit.shared.resources.theme.Palette;
import com.cometchat.chatuikit.shared.utils.ConversationTailView;
import com.cometchat.chatuikit.shared.views.CometChatAvatar.AvatarStyle;
import com.cometchat.chatuikit.shared.views.CometChatBadge.BadgeStyle;
Expand All @@ -33,6 +34,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
CometChatTheme theme = CometChatTheme.getInstance();
CometChatListItem groupListItem = view.findViewById(R.id.group_list_item);
groupListItem.setTitle("Superhero");
groupListItem.setTitleColor(Palette.getInstance().getAccent(getContext()));
groupListItem.setSubtitleView(getTextView("8 members"));
groupListItem.setAvatar("https://data-us.cometchat.io/2379614bd4db65dd/media/1682517838_2050398854_08d684e835e3c003f70f2478f937ed57.jpeg", "Superhero");
groupListItem.hideStatusIndicator(true);
Expand All @@ -42,6 +44,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
userListItem.setAvatar(CometChatUIKit.getLoggedInUser().getAvatar(), name);
userListItem.setSubtitleView(getTextView(CometChatUIKit.getLoggedInUser().getStatus()));
userListItem.setTitle(name);
userListItem.setTitleColor(Palette.getInstance().getAccent(getContext()));
userListItem.setStatusIndicatorColor(getResources().getColor(com.cometchat.chatuikit.R.color.cometchat_online_green));

CometChatListItem conversationListItem = view.findViewById(R.id.conversation_list_item);
Expand All @@ -51,6 +54,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
tailView.getDate().setDate(System.currentTimeMillis() / 1000, Pattern.DAY_DATE_TIME);
tailView.getDate().setStyle(new DateStyle().setTextAppearance(theme.getTypography().getSubtitle1()).setTextColor(theme.getPalette().getAccent600(getContext())));
conversationListItem.setTitle(name);
conversationListItem.setTitleColor(Palette.getInstance().getAccent(getContext()));
conversationListItem.setAvatar(CometChatUIKit.getLoggedInUser().getAvatar(), name);
conversationListItem.setTailView(tailView);
conversationListItem.setSubtitleView(getTextView("Hey, How are you?"));
Expand Down

0 comments on commit b481315

Please sign in to comment.