Skip to content

Commit

Permalink
Android UI Kit v3.0.0-1
Browse files Browse the repository at this point in the history
  • Loading branch information
darshanbhanushali committed Aug 16, 2021
1 parent 91673f2 commit 6b83fbc
Show file tree
Hide file tree
Showing 326 changed files with 4,400 additions and 4,439 deletions.
7 changes: 1 addition & 6 deletions .idea/misc.xml

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

19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The UI Kit is developed to keep developers in mind and aims to reduce developmen
[![Platform](https://img.shields.io/badge/Language-Java-yellowgreen.svg)](#)
![GitHub repo size](https://img.shields.io/github/repo-size/cometchat-pro/android-java-chat-ui-kit)
![GitHub contributors](https://img.shields.io/github/contributors/cometchat-pro/android-java-chat-ui-kit)
![Version](https://shields.io/badge/version-v3.0.0--beta4--1-orange)
![Version](https://shields.io/badge/version-v3.0.0--1-orange)
![GitHub stars](https://img.shields.io/github/stars/cometchat-pro/android-java-chat-ui-kit?style=social)
![Twitter Follow](https://img.shields.io/twitter/follow/cometchat?style=social)

Expand All @@ -28,7 +28,7 @@ The UI Kit is developed to keep developers in mind and aims to reduce developmen
Before you begin, ensure you have met the following requirements:<br/>
&nbsp; You have `Android Studio` installed in your machine.<br/>
&nbsp; You have a `Android Device or Emulator` with Android Version 6.0 or above.<br/>
&nbsp; You have read [CometChat Key Concepts](https://prodocs.cometchat.com/v3.0-beta/docs/concepts).<br/>
&nbsp; You have read [CometChat Key Concepts](https://prodocs.cometchat.com/v3.0/docs/concepts).<br/>

<hr/>

Expand Down Expand Up @@ -70,7 +70,12 @@ allprojects {

```groovy
dependencies {
implementation 'com.cometchat:pro-android-chat-sdk:3.0.0-beta4'
implementation 'com.cometchat:pro-android-chat-sdk:3.0.0'
/** From v2.4+ onwards, Voice & Video Calling functionality has been
moved to a separate library. In case you plan to use the calling
feature, please add the Calling dependency.**/
implementation 'com.cometchat:pro-android-calls-sdk:2.1.0'
}
```

Expand All @@ -92,7 +97,7 @@ android {
</td></table>

You can refer to the below link for instructions on how to do so:<br/>
[📝 Add CometChat Dependency](https://prodocs.cometchat.com/v3.0-beta/docs/android-quick-start#section-add-the-cometchat-dependency)
[📝 Add CometChat Dependency](https://prodocs.cometchat.com/v3.0/docs/android-quick-start#section-add-the-cometchat-dependency)

<hr/>

Expand Down Expand Up @@ -167,15 +172,15 @@ String authKey = "AUTH_KEY"; // Replace with your App Auth Key

<hr/>

📝 &nbsp; Please refer to our [Developer Documentation](https://prodocs.cometchat.com/v3.0-beta/docs/android-quick-start) for more information on how to configure the CometChat Pro SDK and implement various features using the same.
📝 &nbsp; Please refer to our [Developer Documentation](https://prodocs.cometchat.com/v3.0/docs/android-quick-start) for more information on how to configure the CometChat Pro SDK and implement various features using the same.

<hr/>

## Add UI Kit Library

1. Simply clone the project from [android-java-chat-ui-kit](https://github.com/cometchat-pro/android-java-chat-ui-kit/tree/v3) repository.

2. Import `uikit` Module from Module Settings.( To know how to import `uikit` as Module visit this [link](https://prodocs.cometchat.com/v3.0-beta/docs/android-ui-kit-setup) )
2. Import `uikit` Module from Module Settings.( To know how to import `uikit` as Module visit this [link](https://prodocs.cometchat.com/v3.0/docs/android-ui-kit-setup) )

3. If the Library is added successfully, it will look like mentioned in the below image.
<img align="center" width="auto" height="auto" src="https://github.com/cometchat-pro/android-chat-uikit/blob/master/Screenshot/Screen%20Shot%202019-12-23%20at%207.37.37%20PM.png">
Expand Down Expand Up @@ -286,7 +291,7 @@ Visit our [Kotlin sample app](https://github.com/cometchat-pro/android-kotlin-ch

## Troubleshooting

- To read the full documentation on UI Kit integration visit our [Documentation](https://prodocs.cometchat.com/v3.0-beta/docs/android-ui-kit) .
- To read the full documentation on UI Kit integration visit our [Documentation](https://prodocs.cometchat.com/v3.0/docs/android-ui-kit) .

- Facing any issues while integrating or installing the UI Kit please <a href="https://app.cometchat.com/"> connect with us via real time support present in CometChat Dashboard.</a>.

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:4.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jan 23 15:07:58 IST 2020
#Tue Aug 17 02:58:03 IST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
8 changes: 4 additions & 4 deletions uikit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
compileSdkVersion 30

defaultConfig {
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
Expand Down Expand Up @@ -90,7 +90,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:3.0.0-beta4'

compileOnly 'com.cometchat:pro-android-chat-sdk:3.0.0'
compileOnly 'com.cometchat:pro-android-calls-sdk:2.1.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.0'
}
52 changes: 38 additions & 14 deletions uikit/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,49 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<queries>

<!-- Gallery -->
<intent>
<action android:name="android.intent.action.GET_CONTENT" />

<data android:mimeType="image/* video/*" />
</intent>
<intent>
<action android:name="android.intent.action.PICK" />

<data android:mimeType="image/* video/*" />
</intent>
<intent>
<action android:name="android.intent.action.CHOOSER" />
</intent>
</queries>

<application
android:extractNativeLibs="false"
android:hardwareAccelerated="true"
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true"
tools:node="merge"
tools:targetApi="m">
<activity android:name=".ui_components.messages.extensions.Collaborative.CometChatWebViewActivity"/>
<activity
android:name=".ui_components.messages.extensions.Reactions.CometChatReactionInfoActivity"/>
<activity android:name=".ui_components.chats.CometChatStartConversation"/>
<activity android:name=".ui_components.messages.extensions.Collaborative.CometChatWebViewActivity" />
<activity android:name=".ui_components.messages.extensions.Reactions.CometChatReactionInfoActivity" />
<activity android:name=".ui_components.messages.media_view.CometChatMediaViewActivity" />
<activity android:name=".ui_components.messages.message_information.CometChatMessageInfoScreenActivity" />
<activity android:name=".ui_components.calls.call_manager.CometChatStartCallActivity"
android:screenOrientation="portrait"
android:launchMode="singleTask" />
<activity
android:name=".ui_components.calls.call_manager.CometChatStartCallActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<activity
android:name=".ui_components.messages.thread_message_list.CometChatThreadMessageListActivity"
android:windowSoftInputMode="adjustResize" />
Expand All @@ -47,7 +68,7 @@

<category android:name="android.intent.category.DEFAULT" />

<data android:mimeType="image/*"/>
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
Expand All @@ -57,6 +78,7 @@
<data android:mimeType="text/plain" />
</intent-filter>
</activity>

<meta-data
android:name="com.cometchat.pro.uikit"
android:value="${file_provider}" />
Expand Down Expand Up @@ -95,6 +117,7 @@
android:name=".ui_components.messages.message_list.CometChatMessageListActivity"
android:parentActivityName=".ui_components.cometchat_ui.CometChatUI"
android:screenOrientation="portrait" />

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${file_provider}.provider"
Expand All @@ -105,17 +128,18 @@
android:resource="@xml/provider_path" />
</provider>

<receiver android:name=".ui_components.calls.call_manager.ongoing_call.OngoingCallBroadcast"
<receiver
android:name=".ui_components.calls.call_manager.ongoing_call.OngoingCallBroadcast"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="restartService"/>
<action android:name="restartService" />
</intent-filter>
</receiver>

<service android:name=".ui_components.calls.call_manager.ongoing_call.OngoingCallService"
android:enabled="true"/>

<service
android:name=".ui_components.calls.call_manager.ongoing_call.OngoingCallService"
android:enabled="true" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.cometchat.pro.uikit.R;
import com.cometchat.pro.uikit.ui_components.shared.cometchatCalls.CometChatCalls;
import com.cometchat.pro.uikit.ui_resources.utils.CometChatError;
import com.cometchat.pro.uikit.ui_settings.UIKitSettings;
import com.facebook.shimmer.ShimmerFrameLayout;
import com.google.android.material.tabs.TabLayout;

Expand Down Expand Up @@ -83,20 +84,17 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_cometchat_calls, container, false);
tvTitle = view.findViewById(R.id.tv_title);
fetchSettings();
CometChatError.init(getContext());
phoneAddIv = view.findViewById(R.id.add_phone_iv);
if (oneOnoneCallEnabled || oneOnoneVideoCallEnabled)
phoneAddIv.setVisibility(View.VISIBLE);
else
phoneAddIv.setVisibility(View.GONE);

phoneAddIv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openUserListScreen();
}
});

fetchSettings();

viewPager = view.findViewById(R.id.viewPager);
tabLayout = view.findViewById(R.id.tabLayout);
if (getActivity() != null) {
Expand All @@ -106,13 +104,13 @@ public void onClick(View v) {
viewPager.setAdapter(tabAdapter);
}
tabLayout.setupWithViewPager(viewPager);
if (FeatureRestriction.getColor()!=null) {
phoneAddIv.setImageTintList(ColorStateList.valueOf(Color.parseColor(FeatureRestriction.getColor())));
if (UIKitSettings.getColor()!=null) {
phoneAddIv.setImageTintList(ColorStateList.valueOf(Color.parseColor(UIKitSettings.getColor())));
Drawable wrappedDrawable = DrawableCompat.wrap(getResources().
getDrawable(R.drawable.tab_layout_background_active));
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(FeatureRestriction.getColor()));
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(UIKitSettings.getColor()));
tabLayout.getTabAt(tabLayout.getSelectedTabPosition()).view.setBackground(wrappedDrawable);
tabLayout.setSelectedTabIndicatorColor(Color.parseColor(FeatureRestriction.getColor()));
tabLayout.setSelectedTabIndicatorColor(Color.parseColor(UIKitSettings.getColor()));
} else {
tabLayout.getTabAt(tabLayout.getSelectedTabPosition()).
view.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
Expand All @@ -121,10 +119,10 @@ public void onClick(View v) {
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
if (FeatureRestriction.getColor()!=null) {
if (UIKitSettings.getColor()!=null) {
Drawable wrappedDrawable = DrawableCompat.wrap(getResources().
getDrawable(R.drawable.tab_layout_background_active));
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(FeatureRestriction.getColor()));
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(UIKitSettings.getColor()));
tab.view.setBackground(wrappedDrawable);
}
else
Expand All @@ -149,13 +147,15 @@ private void fetchSettings() {
FeatureRestriction.isOneOnOneAudioCallEnabled(new FeatureRestriction.OnSuccessListener() {
@Override
public void onSuccess(Boolean booleanVal) {
oneOnoneCallEnabled = booleanVal;
if (booleanVal)
phoneAddIv.setVisibility(View.VISIBLE);
}
});
FeatureRestriction.isOneOnOneVideoCallEnabled(new FeatureRestriction.OnSuccessListener() {
@Override
public void onSuccess(Boolean booleanVal) {
oneOnoneVideoCallEnabled = booleanVal;
if (booleanVal)
phoneAddIv.setVisibility(View.VISIBLE);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.cometchat.pro.uikit.R;
import com.cometchat.pro.uikit.ui_components.shared.CometChatSnackBar;
import com.cometchat.pro.uikit.ui_resources.utils.CometChatError;
import com.cometchat.pro.uikit.ui_settings.UIKitSettings;
import com.facebook.shimmer.ShimmerFrameLayout;

import java.util.List;
Expand Down Expand Up @@ -101,19 +102,19 @@ public CometChatNewCallList() {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_cometchat_userlist);
fetchSettings();
title = findViewById(R.id.tv_title);
CometChatError.init(this);
ImageView imageView = new ImageView(this);
imageView.setImageDrawable(getResources().getDrawable(R.drawable.ic_close_24dp));
if (FeatureRestriction.getColor()!=null) {
getWindow().setStatusBarColor(Color.parseColor(FeatureRestriction.getColor()));
imageView.setImageDrawable(getResources().getDrawable(R.drawable.ic_back_arrow_selected));
if (UIKitSettings.getColor()!=null) {
getWindow().setStatusBarColor(Color.parseColor(UIKitSettings.getColor()));
imageView.setImageTintList(ColorStateList.valueOf(
Color.parseColor(FeatureRestriction.getColor())));
Color.parseColor(UIKitSettings.getColor())));
} else
imageView.setImageTintList(
ColorStateList.valueOf(getResources().getColor(R.color.colorPrimary)));

fetchSettings();
imageView.setClickable(true);
imageView.setPadding(8,8,8,8);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
Expand All @@ -128,11 +129,11 @@ public void onClick(View v) {
onBackPressed();
}
});
title.setTypeface(FontUtils.getInstance(this).getTypeFace(FontUtils.robotoMedium));
RelativeLayout.LayoutParams titleLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
titleLayoutParams.setMargins(16,32,16,48);
titleLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
title.setLayoutParams(titleLayoutParams);
title.setTextAppearance(R.style.TextAppearance_AppCompat_Large);
title.setText(getResources().getString(R.string.new_call));
rvUserList = findViewById(R.id.rv_user_list);
etSearch = findViewById(R.id.search_bar);
Expand Down Expand Up @@ -201,9 +202,7 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat
}
});

if (audioCallEnabled || videoCallEnabled) {
// Used to trigger event on click of user item in rvUserList (RecyclerView)
rvUserList.setItemClickListener(new OnItemClickListener<User>() {
rvUserList.setItemClickListener(new OnItemClickListener<User>() {
@Override
public void OnItemClick(User var, int position) {
User user = var;
Expand All @@ -229,7 +228,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
alertDialog.show();
}
});
}

fetchUsers();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ public void setCallType(boolean isVideoCall, boolean isIncoming) {
outgoingCallView.setVisibility(View.GONE);
if (isVideoCall) {
callMessage.setText(getResources().getString(R.string.incoming_video_call));
callMessage.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.ic_videocam_white_24dp),null,null,null);
callMessage.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.ic_incoming_video_call),null,null,null);
} else {
callMessage.setText(getResources().getString(R.string.incoming_audio_call));
callMessage.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.ic_call_incoming_24dp),null,null,null);
callMessage.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.ic_incoming_call),null,null,null);
}
} else {
callTv.setText(getString(R.string.calling));
Expand All @@ -248,7 +248,7 @@ public void setCallType(boolean isVideoCall, boolean isIncoming) {
if (isVideoCall) {
cameraPreview = new CameraPreview(this);
cameraFrame.addView(cameraPreview);
hangUp.setImageDrawable(getResources().getDrawable(R.drawable.ic_videocam_white_24dp));
hangUp.setImageDrawable(getResources().getDrawable(R.drawable.ic_videocall));

} else {
hangUp.setImageDrawable(getResources().getDrawable(R.drawable.ic_call_end_white_24dp));
Expand Down
Loading

0 comments on commit 6b83fbc

Please sign in to comment.