Skip to content

Commit d451ec5

Browse files
v4.0.0
1 parent bde7b75 commit d451ec5

52 files changed

Lines changed: 1048 additions & 275 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Readme.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<p align="left">
1010
CometChat Kitchen Sink Sample App (built using <b>CometChat UI Kits</b>) is a fully functional real-time messaging app capable of private (one-on-one), group messaging, voice & video calling.
1111
<br />
12-
<a href="https://www.cometchat.com/docs/android-v4-uikit/overview"><strong>Explore the docs »</strong></a>
12+
<a href="https://www.cometchat.com/docs/java-uikit-beta/overview"><strong>Explore the docs »</strong></a>
1313
<br />
1414
<br />
15-
<a href="https://github.com/cometchat-pro/cometchat-chat-sample-app-android-java/issues">Report Bug</a>
15+
<a href="https://github.com/cometchat-pro/android-java-chat-app/issues">Report Bug</a>
1616
</p>
1717
</p>
1818

@@ -74,13 +74,13 @@ Simply clone or fork this repo and run it using the instructions below to see al
7474
1. Clone the repo
7575

7676
```sh
77-
git clone https://github.com/cometchat-pro/cometchat-chat-sample-app-android-java.git
77+
git clone https://github.com/cometchat-pro/android-java-chat-app.git
7878
```
7979

8080
2. Change to the working directory
8181

8282
```sh
83-
cd cometchat-chat-sample-app-android-java
83+
cd android-java-chat-app
8484
```
8585

