Skip to content

Commit

Permalink
Android UIKit v2.3.4-1
Browse files Browse the repository at this point in the history
  • Loading branch information
darshanbhanushali committed Jun 1, 2021
1 parent 862833b commit 9bac4b7
Show file tree
Hide file tree
Showing 131 changed files with 4,857 additions and 2,264 deletions.
4 changes: 2 additions & 2 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)](#)
<img src="https://img.shields.io/badge/Repo%20Size-9.26%20MB-blue" />
![GitHub contributors](https://img.shields.io/github/contributors/cometchat-pro/android-java-chat-ui-kit)
![Version](https://shields.io/badge/version-v2.3.1--1-orange)
![Version](https://shields.io/badge/version-v2.3.4--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 Down Expand Up @@ -71,7 +71,7 @@ allprojects {

```groovy
dependencies {
implementation 'com.cometchat:pro-android-chat-sdk:2.3.1'
implementation 'com.cometchat:pro-android-chat-sdk:2.3.4'
}
```

Expand Down
4 changes: 2 additions & 2 deletions uikit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
versionName "2.3.4-1"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
renderscriptSupportModeEnabled 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:2.3.1'
compileOnly 'com.cometchat:pro-android-chat-sdk:2.3.4'

implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.0'
}
2 changes: 1 addition & 1 deletion uikit/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:usesCleartextTraffic="true"
tools:node="merge"
tools:targetApi="m">
<activity android:name=".ui_components.messages.extensions.Collaborative.CometChatCollaborativeActivity"/>
<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" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.cometchat.pro.constants.CometChatConstants;
import com.cometchat.pro.core.Call;
import com.cometchat.pro.core.CometChat;
import com.cometchat.pro.core.MessagesRequest;
Expand All @@ -28,6 +29,7 @@
import com.cometchat.pro.uikit.R;
import com.cometchat.pro.uikit.ui_resources.utils.CometChatError;
import com.cometchat.pro.uikit.ui_resources.utils.Utils;
import com.cometchat.pro.uikit.ui_settings.FeatureRestriction;
import com.google.android.material.snackbar.Snackbar;

import java.util.Arrays;
Expand Down Expand Up @@ -57,9 +59,15 @@ public class AllCall extends Fragment {
private MessagesRequest messagesRequest;

private LinearLayoutManager linearLayoutManager;

private boolean videoCallEnabled;
private boolean audioCallEnabled;

@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_cometchat_all_call, container, false);
fetchSettings();
CometChatError.init(getContext());
rvCallList = view.findViewById(R.id.callList_rv);
linearLayoutManager = new LinearLayoutManager(getContext(),LinearLayoutManager.VERTICAL,false
);
Expand All @@ -68,7 +76,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
rvCallList.setItemClickListener(new OnItemClickListener<Call>() {
@Override
public void OnItemClick(Call var, int position) {
if (var.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) {
if (var.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) {
User user;
if (((User)var.getCallInitiator()).getUid().equals(CometChat.getLoggedInUser().getUid())) {
user = ((User)var.getCallReceiver());
Expand All @@ -81,6 +89,7 @@ public void OnItemClick(Call var, int position) {
intent.putExtra(UIKitConstants.IntentStrings.NAME, user.getName());
intent.putExtra(UIKitConstants.IntentStrings.AVATAR, user.getAvatar());
intent.putExtra(UIKitConstants.IntentStrings.STATUS, user.getStatus());
intent.putExtra(UIKitConstants.IntentStrings.LINK,user.getLink());
intent.putExtra(UIKitConstants.IntentStrings.IS_BLOCKED_BY_ME, user.isBlockedByMe());
intent.putExtra(UIKitConstants.IntentStrings.FROM_CALL_LIST,true);
startActivity(intent);
Expand Down Expand Up @@ -121,7 +130,7 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat
}

private void checkOnGoingCall(Call var) {
if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null)
if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null)
{
AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
alert.setTitle(getContext().getResources().getString(R.string.ongoing_call))
Expand All @@ -139,22 +148,28 @@ public void onClick(DialogInterface dialog, int which) {
}).create().show();
}
else {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(getContext());
alertDialog.setMessage(getString(R.string.initiate_a_call));
alertDialog.setPositiveButton(getString(R.string.audio_call), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
initiateCall(var, com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_AUDIO);
if (audioCallEnabled || videoCallEnabled) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(getContext());
alertDialog.setMessage(getString(R.string.initiate_a_call));
if (audioCallEnabled) {
alertDialog.setPositiveButton(getString(R.string.audio_call), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
initiateCall(var, CometChatConstants.CALL_TYPE_AUDIO);
}
});
}
});
alertDialog.setNegativeButton(getString(R.string.video_call), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
initiateCall(var, com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_VIDEO);
if (videoCallEnabled) {
alertDialog.setNegativeButton(getString(R.string.video_call), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
initiateCall(var, CometChatConstants.CALL_TYPE_VIDEO);
}
});
}
});
alertDialog.create();
alertDialog.show();
alertDialog.create();
alertDialog.show();
}
}

}
Expand All @@ -164,7 +179,7 @@ private void initiateCall(Call var,String callType) {
@Override
public void onSuccess(Call call) {
Log.e("onSuccess: ", call.toString());
if (call.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) {
if (call.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) {
User user;
if (((User) call.getCallInitiator()).getUid().equals(CometChat.getLoggedInUser().getUid())) {
user = ((User) call.getCallReceiver());
Expand Down Expand Up @@ -192,7 +207,7 @@ private void getCallList() {
if (messagesRequest == null)
{
messagesRequest = new MessagesRequest.MessagesRequestBuilder().
setCategories(Arrays.asList(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL)).setLimit(30).build();
setCategories(Arrays.asList(CometChatConstants.CATEGORY_CALL)).setLimit(30).build();
}

messagesRequest.fetchPrevious(new CometChat.CallbackListener<List<BaseMessage>>() {
Expand Down Expand Up @@ -229,4 +244,19 @@ public void setMenuVisibility(boolean menuVisible) {
public void onResume() {
super.onResume();
}

private void fetchSettings() {
FeatureRestriction.isOneOnOneVideoCallEnabled(new FeatureRestriction.OnSuccessListener() {
@Override
public void onSuccess(Boolean booleanVal) {
videoCallEnabled = booleanVal;
}
});
FeatureRestriction.isOneOnOneAudioCallEnabled(new FeatureRestriction.OnSuccessListener() {
@Override
public void onSuccess(Boolean booleanVal) {
audioCallEnabled = booleanVal;
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.cometchat.pro.core.MessagesRequest;
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.facebook.shimmer.ShimmerFrameLayout;
import com.google.android.material.tabs.TabLayout;

Expand All @@ -28,7 +29,7 @@

import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener;

import com.cometchat.pro.uikit.ui_settings.UISettings;
import com.cometchat.pro.uikit.ui_settings.FeatureRestriction;

import com.cometchat.pro.uikit.ui_resources.utils.Utils;

Expand Down Expand Up @@ -68,6 +69,10 @@ public class CometChatCallList extends Fragment {

private ImageView phoneAddIv;

private boolean oneOnoneCallEnabled;

private boolean oneOnoneVideoCallEnabled;

public CometChatCallList() {
// Required empty public constructor
}
Expand All @@ -78,7 +83,14 @@ 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) {
Expand All @@ -94,13 +106,13 @@ public void onClick(View v) {
viewPager.setAdapter(tabAdapter);
}
tabLayout.setupWithViewPager(viewPager);
if (UISettings.getColor()!=null) {
phoneAddIv.setImageTintList(ColorStateList.valueOf(Color.parseColor(UISettings.getColor())));
if (FeatureRestriction.getColor()!=null) {
phoneAddIv.setImageTintList(ColorStateList.valueOf(Color.parseColor(FeatureRestriction.getColor())));
Drawable wrappedDrawable = DrawableCompat.wrap(getResources().
getDrawable(R.drawable.tab_layout_background_active));
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(UISettings.getColor()));
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(FeatureRestriction.getColor()));
tabLayout.getTabAt(tabLayout.getSelectedTabPosition()).view.setBackground(wrappedDrawable);
tabLayout.setSelectedTabIndicatorColor(Color.parseColor(UISettings.getColor()));
tabLayout.setSelectedTabIndicatorColor(Color.parseColor(FeatureRestriction.getColor()));
} else {
tabLayout.getTabAt(tabLayout.getSelectedTabPosition()).
view.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
Expand All @@ -109,10 +121,10 @@ public void onClick(View v) {
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
if (UISettings.getColor()!=null) {
if (FeatureRestriction.getColor()!=null) {
Drawable wrappedDrawable = DrawableCompat.wrap(getResources().
getDrawable(R.drawable.tab_layout_background_active));
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(UISettings.getColor()));
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(FeatureRestriction.getColor()));
tab.view.setBackground(wrappedDrawable);
}
else
Expand All @@ -133,6 +145,21 @@ public void onTabReselected(TabLayout.Tab tab) {
return view;
}

private void fetchSettings() {
FeatureRestriction.isOneOnOneAudioCallEnabled(new FeatureRestriction.OnSuccessListener() {
@Override
public void onSuccess(Boolean booleanVal) {
oneOnoneCallEnabled = booleanVal;
}
});
FeatureRestriction.isOneOnOneVideoCallEnabled(new FeatureRestriction.OnSuccessListener() {
@Override
public void onSuccess(Boolean booleanVal) {
oneOnoneVideoCallEnabled = booleanVal;
}
});
}

private void checkDarkMode() {
if(Utils.isDarkMode(getContext())) {
tvTitle.setTextColor(getResources().getColor(R.color.textColorWhite));
Expand Down
Loading

0 comments on commit 9bac4b7

Please sign in to comment.