8686
3. Change the Branch
@@ -89,42 +89,43 @@ Simply clone or fork this repo and run it using the instructions below to see al
8989
git checkout v4
9090
```
9191

92-
4. Replace `APP_ID`, `REGION`, and `AUTH_KEY` with your CometChat `App ID`, `Region`, and `Auth Key` in `AppConstants.java` file.
92+
4. Replace `APP_ID`, `REGION` and `AUTH_KEY` with your CometChat `App ID`, `Region` and `Auth Key` in `AppConstants.java` file.
9393

9494
![Replacing constants in AppConstants.java](./Screenshots/credentials.png "Replacing constants in AppConstants.java")
9595

9696
<!-- USAGE EXAMPLES -->
9797

9898
## Usage
9999

100-
This app contains all features offered by CometChat through its UI Kit. [Read more about the Android UI Kit here.](https://www.cometchat.com/docs/android-v4-uikit/overview)
100+
This app contains all features offered by CometChat through its UI Kit. [Read more about the Android chat UI Kit here.](https://www.cometchat.com/docs/java-uikit-beta/overview)
101101

102102
### Run project locally
103103

104104
- Open the project in Android Studio.
105105

106+
- Modify `APP_ID` and `AUTH_KEY` and `REGION` with your own .
106107
- Build and run the Sample App.
107108
- Select demo users or enter the **UID** at the time of login once the app is launched.
108109

109-
To learn about Android UI Kit Integration, please [click here](https://www.cometchat.com/docs/android-v4-uikit/integration).
110+
To learn about Android UI Kit Integration, please [click here](https://www.cometchat.com/docs/java-uikit-beta/integration).
110111

111112
## Help
112113

113-
To learn more about our UI kits, visit our [documentation](https://www.cometchat.com/docs/v4-uikits).
114+
To learn more about our UI kits, visit our [documentation](https://www.cometchat.com/docs/java-uikit-beta/overview).
114115

115-
If you are still facing issues while running this project or integrating with our UI Kits, please connect with our real-time support via the [CometChat Dashboard](https://app.cometchat.com/).
116+
If you are still facing issues while running this project or integrating with our UI Kits, please connect with our real time support via the [CometChat Dashboard](https://app.cometchat.com/).
116117

117118
<!-- CONTRIBUTING -->
118119

119120
## Contributing
120121

121-
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. Sincere thanks to all our [contributors](https://github.com/cometchat-pro/android-java-chat-app/graphs/contributors)!
122+
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**. Sincere thanks to all our [contributors](https://github.com/cometchat-pro/android-java-chat-app/graphs/contributors)!
122123

123124
You are requested to follow the contribution guidelines specified in [CONTRIBUTING.md](./CONTRIBUTING.md) while contributing to the project :smile:.
124125

125126
## Support
126127

127-
Please connect with our real-time support via the [CometChat Dashboard](https://app.cometchat.com/).
128+
Please connect with our real time support via the [CometChat Dashboard](https://app.cometchat.com/).
128129

129130
<!-- LICENSE -->
130131

@@ -134,8 +135,8 @@ This project is licensed under the MIT License - see the [LICENSE](./LICENSE) fi
134135

135136
## About Authors
136137

137-
`cometchat-chat-sample-app-android-java` is created & maintained by CometChat.
138+
`android-java-chat-app` is created & maintained by CometChat.
138139

139140
The names and logos for CometChat are trademarks of CometChat, Inc.
140141

141-
We love open-source software! See [our other projects](https://github.com/cometchat-pro) or [sign up with us](https://app.cometchat.com) to start using our product.
142+
We love open source software! See [our other projects](https://github.com/cometchat-pro) or [sign up with us](https://app.cometchat.com) to start using our product.

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ android {
3030
}
3131

3232
dependencies {
33-
implementation 'com.cometchat:chat-uikit-android:4.0.0-beta.1'
33+
implementation 'com.cometchat:chat-uikit-android:4.0.0'
3434
implementation 'androidx.appcompat:appcompat:1.6.1'
3535
implementation 'com.google.android.material:material:1.8.0'
3636
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
3737
testImplementation 'junit:junit:4.13.2'
3838
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
3939
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
40-
implementation 'com.cometchat:pro-android-calls-sdk:3.0.0'
40+
implementation 'com.cometchat:calls-sdk-android:4.0.0'
4141
}

app/src/main/java/com/cometchat/javasampleapp/AppConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class AppConstants {
44

55
public static final String APP_ID = "XXXXXXXXXXXXXXXXX";
66

7-
public static final String AUTH_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXX";
7+
public static final String AUTH_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
88

99
public static final String REGION = "XX";
1010

app/src/main/java/com/cometchat/javasampleapp/AppUtils.java

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
package com.cometchat.javasampleapp;
22

3-
import com.cometchat.pro.core.CometChat;
4-
import com.cometchat.pro.exceptions.CometChatException;
5-
import com.cometchat.pro.models.Group;
6-
import com.cometchat.pro.models.User;
3+
import android.content.Context;
4+
import android.content.res.ColorStateList;
5+
import android.content.res.Configuration;
6+
import android.widget.ImageView;
7+
import android.widget.TextView;
8+
9+
import androidx.appcompat.app.AppCompatDelegate;
10+
import androidx.core.content.ContextCompat;
11+
12+
import com.cometchat.chat.core.CometChat;
13+
import com.cometchat.chat.exceptions.CometChatException;
14+
import com.cometchat.chat.models.Group;
15+
import com.cometchat.chat.models.TextMessage;
16+
import com.cometchat.chat.models.User;
717

818
public class AppUtils {
919
private static Group group;
@@ -42,4 +52,33 @@ public static User getDefaultUser() {
4252
return user;
4353
}
4454

55+
public static void switchLightMode() {
56+
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
57+
}
58+
59+
public static void switchDarkMode() {
60+
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
61+
}
62+
63+
public static boolean isNightMode(Context context) {
64+
int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
65+
return currentNightMode == Configuration.UI_MODE_NIGHT_YES;
66+
}
67+
68+
public static void changeIconTintToWhite(Context context, ImageView imageView) {
69+
imageView.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(context, R.color.white)));
70+
}
71+
72+
public static void changeIconTintToBlack(Context context, ImageView imageView) {
73+
imageView.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(context, R.color.black)));
74+
}
75+
76+
public static void changeTextColorToWhite(Context context, TextView textView) {
77+
textView.setTextColor(ContextCompat.getColor(context, R.color.white));
78+
}
79+
80+
public static void changeTextColorToBlack(Context context, TextView textView) {
81+
textView.setTextColor(ContextCompat.getColor(context, R.color.black));
82+
}
83+
4584
}

app/src/main/java/com/cometchat/javasampleapp/Application.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,15 @@
66
import androidx.appcompat.app.AppCompatDelegate;
77

88
import com.cometchat.chatuikit.shared.resources.utils.Utils;
9-
import com.cometchat.pro.core.CometChat;
9+
import com.cometchat.chat.core.CometChat;
1010

1111

1212
public class Application extends android.app.Application {
13-
1413
private static final String TAG = "UIKitApplication";
15-
1614
@Override
1715
public void onCreate() {
1816
super.onCreate();
19-
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
20-
}
21-
22-
@Override
23-
public void onConfigurationChanged(@NonNull Configuration newConfig) {
24-
super.onConfigurationChanged(newConfig);
25-
setTheme();
26-
}
27-
28-
private void setTheme() {
29-
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
3017
}
31-
3218
@Override
3319
public void onTerminate() {
3420
super.onTerminate();

app/src/main/java/com/cometchat/javasampleapp/activity/ComponentLaunchActivity.java

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
package com.cometchat.javasampleapp.activity;
22

3+
import android.content.res.ColorStateList;
34
import android.os.Bundle;
5+
import android.view.View;
6+
import android.widget.LinearLayout;
47

58
import androidx.appcompat.app.AppCompatActivity;
9+
import androidx.core.content.ContextCompat;
610
import androidx.fragment.app.Fragment;
711

812
import com.cometchat.chatuikit.shared.resources.utils.Utils;
13+
import com.cometchat.javasampleapp.AppUtils;
914
import com.cometchat.javasampleapp.R;
1015
import com.cometchat.javasampleapp.fragments.calls.CallButtonFragment;
16+
import com.cometchat.javasampleapp.fragments.conversations.ContactsFragment;
1117
import com.cometchat.javasampleapp.fragments.conversations.ConversationsFragment;
1218
import com.cometchat.javasampleapp.fragments.conversations.ConversationsWithMessagesFragment;
1319
import com.cometchat.javasampleapp.fragments.groups.AddMemberFragment;
@@ -21,6 +27,7 @@
2127
import com.cometchat.javasampleapp.fragments.groups.TransferOwnershipFragment;
2228
import com.cometchat.javasampleapp.fragments.messages.MessageComposerFragment;
2329
import com.cometchat.javasampleapp.fragments.messages.MessageHeaderFragment;
30+
import com.cometchat.javasampleapp.fragments.messages.MessageInformationFragment;
2431
import com.cometchat.javasampleapp.fragments.messages.MessageListFragment;
2532
import com.cometchat.javasampleapp.fragments.messages.MessagesFragment;
2633
import com.cometchat.javasampleapp.fragments.shared.resources.LocalizeFragment;
@@ -32,6 +39,7 @@
3239
import com.cometchat.javasampleapp.fragments.shared.views.FileBubbleFragment;
3340
import com.cometchat.javasampleapp.fragments.shared.views.ImageBubbleFragment;
3441
import com.cometchat.javasampleapp.fragments.shared.views.ListItemFragment;
42+
import com.cometchat.javasampleapp.fragments.shared.views.MediaRecorderFragment;
3543
import com.cometchat.javasampleapp.fragments.shared.views.MessageReceiptFragment;
3644
import com.cometchat.javasampleapp.fragments.shared.views.StatusIndicatorFragment;
3745
import com.cometchat.javasampleapp.fragments.shared.views.TextBubbleFragment;
@@ -41,14 +49,14 @@
4149
import com.cometchat.javasampleapp.fragments.users.UsersWithMessagesFragment;
4250

4351
public class ComponentLaunchActivity extends AppCompatActivity {
44-
52+
private LinearLayout parentView;
4553
@Override
4654
protected void onCreate(Bundle savedInstanceState) {
4755
super.onCreate(savedInstanceState);
4856
setContentView(R.layout.activity_component_launch);
49-
Utils.setStatusBarColor(this, getResources().getColor(R.color.app_background));
5057
int id = getIntent().getIntExtra("component", 0);
51-
58+
parentView = findViewById(R.id.container);
59+
setUpUI();
5260
if (id == R.id.conversationWithMessages) {
5361
loadFragment(new ConversationsWithMessagesFragment());
5462
} else if (id == R.id.conversations) {
@@ -113,6 +121,21 @@ protected void onCreate(Bundle savedInstanceState) {
113121
loadFragment(new AudioBubbleFragment());
114122
} else if (id == R.id.files_bubble) {
115123
loadFragment(new FileBubbleFragment());
124+
} else if (id == R.id.media_recorder) {
125+
loadFragment(new MediaRecorderFragment());
126+
} else if (id == R.id.contacts) {
127+
loadFragment(new ContactsFragment());
128+
}else if (id == R.id.messageInformation) {
129+
loadFragment(new MessageInformationFragment());
130+
}
131+
}
132+
private void setUpUI() {
133+
if(AppUtils.isNightMode(this)){
134+
Utils.setStatusBarColor(this, ContextCompat.getColor(this,R.color.app_background_dark));
135+
parentView.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(this,R.color.app_background_dark)));
136+
}else {
137+
Utils.setStatusBarColor(this, getResources().getColor(R.color.app_background));
138+
parentView.setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.app_background)));
116139
}
117140
}
118141

0 commit comments

Comments
 (0)