diff --git a/app/build.gradle b/app/build.gradle index c2aee263..4aa6bab3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,6 +58,7 @@ dependencies { implementation 'com.google.android.material:material:1.2.0-alpha05' implementation 'com.facebook.shimmer:shimmer:0.4.0' + // implementation 'com.cometchat:pro-android-chat-sdk:2.1.7-beta3' } diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/AvatarFragment.java b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/AvatarFragment.java index b641df63..fd3db74a 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/AvatarFragment.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/AvatarFragment.java @@ -6,7 +6,6 @@ import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -15,16 +14,13 @@ import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.cometchat.pro.androiduikit.ColorPickerDialog; import com.cometchat.pro.androiduikit.R; import com.cometchat.pro.core.CometChat; -import com.cometchat.pro.uikit.Avatar; +import com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar.CometChatAvatar; import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputLayout; -import java.util.Random; - -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; public class AvatarFragment extends Fragment { @@ -46,7 +42,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_avatar, container, false); - Avatar avatar = view.findViewById(R.id.avataricon); + CometChatAvatar avatar = view.findViewById(R.id.avataricon); avatar.setBorderColor(getResources().getColor(R.color.colorPrimaryDark)); avatar.setAvatar(CometChat.getLoggedInUser().getAvatar()); TextInputEditText borderWidth = view.findViewById(R.id.borderWidth); @@ -148,7 +144,7 @@ public void onAttach(@NonNull Context context) { super.onAttach(context); this.context = context; } - public void refreshAvatar(Avatar avatar) + public void refreshAvatar(CometChatAvatar avatar) { avatar.setAvatar(CometChat.getLoggedInUser()); } diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/BadgeCountFragment.java b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/BadgeCountFragment.java index 1f1bd80e..f23987f7 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/BadgeCountFragment.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/BadgeCountFragment.java @@ -7,18 +7,15 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.RadioGroup; -import android.widget.Toast; import androidx.fragment.app.Fragment; import com.cometchat.pro.androiduikit.R; -import com.cometchat.pro.uikit.BadgeCount; -import com.cometchat.pro.uikit.StatusIndicator; +import com.cometchat.pro.uikit.ui_components.shared.cometchatBadgeCount.CometChatBadgeCount; import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputLayout; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; public class BadgeCountFragment extends Fragment { @@ -35,7 +32,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_badge_count, container, false); - BadgeCount badgeCount = view.findViewById(R.id.badgeCount); + CometChatBadgeCount badgeCount = view.findViewById(R.id.badgeCount); badgeCountLayout = view.findViewById(R.id.badgeCount_layout); badgeCountSizeLayout = view.findViewById(R.id.badgeCountSize_layout); badgeCountEdt = view.findViewById(R.id.badgeCount_edt); @@ -192,7 +189,7 @@ private void checkDarkMode() { } } - private void refreshbadgeCount(BadgeCount badgeCount) { + private void refreshbadgeCount(CometChatBadgeCount badgeCount) { badgeCount.setCount(count); } } diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/CallListViewFragment.java b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/CallListViewFragment.java index 3825874d..7e74941c 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/CallListViewFragment.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/CallListViewFragment.java @@ -15,7 +15,6 @@ import androidx.recyclerview.widget.RecyclerView; import com.cometchat.pro.androiduikit.R; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.Call; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.MessagesRequest; @@ -23,24 +22,22 @@ import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.Group; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.CometChatCallList; +import com.cometchat.pro.uikit.ui_components.shared.cometchatCalls.CometChatCalls; import com.facebook.shimmer.ShimmerFrameLayout; import com.google.android.material.snackbar.Snackbar; import java.util.Collections; import java.util.List; -import constant.StringContract; -import listeners.OnItemClickListener; -import screen.CometChatGroupDetailScreenActivity; -import screen.CometChatUserDetailScreenActivity; -import screen.messagelist.CometChatMessageListActivity; -import utils.CallUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_components.groups.group_details.CometChatGroupDetailActivity; +import com.cometchat.pro.uikit.ui_components.users.user_details.CometChatUserDetailScreenActivity; +import com.cometchat.pro.uikit.ui_resources.utils.CallUtils; public class CallListViewFragment extends Fragment { - private CometChatCallList rvCallList; + private CometChatCalls rvCallList; private LinearLayout noCallView; @@ -61,7 +58,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c rvCallList.setItemClickListener(new OnItemClickListener() { @Override public void OnItemClick(Call var, int position) { - if (var.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (var.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { User user; if (var.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) { user = ((User)var.getCallReceiver()); @@ -71,27 +68,27 @@ public void OnItemClick(Call var, int position) { user = var.getSender(); } Intent intent = new Intent(getContext(), CometChatUserDetailScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.UID, user.getUid()); - intent.putExtra(StringContract.IntentStrings.NAME, user.getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR, user.getAvatar()); - intent.putExtra(StringContract.IntentStrings.STATUS, user.getStatus()); - intent.putExtra(StringContract.IntentStrings.IS_BLOCKED_BY_ME, user.isBlockedByMe()); - intent.putExtra(StringContract.IntentStrings.FROM_CALL_LIST,true); + intent.putExtra(UIKitConstants.IntentStrings.UID, user.getUid()); + 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.IS_BLOCKED_BY_ME, user.isBlockedByMe()); + intent.putExtra(UIKitConstants.IntentStrings.FROM_CALL_LIST,true); startActivity(intent); } else { Group group; group = ((Group)var.getCallReceiver()); - Intent intent = new Intent(getContext(), CometChatGroupDetailScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID, group.getGuid()); - intent.putExtra(StringContract.IntentStrings.NAME, group.getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR, group.getIcon()); - intent.putExtra(StringContract.IntentStrings.MEMBER_SCOPE, group.getScope()); - intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,group.getMembersCount()); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER, group.getOwner()); - intent.putExtra(StringContract.IntentStrings.GROUP_DESC,group.getDescription()); - intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,group.getPassword()); - intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,group.getGroupType()); + Intent intent = new Intent(getContext(), CometChatGroupDetailActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.GUID, group.getGuid()); + intent.putExtra(UIKitConstants.IntentStrings.NAME, group.getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, group.getIcon()); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE, group.getScope()); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,group.getMembersCount()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER, group.getOwner()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_DESC,group.getDescription()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD,group.getPassword()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_TYPE,group.getGroupType()); startActivity(intent); } } @@ -103,16 +100,16 @@ public void OnItemClick(Call var, int position) { @Override public void onSuccess(Call call) { Log.e( "onSuccess: ",call.toString()); - if (var.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (var.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { User user; if (var.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) { user = ((User) var.getCallReceiver()); } else { user = var.getSender(); } - CallUtils.startCallIntent(getContext(), user, CometChatConstants.CALL_TYPE_AUDIO, true, call.getSessionId()); + CallUtils.startCallIntent(getContext(), user, com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_AUDIO, true, call.getSessionId()); } else - CallUtils.startGroupCallIntent(getContext(),((Group)call.getCallReceiver()),CometChatConstants.CALL_TYPE_AUDIO,true,call.getSessionId()); + CallUtils.startGroupCallIntent(getContext(),((Group)call.getCallReceiver()), com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_AUDIO,true,call.getSessionId()); } @Override @@ -141,7 +138,7 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat private void getCallList() { if (messagesRequest == null) { - messagesRequest = new MessagesRequest.MessagesRequestBuilder().setCategory(CometChatConstants.CATEGORY_CALL).setLimit(30).build(); + messagesRequest = new MessagesRequest.MessagesRequestBuilder().setCategory(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL).setLimit(30).build(); } messagesRequest.fetchPrevious(new CometChat.CallbackListener>() { diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/ConversationListViewFragment.java b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/ConversationListViewFragment.java index 4ae9adaf..6ee76caa 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/ConversationListViewFragment.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/ConversationListViewFragment.java @@ -13,7 +13,6 @@ import com.cometchat.pro.androiduikit.R; import com.cometchat.pro.androiduikit.databinding.FragmentConversationListBinding; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.ConversationsRequest; import com.cometchat.pro.exceptions.CometChatException; @@ -23,9 +22,9 @@ import java.util.List; -import constant.StringContract; -import listeners.OnItemClickListener; -import screen.messagelist.CometChatMessageListActivity; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_components.messages.message_list.CometChatMessageListActivity; public class ConversationListViewFragment extends Fragment { @@ -49,24 +48,24 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, @Override public void OnItemClick(Conversation conversation, int position) { Intent intent = new Intent(getContext(), CometChatMessageListActivity.class); - intent.putExtra(StringContract.IntentStrings.TYPE,conversation.getConversationType()); - if (conversation.getConversationType().equals(CometChatConstants.CONVERSATION_TYPE_GROUP)) + intent.putExtra(UIKitConstants.IntentStrings.TYPE,conversation.getConversationType()); + if (conversation.getConversationType().equals(com.cometchat.pro.constants.CometChatConstants.CONVERSATION_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.NAME,((Group)conversation.getConversationWith()).getName()); - intent.putExtra(StringContract.IntentStrings.GUID,((Group)conversation.getConversationWith()).getGuid()); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER,((Group)conversation.getConversationWith()).getOwner()); - intent.putExtra(StringContract.IntentStrings.AVATAR,((Group)conversation.getConversationWith()).getIcon()); - intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,((Group)conversation.getConversationWith()).getGroupType()); - intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,((Group)conversation.getConversationWith()).getMembersCount()); - intent.putExtra(StringContract.IntentStrings.GROUP_DESC,((Group)conversation.getConversationWith()).getDescription()); - intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,((Group)conversation.getConversationWith()).getPassword()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,((Group)conversation.getConversationWith()).getName()); + intent.putExtra(UIKitConstants.IntentStrings.GUID,((Group)conversation.getConversationWith()).getGuid()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER,((Group)conversation.getConversationWith()).getOwner()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,((Group)conversation.getConversationWith()).getIcon()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_TYPE,((Group)conversation.getConversationWith()).getGroupType()); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,((Group)conversation.getConversationWith()).getMembersCount()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_DESC,((Group)conversation.getConversationWith()).getDescription()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD,((Group)conversation.getConversationWith()).getPassword()); } else { - intent.putExtra(StringContract.IntentStrings.NAME,((User)conversation.getConversationWith()).getName()); - intent.putExtra(StringContract.IntentStrings.UID,((User)conversation.getConversationWith()).getUid()); - intent.putExtra(StringContract.IntentStrings.AVATAR,((User)conversation.getConversationWith()).getAvatar()); - intent.putExtra(StringContract.IntentStrings.STATUS,((User)conversation.getConversationWith()).getStatus()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,((User)conversation.getConversationWith()).getName()); + intent.putExtra(UIKitConstants.IntentStrings.UID,((User)conversation.getConversationWith()).getUid()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,((User)conversation.getConversationWith()).getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.STATUS,((User)conversation.getConversationWith()).getStatus()); } startActivity(intent); } diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/GroupListViewFragment.java b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/GroupListViewFragment.java index 7037487e..895ed0aa 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/GroupListViewFragment.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/GroupListViewFragment.java @@ -14,7 +14,6 @@ import com.cometchat.pro.androiduikit.R; import com.cometchat.pro.androiduikit.databinding.FragmentGroupListBinding; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.GroupsRequest; import com.cometchat.pro.exceptions.CometChatException; @@ -22,9 +21,9 @@ import java.util.List; -import constant.StringContract; -import listeners.OnItemClickListener; -import screen.messagelist.CometChatMessageListActivity; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_components.messages.message_list.CometChatMessageListActivity; public class GroupListViewFragment extends Fragment { @@ -41,15 +40,15 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, @Override public void OnItemClick(Group group, int position) { Intent intent = new Intent(getContext(), CometChatMessageListActivity.class); - intent.putExtra(StringContract.IntentStrings.NAME,group.getName()); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER,group.getOwner()); - intent.putExtra(StringContract.IntentStrings.GUID,group.getGuid()); - intent.putExtra(StringContract.IntentStrings.AVATAR,group.getIcon()); - intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,group.getGroupType()); - intent.putExtra(StringContract.IntentStrings.TYPE,CometChatConstants.RECEIVER_TYPE_GROUP); - intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,group.getMembersCount()); - intent.putExtra(StringContract.IntentStrings.GROUP_DESC,group.getDescription()); - intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,group.getPassword()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,group.getName()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER,group.getOwner()); + intent.putExtra(UIKitConstants.IntentStrings.GUID,group.getGuid()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,group.getIcon()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_TYPE,group.getGroupType()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,group.getMembersCount()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_DESC,group.getDescription()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD,group.getPassword()); startActivity(intent); } diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/StatusIndicatorFragment.java b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/StatusIndicatorFragment.java index d7fca535..67e8d6b5 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/StatusIndicatorFragment.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/StatusIndicatorFragment.java @@ -1,7 +1,5 @@ package com.cometchat.pro.androiduikit.ComponentFragments; -import android.content.Context; -import android.net.Uri; import android.os.Bundle; import androidx.fragment.app.Fragment; @@ -12,7 +10,7 @@ import android.widget.RadioGroup; import com.cometchat.pro.androiduikit.R; -import com.cometchat.pro.uikit.StatusIndicator; +import com.cometchat.pro.uikit.ui_components.shared.cometchatUserPresence.CometChatUserPresence; public class StatusIndicatorFragment extends Fragment { @@ -26,7 +24,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_status_indicator, container, false); - StatusIndicator statusIndicator = view.findViewById(R.id.statusIndicator); + CometChatUserPresence statusIndicator = view.findViewById(R.id.statusIndicator); RadioGroup statusChangeGroup = view.findViewById(R.id.statusChange); statusIndicator.setUserStatus("online"); statusChangeGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/UserListViewFragment.java b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/UserListViewFragment.java index 5580ac1d..9bdcaa4c 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/UserListViewFragment.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentFragments/UserListViewFragment.java @@ -12,18 +12,17 @@ import com.cometchat.pro.androiduikit.R; import com.cometchat.pro.androiduikit.databinding.FragmentUserListBinding; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.UsersRequest; import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.User; +import com.cometchat.pro.uikit.ui_components.messages.message_list.CometChatMessageListActivity; import com.facebook.shimmer.ShimmerFrameLayout; import java.util.List; -import constant.StringContract; -import listeners.OnItemClickListener; -import screen.messagelist.CometChatMessageListActivity; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; public class UserListViewFragment extends Fragment { @@ -48,11 +47,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, @Override public void OnItemClick(User user, int position) { Intent intent = new Intent(getContext(), CometChatMessageListActivity.class); - intent.putExtra(StringContract.IntentStrings.TYPE, CometChatConstants.RECEIVER_TYPE_USER); - intent.putExtra(StringContract.IntentStrings.NAME,user.getName()); - intent.putExtra(StringContract.IntentStrings.UID,user.getUid()); - intent.putExtra(StringContract.IntentStrings.AVATAR,user.getAvatar()); - intent.putExtra(StringContract.IntentStrings.STATUS,user.getStatus()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); + intent.putExtra(UIKitConstants.IntentStrings.NAME,user.getName()); + intent.putExtra(UIKitConstants.IntentStrings.UID,user.getUid()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,user.getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.STATUS,user.getStatus()); startActivity(intent); } diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentLoadActivity.java b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentLoadActivity.java index 2e3e4963..877dbc5e 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/ComponentLoadActivity.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/ComponentLoadActivity.java @@ -20,23 +20,22 @@ import com.cometchat.pro.androiduikit.ComponentFragments.GroupListViewFragment; import com.cometchat.pro.androiduikit.ComponentFragments.StatusIndicatorFragment; import com.cometchat.pro.androiduikit.ComponentFragments.UserListViewFragment; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.Conversation; import com.cometchat.pro.models.Group; import com.cometchat.pro.models.User; -import constant.StringContract; -import listeners.CustomAlertDialogHelper; -import listeners.OnAlertDialogButtonClickListener; -import listeners.OnItemClickListener; -import screen.CometChatConversationListScreen; -import screen.call.CometChatCallListScreen; -import screen.messagelist.CometChatMessageListActivity; -import screen.CometChatGroupListScreen; -import screen.CometChatUserInfoScreen; -import screen.CometChatUserListScreen; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.custom_alertDialog.CustomAlertDialogHelper; +import com.cometchat.pro.uikit.ui_resources.utils.custom_alertDialog.OnAlertDialogButtonClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_components.chats.CometChatConversationList; +import com.cometchat.pro.uikit.ui_components.calls.call_list.CometChatCallList; +import com.cometchat.pro.uikit.ui_components.groups.group_list.CometChatGroupList; +import com.cometchat.pro.uikit.ui_components.messages.message_list.CometChatMessageListActivity; +import com.cometchat.pro.uikit.ui_components.userprofile.CometChatUserProfile; +import com.cometchat.pro.uikit.ui_components.users.user_list.CometChatUserList; public class ComponentLoadActivity extends AppCompatActivity implements OnAlertDialogButtonClickListener { @@ -50,16 +49,16 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_load_fragment); int id = getIntent().getIntExtra("screen", 0); if (id == R.id.users) { - loadFragment(new CometChatUserListScreen()); + loadFragment(new CometChatUserList()); } else if (id == R.id.calls) { - loadFragment(new CometChatCallListScreen()); + loadFragment(new CometChatCallList()); }else if (id == R.id.groups) { - loadFragment(new CometChatGroupListScreen()); + loadFragment(new CometChatGroupList()); } else if (id == R.id.conversations) { - loadFragment(new CometChatConversationListScreen()); + loadFragment(new CometChatConversationList()); } else if (id == R.id.moreinfo) { - loadFragment(new CometChatUserInfoScreen()); + loadFragment(new CometChatUserProfile()); } else if (id== R.id.cometchat_avatar) { loadFragment(new AvatarFragment()); } else if (id== R.id.cometchat_status_indicator) { @@ -75,7 +74,7 @@ protected void onCreate(Bundle savedInstanceState) { } else if (id == R.id.cometchat_callList) { loadFragment(new CallListViewFragment()); } - CometChatUserListScreen.setItemClickListener(new OnItemClickListener() { + CometChatUserList.setItemClickListener(new OnItemClickListener() { @Override public void OnItemClick(User var, int position) { userIntent((User)var); @@ -83,19 +82,19 @@ public void OnItemClick(User var, int position) { }); - CometChatGroupListScreen.setItemClickListener(new OnItemClickListener() { + CometChatGroupList.setItemClickListener(new OnItemClickListener() { @Override public void OnItemClick(Group var, int position) { if (group.isJoined()) { startGroupIntent(group); } else { - if (group.getGroupType().equals(CometChatConstants.GROUP_TYPE_PASSWORD)) { + if (group.getGroupType().equals(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PASSWORD)) { View dialogview = getLayoutInflater().inflate(R.layout.cc_dialog, null); TextView tvTitle = dialogview.findViewById(R.id.textViewDialogueTitle); tvTitle.setText(""); new CustomAlertDialogHelper(ComponentLoadActivity.this, "Password", dialogview, "Join", "", "Cancel", ComponentLoadActivity.this, 1, false); - } else if (group.getGroupType().equals(CometChatConstants.GROUP_TYPE_PUBLIC)) { + } else if (group.getGroupType().equals(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PUBLIC)) { joinGroup(group); } } @@ -103,10 +102,10 @@ public void OnItemClick(Group var, int position) { }); - CometChatConversationListScreen.setItemClickListener(new OnItemClickListener() { + CometChatConversationList.setItemClickListener(new OnItemClickListener() { @Override public void OnItemClick(Conversation conversation, int position) { - if (conversation.getConversationType().equals(CometChatConstants.CONVERSATION_TYPE_GROUP)) { + if (conversation.getConversationType().equals(com.cometchat.pro.constants.CometChatConstants.CONVERSATION_TYPE_GROUP)) { startGroupIntent(((Group) conversation.getConversationWith())); } else { User user = ((User) conversation.getConversationWith()); @@ -129,26 +128,26 @@ private void loadFragment(Fragment fragment) { public void userIntent(User user) { Intent intent = new Intent(ComponentLoadActivity.this, CometChatMessageListActivity.class); - intent.putExtra(StringContract.IntentStrings.UID, user.getUid()); - intent.putExtra(StringContract.IntentStrings.AVATAR, user.getAvatar()); - intent.putExtra(StringContract.IntentStrings.STATUS, user.getStatus()); - intent.putExtra(StringContract.IntentStrings.NAME, user.getName()); - intent.putExtra(StringContract.IntentStrings.TYPE, CometChatConstants.RECEIVER_TYPE_USER); + intent.putExtra(UIKitConstants.IntentStrings.UID, user.getUid()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, user.getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.STATUS, user.getStatus()); + intent.putExtra(UIKitConstants.IntentStrings.NAME, user.getName()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); startActivity(intent); } private void startGroupIntent(Group group) { Intent intent = new Intent(ComponentLoadActivity.this, CometChatMessageListActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID, group.getGuid()); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER,group.getOwner()); - intent.putExtra(StringContract.IntentStrings.AVATAR, group.getIcon()); - intent.putExtra(StringContract.IntentStrings.NAME, group.getName()); - intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,group.getGroupType()); - intent.putExtra(StringContract.IntentStrings.TYPE, CometChatConstants.RECEIVER_TYPE_GROUP); - intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,group.getMembersCount()); - intent.putExtra(StringContract.IntentStrings.GROUP_DESC,group.getDescription()); - intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,group.getPassword()); + intent.putExtra(UIKitConstants.IntentStrings.GUID, group.getGuid()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER,group.getOwner()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, group.getIcon()); + intent.putExtra(UIKitConstants.IntentStrings.NAME, group.getName()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_TYPE,group.getGroupType()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,group.getMembersCount()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_DESC,group.getDescription()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD,group.getPassword()); startActivity(intent); } diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/CreateUserActivity.java b/app/src/main/java/com/cometchat/pro/androiduikit/CreateUserActivity.java index d1748cee..f5df9ab9 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/CreateUserActivity.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/CreateUserActivity.java @@ -19,7 +19,7 @@ import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputLayout; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; public class CreateUserActivity extends AppCompatActivity { diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/LoginActivity.java b/app/src/main/java/com/cometchat/pro/androiduikit/LoginActivity.java index 6c8b4db7..b4d68ea1 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/LoginActivity.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/LoginActivity.java @@ -19,7 +19,7 @@ import com.cometchat.pro.androiduikit.constants.AppConfig; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; public class LoginActivity extends AppCompatActivity { diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/MainActivity.java b/app/src/main/java/com/cometchat/pro/androiduikit/MainActivity.java index d88231b2..bd615c31 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/MainActivity.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/MainActivity.java @@ -15,7 +15,7 @@ import com.google.android.material.button.MaterialButton; import com.google.android.material.card.MaterialCardView; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; public class MainActivity extends AppCompatActivity { diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/SelectActivity.java b/app/src/main/java/com/cometchat/pro/androiduikit/SelectActivity.java index f3290ee8..9c0810ce 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/SelectActivity.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/SelectActivity.java @@ -5,7 +5,6 @@ import androidx.cardview.widget.CardView; import android.app.Dialog; -import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; @@ -19,13 +18,12 @@ import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; -import com.cometchat.pro.uikit.Settings.UIKitSettings; +import com.cometchat.pro.uikit.ui_components.cometchat_ui.CometChatUI; import com.google.android.material.button.MaterialButton; import com.google.android.material.snackbar.Snackbar; -import listeners.CometChatCallListener; -import screen.unified.CometChatUnified; -import utils.Utils;; +import com.cometchat.pro.uikit.ui_components.calls.call_manager.listener.CometChatCallListener; +import com.cometchat.pro.uikit.ui_resources.utils.Utils;; public class SelectActivity extends AppCompatActivity { @@ -68,7 +66,7 @@ public void onClick(View v) { unifiedLaunch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - startActivity(new Intent(SelectActivity.this, CometChatUnified.class)); + startActivity(new Intent(SelectActivity.this, CometChatUI.class)); overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up ); } }); diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/UIKitApplication.java b/app/src/main/java/com/cometchat/pro/androiduikit/UIKitApplication.java index abfaf31a..3a91a526 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/UIKitApplication.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/UIKitApplication.java @@ -12,9 +12,9 @@ import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.androiduikit.constants.AppConfig; -import com.cometchat.pro.uikit.Settings.UIKitSettings; +import com.cometchat.pro.uikit.ui_settings.UIKitSettings; -import listeners.CometChatCallListener; +import com.cometchat.pro.uikit.ui_components.calls.call_manager.listener.CometChatCallListener; public class UIKitApplication extends Application { diff --git a/app/src/main/java/com/cometchat/pro/androiduikit/constants/AppConfig.java b/app/src/main/java/com/cometchat/pro/androiduikit/constants/AppConfig.java index 10440012..018edfe0 100644 --- a/app/src/main/java/com/cometchat/pro/androiduikit/constants/AppConfig.java +++ b/app/src/main/java/com/cometchat/pro/androiduikit/constants/AppConfig.java @@ -6,7 +6,7 @@ public class AppDetails { public static final String APP_ID = "XXXXXXXXXXXXXXXXX"; - public static final String AUTH_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; + public static final String AUTH_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXX"; public static final String REGION = "XX"; } diff --git a/app/src/main/res/layout/activity_create_user.xml b/app/src/main/res/layout/activity_create_user.xml index cb82aaa1..b083f2ff 100644 --- a/app/src/main/res/layout/activity_create_user.xml +++ b/app/src/main/res/layout/activity_create_user.xml @@ -6,7 +6,7 @@ android:layout_height="match_parent" android:orientation="vertical" android:fillViewport="true" - tools:context="screen.CometChatGroupListScreen" + tools:context="com.cometchat.pro.uikit.ui_components.groups.group_list.CometChatGroupList" tools:ignore="MissingDefaultResource"> + tools:context="com.cometchat.pro.uikit.ui_components.groups.group_list.CometChatGroupList"> diff --git a/app/src/main/res/layout/contact_placeholder.xml b/app/src/main/res/layout/contact_placeholder.xml index 8d87a85a..2ec5b75b 100755 --- a/app/src/main/res/layout/contact_placeholder.xml +++ b/app/src/main/res/layout/contact_placeholder.xml @@ -9,7 +9,7 @@ android:paddingTop="10dp" android:paddingBottom="10dp"> - - - - - - - - - + - - - + android:name=".ui_components.messages.extensions.Reactions.CometChatReactionInfoActivity"/> + + + - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - = 21) { - fab.getDrawable().setTint(getResources().getColor(R.color.green_600)); - fab.getBackground().setTint(Color.WHITE); - } - animating = true; - animateElement(0); - break; - case MotionEvent.ACTION_MOVE: - float diff = motionEvent.getRawY() - lastY; - - float diffThreshold; - float percentageToThreshold; - int backgroundColor; - int foregroundColor; - - if (diff < 0) { - diffThreshold = Utils.dpToPx(getContext(), ANSWER_THRESHOLD); - percentageToThreshold = Math.min(1, (diff * -1) / diffThreshold); - backgroundColor = (int) new ArgbEvaluator().evaluate(percentageToThreshold, - getResources().getColor(R.color.green_100), getResources().getColor(R.color.green_600)); - - if (percentageToThreshold > 0.5) { - foregroundColor = Color.WHITE; - } else { - foregroundColor = getResources().getColor(R.color.green_600); - } - - fab.setTranslationY(diff); - - if (percentageToThreshold == 1 && listener != null) { - fab.setVisibility(View.INVISIBLE); - lastY = motionEvent.getRawY(); - if (!complete) { - complete = true; - MediaUtils.vibrate(getContext()); - listener.onAnswered(); - - } - } - } else { - diffThreshold = Utils.dpToPx(getContext(), DECLINE_THRESHOLD); - percentageToThreshold = Math.min(1, diff / diffThreshold); - backgroundColor = (int) new ArgbEvaluator().evaluate(percentageToThreshold, - getResources().getColor(R.color.red_100), getResources().getColor(R.color.red_600)); - - if (percentageToThreshold > 0.5) { - foregroundColor = Color.WHITE; - } else { - foregroundColor = getResources().getColor(R.color.green_600); - } - if (!isVideo) { - fab.setRotation(135 * percentageToThreshold); - } - - if (percentageToThreshold == 1 && listener != null) { - fab.setVisibility(View.INVISIBLE); - lastY = motionEvent.getRawY(); - - if (!complete) { - complete = true; - MediaUtils.vibrate(getContext()); - listener.onDeclined(); - - } - } - } - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - fab.getBackground().setTint(backgroundColor); - fab.getDrawable().setTint(foregroundColor); - } - - break; - } - - return true; - } - - public void setAnswerDeclineListener(AnswerDeclineListener listener,boolean isVideo) { - this.listener = listener; - this.isVideo=isVideo; - if (isVideo) - { - fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_videocam_green_24dp)); - - } - else { - fab.setBackground(getResources().getDrawable(R.drawable.ic_call_green24dp)); - } - - } - - private void intiComponentView() { - setOrientation(LinearLayout.VERTICAL); - setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, - ViewGroup.LayoutParams.WRAP_CONTENT)); - View view = View.inflate(getContext(), R.layout.cometchat_call_screen_button, this); - - this.ivGreenArrowOne = view.findViewById(R.id.green_arrow_one); - this.ivGreenArrowTwo = view.findViewById(R.id.green_arrow_two); - this.ivGreenArrowThree = view.findViewById(R.id.green_arrow_three); - this.ivRedArrowOne = view.findViewById(R.id.red_arrow_one); - this.ivRedArrowTwo = view.findViewById(R.id.red_arrow_two); - this.ivRedArrowThree = view.findViewById(R.id.red_arrow_three); - this.fab = view.findViewById(R.id.fab); - - this.fab.setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.colorPrimary))); - this.fab.setOnTouchListener(this); - - } - - public void startAnimation() { - if (!animating) { - animating = true; - animateElement(0); - } - } - - public void stopAnimation() { - if (animating) { - animating = false; - resetAnimation(); - } - } - - private void animateElement(int delay) { - - ObjectAnimator fabUp = getUpAnimation(fab); - ObjectAnimator fabDown = getDownAnimation(fab); - ObjectAnimator fabShake = getShakeAnimation(fab); - - animatorSet = new AnimatorSet(); - animatorSet.play(fabShake).after(fabUp); - animatorSet.play(fabDown).after(fabShake); - - - animatorSet.play(getShimmer(ivGreenArrowOne, ivGreenArrowTwo,ivGreenArrowThree, - ivRedArrowOne, ivRedArrowTwo,ivRedArrowThree)); - - animatorSet.addListener(new Animator.AnimatorListener() { - @Override - public void onAnimationStart(Animator animation) { - } - - @Override - public void onAnimationEnd(Animator animation) { - if (animating) animateElement(1000); - } - - @Override - public void onAnimationCancel(Animator animation) { - } - - @Override - public void onAnimationRepeat(Animator animation) { - } - }); - - animatorSet.setStartDelay(delay); - animatorSet.start(); - } - - private Animator getShimmer(View... views) { - - AnimatorSet animatorSet = new AnimatorSet(); - int evenDuration = SHIMMER_TOTAL / views.length; - int interval = 75; - - for (int i = 0; i < views.length; i++) { - animatorSet.play(getShimmer(views[i], evenDuration + (evenDuration - interval))) - .after(interval * i); - } - return animatorSet; - } - - private ObjectAnimator getShakeAnimation(View target) { - ObjectAnimator animator = ObjectAnimator.ofFloat(target, "translationX", 0, 15, -15, 15, -15, 10, -10, 5, -5, 0); - animator.setDuration(SHAKE_TIME); - - return animator; - } - - private ObjectAnimator getUpAnimation(View target) { - ObjectAnimator animator = ObjectAnimator.ofFloat(target, "translationY", 0, -1 * Utils.dpToPx(getContext(), 16)); - animator.setInterpolator(new AccelerateInterpolator()); - animator.setDuration(UP_TIME); - - return animator; - } - - private ObjectAnimator getShimmer(View target, int duration) { - ObjectAnimator shimmer = ObjectAnimator.ofFloat(target, "alpha", 0, 0.5f, 1,0,1,0.5f); - shimmer.setDuration(duration); - - return shimmer; - } - - private ObjectAnimator getDownAnimation(View target) { - ObjectAnimator animator = ObjectAnimator.ofFloat(target, "translationY", 0); - animator.setInterpolator(new DecelerateInterpolator()); - animator.setDuration(DOWN_TIME); - - return animator; - } - - private void resetAnimation() { - - animating = false; - complete = false; - - if (animatorSet != null) animatorSet.cancel(); - fab.setTranslationY(0); - } - - public interface AnswerDeclineListener { - void onAnswered(); - - void onDeclined(); - } -} \ No newline at end of file diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/OnEmojiClickListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/OnEmojiClickListener.java deleted file mode 100644 index 7b6bbf4b..00000000 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/OnEmojiClickListener.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.cometchat.pro.uikit.Reaction; - -import com.cometchat.pro.uikit.Reaction.model.Reaction; - -public interface OnEmojiClickListener { - void onEmojiClicked(Reaction emojicon); -} diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Sticker/listener/StickerClickListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/Sticker/listener/StickerClickListener.java deleted file mode 100644 index 93157ff1..00000000 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Sticker/listener/StickerClickListener.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.cometchat.pro.uikit.Sticker.listener; - -import com.cometchat.pro.uikit.Sticker.model.Sticker; - -public interface StickerClickListener { - void onClickListener(Sticker sticker); -} diff --git a/uikit/src/main/java/screen/call/AllCall.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/AllCall.java similarity index 76% rename from uikit/src/main/java/screen/call/AllCall.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/AllCall.java index 20052975..ebc6169d 100644 --- a/uikit/src/main/java/screen/call/AllCall.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/AllCall.java @@ -1,4 +1,4 @@ -package screen.call; +package com.cometchat.pro.uikit.ui_components.calls.call_list; import android.app.AlertDialog; import android.content.DialogInterface; @@ -16,7 +16,6 @@ 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; @@ -24,24 +23,19 @@ import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.Group; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.CometChatCallList; +import com.cometchat.pro.uikit.ui_components.shared.cometchatCalls.CometChatCalls; import com.cometchat.pro.uikit.R; import com.google.android.material.snackbar.Snackbar; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import constant.StringContract; -import listeners.OnItemClickListener; -import screen.CometChatCallActivity; -import screen.CometChatGroupDetailScreenActivity; -import screen.CometChatUserDetailScreenActivity; -import utils.CallUtils; -import utils.Utils; - -import static constant.StringContract.Tab.Group; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_components.groups.group_details.CometChatGroupDetailActivity; +import com.cometchat.pro.uikit.ui_components.users.user_details.CometChatUserDetailScreenActivity; +import com.cometchat.pro.uikit.ui_resources.utils.CallUtils; /** * AllCall.class is a Fragment which is used to display all the call being placed by or to the @@ -53,7 +47,7 @@ */ public class AllCall extends Fragment { - private CometChatCallList rvCallList; + private CometChatCalls rvCallList; private LinearLayout noCallView; @@ -62,7 +56,7 @@ public class AllCall extends Fragment { private LinearLayoutManager linearLayoutManager; @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_all_call, container, false); + View view = inflater.inflate(R.layout.fragment_cometchat_all_call, container, false); rvCallList = view.findViewById(R.id.callList_rv); linearLayoutManager = new LinearLayoutManager(getContext(),LinearLayoutManager.VERTICAL,false ); @@ -71,7 +65,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c rvCallList.setItemClickListener(new OnItemClickListener() { @Override public void OnItemClick(Call var, int position) { - if (var.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (var.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { User user; if (((User)var.getCallInitiator()).getUid().equals(CometChat.getLoggedInUser().getUid())) { user = ((User)var.getCallReceiver()); @@ -80,27 +74,27 @@ public void OnItemClick(Call var, int position) { user = (User)var.getCallInitiator(); } Intent intent = new Intent(getContext(), CometChatUserDetailScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.UID, user.getUid()); - intent.putExtra(StringContract.IntentStrings.NAME, user.getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR, user.getAvatar()); - intent.putExtra(StringContract.IntentStrings.STATUS, user.getStatus()); - intent.putExtra(StringContract.IntentStrings.IS_BLOCKED_BY_ME, user.isBlockedByMe()); - intent.putExtra(StringContract.IntentStrings.FROM_CALL_LIST,true); + intent.putExtra(UIKitConstants.IntentStrings.UID, user.getUid()); + 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.IS_BLOCKED_BY_ME, user.isBlockedByMe()); + intent.putExtra(UIKitConstants.IntentStrings.FROM_CALL_LIST,true); startActivity(intent); } else { Group group; group = ((Group)var.getCallReceiver()); - Intent intent = new Intent(getContext(), CometChatGroupDetailScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID, group.getGuid()); - intent.putExtra(StringContract.IntentStrings.NAME, group.getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR, group.getIcon()); - intent.putExtra(StringContract.IntentStrings.MEMBER_SCOPE, group.getScope()); - intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,group.getGroupType()); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER, group.getOwner()); - intent.putExtra(StringContract.IntentStrings.GROUP_DESC,group.getDescription()); - intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,group.getPassword()); - intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,group.getMembersCount()); + Intent intent = new Intent(getContext(), CometChatGroupDetailActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.GUID, group.getGuid()); + intent.putExtra(UIKitConstants.IntentStrings.NAME, group.getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, group.getIcon()); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE, group.getScope()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_TYPE,group.getGroupType()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER, group.getOwner()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_DESC,group.getDescription()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD,group.getPassword()); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,group.getMembersCount()); startActivity(intent); } } @@ -124,7 +118,7 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat } private void checkOnGoingCall(Call var) { - if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null) + if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null) { AlertDialog.Builder alert = new AlertDialog.Builder(getContext()); alert.setTitle(getContext().getResources().getString(R.string.ongoing_call)) @@ -147,13 +141,13 @@ public void onClick(DialogInterface dialog, int which) { alertDialog.setPositiveButton(getString(R.string.audio_call), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { - initiateCall(var,CometChatConstants.CALL_TYPE_AUDIO); + initiateCall(var, com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_AUDIO); } }); alertDialog.setNegativeButton(getString(R.string.video_call), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { - initiateCall(var,CometChatConstants.CALL_TYPE_VIDEO); + initiateCall(var, com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_VIDEO); } }); alertDialog.create(); @@ -167,7 +161,7 @@ private void initiateCall(Call var,String callType) { @Override public void onSuccess(Call call) { Log.e("onSuccess: ", call.toString()); - if (call.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (call.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { User user; if (((User) call.getCallInitiator()).getUid().equals(CometChat.getLoggedInUser().getUid())) { user = ((User) call.getCallReceiver()); @@ -194,7 +188,7 @@ private void getCallList() { if (messagesRequest == null) { messagesRequest = new MessagesRequest.MessagesRequestBuilder(). - setCategories(Arrays.asList(CometChatConstants.CATEGORY_CALL)).setLimit(30).build(); + setCategories(Arrays.asList(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL)).setLimit(30).build(); } messagesRequest.fetchPrevious(new CometChat.CallbackListener>() { diff --git a/uikit/src/main/java/screen/call/CometChatCallListScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/CometChatCallList.java similarity index 89% rename from uikit/src/main/java/screen/call/CometChatCallListScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/CometChatCallList.java index ae7a2b7b..e61fc05c 100644 --- a/uikit/src/main/java/screen/call/CometChatCallListScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/CometChatCallList.java @@ -1,4 +1,4 @@ -package screen.call; +package com.cometchat.pro.uikit.ui_components.calls.call_list; import android.content.Intent; @@ -18,19 +18,19 @@ import com.cometchat.pro.core.Call; import com.cometchat.pro.core.MessagesRequest; -import com.cometchat.pro.uikit.CometChatCallList; import com.cometchat.pro.uikit.R; +import com.cometchat.pro.uikit.ui_components.shared.cometchatCalls.CometChatCalls; import com.facebook.shimmer.ShimmerFrameLayout; import com.google.android.material.tabs.TabLayout; import java.util.ArrayList; import java.util.List; -import adapter.TabAdapter; -import listeners.OnItemClickListener; -import screen.CometChatUserCallListScreenActivity; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +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_resources.utils.Utils; /** * * Purpose - CometChatCallList class is a activity used to display list of calls recieved to user and perform certain action on click of item. @@ -42,9 +42,9 @@ * **/ -public class CometChatCallListScreen extends Fragment { +public class CometChatCallList extends Fragment { - private CometChatCallList rvCallList; + private CometChatCalls rvCallList; private MessagesRequest messageRequest; //Uses to fetch Conversations. @@ -68,7 +68,7 @@ public class CometChatCallListScreen extends Fragment { private ImageView phoneAddIv; - public CometChatCallListScreen() { + public CometChatCallList() { // Required empty public constructor } @@ -76,7 +76,7 @@ public CometChatCallListScreen() { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - view = inflater.inflate(R.layout.call_screen, container, false); + view = inflater.inflate(R.layout.fragment_cometchat_calls, container, false); tvTitle = view.findViewById(R.id.tv_title); phoneAddIv = view.findViewById(R.id.add_phone_iv); phoneAddIv.setOnClickListener(new View.OnClickListener() { @@ -147,7 +147,7 @@ private void checkDarkMode() { } private void openUserListScreen() { - Intent intent = new Intent(getContext(),CometChatUserCallListScreenActivity.class); + Intent intent = new Intent(getContext(), CometChatNewCallList.class); startActivity(intent); } diff --git a/uikit/src/main/java/screen/CometChatUserCallListScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/CometChatNewCallList.java similarity index 92% rename from uikit/src/main/java/screen/CometChatUserCallListScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/CometChatNewCallList.java index 93152ee2..2e3b98c8 100644 --- a/uikit/src/main/java/screen/CometChatUserCallListScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/CometChatNewCallList.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.calls.call_list; /* * Copyright 2019 The Android Open Source Project @@ -46,17 +46,17 @@ import com.cometchat.pro.core.UsersRequest; import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.CometChatUserList; import com.cometchat.pro.uikit.R; import com.facebook.shimmer.ShimmerFrameLayout; import com.google.android.material.snackbar.Snackbar; import java.util.List; -import listeners.OnItemClickListener; -import utils.CallUtils; -import utils.FontUtils; -import com.cometchat.pro.uikit.Settings.UISettings; +import com.cometchat.pro.uikit.ui_components.shared.cometchatUsers.CometChatUsers; +import com.cometchat.pro.uikit.ui_resources.utils.CallUtils; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_settings.UISettings; /** @@ -70,7 +70,7 @@ * */ -public class CometChatUserCallListScreenActivity extends AppCompatActivity { +public class CometChatNewCallList extends AppCompatActivity { private static final String TAG = "CometChatUserCallList"; @@ -78,7 +78,7 @@ public class CometChatUserCallListScreenActivity extends AppCompatActivity { private UsersRequest usersRequest; // Use to fetch users - private CometChatUserList rvUserList; + private CometChatUsers rvUserList; private EditText etSearch; // Use to perform search operation on list of users. @@ -90,14 +90,14 @@ public class CometChatUserCallListScreenActivity extends AppCompatActivity { private RelativeLayout rlSearchBox; - public CometChatUserCallListScreenActivity() { + public CometChatNewCallList() { // Required empty public constructor } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_user_list_screen); + setContentView(R.layout.fragment_cometchat_userlist); title = findViewById(R.id.tv_title); ImageView imageView = new ImageView(this); imageView.setImageDrawable(getResources().getDrawable(R.drawable.ic_close_24dp)); @@ -196,13 +196,12 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat } }); - // Used to trigger event on click of user item in rvUserList (RecyclerView) // Used to trigger event on click of user item in rvUserList (RecyclerView) rvUserList.setItemClickListener(new OnItemClickListener() { @Override public void OnItemClick(User var, int position) { User user = var; - AlertDialog.Builder alertDialog = new AlertDialog.Builder(CometChatUserCallListScreenActivity.this); + AlertDialog.Builder alertDialog = new AlertDialog.Builder(CometChatNewCallList.this); alertDialog.setMessage(getString(R.string.initiate_a_call)); alertDialog.setPositiveButton(getString(R.string.audio_call), new DialogInterface.OnClickListener() { @Override @@ -254,7 +253,7 @@ public void onSuccess(List users) { public void onError(CometChatException e) { Log.e(TAG, "onError: " + e.getMessage()); stopHideShimmer(); - Toast.makeText(CometChatUserCallListScreenActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show(); + Toast.makeText(CometChatNewCallList.this, e.getMessage(), Toast.LENGTH_SHORT).show(); } }); } @@ -284,6 +283,6 @@ public void onError(CometChatException e) { public void initiateCall(String receiverID, String receiverType, String callType) { - CallUtils.initiateCall(CometChatUserCallListScreenActivity.this,receiverID,receiverType,callType); + CallUtils.initiateCall(CometChatNewCallList.this,receiverID,receiverType,callType); } } diff --git a/uikit/src/main/java/screen/call/MissedCall.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/MissedCall.java similarity index 75% rename from uikit/src/main/java/screen/call/MissedCall.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/MissedCall.java index 37fbc4da..516609b1 100644 --- a/uikit/src/main/java/screen/call/MissedCall.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/MissedCall.java @@ -1,4 +1,4 @@ -package screen.call; +package com.cometchat.pro.uikit.ui_components.calls.call_list; import android.app.AlertDialog; import android.content.DialogInterface; @@ -16,7 +16,6 @@ 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; @@ -24,7 +23,7 @@ import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.Group; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.CometChatCallList; +import com.cometchat.pro.uikit.ui_components.shared.cometchatCalls.CometChatCalls; import com.cometchat.pro.uikit.R; import com.google.android.material.snackbar.Snackbar; @@ -33,13 +32,11 @@ import java.util.Collections; import java.util.List; -import constant.StringContract; -import listeners.OnItemClickListener; -import screen.CometChatCallActivity; -import screen.CometChatGroupDetailScreenActivity; -import screen.CometChatUserDetailScreenActivity; -import utils.CallUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_components.groups.group_details.CometChatGroupDetailActivity; +import com.cometchat.pro.uikit.ui_components.users.user_details.CometChatUserDetailScreenActivity; +import com.cometchat.pro.uikit.ui_resources.utils.CallUtils; /** * MissedCall.class is a Fragment class used to display all the call that has been missed by loggedIn @@ -51,7 +48,7 @@ */ public class MissedCall extends Fragment { - private CometChatCallList rvCallList; + private CometChatCalls rvCallList; private LinearLayout noCallView; @@ -63,7 +60,7 @@ public class MissedCall extends Fragment { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_missed_call, container, false); + View view = inflater.inflate(R.layout.fragment_cometchat_missed_call, container, false); rvCallList = view.findViewById(R.id.callList_rv); linearLayoutManager = new LinearLayoutManager(getContext(),LinearLayoutManager.VERTICAL,false); rvCallList.setLayoutManager(linearLayoutManager); @@ -71,7 +68,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c rvCallList.setItemClickListener(new OnItemClickListener() { @Override public void OnItemClick(Call var, int position) { - if (var.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (var.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { User user; if (((User)var.getCallInitiator()).getUid().equals(CometChat.getLoggedInUser().getUid())) { user = ((User)var.getCallReceiver()); @@ -81,27 +78,27 @@ public void OnItemClick(Call var, int position) { user = (User)var.getCallInitiator(); } Intent intent = new Intent(getContext(), CometChatUserDetailScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.UID, user.getUid()); - intent.putExtra(StringContract.IntentStrings.NAME, user.getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR, user.getAvatar()); - intent.putExtra(StringContract.IntentStrings.STATUS, user.getStatus()); - intent.putExtra(StringContract.IntentStrings.IS_BLOCKED_BY_ME, user.isBlockedByMe()); - intent.putExtra(StringContract.IntentStrings.FROM_CALL_LIST,true); + intent.putExtra(UIKitConstants.IntentStrings.UID, user.getUid()); + 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.IS_BLOCKED_BY_ME, user.isBlockedByMe()); + intent.putExtra(UIKitConstants.IntentStrings.FROM_CALL_LIST,true); startActivity(intent); } else { Group group; group = ((Group)var.getCallReceiver()); - Intent intent = new Intent(getContext(), CometChatGroupDetailScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID, group.getGuid()); - intent.putExtra(StringContract.IntentStrings.NAME, group.getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR, group.getIcon()); - intent.putExtra(StringContract.IntentStrings.MEMBER_SCOPE, group.getScope()); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER, group.getOwner()); - intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,group.getGroupType()); - intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,group.getMembersCount()); - intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,group.getPassword()); - intent.putExtra(StringContract.IntentStrings.GROUP_DESC,group.getDescription()); + Intent intent = new Intent(getContext(), CometChatGroupDetailActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.GUID, group.getGuid()); + intent.putExtra(UIKitConstants.IntentStrings.NAME, group.getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, group.getIcon()); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE, group.getScope()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER, group.getOwner()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_TYPE,group.getGroupType()); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,group.getMembersCount()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD,group.getPassword()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_DESC,group.getDescription()); startActivity(intent); } } @@ -126,7 +123,7 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat } private void checkOnGoingCall(Call var) { - if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null) { + if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null) { AlertDialog.Builder alert = new AlertDialog.Builder(getContext()); alert.setTitle(getContext().getResources().getString(R.string.ongoing_call)) .setMessage(getContext().getResources().getString(R.string.ongoing_call_message)) @@ -152,16 +149,16 @@ private void initiateCall(Call var) { @Override public void onSuccess(Call call) { Log.e("onSuccess: ", call.toString()); - if (call.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (call.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { User user; if (((User) call.getCallInitiator()).getUid().equals(CometChat.getLoggedInUser().getUid())) { user = ((User) call.getCallReceiver()); } else { user = (User) call.getCallInitiator(); } - CallUtils.startCallIntent(getContext(), user, CometChatConstants.CALL_TYPE_AUDIO, true, call.getSessionId()); + CallUtils.startCallIntent(getContext(), user, com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_AUDIO, true, call.getSessionId()); } else - CallUtils.startGroupCallIntent(getContext(), ((Group) call.getCallReceiver()), CometChatConstants.CALL_TYPE_AUDIO, true, call.getSessionId()); + CallUtils.startGroupCallIntent(getContext(), ((Group) call.getCallReceiver()), com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_AUDIO, true, call.getSessionId()); } @Override @@ -176,7 +173,7 @@ private void getCallList() { if (messagesRequest == null) { messagesRequest = new MessagesRequest.MessagesRequestBuilder() - .setCategories(Arrays.asList(CometChatConstants.CATEGORY_CALL)).build(); + .setCategories(Arrays.asList(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL)).build(); } messagesRequest.fetchPrevious(new CometChat.CallbackListener>() { @@ -205,8 +202,8 @@ private List filteredMissedCall(List baseMessages) { for (BaseMessage baseMessage : baseMessages) { Call call = (Call)baseMessage; if(!((User)call.getCallInitiator()).getUid().equals(loggedInUid)) { - if (((Call) baseMessage).getCallStatus().equals(CometChatConstants.CALL_STATUS_UNANSWERED) - || ((Call) baseMessage).getCallStatus().equals(CometChatConstants.CALL_STATUS_CANCELLED)) { + if (((Call) baseMessage).getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_UNANSWERED) + || ((Call) baseMessage).getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_CANCELLED)) { filteredList.add(baseMessage); } } diff --git a/uikit/src/main/java/adapter/TabAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/TabAdapter.java similarity index 94% rename from uikit/src/main/java/adapter/TabAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/TabAdapter.java index d6a6afd1..e78b7a70 100644 --- a/uikit/src/main/java/adapter/TabAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/TabAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.calls.call_list; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; diff --git a/uikit/src/main/java/screen/CometChatCallActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/CometChatCallActivity.java similarity index 85% rename from uikit/src/main/java/screen/CometChatCallActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/CometChatCallActivity.java index 5faf6a9b..7e5a3fcb 100644 --- a/uikit/src/main/java/screen/CometChatCallActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/CometChatCallActivity.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.calls.call_manager; import androidx.appcompat.app.AppCompatActivity; @@ -15,24 +15,23 @@ import android.widget.TextView; import android.widget.Toast; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.Call; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; -import com.cometchat.pro.uikit.Avatar; +import com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar.CometChatAvatar; import com.cometchat.pro.uikit.R; import com.google.android.material.button.MaterialButton; import com.google.android.material.card.MaterialCardView; import com.google.android.material.floatingactionbutton.FloatingActionButton; -import constant.StringContract; -import utils.AnimUtil; -import helper.CometChatAudioHelper; -import helper.OutgoingAudioHelper; -import utils.CallUtils; -import utils.CameraPreview; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.AnimUtil; +import com.cometchat.pro.uikit.ui_components.calls.call_manager.helper.CometChatAudioHelper; +import com.cometchat.pro.uikit.ui_components.calls.call_manager.helper.OutgoingAudioHelper; +import com.cometchat.pro.uikit.ui_resources.utils.CallUtils; +import com.cometchat.pro.uikit.ui_resources.utils.camera_preview.CameraPreview; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * CometChatCallActivity.class is a activity class which is used to load the incoming and outgoing @@ -57,7 +56,7 @@ public class CometChatCallActivity extends AppCompatActivity implements View.OnC private TextView callMessage; - private Avatar callerAvatar; + private CometChatAvatar callerAvatar; private MaterialButton acceptCall; @@ -73,7 +72,7 @@ public class CometChatCallActivity extends AppCompatActivity implements View.OnC private TextView tvDots; - private Avatar userAv; + private CometChatAvatar userAv; public RelativeLayout mainView; @@ -108,7 +107,7 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); callActivity = this; handleIntent(); - setContentView(R.layout.activity_comet_chat_call); + setContentView(R.layout.activity_cometchat_callmanager); handleIntent(); initView(); setValues(); @@ -120,27 +119,27 @@ protected void onCreate(Bundle savedInstanceState) { */ private void handleIntent() { Intent intent = getIntent(); - if (intent.hasExtra(StringContract.IntentStrings.JOIN_ONGOING)) + if (intent.hasExtra(UIKitConstants.IntentStrings.JOIN_ONGOING)) { - isOngoing = intent.getBooleanExtra(StringContract.IntentStrings.JOIN_ONGOING,false); + isOngoing = intent.getBooleanExtra(UIKitConstants.IntentStrings.JOIN_ONGOING,false); } - if (intent.hasExtra(StringContract.IntentStrings.ID)) { - String id = intent.getStringExtra(StringContract.IntentStrings.ID); + if (intent.hasExtra(UIKitConstants.IntentStrings.ID)) { + String id = intent.getStringExtra(UIKitConstants.IntentStrings.ID); } - if (intent.hasExtra(StringContract.IntentStrings.SESSION_ID)) { - sessionId = intent.getStringExtra(StringContract.IntentStrings.SESSION_ID); + if (intent.hasExtra(UIKitConstants.IntentStrings.SESSION_ID)) { + sessionId = intent.getStringExtra(UIKitConstants.IntentStrings.SESSION_ID); } - if (intent.hasExtra(StringContract.IntentStrings.AVATAR)) { - avatar = intent.getStringExtra(StringContract.IntentStrings.AVATAR); + if (intent.hasExtra(UIKitConstants.IntentStrings.AVATAR)) { + avatar = intent.getStringExtra(UIKitConstants.IntentStrings.AVATAR); } - if (intent.hasExtra(StringContract.IntentStrings.NAME)) { - name = intent.getStringExtra(StringContract.IntentStrings.NAME); + if (intent.hasExtra(UIKitConstants.IntentStrings.NAME)) { + name = intent.getStringExtra(UIKitConstants.IntentStrings.NAME); } if(!isOngoing) { try { - isVideo = intent.getAction().equals(CometChatConstants.CALL_TYPE_VIDEO); + isVideo = intent.getAction().equals(com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_VIDEO); - isIncoming = intent.getType().equals(StringContract.IntentStrings.INCOMING); + isIncoming = intent.getType().equals(UIKitConstants.IntentStrings.INCOMING); if (isIncoming) setTheme(R.style.TransparentCompat); @@ -265,14 +264,14 @@ public void onClick(View v) { if (id == R.id.call_hang_btn) { cometChatAudioHelper.stop(false); AnimUtil.stopBlinkAnimation(tvDots); - rejectCall(sessionId, CometChatConstants.CALL_STATUS_CANCELLED); + rejectCall(sessionId, com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_CANCELLED); } else if (id == R.id.accept_incoming) { cometChatAudioHelper.stop(false); incomingCallView.setVisibility(View.GONE); answerCall(mainView,sessionId); } else if (id == R.id.decline_incoming) { cometChatAudioHelper.stop(true); - rejectCall(sessionId,CometChatConstants.CALL_STATUS_REJECTED); + rejectCall(sessionId, com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_REJECTED); finish(); } } diff --git a/uikit/src/main/java/screen/CometChatStartCallActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/CometChatStartCallActivity.java similarity index 85% rename from uikit/src/main/java/screen/CometChatStartCallActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/CometChatStartCallActivity.java index 85ee6726..15bedfa2 100644 --- a/uikit/src/main/java/screen/CometChatStartCallActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/CometChatStartCallActivity.java @@ -1,10 +1,7 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.calls.call_manager; import androidx.appcompat.app.AppCompatActivity; -import androidx.core.app.NotificationManagerCompat; -import android.app.ActivityManager; -import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.Log; @@ -13,7 +10,6 @@ import android.widget.RelativeLayout; import android.widget.Toast; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.Call; import com.cometchat.pro.core.CallSettings; import com.cometchat.pro.core.CometChat; @@ -23,7 +19,7 @@ import com.cometchat.pro.uikit.R; import com.google.android.material.snackbar.Snackbar; -import constant.StringContract; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; /** * CometChatStartCallActivity is activity class which is used to start a call. It takes sessionID @@ -53,13 +49,13 @@ public class CometChatStartCallActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); activity = this; - setContentView(R.layout.activity_comet_chat_start_call); + setContentView(R.layout.activity_cometchat_start_call); mainView = findViewById(R.id.call_view); connectingLayout = findViewById(R.id.connecting_to_call); - sessionID = getIntent().getStringExtra(StringContract.IntentStrings.SESSION_ID); - type = getIntent().getStringExtra(StringContract.IntentStrings.TYPE); - if (type!=null && type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) + sessionID = getIntent().getStringExtra(UIKitConstants.IntentStrings.SESSION_ID); + type = getIntent().getStringExtra(UIKitConstants.IntentStrings.TYPE); + if (type!=null && type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) callSettings = new CallSettings.CallSettingsBuilder(this,mainView) .setSessionId(sessionID) .setMode(CallSettings.MODE_SINGLE) @@ -97,7 +93,7 @@ public void onCallEnded(Call call) { } @Override public void onBackPressed() { - if (type!=null && type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_GROUP)) { + if (type!=null && type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { CometChat.endCall(sessionID, new CometChat.CallbackListener() { @Override public void onSuccess(Call call) { diff --git a/uikit/src/main/java/helper/CometChatAudioHelper.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/helper/CometChatAudioHelper.java similarity index 96% rename from uikit/src/main/java/helper/CometChatAudioHelper.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/helper/CometChatAudioHelper.java index 8526acf0..42131218 100644 --- a/uikit/src/main/java/helper/CometChatAudioHelper.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/helper/CometChatAudioHelper.java @@ -1,4 +1,4 @@ -package helper; +package com.cometchat.pro.uikit.ui_components.calls.call_manager.helper; import android.content.Context; import android.media.AudioManager; @@ -8,7 +8,7 @@ import com.cometchat.pro.uikit.R; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * CometChatAudioHelper class is used to manage the audio tone and ringtone for incoming and outgoing diff --git a/uikit/src/main/java/helper/IncomingAudioHelper.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/helper/IncomingAudioHelper.java similarity index 97% rename from uikit/src/main/java/helper/IncomingAudioHelper.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/helper/IncomingAudioHelper.java index b4a22f65..c5b5c974 100644 --- a/uikit/src/main/java/helper/IncomingAudioHelper.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/helper/IncomingAudioHelper.java @@ -1,4 +1,4 @@ -package helper; +package com.cometchat.pro.uikit.ui_components.calls.call_manager.helper; import android.annotation.TargetApi; import android.content.Context; @@ -15,7 +15,7 @@ import java.io.IOException; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * IncomingAudioHelper class is used to provide audio tone or ringtone when a there is a incoming call. diff --git a/uikit/src/main/java/helper/OutgoingAudioHelper.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/helper/OutgoingAudioHelper.java similarity index 96% rename from uikit/src/main/java/helper/OutgoingAudioHelper.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/helper/OutgoingAudioHelper.java index 7ea46a23..13205d2b 100644 --- a/uikit/src/main/java/helper/OutgoingAudioHelper.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/helper/OutgoingAudioHelper.java @@ -1,4 +1,4 @@ -package helper; +package com.cometchat.pro.uikit.ui_components.calls.call_manager.helper; import android.content.Context; import android.media.AudioManager; diff --git a/uikit/src/main/java/listeners/CometChatCallListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/listener/CometChatCallListener.java similarity index 93% rename from uikit/src/main/java/listeners/CometChatCallListener.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/listener/CometChatCallListener.java index 2793a104..b03e4ed7 100644 --- a/uikit/src/main/java/listeners/CometChatCallListener.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_manager/listener/CometChatCallListener.java @@ -1,8 +1,7 @@ -package listeners; +package com.cometchat.pro.uikit.ui_components.calls.call_manager.listener; import android.content.Context; -import android.util.Log; import android.widget.Toast; import com.cometchat.pro.constants.CometChatConstants; @@ -11,13 +10,10 @@ import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.Group; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.CometChatCallList; -import helper.CometChatAudioHelper; -import screen.CometChatCallActivity; -import screen.CometChatStartCallActivity; -import utils.CallUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.calls.call_manager.CometChatCallActivity; +import com.cometchat.pro.uikit.ui_components.calls.call_manager.CometChatStartCallActivity; +import com.cometchat.pro.uikit.ui_resources.utils.CallUtils; /** * CometChatCallListener.class is used to add and remove CallListener in app. diff --git a/uikit/src/main/java/screen/CometChatConversationListScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/chats/CometChatConversationList.java similarity index 95% rename from uikit/src/main/java/screen/CometChatConversationListScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/chats/CometChatConversationList.java index 513a5d2b..f2b6f459 100644 --- a/uikit/src/main/java/screen/CometChatConversationListScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/chats/CometChatConversationList.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.chats; import android.os.Bundle; @@ -28,7 +28,7 @@ import com.cometchat.pro.models.Group; import com.cometchat.pro.models.MessageReceipt; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.CometChatConversationList; +import com.cometchat.pro.uikit.ui_components.shared.cometchatConversations.CometChatConversations; import com.cometchat.pro.uikit.R; import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.Conversation; @@ -40,9 +40,9 @@ import java.util.ArrayList; import java.util.List; -import listeners.OnItemClickListener; -import utils.FontUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /* @@ -55,9 +55,9 @@ */ -public class CometChatConversationListScreen extends Fragment implements TextWatcher { +public class CometChatConversationList extends Fragment implements TextWatcher { - private CometChatConversationList rvConversationList; //Uses to display list of conversations. + private CometChatConversations rvConversationList; //Uses to display list of conversations. private ConversationsRequest conversationsRequest; //Uses to fetch Conversations. @@ -79,7 +79,7 @@ public class CometChatConversationListScreen extends Fragment implements TextWat private List conversationList = new ArrayList<>(); - public CometChatConversationListScreen() { + public CometChatConversationList() { // Required empty public constructor } @@ -87,7 +87,7 @@ public CometChatConversationListScreen() { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - view = inflater.inflate(R.layout.fragment_conversation_screen, container, false); + view = inflater.inflate(R.layout.fragment_cometchat_conversationlist, container, false); rvConversationList = view.findViewById(R.id.rv_conversation_list); diff --git a/uikit/src/main/java/screen/unified/CometChatUnified.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/cometchat_ui/CometChatUI.java similarity index 78% rename from uikit/src/main/java/screen/unified/CometChatUnified.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/cometchat_ui/CometChatUI.java index aa44e41d..298048d2 100644 --- a/uikit/src/main/java/screen/unified/CometChatUnified.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/cometchat_ui/CometChatUI.java @@ -1,12 +1,4 @@ -package screen.unified; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatActivity; -import androidx.databinding.DataBindingUtil; -import androidx.emoji.bundled.BundledEmojiCompatConfig; -import androidx.emoji.text.EmojiCompat; -import androidx.fragment.app.Fragment; +package com.cometchat.pro.uikit.ui_components.cometchat_ui; import android.Manifest; import android.app.ProgressDialog; @@ -22,10 +14,16 @@ import android.widget.EditText; import android.widget.TextView; -import com.cometchat.pro.constants.CometChatConstants; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; +import androidx.emoji.bundled.BundledEmojiCompatConfig; +import androidx.emoji.text.EmojiCompat; +import androidx.fragment.app.Fragment; + import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; -import com.cometchat.pro.uikit.R; import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.Conversation; import com.cometchat.pro.models.CustomMessage; @@ -33,6 +31,7 @@ import com.cometchat.pro.models.MediaMessage; import com.cometchat.pro.models.TextMessage; import com.cometchat.pro.models.User; +import com.cometchat.pro.uikit.R; import com.cometchat.pro.uikit.databinding.ActivityCometchatUnifiedBinding; import com.google.android.material.badge.BadgeDrawable; import com.google.android.material.bottomnavigation.BottomNavigationView; @@ -42,19 +41,19 @@ import java.util.HashMap; import java.util.List; -import constant.StringContract; -import listeners.CometChatCallListener; -import listeners.CustomAlertDialogHelper; -import listeners.OnAlertDialogButtonClickListener; -import listeners.OnItemClickListener; -import screen.CometChatConversationListScreen; -import screen.CometChatGroupListScreen; -import screen.call.CometChatCallListScreen; -import screen.messagelist.CometChatMessageListActivity; -import screen.CometChatUserInfoScreen; -import screen.CometChatUserListScreen; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.calls.call_list.CometChatCallList; +import com.cometchat.pro.uikit.ui_components.calls.call_manager.listener.CometChatCallListener; +import com.cometchat.pro.uikit.ui_components.chats.CometChatConversationList; +import com.cometchat.pro.uikit.ui_components.groups.group_list.CometChatGroupList; +import com.cometchat.pro.uikit.ui_components.messages.message_list.CometChatMessageListActivity; +import com.cometchat.pro.uikit.ui_components.userprofile.CometChatUserProfile; +import com.cometchat.pro.uikit.ui_components.users.user_list.CometChatUserList; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.custom_alertDialog.CustomAlertDialogHelper; +import com.cometchat.pro.uikit.ui_resources.utils.custom_alertDialog.OnAlertDialogButtonClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; +import com.cometchat.pro.uikit.ui_settings.UISettings; /** * Purpose - CometChatUnified class is main class used to launch the fully working chat application. @@ -66,14 +65,14 @@ * * Modified on - 16th January 2020 */ -public class CometChatUnified extends AppCompatActivity implements +public class CometChatUI extends AppCompatActivity implements BottomNavigationView.OnNavigationItemSelectedListener,OnAlertDialogButtonClickListener { //Used to bind the layout with class private ActivityCometchatUnifiedBinding activityCometChatUnifiedBinding; //Used to identify class in Log's - private static final String TAG = CometChatUnified.class.getSimpleName(); + private static final String TAG = CometChatUI.class.getSimpleName(); //Stores the count of user whose messages are unread. private List unreadCount = new ArrayList<>(); @@ -88,7 +87,7 @@ public class CometChatUnified extends AppCompatActivity implements private Group group; - private Fragment active = new CometChatConversationListScreen(); + private Fragment active = new CometChatConversationList(); @Override protected void onCreate(Bundle savedInstanceState) { @@ -117,10 +116,10 @@ protected void onCreate(Bundle savedInstanceState) { } private void setConversationClickListener() { - CometChatConversationListScreen.setItemClickListener(new OnItemClickListener() { + CometChatConversationList.setItemClickListener(new OnItemClickListener() { @Override public void OnItemClick(Conversation conversation, int position) { - if (conversation.getConversationType().equals(CometChatConstants.CONVERSATION_TYPE_GROUP)) + if (conversation.getConversationType().equals(com.cometchat.pro.constants.CometChatConstants.CONVERSATION_TYPE_GROUP)) startGroupIntent(((Group) conversation.getConversationWith())); else startUserIntent(((User) conversation.getConversationWith())); @@ -129,20 +128,20 @@ public void OnItemClick(Conversation conversation, int position) { } private void setGroupClickListener() { - CometChatGroupListScreen.setItemClickListener(new OnItemClickListener() { + CometChatGroupList.setItemClickListener(new OnItemClickListener() { @Override public void OnItemClick(Group g, int position) { group = g; if (group.isJoined()) { startGroupIntent(group); } else { - if (group.getGroupType().equals(CometChatConstants.GROUP_TYPE_PASSWORD)) { + if (group.getGroupType().equals(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PASSWORD)) { View dialogview = getLayoutInflater().inflate(R.layout.cc_dialog, null); TextView tvTitle = dialogview.findViewById(R.id.textViewDialogueTitle); tvTitle.setText(String.format(getResources().getString(R.string.enter_password_to_join),group.getName())); - new CustomAlertDialogHelper(CometChatUnified.this, getResources().getString(R.string.password), dialogview, getResources().getString(R.string.join), - "", getResources().getString(R.string.cancel), CometChatUnified.this, 1, false); - } else if (group.getGroupType().equals(CometChatConstants.GROUP_TYPE_PUBLIC)) { + new CustomAlertDialogHelper(CometChatUI.this, getResources().getString(R.string.password), dialogview, getResources().getString(R.string.join), + "", getResources().getString(R.string.cancel), CometChatUI.this, 1, false); + } else if (group.getGroupType().equals(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PUBLIC)) { joinGroup(group); } } @@ -151,7 +150,7 @@ public void OnItemClick(Group g, int position) { } private void setUserClickListener() { - CometChatUserListScreen.setItemClickListener(new OnItemClickListener() { + CometChatUserList.setItemClickListener(new OnItemClickListener() { @Override public void OnItemClick(User user, int position) { startUserIntent(user); @@ -162,7 +161,7 @@ public void OnItemClick(User user, int position) { /** * This method initialize the BadgeDrawable which is used on conversation menu of BottomNavigationBar to display unread conversations. * It Loads CometChatConversationScreen at initial phase. - * @see CometChatConversationListScreen + * @see CometChatConversationList */ private void initViewComponent() { @@ -171,7 +170,7 @@ private void initViewComponent() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA,Manifest.permission.WRITE_EXTERNAL_STORAGE}, - StringContract.RequestCode.RECORD); + UIKitConstants.RequestCode.RECORD); } } badgeDrawable = activityCometChatUnifiedBinding.bottomNavigation.getOrCreateBadge(R.id.menu_conversation); @@ -202,15 +201,15 @@ private void initViewComponent() { badgeDrawable.setVisible(false); if (UISettings.isShowChatsBB()) - loadFragment(new CometChatConversationListScreen()); + loadFragment(new CometChatConversationList()); else if (UISettings.isShowCallsBB()) - loadFragment(new CometChatCallListScreen()); + loadFragment(new CometChatCallList()); else if (UISettings.isShowUsersBB()) - loadFragment(new CometChatUserListScreen()); + loadFragment(new CometChatUserList()); else if (UISettings.isShowGroupsBB()) - loadFragment(new CometChatGroupListScreen()); + loadFragment(new CometChatGroupList()); else if (UISettings.isShowUserSettingsBB()) - loadFragment(new CometChatUserInfoScreen()); + loadFragment(new CometChatUserProfile()); } @@ -299,7 +298,7 @@ public void onError(CometChatException e) { */ private void setUnreadCount(BaseMessage message) { - if (message.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + if (message.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (!unreadCount.contains(message.getReceiverUid())) { unreadCount.add(message.getReceiverUid()); setBadge(); @@ -356,12 +355,12 @@ public void onCustomMessageReceived(CustomMessage message) { * @see CometChatMessageListActivity */ private void startUserIntent(User user) { - Intent intent = new Intent(CometChatUnified.this, CometChatMessageListActivity.class); - intent.putExtra(StringContract.IntentStrings.UID, user.getUid()); - intent.putExtra(StringContract.IntentStrings.AVATAR, user.getAvatar()); - intent.putExtra(StringContract.IntentStrings.STATUS, user.getStatus()); - intent.putExtra(StringContract.IntentStrings.NAME, user.getName()); - intent.putExtra(StringContract.IntentStrings.TYPE, CometChatConstants.RECEIVER_TYPE_USER); + Intent intent = new Intent(CometChatUI.this, CometChatMessageListActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.UID, user.getUid()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, user.getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.STATUS, user.getStatus()); + intent.putExtra(UIKitConstants.IntentStrings.NAME, user.getName()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); startActivity(intent); } @@ -373,16 +372,16 @@ private void startUserIntent(User user) { */ private void startGroupIntent(Group group) { - Intent intent = new Intent(CometChatUnified.this, CometChatMessageListActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID, group.getGuid()); - intent.putExtra(StringContract.IntentStrings.AVATAR, group.getIcon()); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER,group.getOwner()); - intent.putExtra(StringContract.IntentStrings.NAME, group.getName()); - intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,group.getGroupType()); - intent.putExtra(StringContract.IntentStrings.TYPE, CometChatConstants.RECEIVER_TYPE_GROUP); - intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,group.getMembersCount()); - intent.putExtra(StringContract.IntentStrings.GROUP_DESC,group.getDescription()); - intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,group.getPassword()); + Intent intent = new Intent(CometChatUI.this, CometChatMessageListActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.GUID, group.getGuid()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, group.getIcon()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER,group.getOwner()); + intent.putExtra(UIKitConstants.IntentStrings.NAME, group.getName()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_TYPE,group.getGroupType()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,group.getMembersCount()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_DESC,group.getDescription()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD,group.getPassword()); startActivity(intent); } @@ -390,25 +389,25 @@ private void startGroupIntent(Group group) { * Open various screen on fragment based on item selected from BottomNavigationBar * @param item * @return true if fragment is not null. - * @see CometChatUserListScreen - * @see CometChatGroupListScreen - * @see CometChatConversationListScreen - * @see CometChatUserInfoScreen + * @see CometChatUserList + * @see CometChatGroupList + * @see CometChatConversationList + * @see CometChatUserProfile */ @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { int itemId = item.getItemId(); Fragment fragment = null; if (itemId == R.id.menu_users) { - fragment = new CometChatUserListScreen(); + fragment = new CometChatUserList(); } else if (itemId == R.id.menu_group) { - fragment = new CometChatGroupListScreen(); + fragment = new CometChatGroupList(); } else if (itemId == R.id.menu_conversation) { - fragment = new CometChatConversationListScreen(); + fragment = new CometChatConversationList(); } else if (itemId == R.id.menu_more) { - fragment = new CometChatUserInfoScreen(); + fragment = new CometChatUserProfile(); } else if (itemId == R.id.menu_call) { - fragment = new CometChatCallListScreen(); + fragment = new CometChatCallList(); } return loadFragment(fragment); diff --git a/uikit/src/main/java/screen/addmember/CometChatAddMemberScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/add_members/CometChatAddMembers.java similarity index 83% rename from uikit/src/main/java/screen/addmember/CometChatAddMemberScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/add_members/CometChatAddMembers.java index fbab18ed..e7b321c7 100644 --- a/uikit/src/main/java/screen/addmember/CometChatAddMemberScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/add_members/CometChatAddMembers.java @@ -1,4 +1,4 @@ -package screen.addmember; +package com.cometchat.pro.uikit.ui_components.groups.add_members; import android.content.Context; import android.content.Intent; @@ -25,33 +25,29 @@ import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.UsersRequest; import com.cometchat.pro.exceptions.CometChatException; -import com.cometchat.pro.models.GroupMember; import com.cometchat.pro.models.User; import com.cometchat.pro.uikit.R; import com.google.android.material.appbar.MaterialToolbar; -import com.google.android.material.chip.ChipGroup; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import adapter.UserListAdapter; -import constant.StringContract; -import listeners.ClickListener; -import listeners.RecyclerTouchListener; -import listeners.StickyHeaderDecoration; -import screen.CometChatUserDetailScreenActivity; -import utils.FontUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.shared.cometchatUsers.CometChatUsersAdapter; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; +import com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderDecoration; +import com.cometchat.pro.uikit.ui_components.users.user_details.CometChatUserDetailScreenActivity; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; -public class CometChatAddMemberScreen extends Fragment { +public class CometChatAddMembers extends Fragment { private static final String TAG = "CometChatAddMember"; - private UserListAdapter userListAdapter; + private CometChatUsersAdapter userListAdapter; private UsersRequest usersRequest; @@ -81,7 +77,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - View view = inflater.inflate(R.layout.fragment_comet_chat_add_member_screen, container, false); + View view = inflater.inflate(R.layout.fragment_cometchat_add_member, container, false); init(view); return view; @@ -164,15 +160,15 @@ public void onClick(View var1, int var2) { if (getActivity()!=null) { Intent intent = new Intent(getActivity(), CometChatUserDetailScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.UID, user.getUid()); - intent.putExtra(StringContract.IntentStrings.NAME, user.getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR, user.getAvatar()); - intent.putExtra(StringContract.IntentStrings.STATUS, user.getStatus()); - intent.putExtra(StringContract.IntentStrings.IS_BLOCKED_BY_ME, user.isBlockedByMe()); - intent.putExtra(StringContract.IntentStrings.TYPE, CometChatConstants.RECEIVER_TYPE_GROUP); - intent.putExtra(StringContract.IntentStrings.GUID, guid); - intent.putExtra(StringContract.IntentStrings.IS_ADD_MEMBER, true); - intent.putExtra(StringContract.IntentStrings.GROUP_NAME, groupName); + intent.putExtra(UIKitConstants.IntentStrings.UID, user.getUid()); + 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.IS_BLOCKED_BY_ME, user.isBlockedByMe()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); + intent.putExtra(UIKitConstants.IntentStrings.GUID, guid); + intent.putExtra(UIKitConstants.IntentStrings.IS_ADD_MEMBER, true); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_NAME, groupName); getActivity().finish(); startActivity(intent); @@ -204,9 +200,9 @@ private void setToolbar(MaterialToolbar toolbar) { private void handleArguments() { if (getArguments() != null) { - guid = getArguments().getString(StringContract.IntentStrings.GUID); - groupName = getArguments().getString(StringContract.IntentStrings.GROUP_NAME); - groupMembersUids = getArguments().getStringArrayList(StringContract.IntentStrings.GROUP_MEMBER); + guid = getArguments().getString(UIKitConstants.IntentStrings.GUID); + groupName = getArguments().getString(UIKitConstants.IntentStrings.GROUP_NAME); + groupMembersUids = getArguments().getStringArrayList(UIKitConstants.IntentStrings.GROUP_MEMBER); } } @@ -277,7 +273,7 @@ public void onError(CometChatException e) { private void setAdapter(List users) { if (userListAdapter==null){ - userListAdapter=new UserListAdapter(getContext(),Utils.userSort(users)); + userListAdapter=new CometChatUsersAdapter(getContext(),Utils.userSort(users)); StickyHeaderDecoration stickyHeaderDecoration = new StickyHeaderDecoration(userListAdapter); rvUserList.addItemDecoration(stickyHeaderDecoration, 0); rvUserList.setAdapter(userListAdapter); diff --git a/uikit/src/main/java/screen/addmember/CometChatAddMemberScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/add_members/CometChatAddMembersActivity.java similarity index 61% rename from uikit/src/main/java/screen/addmember/CometChatAddMemberScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/add_members/CometChatAddMembersActivity.java index 1487d75d..92665161 100644 --- a/uikit/src/main/java/screen/addmember/CometChatAddMemberScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/add_members/CometChatAddMembersActivity.java @@ -1,4 +1,4 @@ -package screen.addmember; +package com.cometchat.pro.uikit.ui_components.groups.add_members; import android.graphics.Color; import android.os.Bundle; @@ -11,17 +11,17 @@ import com.cometchat.pro.uikit.R; -import constant.StringContract; -import com.cometchat.pro.uikit.Settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_settings.UISettings; -public class CometChatAddMemberScreenActivity extends AppCompatActivity { +public class CometChatAddMembersActivity extends AppCompatActivity { private Fragment fragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_block_screen); + setContentView(R.layout.activity_screen); handleIntent(); if (UISettings.getColor()!=null) getWindow().setStatusBarColor(Color.parseColor(UISettings.getColor())); @@ -30,16 +30,16 @@ protected void onCreate(Bundle savedInstanceState) { private void handleIntent() { if (getIntent()!=null) { Bundle bundle = new Bundle(); - fragment=new CometChatAddMemberScreen(); - if (getIntent().hasExtra(StringContract.IntentStrings.GUID)) - bundle.putString(StringContract.IntentStrings.GUID, getIntent() - .getStringExtra(StringContract.IntentStrings.GUID)); - if (getIntent().hasExtra(StringContract.IntentStrings.GROUP_NAME)) - bundle.putString(StringContract.IntentStrings.GROUP_NAME, getIntent() - .getStringExtra(StringContract.IntentStrings.GROUP_NAME)); - if (getIntent().hasExtra(StringContract.IntentStrings.GROUP_MEMBER)) - bundle.putStringArrayList(StringContract.IntentStrings.GROUP_MEMBER,getIntent() - .getStringArrayListExtra(StringContract.IntentStrings.GROUP_MEMBER)); + fragment=new CometChatAddMembers(); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GUID)) + bundle.putString(UIKitConstants.IntentStrings.GUID, getIntent() + .getStringExtra(UIKitConstants.IntentStrings.GUID)); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GROUP_NAME)) + bundle.putString(UIKitConstants.IntentStrings.GROUP_NAME, getIntent() + .getStringExtra(UIKitConstants.IntentStrings.GROUP_NAME)); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GROUP_MEMBER)) + bundle.putStringArrayList(UIKitConstants.IntentStrings.GROUP_MEMBER,getIntent() + .getStringArrayListExtra(UIKitConstants.IntentStrings.GROUP_MEMBER)); fragment.setArguments(bundle); getSupportFragmentManager().beginTransaction().replace(R.id.frame_fragment,fragment).commit(); diff --git a/uikit/src/main/java/screen/adminAndModeratorList/CometChatAdminModeratorListScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/admin_moderator_list/CometChatAdminModeratorList.java similarity index 85% rename from uikit/src/main/java/screen/adminAndModeratorList/CometChatAdminModeratorListScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/admin_moderator_list/CometChatAdminModeratorList.java index 4f336954..d3444333 100644 --- a/uikit/src/main/java/screen/adminAndModeratorList/CometChatAdminModeratorListScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/admin_moderator_list/CometChatAdminModeratorList.java @@ -1,4 +1,4 @@ -package screen.adminAndModeratorList; +package com.cometchat.pro.uikit.ui_components.groups.admin_moderator_list; import android.content.DialogInterface; import android.content.Intent; @@ -19,7 +19,6 @@ import android.widget.TextView; import android.widget.Toast; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.GroupMembersRequest; import com.cometchat.pro.exceptions.CometChatException; @@ -36,13 +35,13 @@ import java.util.Arrays; import java.util.List; -import adapter.GroupMemberAdapter; -import constant.StringContract; -import listeners.ClickListener; -import listeners.RecyclerTouchListener; -import screen.groupmemberlist.CometChatGroupMemberListScreenActivity; -import utils.FontUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.groups.group_members.GroupMemberAdapter; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; +import com.cometchat.pro.uikit.ui_components.groups.group_members.CometChatGroupMemberListActivity; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - CometChatAdminListScreen.class is a screen used to display List of admin's of a particular @@ -53,7 +52,7 @@ * Modified on - 16th January 2020 */ -public class CometChatAdminModeratorListScreen extends Fragment { +public class CometChatAdminModeratorList extends Fragment { private RecyclerView adminList; @@ -91,10 +90,10 @@ public void onCreate(@Nullable Bundle savedInstanceState) { private void handleArguments() { if (getArguments() != null) { - guid = getArguments().getString(StringContract.IntentStrings.GUID); - loggedInUserScope = getArguments().getString(StringContract.IntentStrings.MEMBER_SCOPE); - ownerId = getArguments().getString(StringContract.IntentStrings.GROUP_OWNER); - showModerators = getArguments().getBoolean(StringContract.IntentStrings.SHOW_MODERATORLIST); + guid = getArguments().getString(UIKitConstants.IntentStrings.GUID); + loggedInUserScope = getArguments().getString(UIKitConstants.IntentStrings.MEMBER_SCOPE); + ownerId = getArguments().getString(UIKitConstants.IntentStrings.GROUP_OWNER); + showModerators = getArguments().getBoolean(UIKitConstants.IntentStrings.SHOW_MODERATORLIST); } } @@ -102,7 +101,7 @@ private void handleArguments() { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - View view = inflater.inflate(R.layout.fragment_comet_chat_admin_list_screen, container, false); + View view = inflater.inflate(R.layout.fragment_cometchat_admin_moderator_list, container, false); adminList = view.findViewById(R.id.adminList); setHasOptionsMenu(true); RelativeLayout rlAddMember = view.findViewById(R.id.rl_add_Admin); @@ -118,7 +117,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, } adapter = new GroupMemberAdapter(getContext(), members, null); adminList.setAdapter(adapter); - if (loggedInUserScope != null && loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN)) { + if (loggedInUserScope != null && loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)) { rlAddMember.setVisibility(View.VISIBLE); } if (showModerators){ @@ -128,9 +127,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, getAdminList(guid); } rlAddMember.setOnClickListener(view1 -> { - Intent intent = new Intent(getContext(), CometChatGroupMemberListScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID, guid); - intent.putExtra(StringContract.IntentStrings.SHOW_MODERATORLIST,showModerators); + Intent intent = new Intent(getContext(), CometChatGroupMemberListActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.GUID, guid); + intent.putExtra(UIKitConstants.IntentStrings.SHOW_MODERATORLIST,showModerators); startActivity(intent); }); adminList.addOnItemTouchListener(new RecyclerTouchListener(getContext(), adminList, new ClickListener() { @@ -138,7 +137,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, public void onClick(View var1, int var2) { GroupMember groupMember = (GroupMember) var1.getTag(R.string.user); if (showModerators) { - if (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) && !groupMember.getUid().equals(loggedInUser.getUid())) { + if (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) && !groupMember.getUid().equals(loggedInUser.getUid())) { if (getActivity() != null) { MaterialAlertDialogBuilder alert_dialog = new MaterialAlertDialogBuilder(getActivity()); alert_dialog.setTitle(getResources().getString(R.string.remove)); @@ -169,7 +168,7 @@ public void onClick(DialogInterface dialogInterface, int i) { } } else { - if (ownerId != null && loggedInUser.getUid().equals(ownerId) && loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) && !groupMember.getUid().equals(loggedInUser.getUid())) { + if (ownerId != null && loggedInUser.getUid().equals(ownerId) && loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) && !groupMember.getUid().equals(loggedInUser.getUid())) { if (getActivity() != null) { MaterialAlertDialogBuilder alert_dialog = new MaterialAlertDialogBuilder(getActivity()); alert_dialog.setTitle(getResources().getString(R.string.remove)); @@ -226,7 +225,7 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) { private void updateMemberScope(GroupMember groupMember, View view) { - CometChat.updateGroupMemberScope(groupMember.getUid(), guid, CometChatConstants.SCOPE_PARTICIPANT, + CometChat.updateGroupMemberScope(groupMember.getUid(), guid, com.cometchat.pro.constants.CometChatConstants.SCOPE_PARTICIPANT, new CometChat.CallbackListener() { @Override public void onSuccess(String s) { @@ -260,7 +259,7 @@ public void onError(CometChatException e) { private void getAdminList(String groupId) { if (groupMembersRequest == null) { groupMembersRequest = new GroupMembersRequest.GroupMembersRequestBuilder(groupId). - setScopes(Arrays.asList(CometChatConstants.SCOPE_ADMIN)).setLimit(100).build(); + setScopes(Arrays.asList(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)).setLimit(100).build(); } groupMembersRequest.fetchNext(new CometChat.CallbackListener>() { @Override @@ -291,7 +290,7 @@ public void onError(CometChatException e) { private void getModeratorList(String groupId) { if (groupMembersRequest == null) { groupMembersRequest = new GroupMembersRequest.GroupMembersRequestBuilder(groupId) - .setScopes(Arrays.asList(CometChatConstants.SCOPE_MODERATOR)) + .setScopes(Arrays.asList(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR)) .setLimit(100).build(); } groupMembersRequest.fetchNext(new CometChat.CallbackListener>() { @@ -300,7 +299,7 @@ public void onSuccess(List groupMembers) { ArrayList memberList = new ArrayList<>(); for (GroupMember groupMember : groupMembers) { - if (groupMember.getScope().equals(CometChatConstants.SCOPE_MODERATOR)) { + if (groupMember.getScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR)) { memberList.add(groupMember); } } @@ -351,9 +350,9 @@ public void onGroupMemberKicked(Action action, User kickedUser, User kickedBy, G @Override public void onGroupMemberScopeChanged(Action action, User updatedBy, User updatedUser, String scopeChangedTo, String scopeChangedFrom, Group group) { - if (action.getNewScope().equals(CometChatConstants.SCOPE_ADMIN)) + if (action.getNewScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)) updateGroupMember(updatedUser,false,action); - else if (action.getOldScope().equals(CometChatConstants.SCOPE_ADMIN)) + else if (action.getOldScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)) updateGroupMember(updatedUser,true,null); } }); @@ -362,7 +361,7 @@ else if (action.getOldScope().equals(CometChatConstants.SCOPE_ADMIN)) private void updateGroupMember(User user, boolean isRemove,Action action) { if (adapter != null) { if (isRemove) - adapter.removeGroupMember(Utils.UserToGroupMember(user, false, CometChatConstants.SCOPE_PARTICIPANT)); + adapter.removeGroupMember(Utils.UserToGroupMember(user, false, com.cometchat.pro.constants.CometChatConstants.SCOPE_PARTICIPANT)); else adapter.addGroupMember(Utils.UserToGroupMember(user, true, action.getNewScope())); } diff --git a/uikit/src/main/java/screen/adminAndModeratorList/CometChatAdminModeratorListScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/admin_moderator_list/CometChatAdminModeratorListActivity.java similarity index 55% rename from uikit/src/main/java/screen/adminAndModeratorList/CometChatAdminModeratorListScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/admin_moderator_list/CometChatAdminModeratorListActivity.java index b159d9f9..900cc555 100644 --- a/uikit/src/main/java/screen/adminAndModeratorList/CometChatAdminModeratorListScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/admin_moderator_list/CometChatAdminModeratorListActivity.java @@ -1,4 +1,4 @@ -package screen.adminAndModeratorList; +package com.cometchat.pro.uikit.ui_components.groups.admin_moderator_list; import android.graphics.Color; import android.os.Bundle; @@ -11,10 +11,10 @@ import com.cometchat.pro.uikit.R; -import constant.StringContract; -import com.cometchat.pro.uikit.Settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_settings.UISettings; -public class CometChatAdminModeratorListScreenActivity extends AppCompatActivity { +public class CometChatAdminModeratorListActivity extends AppCompatActivity { private String guid; @@ -27,31 +27,31 @@ public class CometChatAdminModeratorListScreenActivity extends AppCompatActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_block_screen); + setContentView(R.layout.activity_screen); handleIntent(); if (UISettings.getColor()!=null) getWindow().setStatusBarColor(Color.parseColor(UISettings.getColor())); } private void handleIntent() { - if (getIntent().hasExtra(StringContract.IntentStrings.MEMBER_SCOPE)){ - loggedInUserScope=getIntent().getStringExtra(StringContract.IntentStrings.MEMBER_SCOPE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE)){ + loggedInUserScope=getIntent().getStringExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE); } - if (getIntent().hasExtra(StringContract.IntentStrings.GUID)) { - guid = getIntent().getStringExtra(StringContract.IntentStrings.GUID); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GUID)) { + guid = getIntent().getStringExtra(UIKitConstants.IntentStrings.GUID); } - if (getIntent().hasExtra(StringContract.IntentStrings.GROUP_OWNER)) { - ownerId = getIntent().getStringExtra(StringContract.IntentStrings.GROUP_OWNER); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GROUP_OWNER)) { + ownerId = getIntent().getStringExtra(UIKitConstants.IntentStrings.GROUP_OWNER); } - if (getIntent().hasExtra(StringContract.IntentStrings.SHOW_MODERATORLIST)) { - showModerator = getIntent().getBooleanExtra(StringContract.IntentStrings.SHOW_MODERATORLIST,false); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.SHOW_MODERATORLIST)) { + showModerator = getIntent().getBooleanExtra(UIKitConstants.IntentStrings.SHOW_MODERATORLIST,false); } - Fragment fragment = new CometChatAdminModeratorListScreen(); + Fragment fragment = new CometChatAdminModeratorList(); Bundle bundle = new Bundle(); - bundle.putString(StringContract.IntentStrings.GUID,guid); - bundle.putString(StringContract.IntentStrings.GROUP_OWNER,ownerId); - bundle.putString(StringContract.IntentStrings.MEMBER_SCOPE,loggedInUserScope); - bundle.putBoolean(StringContract.IntentStrings.SHOW_MODERATORLIST,showModerator); + bundle.putString(UIKitConstants.IntentStrings.GUID,guid); + bundle.putString(UIKitConstants.IntentStrings.GROUP_OWNER,ownerId); + bundle.putString(UIKitConstants.IntentStrings.MEMBER_SCOPE,loggedInUserScope); + bundle.putBoolean(UIKitConstants.IntentStrings.SHOW_MODERATORLIST,showModerator); fragment.setArguments(bundle); getSupportFragmentManager().beginTransaction().replace(R.id.frame_fragment,fragment).commit(); diff --git a/uikit/src/main/java/screen/banmembers/CometChatBanMemberScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/banned_members/CometChatBanMembers.java similarity index 84% rename from uikit/src/main/java/screen/banmembers/CometChatBanMemberScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/banned_members/CometChatBanMembers.java index 746d333b..555f624c 100644 --- a/uikit/src/main/java/screen/banmembers/CometChatBanMemberScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/banned_members/CometChatBanMembers.java @@ -1,4 +1,4 @@ -package screen.banmembers; +package com.cometchat.pro.uikit.ui_components.groups.banned_members; import android.os.Bundle; import android.view.ContextMenu; @@ -14,7 +14,6 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.BannedGroupMembersRequest; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; @@ -24,12 +23,12 @@ import java.util.List; -import adapter.GroupMemberAdapter; -import constant.StringContract; -import listeners.ClickListener; -import listeners.RecyclerTouchListener; +import com.cometchat.pro.uikit.ui_components.groups.group_members.GroupMemberAdapter; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; -public class CometChatBanMemberScreen extends Fragment { +public class CometChatBanMembers extends Fragment { private BannedGroupMembersRequest bannedGroupMembersRequest; private String guid,gName; private TextView noMemberTv; @@ -42,7 +41,7 @@ public class CometChatBanMemberScreen extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - View view = inflater.inflate(R.layout.fragment_comet_chat_ban_member_screen, container, false); + View view = inflater.inflate(R.layout.fragment_cometchat_ban_member, container, false); bannedMemberRv = view.findViewById(R.id.bannedMembers_rv); noMemberTv = view.findViewById(R.id.no_member_tv); bannedMemberRv.setLayoutManager(new LinearLayoutManager(getContext())); @@ -55,7 +54,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, public void onClick(View var1, int var2) { GroupMember user = (GroupMember) var1.getTag(R.string.user); groupMember = user; - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN)||loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) { + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)||loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))) { registerForContextMenu(bannedMemberRv); getActivity().openContextMenu(var1); } @@ -65,9 +64,9 @@ public void onClick(View var1, int var2) { } public void handleArguments() { if (getArguments()!=null){ - guid = getArguments().getString(StringContract.IntentStrings.GUID); - gName = getArguments().getString(StringContract.IntentStrings.GROUP_NAME); - loggedInUserScope = getArguments().getString(StringContract.IntentStrings.MEMBER_SCOPE); + guid = getArguments().getString(UIKitConstants.IntentStrings.GUID); + gName = getArguments().getString(UIKitConstants.IntentStrings.GROUP_NAME); + loggedInUserScope = getArguments().getString(UIKitConstants.IntentStrings.MEMBER_SCOPE); } } public void getBannedMembers() { diff --git a/uikit/src/main/java/screen/banmembers/CometChatBanMemberScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/banned_members/CometChatBanMembersActivity.java similarity index 63% rename from uikit/src/main/java/screen/banmembers/CometChatBanMemberScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/banned_members/CometChatBanMembersActivity.java index 9d4323e1..54a1f155 100644 --- a/uikit/src/main/java/screen/banmembers/CometChatBanMemberScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/banned_members/CometChatBanMembersActivity.java @@ -1,4 +1,4 @@ -package screen.banmembers; +package com.cometchat.pro.uikit.ui_components.groups.banned_members; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; @@ -12,10 +12,10 @@ import com.cometchat.pro.uikit.R; import com.google.android.material.appbar.MaterialToolbar; -import constant.StringContract; -import com.cometchat.pro.uikit.Settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_settings.UISettings; -public class CometChatBanMemberScreenActivity extends AppCompatActivity { +public class CometChatBanMembersActivity extends AppCompatActivity { private String guid,gName; private String loggedInUserScope; @@ -23,7 +23,7 @@ public class CometChatBanMemberScreenActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_comet_chat_ban_member_screen); + setContentView(R.layout.activity_cometchat_ban_members); banToolbar = findViewById(R.id.banToolbar); banToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override @@ -34,25 +34,25 @@ public void onClick(View v) { handleIntent(); if (UISettings.getColor()!=null) getWindow().setStatusBarColor(Color.parseColor(UISettings.getColor())); - CometChatBanMemberScreen banFragment = new CometChatBanMemberScreen(); + CometChatBanMembers banFragment = new CometChatBanMembers(); Bundle bundle = new Bundle(); - bundle.putString(StringContract.IntentStrings.GUID,guid); - bundle.putString(StringContract.IntentStrings.GROUP_NAME,gName); - bundle.putString(StringContract.IntentStrings.MEMBER_SCOPE,loggedInUserScope); + bundle.putString(UIKitConstants.IntentStrings.GUID,guid); + bundle.putString(UIKitConstants.IntentStrings.GROUP_NAME,gName); + bundle.putString(UIKitConstants.IntentStrings.MEMBER_SCOPE,loggedInUserScope); banFragment.setArguments(bundle); getSupportFragmentManager().beginTransaction().add(R.id.ban_member_frame,banFragment).commit(); } public void handleIntent() { - if (getIntent().hasExtra(StringContract.IntentStrings.GUID)) { - guid = getIntent().getStringExtra(StringContract.IntentStrings.GUID); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GUID)) { + guid = getIntent().getStringExtra(UIKitConstants.IntentStrings.GUID); } - if (getIntent().hasExtra(StringContract.IntentStrings.GROUP_NAME)) { - gName = getIntent().getStringExtra(StringContract.IntentStrings.GROUP_NAME); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GROUP_NAME)) { + gName = getIntent().getStringExtra(UIKitConstants.IntentStrings.GROUP_NAME); banToolbar.setTitle(String.format(getResources().getString(R.string.ban_member_of_group),gName)); } - if (getIntent().hasExtra(StringContract.IntentStrings.MEMBER_SCOPE)) { - loggedInUserScope = getIntent().getStringExtra(StringContract.IntentStrings.MEMBER_SCOPE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE)) { + loggedInUserScope = getIntent().getStringExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE); } } diff --git a/uikit/src/main/java/screen/creategroup/CometChatCreateGroupScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/create_group/CometChatCreateGroup.java similarity index 87% rename from uikit/src/main/java/screen/creategroup/CometChatCreateGroupScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/create_group/CometChatCreateGroup.java index 2061fcc9..fef14c8a 100644 --- a/uikit/src/main/java/screen/creategroup/CometChatCreateGroupScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/create_group/CometChatCreateGroup.java @@ -1,10 +1,9 @@ -package screen.creategroup; +package com.cometchat.pro.uikit.ui_components.groups.create_group; import androidx.fragment.app.Fragment; import android.content.Intent; import android.content.res.ColorStateList; -import android.graphics.Color; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; @@ -16,7 +15,6 @@ import android.widget.Spinner; import android.widget.TextView; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.Group; @@ -27,11 +25,10 @@ import com.google.android.material.textfield.TextInputLayout; import java.security.SecureRandom; -import java.util.Random; -import constant.StringContract; -import screen.messagelist.CometChatMessageListActivity; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.messages.message_list.CometChatMessageListActivity; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - CometChatCreateGroup class is a fragment used to create a group. User just need to enter @@ -43,7 +40,7 @@ */ -public class CometChatCreateGroupScreen extends Fragment { +public class CometChatCreateGroup extends Fragment { private TextInputEditText etGroupName,etGroupDesc,etGroupPassword,etGroupCnfPassword; @@ -65,7 +62,7 @@ public class CometChatCreateGroupScreen extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - View view= inflater.inflate(R.layout.fragment_comet_chat_create_group_screen, container, false); + View view= inflater.inflate(R.layout.fragment_cometchat_create_group, container, false); etGroupName = view.findViewById(R.id.group_name); etGroupDesc = view.findViewById(R.id.group_desc); @@ -103,15 +100,15 @@ public void afterTextChanged(Editable s) { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { if (position==0) { - groupType = CometChatConstants.GROUP_TYPE_PUBLIC; + groupType = com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PUBLIC; groupPasswordLayout.setVisibility(View.GONE); groupCnfPasswordLayout.setVisibility(View.GONE); } else if (position==1) { - groupType = CometChatConstants.GROUP_TYPE_PRIVATE; + groupType = com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PRIVATE; groupPasswordLayout.setVisibility(View.GONE); groupCnfPasswordLayout.setVisibility(View.GONE); } else if (position==2) { - groupType = CometChatConstants.GROUP_TYPE_PASSWORD; + groupType = com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PASSWORD; groupPasswordLayout.setVisibility(View.VISIBLE); groupCnfPasswordLayout.setVisibility(View.VISIBLE); } @@ -207,11 +204,11 @@ public static String generateRandomString(int length) { private void createGroup() { if (!etGroupName.getText().toString().isEmpty()) { - if(groupType.equals(CometChatConstants.GROUP_TYPE_PUBLIC) || groupType.equals(CometChatConstants.GROUP_TYPE_PRIVATE)) { + if(groupType.equals(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PUBLIC) || groupType.equals(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PRIVATE)) { Group group = new Group("group" + generateRandomString(95), etGroupName.getText().toString(), groupType, ""); createGroup(group); } - else if (groupType.equals(CometChatConstants.GROUP_TYPE_PASSWORD)) { + else if (groupType.equals(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PASSWORD)) { if(etGroupPassword.getText().toString().isEmpty()) etGroupPassword.setError(getResources().getString(R.string.fill_this_field)); else if (etGroupCnfPassword.getText().toString().isEmpty()) @@ -235,15 +232,15 @@ private void createGroup(Group group) { @Override public void onSuccess(Group group) { Intent intent = new Intent(getActivity(), CometChatMessageListActivity.class); - intent.putExtra(StringContract.IntentStrings.NAME,group.getName()); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER,group.getOwner()); - intent.putExtra(StringContract.IntentStrings.GUID,group.getGuid()); - intent.putExtra(StringContract.IntentStrings.AVATAR,group.getIcon()); - intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,group.getGroupType()); - intent.putExtra(StringContract.IntentStrings.TYPE,CometChatConstants.RECEIVER_TYPE_GROUP); - intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,group.getMembersCount()); - intent.putExtra(StringContract.IntentStrings.GROUP_DESC,group.getDescription()); - intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,group.getPassword()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,group.getName()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER,group.getOwner()); + intent.putExtra(UIKitConstants.IntentStrings.GUID,group.getGuid()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,group.getIcon()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_TYPE,group.getGroupType()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,group.getMembersCount()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_DESC,group.getDescription()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD,group.getPassword()); if (getActivity()!=null) getActivity().finish(); diff --git a/uikit/src/main/java/screen/creategroup/CometChatCreateGroupScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/create_group/CometChatCreateGroupActivity.java similarity index 76% rename from uikit/src/main/java/screen/creategroup/CometChatCreateGroupScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/create_group/CometChatCreateGroupActivity.java index 9bbd6848..d7c61445 100644 --- a/uikit/src/main/java/screen/creategroup/CometChatCreateGroupScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/create_group/CometChatCreateGroupActivity.java @@ -1,4 +1,4 @@ -package screen.creategroup; +package com.cometchat.pro.uikit.ui_components.groups.create_group; import android.graphics.Color; import android.os.Bundle; @@ -11,9 +11,9 @@ import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Settings.UISettings; +import com.cometchat.pro.uikit.ui_settings.UISettings; -public class CometChatCreateGroupScreenActivity extends AppCompatActivity { +public class CometChatCreateGroupActivity extends AppCompatActivity { private Fragment fragment; @@ -23,8 +23,8 @@ public class CometChatCreateGroupScreenActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_block_screen); - Fragment fragment = new CometChatCreateGroupScreen(); + setContentView(R.layout.activity_screen); + Fragment fragment = new CometChatCreateGroup(); getSupportFragmentManager().beginTransaction().replace(R.id.frame_fragment,fragment).commit(); if (UISettings.getColor()!=null) getWindow().setStatusBarColor(Color.parseColor(UISettings.getColor())); diff --git a/uikit/src/main/java/screen/CometChatGroupDetailScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_details/CometChatGroupDetailActivity.java similarity index 83% rename from uikit/src/main/java/screen/CometChatGroupDetailScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_details/CometChatGroupDetailActivity.java index e0e03a83..bcf0171d 100644 --- a/uikit/src/main/java/screen/CometChatGroupDetailScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_details/CometChatGroupDetailActivity.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.groups.group_details; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; @@ -29,7 +29,6 @@ import android.widget.Toast; import com.bumptech.glide.Glide; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.BannedGroupMembersRequest; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.GroupMembersRequest; @@ -38,9 +37,11 @@ import com.cometchat.pro.models.Group; import com.cometchat.pro.models.GroupMember; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.Avatar; + +import com.cometchat.pro.uikit.ui_components.cometchat_ui.CometChatUI; +import com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar.CometChatAvatar; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.SharedMediaView; +import com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.CometChatSharedMedia; import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.button.MaterialButton; import com.google.android.material.dialog.MaterialAlertDialogBuilder; @@ -52,28 +53,27 @@ import java.util.Arrays; import java.util.List; -import adapter.GroupMemberAdapter; -import constant.StringContract; -import listeners.ClickListener; -import listeners.RecyclerTouchListener; -import screen.addmember.CometChatAddMemberScreenActivity; -import screen.adminAndModeratorList.CometChatAdminModeratorListScreenActivity; -import screen.banmembers.CometChatBanMemberScreenActivity; -import screen.groupmemberlist.CometChatGroupMemberListScreenActivity; -import screen.unified.CometChatUnified; -import utils.CallUtils; -import utils.FontUtils; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.groups.group_members.GroupMemberAdapter; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; +import com.cometchat.pro.uikit.ui_components.groups.add_members.CometChatAddMembersActivity; +import com.cometchat.pro.uikit.ui_components.groups.admin_moderator_list.CometChatAdminModeratorListActivity; +import com.cometchat.pro.uikit.ui_components.groups.banned_members.CometChatBanMembersActivity; +import com.cometchat.pro.uikit.ui_components.groups.group_members.CometChatGroupMemberListActivity; +import com.cometchat.pro.uikit.ui_resources.utils.CallUtils; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; -import static utils.Utils.UserToGroupMember; +import static com.cometchat.pro.uikit.ui_resources.utils.Utils.UserToGroupMember; -public class CometChatGroupDetailScreenActivity extends AppCompatActivity { +public class CometChatGroupDetailActivity extends AppCompatActivity { private String TAG = "CometChatGroupDetail"; - private Avatar groupIcon; + private CometChatAvatar groupIcon; private String groupType; @@ -135,7 +135,7 @@ public class CometChatGroupDetailScreenActivity extends AppCompatActivity { private FontUtils fontUtils; - private SharedMediaView sharedMediaView; + private CometChatSharedMedia sharedMediaView; private LinearLayout sharedMediaLayout; @@ -151,7 +151,7 @@ public class CometChatGroupDetailScreenActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_comet_chat_group_detail_screen); + setContentView(R.layout.activity_cometchat_group_detail); fontUtils= FontUtils.getInstance(this); initComponent(); @@ -231,16 +231,16 @@ public void onClick(View v) { sharedMediaLayout = findViewById(R.id.shared_media_layout); sharedMediaView = findViewById(R.id.shared_media_view); sharedMediaView.setRecieverId(guid); - sharedMediaView.setRecieverType(CometChatConstants.RECEIVER_TYPE_GROUP); + sharedMediaView.setRecieverType(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); sharedMediaView.reload(); rvMemberList.addOnItemTouchListener(new RecyclerTouchListener(this, rvMemberList, new ClickListener() { @Override public void onClick(View var1, int var2) { GroupMember user = (GroupMember) var1.getTag(R.string.user); - if (loggedInUserScope != null&&(loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN)||loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) { + if (loggedInUserScope != null&&(loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)||loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))) { groupMember = user; - boolean isAdmin =user.getScope().equals(CometChatConstants.SCOPE_ADMIN) ; + boolean isAdmin =user.getScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) ; boolean isSelf = loggedInUser.getUid().equals(user.getUid()); boolean isOwner = loggedInUser.getUid().equals(ownerId); if (!isSelf) { @@ -270,12 +270,12 @@ public void onClick(View view) { callBtn.setOnClickListener(view -> { callBtn.setClickable(false); - checkOnGoingCall(CometChatConstants.CALL_TYPE_AUDIO); + checkOnGoingCall(com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_AUDIO); }); videoCallBtn.setOnClickListener(view -> { videoCallBtn.setClickable(false); - checkOnGoingCall(CometChatConstants.CALL_TYPE_VIDEO); + checkOnGoingCall(com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_VIDEO); }); tvDelete.setOnClickListener(view -> createDialog(getResources().getString(R.string.delete_group), getResources().getString(R.string.delete_group_message), @@ -341,14 +341,14 @@ private void checkDarkMode() { } private void checkOnGoingCall(String callType) { - if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null) { + if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(getResources().getString(R.string.ongoing_call)) .setMessage(getResources().getString(R.string.ongoing_call_message)) .setPositiveButton(getResources().getString(R.string.join), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - CallUtils.joinOnGoingCall(CometChatGroupDetailScreenActivity.this,CometChat.getActiveCall()); + CallUtils.joinOnGoingCall(CometChatGroupDetailActivity.this,CometChat.getActiveCall()); } }).setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override @@ -360,7 +360,7 @@ public void onClick(DialogInterface dialog, int which) { }).create().show(); } else { - CallUtils.initiateCall(CometChatGroupDetailScreenActivity.this,guid,CometChatConstants.RECEIVER_TYPE_GROUP,callType); + CallUtils.initiateCall(CometChatGroupDetailActivity.this,guid, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP,callType); } } @@ -413,7 +413,7 @@ public boolean onContextItemSelected(@NonNull MenuItem item) { */ private void createDialog(String title, String message, String positiveText, String negativeText, int drawableRes) { - MaterialAlertDialogBuilder alert_dialog = new MaterialAlertDialogBuilder(CometChatGroupDetailScreenActivity.this, + MaterialAlertDialogBuilder alert_dialog = new MaterialAlertDialogBuilder(CometChatGroupDetailActivity.this, R.style.ThemeOverlay_MaterialComponents_MaterialAlertDialog_Centered); alert_dialog.setTitle(title); alert_dialog.setMessage(message); @@ -427,7 +427,7 @@ private void createDialog(String title, String message, String positiveText, Str } else if (positiveText.equalsIgnoreCase(getResources().getString(R.string.delete_group)) - && loggedInUserScope.equalsIgnoreCase(CometChatConstants.SCOPE_ADMIN)) + && loggedInUserScope.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)) deleteGroup(); }); @@ -450,10 +450,10 @@ private void showTansferOwnerShipDialog() { dialog.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { - Intent intent = new Intent(CometChatGroupDetailScreenActivity.this,CometChatGroupMemberListScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID,guid); - intent.putExtra(StringContract.IntentStrings.SHOW_MODERATORLIST,false); - intent.putExtra(StringContract.IntentStrings.TRANSFER_OWNERSHIP,true); + Intent intent = new Intent(CometChatGroupDetailActivity.this, CometChatGroupMemberListActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.GUID,guid); + intent.putExtra(UIKitConstants.IntentStrings.SHOW_MODERATORLIST,false); + intent.putExtra(UIKitConstants.IntentStrings.TRANSFER_OWNERSHIP,true); finish(); startActivity(intent); } @@ -472,17 +472,17 @@ public void onClick(DialogInterface dialogInterface, int i) { * This method is used to handle the intent passed to this activity. */ private void handleIntent() { - if (getIntent().hasExtra(StringContract.IntentStrings.GUID)) { - guid = getIntent().getStringExtra(StringContract.IntentStrings.GUID); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GUID)) { + guid = getIntent().getStringExtra(UIKitConstants.IntentStrings.GUID); } - if (getIntent().hasExtra(StringContract.IntentStrings.MEMBER_SCOPE)) { - loggedInUserScope = getIntent().getStringExtra(StringContract.IntentStrings.MEMBER_SCOPE); - if (loggedInUserScope != null && loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN)) { + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE)) { + loggedInUserScope = getIntent().getStringExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE); + if (loggedInUserScope != null && loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)) { rlAddMemberView.setVisibility(View.VISIBLE); rlBanMembers.setVisibility(View.VISIBLE); rlModeratorView.setVisibility(View.VISIBLE); tvDelete.setVisibility(View.VISIBLE); - } else if(loggedInUserScope!=null && loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR)) { + } else if(loggedInUserScope!=null && loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR)) { rlAddMemberView.setVisibility(View.GONE); rlBanMembers.setVisibility(View.VISIBLE); rlModeratorView.setVisibility(View.VISIBLE); @@ -497,34 +497,34 @@ private void handleIntent() { } } - if (getIntent().hasExtra(StringContract.IntentStrings.NAME)) { - gName = getIntent().getStringExtra(StringContract.IntentStrings.NAME); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.NAME)) { + gName = getIntent().getStringExtra(UIKitConstants.IntentStrings.NAME); tvGroupName.setText(gName); } - if (getIntent().hasExtra(StringContract.IntentStrings.AVATAR)) { - String avatar = getIntent().getStringExtra(StringContract.IntentStrings.AVATAR); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.AVATAR)) { + String avatar = getIntent().getStringExtra(UIKitConstants.IntentStrings.AVATAR); if (avatar != null && !avatar.isEmpty()) groupIcon.setAvatar(avatar); else groupIcon.setInitials(gName); } - if (getIntent().hasExtra(StringContract.IntentStrings.GROUP_DESC)) { - gDesc = getIntent().getStringExtra(StringContract.IntentStrings.GROUP_DESC); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GROUP_DESC)) { + gDesc = getIntent().getStringExtra(UIKitConstants.IntentStrings.GROUP_DESC); tvGroupDesc.setText(gDesc); } - if (getIntent().hasExtra(StringContract.IntentStrings.GROUP_PASSWORD)) { - gPassword = getIntent().getStringExtra(StringContract.IntentStrings.GROUP_PASSWORD); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD)) { + gPassword = getIntent().getStringExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD); } - if (getIntent().hasExtra(StringContract.IntentStrings.GROUP_OWNER)) { - ownerId = getIntent().getStringExtra(StringContract.IntentStrings.GROUP_OWNER); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GROUP_OWNER)) { + ownerId = getIntent().getStringExtra(UIKitConstants.IntentStrings.GROUP_OWNER); } - if(getIntent().hasExtra(StringContract.IntentStrings.MEMBER_COUNT)) { + if(getIntent().hasExtra(UIKitConstants.IntentStrings.MEMBER_COUNT)) { tvMemberCount.setVisibility(View.VISIBLE); - groupMemberCount = getIntent().getIntExtra(StringContract.IntentStrings.MEMBER_COUNT,0); + groupMemberCount = getIntent().getIntExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,0); tvMemberCount.setText((groupMemberCount)+" "+getString(R.string.members)); } - if (getIntent().hasExtra(StringContract.IntentStrings.GROUP_TYPE)) { - groupType = getIntent().getStringExtra(StringContract.IntentStrings.GROUP_TYPE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GROUP_TYPE)) { + groupType = getIntent().getStringExtra(UIKitConstants.IntentStrings.GROUP_TYPE); } } @@ -534,13 +534,13 @@ private void handleIntent() { * This method is used whenever user click Banned Members. It takes user to * CometChatBanMemberScreenActivity.class * - * @see CometChatBanMemberScreenActivity + * @see CometChatBanMembersActivity */ private void openBanMemberListScreen() { - Intent intent = new Intent(this, CometChatBanMemberScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID,guid); - intent.putExtra(StringContract.IntentStrings.GROUP_NAME,gName); - intent.putExtra(StringContract.IntentStrings.MEMBER_SCOPE,loggedInUserScope); + Intent intent = new Intent(this, CometChatBanMembersActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.GUID,guid); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_NAME,gName); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE,loggedInUserScope); startActivity(intent); } @@ -549,14 +549,14 @@ private void openBanMemberListScreen() { * This method is used whenever user click Administrator. It takes user to * CometChatAdminListScreenActivity.class * - * @see CometChatAdminModeratorListScreenActivity + * @see CometChatAdminModeratorListActivity */ public void openAdminListScreen(boolean showModerators) { - Intent intent = new Intent(this, CometChatAdminModeratorListScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID, guid); - intent.putExtra(StringContract.IntentStrings.SHOW_MODERATORLIST,showModerators); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER, ownerId); - intent.putExtra(StringContract.IntentStrings.MEMBER_SCOPE, loggedInUserScope); + Intent intent = new Intent(this, CometChatAdminModeratorListActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.GUID, guid); + intent.putExtra(UIKitConstants.IntentStrings.SHOW_MODERATORLIST,showModerators); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER, ownerId); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE, loggedInUserScope); startActivity(intent); } @@ -564,16 +564,16 @@ public void openAdminListScreen(boolean showModerators) { * This method is used whenever user click Add Member. It takes user to * CometChatAddMemberScreenActivity.class * - * @see CometChatAddMemberScreenActivity + * @see CometChatAddMembersActivity */ public void addMembers() { if (UISettings.isAllowAddMembers()) { - Intent intent = new Intent(this, CometChatAddMemberScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID, guid); - intent.putExtra(StringContract.IntentStrings.GROUP_MEMBER, groupMemberUids); - intent.putExtra(StringContract.IntentStrings.GROUP_NAME, gName); - intent.putExtra(StringContract.IntentStrings.MEMBER_SCOPE, loggedInUserScope); - intent.putExtra(StringContract.IntentStrings.IS_ADD_MEMBER, true); + Intent intent = new Intent(this, CometChatAddMembersActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.GUID, guid); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_MEMBER, groupMemberUids); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_NAME, gName); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE, loggedInUserScope); + intent.putExtra(UIKitConstants.IntentStrings.IS_ADD_MEMBER, true); startActivity(intent); } } @@ -599,7 +599,7 @@ public void onError(CometChatException e) { } private void launchUnified() { - Intent intent = new Intent(CometChatGroupDetailScreenActivity.this, CometChatUnified.class); + Intent intent = new Intent(CometChatGroupDetailActivity.this, CometChatUI.class); startActivity(intent); finish(); } @@ -662,11 +662,11 @@ public void onError(CometChatException e) { */ private void getGroupMembers() { List groupMemeberScopes = new ArrayList<>(); - groupMemeberScopes.add(CometChatConstants.SCOPE_ADMIN); - groupMemeberScopes.add(CometChatConstants.SCOPE_PARTICIPANT); + groupMemeberScopes.add(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN); + groupMemeberScopes.add(com.cometchat.pro.constants.CometChatConstants.SCOPE_PARTICIPANT); if (groupMembersRequest == null) { groupMembersRequest = new GroupMembersRequest.GroupMembersRequestBuilder(guid) - .setScopes(Arrays.asList(CometChatConstants.SCOPE_ADMIN, CometChatConstants.SCOPE_PARTICIPANT, CometChatConstants.SCOPE_MODERATOR)) + .setScopes(Arrays.asList(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN, com.cometchat.pro.constants.CometChatConstants.SCOPE_PARTICIPANT, com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR)) .setLimit(LIMIT).build(); } groupMembersRequest.fetchNext(new CometChat.CallbackListener>() { @@ -680,10 +680,10 @@ public void onSuccess(List groupMembers) { s = new String[groupMembers.size()]; for (int j = 0; j < groupMembers.size(); j++) { groupMemberUids.add(groupMembers.get(j).getUid()); - if (groupMembers.get(j).getScope().equals(CometChatConstants.SCOPE_ADMIN)) { + if (groupMembers.get(j).getScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)) { adminCount++; } - if (groupMembers.get(j).getScope().equals(CometChatConstants.SCOPE_MODERATOR)) { + if (groupMembers.get(j).getScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR)) { moderatorCount++; } s[j] = groupMembers.get(j).getName(); @@ -691,7 +691,7 @@ public void onSuccess(List groupMembers) { // tvAdminCount.setText(adminCount+""); // tvModeratorCount.setText(moderatorCount+""); if (groupMemberAdapter == null) { - groupMemberAdapter = new GroupMemberAdapter(CometChatGroupDetailScreenActivity.this, groupMembers, ownerId); + groupMemberAdapter = new GroupMemberAdapter(CometChatGroupDetailActivity.this, groupMembers, ownerId); rvMemberList.setAdapter(groupMemberAdapter); } else { groupMemberAdapter.addAll(groupMembers); @@ -842,7 +842,7 @@ public void onGroupMemberUnbanned(Action action, User unbannedUser, User unbanne * @see Action * @see GroupMember * @see User - * @see utils.Utils#UserToGroupMember(User, boolean, String) + * @see com.cometchat.pro.uikit.ui_resources.utils.Utils#UserToGroupMember(User, boolean, String) */ private void updateGroupMember(User user, boolean isRemoved, boolean isScopeUpdate, Action action) { if (groupMemberAdapter != null) { @@ -855,35 +855,35 @@ private void updateGroupMember(User user, boolean isRemoved, boolean isScopeUpda int count = --groupMemberCount; tvMemberCount.setText(count+" "+getString(R.string.members)); if(action.getNewScope()!=null) { - if (action.getNewScope().equals(CometChatConstants.SCOPE_ADMIN)) { + if (action.getNewScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)) { adminCount = adminCount - 1; // tvAdminCount.setText(String.valueOf(adminCount)); - } else if (action.getNewScope().equals(CometChatConstants.SCOPE_MODERATOR)) { + } else if (action.getNewScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR)) { moderatorCount = moderatorCount - 1; // tvModeratorCount.setText(String.valueOf(moderatorCount)); } } } else if (!isRemoved) { groupMemberAdapter.updateMember(UserToGroupMember(user, true, action.getNewScope())); - if (action.getNewScope().equals(CometChatConstants.SCOPE_ADMIN)) { + if (action.getNewScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)) { adminCount = adminCount + 1; // tvAdminCount.setText(String.valueOf(adminCount)); if (user.getUid().equals(loggedInUser.getUid())) { rlAddMemberView.setVisibility(View.VISIBLE); - loggedInUserScope = CometChatConstants.SCOPE_ADMIN; + loggedInUserScope = com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN; tvDelete.setVisibility(View.VISIBLE); } - } else if (action.getNewScope().equals(CometChatConstants.SCOPE_MODERATOR)) { + } else if (action.getNewScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR)) { moderatorCount = moderatorCount + 1; // tvModeratorCount.setText(String.valueOf(moderatorCount)); if (user.getUid().equals(loggedInUser.getUid())) { rlBanMembers.setVisibility(View.VISIBLE); - loggedInUserScope = CometChatConstants.SCOPE_MODERATOR; + loggedInUserScope = com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR; } - } else if (action.getOldScope().equals(CometChatConstants.SCOPE_ADMIN)) { + } else if (action.getOldScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)) { adminCount = adminCount - 1; // tvAdminCount.setText(String.valueOf(adminCount)); - } else if (action.getOldScope().equals(CometChatConstants.SCOPE_MODERATOR)) { + } else if (action.getOldScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR)) { moderatorCount = moderatorCount -1; // tvModeratorCount.setText(String.valueOf(moderatorCount)); } @@ -894,8 +894,8 @@ private void updateGroupMember(User user, boolean isRemoved, boolean isScopeUpda private void updateGroupDialog() { dialog = new AlertDialog.Builder(this); - View view = LayoutInflater.from(this).inflate(R.layout.update_group,null); - Avatar avatar = view.findViewById(R.id.group_icon); + View view = LayoutInflater.from(this).inflate(R.layout.cometchat_update_group_dialog,null); + CometChatAvatar avatar = view.findViewById(R.id.group_icon); TextInputEditText avatar_url = view.findViewById(R.id.icon_url_edt); if (groupIcon.getAvatarUrl()!=null) { avatar.setVisibility(View.VISIBLE); @@ -915,11 +915,11 @@ private void updateGroupDialog() { MaterialButton cancelBtn = view.findViewById(R.id.cancelBtn); groupName.setText(gName); groupDesc.setText(gDesc); - if (groupType!=null && groupType.equals(CometChatConstants.GROUP_TYPE_PUBLIC)) { + if (groupType!=null && groupType.equals(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PUBLIC)) { groupTypeSp.setSelection(0); groupOldPwdLayout.setVisibility(View.GONE); groupNewPwdLayout.setVisibility(View.GONE); - } else if(groupType!=null && groupType.equals(CometChatConstants.GROUP_TYPE_PRIVATE)){ + } else if(groupType!=null && groupType.equals(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PRIVATE)){ groupTypeSp.setSelection(1); groupOldPwdLayout.setVisibility(View.GONE); groupNewPwdLayout.setVisibility(View.GONE); @@ -967,7 +967,7 @@ public void afterTextChanged(Editable s) { if(!s.toString().isEmpty()) { avatar.setVisibility(View.VISIBLE); - Glide.with(CometChatGroupDetailScreenActivity.this).load(s.toString()).into(avatar); + Glide.with(CometChatGroupDetailActivity.this).load(s.toString()).into(avatar); } else avatar.setVisibility(View.GONE); } @@ -991,7 +991,7 @@ public void onClick(View v) { } else { group.setName(groupName.getText().toString()); group.setGuid(guid); - group.setGroupType(CometChatConstants.GROUP_TYPE_PASSWORD); + group.setGroupType(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PASSWORD); group.setPassword(groupNewPwd.getText().toString()); group.setIcon(avatar_url.getText().toString()); updateGroup(group, alertDialog); @@ -1000,11 +1000,11 @@ public void onClick(View v) { else if (groupTypeSp.getSelectedItemPosition()==1){ group.setName(groupName.getText().toString()); group.setGuid(guid); - group.setGroupType(CometChatConstants.GROUP_TYPE_PRIVATE); + group.setGroupType(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PRIVATE); group.setIcon(avatar_url.getText().toString()); } else { group.setName(groupName.getText().toString()); - group.setGroupType(CometChatConstants.GROUP_TYPE_PUBLIC); + group.setGroupType(com.cometchat.pro.constants.CometChatConstants.GROUP_TYPE_PUBLIC); group.setIcon(avatar_url.getText().toString()); } group.setGuid(guid); @@ -1075,7 +1075,7 @@ public void onSuccess(Group group) { @Override public void onError(CometChatException e) { - Toast.makeText(CometChatGroupDetailScreenActivity.this,"Error:"+e.getMessage(),Toast.LENGTH_LONG).show(); + Toast.makeText(CometChatGroupDetailActivity.this,"Error:"+e.getMessage(),Toast.LENGTH_LONG).show(); } }); } diff --git a/uikit/src/main/java/screen/CometChatGroupListScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_list/CometChatGroupList.java similarity index 92% rename from uikit/src/main/java/screen/CometChatGroupListScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_list/CometChatGroupList.java index 627d41de..caf6c13d 100644 --- a/uikit/src/main/java/screen/CometChatGroupListScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_list/CometChatGroupList.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.groups.group_list; import android.content.Context; import android.content.Intent; @@ -29,20 +29,19 @@ import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.GroupsRequest; import com.cometchat.pro.exceptions.CometChatException; -import com.cometchat.pro.uikit.CometChatGroupList; import com.cometchat.pro.uikit.R; import com.cometchat.pro.models.Group; +import com.cometchat.pro.uikit.ui_components.shared.cometchatGroups.CometChatGroups; import com.google.android.material.snackbar.Snackbar; import java.util.ArrayList; import java.util.List; -import adapter.GroupListAdapter; -import listeners.OnItemClickListener; -import screen.creategroup.CometChatCreateGroupScreenActivity; -import utils.FontUtils; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_components.groups.create_group.CometChatCreateGroupActivity; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /* @@ -55,13 +54,11 @@ */ -public class CometChatGroupListScreen extends Fragment { +public class CometChatGroupList extends Fragment { private static OnItemClickListener event; - private CometChatGroupList rvGroupList; //Uses to display list of groups. - - private GroupListAdapter groupListAdapter; + private CometChatGroups rvGroupList; //Uses to display list of groups. private GroupsRequest groupsRequest; //Uses to fetch Groups. @@ -77,7 +74,7 @@ public class CometChatGroupListScreen extends Fragment { private static final String TAG = "CometChatGroupListScreen"; - public CometChatGroupListScreen() { + public CometChatGroupList() { // Required empty public constructor } @@ -85,7 +82,7 @@ public CometChatGroupListScreen() { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - View view= inflater.inflate(R.layout.fragment_group_list_screen, container, false); + View view= inflater.inflate(R.layout.fragment_cometchat_grouplist, container, false); TextView title = view.findViewById(R.id.tv_title); title.setTypeface(FontUtils.getInstance(getActivity()).getTypeFace(FontUtils.robotoMedium)); rvGroupList=view.findViewById(R.id.rv_group_list); @@ -108,7 +105,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, } ivCreateGroup.setOnClickListener(view1 -> { - Intent intent = new Intent(getContext(), CometChatCreateGroupScreenActivity.class); + Intent intent = new Intent(getContext(), CometChatCreateGroupActivity.class); startActivity(intent); }); etSearch.addTextChangedListener(new TextWatcher() { @@ -291,6 +288,5 @@ public void onPause() { public void onResume() { super.onResume(); groupsRequest=null; - groupListAdapter=null; } } diff --git a/uikit/src/main/java/screen/groupmemberlist/CometChatGroupMemberListScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_members/CometChatGroupMemberList.java similarity index 79% rename from uikit/src/main/java/screen/groupmemberlist/CometChatGroupMemberListScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_members/CometChatGroupMemberList.java index 3f84eda2..d77dda93 100644 --- a/uikit/src/main/java/screen/groupmemberlist/CometChatGroupMemberListScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_members/CometChatGroupMemberList.java @@ -1,4 +1,4 @@ -package screen.groupmemberlist; +package com.cometchat.pro.uikit.ui_components.groups.group_members; import android.content.Context; import android.os.Bundle; @@ -19,7 +19,6 @@ import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.GroupMembersRequest; import com.cometchat.pro.exceptions.CometChatException; @@ -33,12 +32,11 @@ import java.util.Arrays; import java.util.List; -import adapter.GroupMemberAdapter; -import constant.StringContract; -import listeners.ClickListener; -import listeners.RecyclerTouchListener; -import utils.FontUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - CometChatGroupMemberListScreen.class is used to make another admin to other group members. @@ -50,7 +48,7 @@ * */ -public class CometChatGroupMemberListScreen extends Fragment { +public class CometChatGroupMemberList extends Fragment { private static final String TAG = "CometChatGroupMember"; private GroupMemberAdapter groupMemberListAdapter; @@ -59,7 +57,7 @@ public class CometChatGroupMemberListScreen extends Fragment { private boolean showModerators; - private RecyclerView rvUserList; + private RecyclerView rvGroupMemberList; private EditText etSearch; @@ -75,9 +73,9 @@ public class CometChatGroupMemberListScreen extends Fragment { public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments()!=null) { - guid = getArguments().getString(StringContract.IntentStrings.GUID); - showModerators = getArguments().getBoolean(StringContract.IntentStrings.SHOW_MODERATORLIST); - transferOwnerShip = getArguments().getBoolean(StringContract.IntentStrings.TRANSFER_OWNERSHIP); + guid = getArguments().getString(UIKitConstants.IntentStrings.GUID); + showModerators = getArguments().getBoolean(UIKitConstants.IntentStrings.SHOW_MODERATORLIST); + transferOwnerShip = getArguments().getBoolean(UIKitConstants.IntentStrings.TRANSFER_OWNERSHIP); } } @@ -85,9 +83,9 @@ public void onCreate(@Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - View view = inflater.inflate(R.layout.fragment_comet_chat_add_member_screen, container, false); + View view = inflater.inflate(R.layout.fragment_cometchat_add_member, container, false); - rvUserList = view.findViewById(R.id.rv_user_list); + rvGroupMemberList = view.findViewById(R.id.rv_user_list); etSearch = view.findViewById(R.id.search_bar); @@ -136,7 +134,7 @@ public void afterTextChanged(Editable editable) { } }); - rvUserList.addOnScrollListener(new RecyclerView.OnScrollListener() { + rvGroupMemberList.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { @@ -148,7 +146,7 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat }); // On click of any group member item in rvUserList, It shows dialog with positive and negative button. On click of positive button it changes scope of group member - rvUserList.addOnItemTouchListener(new RecyclerTouchListener(getContext(), rvUserList, new ClickListener() { + rvGroupMemberList.addOnItemTouchListener(new RecyclerTouchListener(getContext(), rvGroupMemberList, new ClickListener() { @Override public void onClick(View var1, int var2) { @@ -198,14 +196,14 @@ private void transferOwner(GroupMember groupMember) { CometChat.transferGroupOwnership(guid, groupMember.getUid(), new CometChat.CallbackListener() { @Override public void onSuccess(String s) { - Snackbar.make(rvUserList,String.format(getResources().getString(R.string.user_is_owner),groupMember.getName()), Snackbar.LENGTH_LONG).show(); + Snackbar.make(rvGroupMemberList,String.format(getResources().getString(R.string.user_is_owner),groupMember.getName()), Snackbar.LENGTH_LONG).show(); if (getActivity()!=null) getActivity().onBackPressed(); } @Override public void onError(CometChatException e) { - Snackbar.make(rvUserList,String.format(getResources().getString(R.string.update_scope_error)+e.getCode(),groupMember.getName()),Snackbar.LENGTH_SHORT).show(); + Snackbar.make(rvGroupMemberList,String.format(getResources().getString(R.string.update_scope_error)+e.getCode(),groupMember.getName()),Snackbar.LENGTH_SHORT).show(); } }); } @@ -222,37 +220,37 @@ private void setToolbar(MaterialToolbar toolbar) { private void updateAsAdminScope(GroupMember groupMember) { - CometChat.updateGroupMemberScope(groupMember.getUid(), guid, CometChatConstants.SCOPE_ADMIN, new CometChat.CallbackListener() { + CometChat.updateGroupMemberScope(groupMember.getUid(), guid, com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN, new CometChat.CallbackListener() { @Override public void onSuccess(String s) { Log.d(TAG, "onSuccess: "+s); groupMemberListAdapter.removeGroupMember(groupMember); - Snackbar.make(rvUserList,String.format(getResources().getString(R.string.is_now_admin),groupMember.getName()), Snackbar.LENGTH_LONG).show(); + Snackbar.make(rvGroupMemberList,String.format(getResources().getString(R.string.is_now_admin),groupMember.getName()), Snackbar.LENGTH_LONG).show(); } @Override public void onError(CometChatException e) { Log.e(TAG, "onError: "+e.getMessage() ); - Snackbar.make(rvUserList,String.format(getResources().getString(R.string.update_scope_error),groupMember.getName()),Snackbar.LENGTH_SHORT).show(); + Snackbar.make(rvGroupMemberList,String.format(getResources().getString(R.string.update_scope_error),groupMember.getName()),Snackbar.LENGTH_SHORT).show(); } }); } private void updateAsModeratorScope(GroupMember groupMember) { - CometChat.updateGroupMemberScope(groupMember.getUid(), guid, CometChatConstants.SCOPE_MODERATOR, new CometChat.CallbackListener() { + CometChat.updateGroupMemberScope(groupMember.getUid(), guid, com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR, new CometChat.CallbackListener() { @Override public void onSuccess(String s) { Log.d(TAG, "onSuccess: "+s); groupMemberListAdapter.removeGroupMember(groupMember); - if (rvUserList!=null) - Snackbar.make(rvUserList,String.format(getResources().getString(R.string.is_now_moderator),groupMember.getName()), Snackbar.LENGTH_LONG).show(); + if (rvGroupMemberList !=null) + Snackbar.make(rvGroupMemberList,String.format(getResources().getString(R.string.is_now_moderator),groupMember.getName()), Snackbar.LENGTH_LONG).show(); } @Override public void onError(CometChatException e) { Log.e(TAG, "onError: "+e.getMessage() ); - Snackbar.make(rvUserList,String.format(getResources().getString(R.string.update_scope_error),groupMember.getName()),Snackbar.LENGTH_SHORT).show(); + Snackbar.make(rvGroupMemberList,String.format(getResources().getString(R.string.update_scope_error),groupMember.getName()),Snackbar.LENGTH_SHORT).show(); } }); } @@ -266,12 +264,12 @@ private void fetchGroupMembers() { if (groupMembersRequest == null) { if (showModerators) groupMembersRequest = new GroupMembersRequest.GroupMembersRequestBuilder(guid) - .setScopes(Arrays.asList(CometChatConstants.SCOPE_PARTICIPANT)) + .setScopes(Arrays.asList(com.cometchat.pro.constants.CometChatConstants.SCOPE_PARTICIPANT)) .setLimit(10).build(); else groupMembersRequest = new GroupMembersRequest.GroupMembersRequestBuilder(guid) - .setScopes(Arrays.asList(CometChatConstants.SCOPE_PARTICIPANT, - CometChatConstants.SCOPE_MODERATOR)) + .setScopes(Arrays.asList(com.cometchat.pro.constants.CometChatConstants.SCOPE_PARTICIPANT, + com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR)) .setLimit(10).build(); } groupMembersRequest.fetchNext(new CometChat.CallbackListener>() { @@ -284,7 +282,7 @@ public void onSuccess(List users) { @Override public void onError(CometChatException e) { Log.e(TAG, "onError: " + e.getMessage()); - Snackbar.make(rvUserList, getResources().getString(R.string.group_member_list_error), Snackbar.LENGTH_LONG).show(); + Snackbar.make(rvGroupMemberList, getResources().getString(R.string.group_member_list_error), Snackbar.LENGTH_LONG).show(); // Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show(); } }); @@ -307,7 +305,7 @@ public void onSuccess(List groupMembers) { { List filterlist = new ArrayList<>(); for (GroupMember gmember : groupMembers) { - if (gmember.getScope().equals(CometChatConstants.SCOPE_PARTICIPANT)) + if (gmember.getScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_PARTICIPANT)) { filterlist.add(gmember); } @@ -331,7 +329,7 @@ public void onError(CometChatException e) { private void setAdapter(List groupMembers) { if (groupMemberListAdapter==null){ groupMemberListAdapter=new GroupMemberAdapter(getContext(),groupMembers,null); - rvUserList.setAdapter(groupMemberListAdapter); + rvGroupMemberList.setAdapter(groupMemberListAdapter); }else { groupMemberListAdapter.updateGroupMembers(groupMembers); } diff --git a/uikit/src/main/java/screen/groupmemberlist/CometChatGroupMemberListScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_members/CometChatGroupMemberListActivity.java similarity index 57% rename from uikit/src/main/java/screen/groupmemberlist/CometChatGroupMemberListScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_members/CometChatGroupMemberListActivity.java index c2cd5a1f..9d93d9a4 100644 --- a/uikit/src/main/java/screen/groupmemberlist/CometChatGroupMemberListScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_members/CometChatGroupMemberListActivity.java @@ -1,4 +1,4 @@ -package screen.groupmemberlist; +package com.cometchat.pro.uikit.ui_components.groups.group_members; import android.graphics.Color; import android.os.Bundle; @@ -11,10 +11,10 @@ import com.cometchat.pro.uikit.R; -import constant.StringContract; -import com.cometchat.pro.uikit.Settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_settings.UISettings; -public class CometChatGroupMemberListScreenActivity extends AppCompatActivity { +public class CometChatGroupMemberListActivity extends AppCompatActivity { private String guid; @@ -25,21 +25,21 @@ public class CometChatGroupMemberListScreenActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_block_screen); + setContentView(R.layout.activity_screen); - if (getIntent().hasExtra(StringContract.IntentStrings.GUID)) - guid = getIntent().getStringExtra(StringContract.IntentStrings.GUID); - if (getIntent().hasExtra(StringContract.IntentStrings.SHOW_MODERATORLIST)) - showModerators = getIntent().getBooleanExtra(StringContract.IntentStrings.SHOW_MODERATORLIST,false); - if (getIntent().hasExtra(StringContract.IntentStrings.TRANSFER_OWNERSHIP)) + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GUID)) + guid = getIntent().getStringExtra(UIKitConstants.IntentStrings.GUID); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.SHOW_MODERATORLIST)) + showModerators = getIntent().getBooleanExtra(UIKitConstants.IntentStrings.SHOW_MODERATORLIST,false); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.TRANSFER_OWNERSHIP)) transferOwnerShip = getIntent() - .getBooleanExtra(StringContract.IntentStrings.TRANSFER_OWNERSHIP,false); + .getBooleanExtra(UIKitConstants.IntentStrings.TRANSFER_OWNERSHIP,false); - Fragment fragment = new CometChatGroupMemberListScreen(); + Fragment fragment = new CometChatGroupMemberList(); Bundle bundle = new Bundle(); - bundle.putString(StringContract.IntentStrings.GUID,guid); - bundle.putBoolean(StringContract.IntentStrings.SHOW_MODERATORLIST,showModerators); - bundle.putBoolean(StringContract.IntentStrings.TRANSFER_OWNERSHIP,transferOwnerShip); + bundle.putString(UIKitConstants.IntentStrings.GUID,guid); + bundle.putBoolean(UIKitConstants.IntentStrings.SHOW_MODERATORLIST,showModerators); + bundle.putBoolean(UIKitConstants.IntentStrings.TRANSFER_OWNERSHIP,transferOwnerShip); fragment.setArguments(bundle); getSupportFragmentManager().beginTransaction().replace(R.id.frame_fragment,fragment).commit(); if (UISettings.getColor()!=null) diff --git a/uikit/src/main/java/adapter/GroupMemberAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_members/GroupMemberAdapter.java similarity index 93% rename from uikit/src/main/java/adapter/GroupMemberAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_members/GroupMemberAdapter.java index 04240d71..5fda61e9 100644 --- a/uikit/src/main/java/adapter/GroupMemberAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/groups/group_members/GroupMemberAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.groups.group_members; import android.content.Context; import android.view.LayoutInflater; @@ -12,17 +12,17 @@ import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.models.GroupMember; -import com.cometchat.pro.models.TypingIndicator; import com.cometchat.pro.models.User; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.databinding.UserListRowBinding; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; -import utils.FontUtils; -import utils.Utils; +import com.cometchat.pro.uikit.databinding.CometchatGroupMemberRowBinding; +import com.cometchat.pro.uikit.databinding.CometchatGroupMemberRowBindingImpl; +import com.cometchat.pro.uikit.databinding.CometchatUserListRowBinding; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - GroupMemberAdapter is a subclass of RecyclerView Adapter which is used to display @@ -78,7 +78,7 @@ public GroupMemberViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); - UserListRowBinding userListRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.user_list_row, parent, false); + CometchatGroupMemberRowBinding userListRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.cometchat_group_member_row, parent, false); return new GroupMemberViewHolder(userListRowBinding); } @@ -232,9 +232,9 @@ public void resetAdapter() { class GroupMemberViewHolder extends RecyclerView.ViewHolder { - UserListRowBinding userListRowBinding; + CometchatGroupMemberRowBinding userListRowBinding; - GroupMemberViewHolder(UserListRowBinding userListRowBinding) { + GroupMemberViewHolder(CometchatGroupMemberRowBinding userListRowBinding) { super(userListRowBinding.getRoot()); this.userListRowBinding = userListRowBinding; diff --git a/uikit/src/main/java/screen/CometChatWebViewActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/extensions/Collaborative/CometChatCollaborativeActivity.java similarity index 56% rename from uikit/src/main/java/screen/CometChatWebViewActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/extensions/Collaborative/CometChatCollaborativeActivity.java index e4be1190..f098932e 100644 --- a/uikit/src/main/java/screen/CometChatWebViewActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/extensions/Collaborative/CometChatCollaborativeActivity.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.messages.extensions.Collaborative; import androidx.appcompat.app.AppCompatActivity; @@ -8,9 +8,16 @@ import com.cometchat.pro.uikit.R; -import constant.StringContract; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; -public class CometChatWebViewActivity extends AppCompatActivity { +/** + * CometChatCollaborativeActivity is a Activity class which is used to load extension such as + * whiteboard and writeboard in webView. + * + * Created On - 26 November 2020 + * + */ +public class CometChatCollaborativeActivity extends AppCompatActivity { private WebView webView; private String url = null; @@ -20,8 +27,8 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cometchat_webview); webView = findViewById(R.id.webview); - if (getIntent().hasExtra(StringContract.IntentStrings.URL)) { - url = getIntent().getStringExtra(StringContract.IntentStrings.URL); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.URL)) { + url = getIntent().getStringExtra(UIKitConstants.IntentStrings.URL); } if (url!=null) { WebSettings webSettings = webView.getSettings(); diff --git a/uikit/src/main/java/listeners/ExtensionResponseListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/extensions/ExtensionResponseListener.java similarity index 77% rename from uikit/src/main/java/listeners/ExtensionResponseListener.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/extensions/ExtensionResponseListener.java index 09678be8..e5f0d227 100644 --- a/uikit/src/main/java/listeners/ExtensionResponseListener.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/extensions/ExtensionResponseListener.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_components.messages.extensions; import com.cometchat.pro.exceptions.CometChatException; diff --git a/uikit/src/main/java/utils/Extensions.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/extensions/Extensions.java similarity index 97% rename from uikit/src/main/java/utils/Extensions.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/extensions/Extensions.java index 16087b3a..b5f6adec 100644 --- a/uikit/src/main/java/utils/Extensions.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/extensions/Extensions.java @@ -1,4 +1,4 @@ -package utils; +package com.cometchat.pro.uikit.ui_components.messages.extensions; import android.content.Context; import android.content.Intent; @@ -20,12 +20,11 @@ import java.util.List; import java.util.Locale; -import constant.StringContract; -import listeners.ExtensionResponseListener; -import screen.CometChatWebViewActivity; - -import com.cometchat.pro.uikit.Reaction.model.Reaction; -import com.cometchat.pro.uikit.Sticker.model.Sticker; +import com.cometchat.pro.uikit.ui_components.messages.extensions.Collaborative.CometChatCollaborativeActivity; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.ReactionUtils; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.model.Sticker; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; public class Extensions { @@ -367,7 +366,7 @@ public static HashMap> extractStickersFromJSON(JSONObject j return stickerMap; } - public static List getInitialEmojis(int i) { + public static List getInitialReactions(int i) { List randomReaction = new ArrayList<>(); List fetchedReaction = ReactionUtils.getFeelList(); for (int k=0;k { onBackPressed(); }); - if (getIntent().hasExtra(StringContract.IntentStrings.REACTION_INFO)) { + if (getIntent().hasExtra(UIKitConstants.IntentStrings.REACTION_INFO)) { try { - jsonObject = new JSONObject(getIntent().getStringExtra(StringContract.IntentStrings.REACTION_INFO)); + jsonObject = new JSONObject(getIntent().getStringExtra(UIKitConstants.IntentStrings.REACTION_INFO)); } catch (JSONException e) { e.printStackTrace(); } diff --git a/uikit/src/main/java/screen/CometChatForwardMessageScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/forward_message/CometChatForwardMessageActivity.java similarity index 86% rename from uikit/src/main/java/screen/CometChatForwardMessageScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/forward_message/CometChatForwardMessageActivity.java index 7ee56980..649d05ad 100644 --- a/uikit/src/main/java/screen/CometChatForwardMessageScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/forward_message/CometChatForwardMessageActivity.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.messages.forward_message; import android.content.Context; import android.content.Intent; @@ -37,7 +37,6 @@ import com.cometchat.pro.models.MediaMessage; import com.cometchat.pro.models.TextMessage; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.CometChatConversationList; import com.cometchat.pro.uikit.R; import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.button.MaterialButton; @@ -52,13 +51,14 @@ import java.util.HashMap; import java.util.List; -import adapter.ConversationListAdapter; -import constant.StringContract; -import listeners.OnItemClickListener; -import screen.unified.CometChatUnified; -import utils.FontUtils; -import utils.MediaUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.cometchat_ui.CometChatUI; +import com.cometchat.pro.uikit.ui_components.shared.cometchatConversations.CometChatConversations; +import com.cometchat.pro.uikit.ui_components.shared.cometchatConversations.CometChatConversationsAdapter; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.MediaUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - CometChatForwardMessageScreenActivity class is a fragment used to display list of users to which @@ -69,14 +69,14 @@ */ -public class CometChatForwardMessageScreenActivity extends AppCompatActivity { +public class CometChatForwardMessageActivity extends AppCompatActivity { private static final String TAG = "CometChatForward"; - private CometChatConversationList rvConversationList; + private CometChatConversations rvConversationList; private HashMap userList = new HashMap<>(); - private ConversationListAdapter conversationListAdapter; + private CometChatConversationsAdapter conversationListAdapter; private ConversationsRequest conversationsRequest; @@ -108,7 +108,7 @@ public class CometChatForwardMessageScreenActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_comet_chat_forward_message_screen); + setContentView(R.layout.activity_cometchat_forward_message); fontUtils= FontUtils.getInstance(this); handleIntent(); init(); @@ -126,7 +126,7 @@ void handleSendText(Intent intent) { void handleSendImage(Intent intent) { Uri imageUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM); if (imageUri != null) { - messageType = StringContract.IntentStrings.INTENT_MEDIA_MESSAGE; + messageType = UIKitConstants.IntentStrings.INTENT_MEDIA_MESSAGE; mediaMessageUrl = imageUri.toString(); Log.e(TAG, "handleSendImage: "+mediaMessageUrl); } @@ -149,38 +149,38 @@ private void handleIntent() { } } - if (getIntent().hasExtra(StringContract.IntentStrings.TYPE)) { - messageType = getIntent().getStringExtra(StringContract.IntentStrings.TYPE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.TYPE)) { + messageType = getIntent().getStringExtra(UIKitConstants.IntentStrings.TYPE); } if (getIntent().hasExtra(CometChatConstants.MESSAGE_TYPE_TEXT)){ textMessage = getIntent().getStringExtra(CometChatConstants.MESSAGE_TYPE_TEXT); } - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL)) { - mediaMessageUrl = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL)) { + mediaMessageUrl = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL); } - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE)) { - mediaMessageSize = getIntent().getIntExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE)) { + mediaMessageSize = getIntent().getIntExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,0); } - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION)) { - mediaMessageExtension = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION)) { + mediaMessageExtension = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION); } - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME)) { - mediaMessageName = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME)) { + mediaMessageName = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME); } - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE)) { - mediaMessageMime = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE)) { + mediaMessageMime = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE); } - if (getIntent().hasExtra(StringContract.IntentStrings.ID)) { - id = getIntent().getIntExtra(StringContract.IntentStrings.ID,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.ID)) { + id = getIntent().getIntExtra(UIKitConstants.IntentStrings.ID,0); } - if (getIntent().hasExtra(StringContract.IntentStrings.LOCATION_LATITUDE)) { - lat = getIntent().getDoubleExtra(StringContract.IntentStrings.LOCATION_LATITUDE,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.LOCATION_LATITUDE)) { + lat = getIntent().getDoubleExtra(UIKitConstants.IntentStrings.LOCATION_LATITUDE,0); } - if (getIntent().hasExtra(StringContract.IntentStrings.LOCATION_LONGITUDE)) { - lon = getIntent().getDoubleExtra(StringContract.IntentStrings.LOCATION_LONGITUDE,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.LOCATION_LONGITUDE)) { + lon = getIntent().getDoubleExtra(UIKitConstants.IntentStrings.LOCATION_LONGITUDE,0); } - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_CATEGORY)) { - messageCategory = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_CATEGORY); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY)) { + messageCategory = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY); } } @@ -251,7 +251,7 @@ public void OnItemClick(Conversation conversation, int position) { if (userList!=null&&userList.size()<5){ if (!userList.containsKey(conversation.getConversationId())) { userList.put(conversation.getConversationId(), conversation); - Chip chip = new Chip(CometChatForwardMessageScreenActivity.this); + Chip chip = new Chip(CometChatForwardMessageActivity.this); if (conversation.getConversationType().equals(CometChatConstants.CONVERSATION_TYPE_USER)) { name = ((User) conversation.getConversationWith()).getName(); @@ -261,7 +261,7 @@ public void OnItemClick(Conversation conversation, int position) { avatar = ((Group) conversation.getConversationWith()).getIcon(); } chip.setText(name); - Glide.with(CometChatForwardMessageScreenActivity.this).load(avatar).placeholder(R.drawable.ic_contacts).transform(new CircleCrop()).into(new SimpleTarget() { + Glide.with(CometChatForwardMessageActivity.this).load(avatar).placeholder(R.drawable.ic_contacts).transform(new CircleCrop()).into(new SimpleTarget() { @Override public void onResourceReady(@NonNull Drawable resource, @Nullable Transition transition) { chip.setChipIcon(resource); @@ -282,7 +282,7 @@ public void onClick(View vw) { checkUserList(); } else { - Toast.makeText(CometChatForwardMessageScreenActivity.this,getString(R.string.forward_to_5_at_a_time),Toast.LENGTH_LONG).show(); + Toast.makeText(CometChatForwardMessageActivity.this,getString(R.string.forward_to_5_at_a_time),Toast.LENGTH_LONG).show(); } } @@ -311,7 +311,7 @@ public void onClick(View view) { message = new TextMessage(uid, textMessage, type); sendMessage(message); if (i == userList.size() - 1) { - Intent intent = new Intent(CometChatForwardMessageScreenActivity.this, CometChatUnified.class); + Intent intent = new Intent(CometChatForwardMessageActivity.this, CometChatUI.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); finish(); @@ -319,7 +319,7 @@ public void onClick(View view) { } }).start(); - } else if (messageType != null && !messageType.equals(StringContract.IntentStrings.INTENT_MEDIA_MESSAGE)) { + } else if (messageType != null && !messageType.equals(UIKitConstants.IntentStrings.INTENT_MEDIA_MESSAGE)) { new Thread(() -> { for (int i = 0; i <= userList.size() - 1; i++) { Conversation conversation = new ArrayList<>(userList.values()).get(i); @@ -345,7 +345,7 @@ public void onClick(View view) { Log.e(TAG, "onClick: " + attachment.toString()); sendMediaMessage(message); if (i == userList.size() - 1) { - Intent intent = new Intent(CometChatForwardMessageScreenActivity.this, CometChatUnified.class); + Intent intent = new Intent(CometChatForwardMessageActivity.this, CometChatUI.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); finish(); @@ -368,7 +368,7 @@ public void onClick(View view) { uid = ((Group) conversation.getConversationWith()).getGuid(); type = CometChatConstants.RECEIVER_TYPE_GROUP; } - File file = MediaUtils.getRealPath(CometChatForwardMessageScreenActivity.this, Uri.parse(mediaMessageUrl)); + File file = MediaUtils.getRealPath(CometChatForwardMessageActivity.this, Uri.parse(mediaMessageUrl)); message = new MediaMessage(uid, file, CometChatConstants.MESSAGE_TYPE_IMAGE, type); try { JSONObject jsonObject = new JSONObject(); @@ -379,7 +379,7 @@ public void onClick(View view) { } sendMediaMessage(message); if (i == userList.size() - 1) { - Intent intent = new Intent(CometChatForwardMessageScreenActivity.this, CometChatUnified.class); + Intent intent = new Intent(CometChatForwardMessageActivity.this, CometChatUI.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); finish(); @@ -389,7 +389,7 @@ public void onClick(View view) { }).start(); } } else { - if (messageType!=null && messageType.equalsIgnoreCase(StringContract.IntentStrings.LOCATION)) { + if (messageType!=null && messageType.equalsIgnoreCase(UIKitConstants.IntentStrings.LOCATION)) { new Thread(() -> { for (int i = 0; i <= userList.size() - 1; i++) { Conversation conversation = new ArrayList<>(userList.values()).get(i); @@ -413,11 +413,11 @@ public void onClick(View view) { } catch (JSONException e) { e.printStackTrace(); } - message = new CustomMessage(uid,type,StringContract.IntentStrings.LOCATION,customData); + message = new CustomMessage(uid,type, UIKitConstants.IntentStrings.LOCATION,customData); sendLocationMessage(message); if (i == userList.size() - 1) { - Intent intent = new Intent(CometChatForwardMessageScreenActivity.this, CometChatUnified.class); + Intent intent = new Intent(CometChatForwardMessageActivity.this, CometChatUI.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); finish(); @@ -536,7 +536,7 @@ public void onError(CometChatException e) { private void setAdapter(List conversations) { if (conversationListAdapter == null) { - conversationListAdapter = new ConversationListAdapter(this, conversations); + conversationListAdapter = new CometChatConversationsAdapter(this, conversations); rvConversationList.setAdapter(conversationListAdapter); } else { conversationListAdapter.updateList(conversations); diff --git a/uikit/src/main/java/listeners/LiveReactionListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/live_reaction/LiveReactionListener.java similarity index 97% rename from uikit/src/main/java/listeners/LiveReactionListener.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/live_reaction/LiveReactionListener.java index 92f94548..5c552565 100644 --- a/uikit/src/main/java/listeners/LiveReactionListener.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/live_reaction/LiveReactionListener.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_components.messages.live_reaction; import android.os.Handler; import android.view.MotionEvent; diff --git a/uikit/src/main/java/listeners/ReactionClickListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/live_reaction/ReactionClickListener.java similarity index 68% rename from uikit/src/main/java/listeners/ReactionClickListener.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/live_reaction/ReactionClickListener.java index ce3cf445..25745709 100644 --- a/uikit/src/main/java/listeners/ReactionClickListener.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/live_reaction/ReactionClickListener.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_components.messages.live_reaction; import android.view.View; diff --git a/uikit/src/main/java/screen/CometChatMediaViewActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/media_view/CometChatMediaViewActivity.java similarity index 66% rename from uikit/src/main/java/screen/CometChatMediaViewActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/media_view/CometChatMediaViewActivity.java index 300b563e..3c7e5524 100644 --- a/uikit/src/main/java/screen/CometChatMediaViewActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/media_view/CometChatMediaViewActivity.java @@ -1,10 +1,11 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.messages.media_view; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; -import androidx.core.graphics.drawable.DrawableCompat; +import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.media.MediaPlayer; import android.net.Uri; @@ -20,18 +21,18 @@ import android.widget.VideoView; import com.bumptech.glide.Glide; -import com.cometchat.pro.constants.CometChatConstants; -import com.cometchat.pro.core.CometChat; -import com.cometchat.pro.models.MediaMessage; +import com.bumptech.glide.load.engine.DiskCacheStrategy; +import com.bumptech.glide.request.target.CustomTarget; +import com.bumptech.glide.request.transition.Transition; import com.cometchat.pro.uikit.R; -import constant.StringContract; -import okhttp3.internal.Util; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.zoom_imageView.ZoomImageView; public class CometChatMediaViewActivity extends AppCompatActivity { - private ImageView imageMessage; + private ZoomImageView imageMessage; private VideoView videoMessage; private Toolbar toolbar; private String senderName; @@ -50,7 +51,7 @@ public class CometChatMediaViewActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_comet_chat_media_view); + setContentView(R.layout.activity_cometchat_media_view); handleIntent(); mediaPlayer = new MediaPlayer(); toolbar = findViewById(R.id.toolbar); @@ -62,16 +63,27 @@ protected void onCreate(Bundle savedInstanceState) { audioMessage = findViewById(R.id.audio_message); mediaSize = findViewById(R.id.media_size_tv); playBtn = findViewById(R.id.playBtn); - if (mediaType.equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) { - Glide.with(this).load(mediaUrl).into(imageMessage); + if (mediaType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) { + Glide.with(this).asBitmap().load(mediaUrl) + .diskCacheStrategy(DiskCacheStrategy.NONE).into(new CustomTarget() { + @Override + public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition transition) { + imageMessage.setImageBitmap(resource); + } + + @Override + public void onLoadCleared(@Nullable Drawable placeholder) { + + } + }); imageMessage.setVisibility(View.VISIBLE); - } else if (mediaType.equals(CometChatConstants.MESSAGE_TYPE_VIDEO)) { + } else if (mediaType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO)) { MediaController mediacontroller = new MediaController(this); mediacontroller.setAnchorView(videoMessage); videoMessage.setMediaController(mediacontroller); videoMessage.setVideoURI(Uri.parse(mediaUrl)); videoMessage.setVisibility(View.VISIBLE); - } else if (mediaType.equals(CometChatConstants.MESSAGE_TYPE_AUDIO)) { + } else if (mediaType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO)) { mediaPlayer.reset(); mediaSize.setText(Utils.getFileSize(mSize)); playBtn.setOnClickListener(new View.OnClickListener() { @@ -120,15 +132,15 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) { return super.onOptionsItemSelected(item); } private void handleIntent() { - if (getIntent().hasExtra(StringContract.IntentStrings.MEDIA_SIZE)) - mSize = getIntent().getIntExtra(StringContract.IntentStrings.MEDIA_SIZE,0); - if (getIntent().hasExtra(StringContract.IntentStrings.NAME)) - senderName = getIntent().getStringExtra(StringContract.IntentStrings.NAME); - if (getIntent().hasExtra(StringContract.IntentStrings.SENTAT)) - sentAt = getIntent().getLongExtra(StringContract.IntentStrings.SENTAT,0); - if (getIntent().hasExtra(StringContract.IntentStrings.INTENT_MEDIA_MESSAGE)) - mediaUrl = getIntent().getStringExtra(StringContract.IntentStrings.INTENT_MEDIA_MESSAGE); - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE)) - mediaType = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MEDIA_SIZE)) + mSize = getIntent().getIntExtra(UIKitConstants.IntentStrings.MEDIA_SIZE,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.NAME)) + senderName = getIntent().getStringExtra(UIKitConstants.IntentStrings.NAME); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.SENTAT)) + sentAt = getIntent().getLongExtra(UIKitConstants.IntentStrings.SENTAT,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.INTENT_MEDIA_MESSAGE)) + mediaUrl = getIntent().getStringExtra(UIKitConstants.IntentStrings.INTENT_MEDIA_MESSAGE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE)) + mediaType = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE); } } \ No newline at end of file diff --git a/uikit/src/main/java/screen/messagelist/MessageActionFragment.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_actions/CometChatMessageActions.java similarity index 89% rename from uikit/src/main/java/screen/messagelist/MessageActionFragment.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_actions/CometChatMessageActions.java index a9b05b47..3d8192fb 100644 --- a/uikit/src/main/java/screen/messagelist/MessageActionFragment.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_actions/CometChatMessageActions.java @@ -1,4 +1,4 @@ -package screen.messagelist; +package com.cometchat.pro.uikit.ui_components.messages.message_actions; import android.app.Activity; import android.content.DialogInterface; @@ -15,18 +15,25 @@ import androidx.annotation.NonNull; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Reaction.model.Reaction; + +import com.cometchat.pro.uikit.ui_components.messages.extensions.Extensions; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.android.material.bottomsheet.BottomSheetDialog; import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import java.util.List; -import screen.threadconversation.CometChatThreadMessageActivity; -import utils.Extensions; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.messages.message_list.CometChatMessageListActivity; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; +import com.cometchat.pro.uikit.ui_components.messages.thread_message_list.CometChatThreadMessageListActivity; -public class MessageActionFragment extends BottomSheetDialogFragment { +/** + * MessageActions is a BottomSheetDialogFragment which is being used in MessageList & ThreadList. + * It is used to show message actions such as edit,delete,copy,share,etc for a particular message. + * + */ +public class CometChatMessageActions extends BottomSheetDialogFragment { private TextView threadMessage; private TextView editMessage; @@ -55,7 +62,7 @@ public class MessageActionFragment extends BottomSheetDialogFragment { private boolean isTranslateVisible; private boolean isRetryVisible; - private MessageActionListener messageActionListener; + public MessageActionListener messageActionListener; private String type; @@ -88,7 +95,7 @@ private void fetchArguments() { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - View view = inflater.inflate(R.layout.fragment_message_actions, container, false); + View view = inflater.inflate(R.layout.fragment_cometchat_message_actions, container, false); view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { @@ -102,7 +109,7 @@ public void onGlobalLayout() { } }); reactionsList = view.findViewById(R.id.initial_reactions); - List reactions = Extensions.getInitialEmojis(INITIAL_REACTION_COUNT); + List reactions = Extensions.getInitialReactions(INITIAL_REACTION_COUNT); for(Reaction reaction : reactions) { View vw = LayoutInflater.from(getContext()).inflate(R.layout.reaction_list_row,null); TextView textView = vw.findViewById(R.id.reaction); @@ -199,7 +206,7 @@ public void onClick(View view) { messageInfo.setVisibility(View.VISIBLE); else messageInfo.setVisibility(View.GONE); - if (type!=null && type.equals(CometChatThreadMessageActivity.class.getName())) { + if (type!=null && type.equals(CometChatThreadMessageListActivity.class.getName())) { threadMessage.setVisibility(View.GONE); } @@ -318,7 +325,7 @@ public void onDismiss(@NonNull DialogInterface dialog) { if (type!=null && type== CometChatMessageListActivity.class.getName()) ((CometChatMessageListActivity)activity).handleDialogClose(dialog); else - ((CometChatThreadMessageActivity)activity).handleDialogClose(dialog); + ((CometChatThreadMessageListActivity)activity).handleDialogClose(dialog); } @Override @@ -326,9 +333,9 @@ public void onCancel(@NonNull DialogInterface dialog) { super.onCancel(dialog); Activity activity = getActivity(); if (activity!=null) - if (type!=null && type==CometChatMessageListActivity.class.getName()) + if (type!=null && type== CometChatMessageListActivity.class.getName()) ((CometChatMessageListActivity)activity).handleDialogClose(dialog); else - ((CometChatThreadMessageActivity)activity).handleDialogClose(dialog); + ((CometChatThreadMessageListActivity)activity).handleDialogClose(dialog); } } \ No newline at end of file diff --git a/uikit/src/main/java/listeners/MessageActionCloseListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_actions/listener/MessageActionCloseListener.java similarity index 64% rename from uikit/src/main/java/listeners/MessageActionCloseListener.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_actions/listener/MessageActionCloseListener.java index c5b46304..bad95856 100644 --- a/uikit/src/main/java/listeners/MessageActionCloseListener.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_actions/listener/MessageActionCloseListener.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_components.messages.message_actions.listener; import android.content.DialogInterface; diff --git a/uikit/src/main/java/listeners/OnMessageLongClick.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_actions/listener/OnMessageLongClick.java similarity index 67% rename from uikit/src/main/java/listeners/OnMessageLongClick.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_actions/listener/OnMessageLongClick.java index c05d02e2..71026a39 100644 --- a/uikit/src/main/java/listeners/OnMessageLongClick.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_actions/listener/OnMessageLongClick.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_components.messages.message_actions.listener; import com.cometchat.pro.models.BaseMessage; diff --git a/uikit/src/main/java/screen/CometChatMessageInfoScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/CometChatMessageInfoScreenActivity.java similarity index 80% rename from uikit/src/main/java/screen/CometChatMessageInfoScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/CometChatMessageInfoScreenActivity.java index 8737c727..6119b577 100644 --- a/uikit/src/main/java/screen/CometChatMessageInfoScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/CometChatMessageInfoScreenActivity.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.messages.message_information; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; @@ -15,11 +15,10 @@ import android.widget.TextView; import com.bumptech.glide.Glide; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.MessageReceipt; -import com.cometchat.pro.uikit.CometChatReceiptsList; +import com.cometchat.pro.uikit.ui_components.messages.message_information.Message_Receipts.CometChatReceiptsList; import com.cometchat.pro.uikit.R; import com.google.android.material.button.MaterialButton; import com.google.android.material.snackbar.Snackbar; @@ -29,8 +28,9 @@ import java.util.List; -import constant.StringContract; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; +import com.cometchat.pro.uikit.ui_components.messages.extensions.Collaborative.CometChatCollaborativeActivity; public class CometChatMessageInfoScreenActivity extends AppCompatActivity { @@ -91,7 +91,7 @@ public class CometChatMessageInfoScreenActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_comet_chat_message_info_screen); + setContentView(R.layout.activity_cometchat_message_info); toolbar = findViewById(R.id.detail_toolbar); messageLayout = findViewById(R.id.message_layout); backIcon = findViewById(R.id.backIcon); @@ -172,52 +172,52 @@ public void onError(CometChatException e) { } private void handleIntent() { - if (getIntent().hasExtra(StringContract.IntentStrings.ID)){ - id = getIntent().getIntExtra(StringContract.IntentStrings.ID,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.ID)){ + id = getIntent().getIntExtra(UIKitConstants.IntentStrings.ID,0); } - if (getIntent().hasExtra(StringContract.IntentStrings.TEXTMESSAGE)) { - message = getIntent().getStringExtra(StringContract.IntentStrings.TEXTMESSAGE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.TEXTMESSAGE)) { + message = getIntent().getStringExtra(UIKitConstants.IntentStrings.TEXTMESSAGE); } - if (getIntent().hasExtra(StringContract.IntentStrings.IMAGE_MODERATION)) { + if (getIntent().hasExtra(UIKitConstants.IntentStrings.IMAGE_MODERATION)) { boolean isImageNotSafe = getIntent() - .getBooleanExtra(StringContract.IntentStrings.IMAGE_MODERATION,true); + .getBooleanExtra(UIKitConstants.IntentStrings.IMAGE_MODERATION,true); if (isImageNotSafe) sensitiveLayout.setVisibility(View.VISIBLE); else sensitiveLayout.setVisibility(View.GONE); } - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL)) { - message = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL)) { + message = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL); } - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE)) { - messageType = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE)) { + messageType = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE); } - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION)) { - messageExtension = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION)) { + messageExtension = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION); } - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE)) { + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE)) { messageSize = getIntent(). - getIntExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,0); + getIntExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,0); } - if (getIntent().hasExtra(StringContract.IntentStrings.SENTAT)) { + if (getIntent().hasExtra(UIKitConstants.IntentStrings.SENTAT)) { txtTime.setText(Utils.getHeaderDate(getIntent() - .getLongExtra(StringContract.IntentStrings.SENTAT,0)*1000)); + .getLongExtra(UIKitConstants.IntentStrings.SENTAT,0)*1000)); } - if (getIntent().hasExtra(StringContract.IntentStrings.CUSTOM_MESSAGE)) { - message = getIntent().getStringExtra(StringContract.IntentStrings.CUSTOM_MESSAGE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.CUSTOM_MESSAGE)) { + message = getIntent().getStringExtra(UIKitConstants.IntentStrings.CUSTOM_MESSAGE); } - if (getIntent().hasExtra(StringContract.IntentStrings.POLL_RESULT)) { - percentage = getIntent().getIntExtra(StringContract.IntentStrings.POLL_RESULT,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.POLL_RESULT)) { + percentage = getIntent().getIntExtra(UIKitConstants.IntentStrings.POLL_RESULT,0); } if (messageType!=null) { - if (messageType.equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { textMessage.setVisibility(View.VISIBLE); messageText.setText(message); - } else if (messageType.equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) { + } else if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) { imageMessage.setVisibility(View.VISIBLE); Glide.with(this).load(message).into(messageImage); - } else if (messageType.equals(StringContract.IntentStrings.STICKERS)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.STICKERS)) { stickerMessage.setVisibility(View.VISIBLE); try { JSONObject jsonObject = new JSONObject(message); @@ -225,59 +225,59 @@ private void handleIntent() { } catch (JSONException e) { e.printStackTrace(); } - }else if (messageType.equals(CometChatConstants.MESSAGE_TYPE_VIDEO)) { + }else if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO)) { videoMessage.setVisibility(View.VISIBLE); Glide.with(this).load(message).into(messageVideo); - } else if (messageType.equals(CometChatConstants.MESSAGE_TYPE_FILE)) { + } else if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE)) { fileMessage.setVisibility(View.VISIBLE); fileName.setText(message); fileSize.setText(Utils.getFileSize(messageSize)); fileExtension.setText(messageExtension); - } else if (messageType.equals(CometChatConstants.MESSAGE_TYPE_AUDIO)) { + } else if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO)) { audioMessage.setVisibility(View.VISIBLE); audioFileSize.setText(Utils.getFileSize(messageSize)); - } else if (messageType.equals(StringContract.IntentStrings.WHITEBOARD)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.WHITEBOARD)) { whiteBoardMessage.setVisibility(View.VISIBLE); whiteBoardText.setText(getString(R.string.you_created_whiteboard)); joinWhiteBoard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - String boardUrl = getIntent().getStringExtra(StringContract.IntentStrings.TEXTMESSAGE); - Intent intent = new Intent(CometChatMessageInfoScreenActivity.this, CometChatWebViewActivity.class); - intent.putExtra(StringContract.IntentStrings.URL, boardUrl); + String boardUrl = getIntent().getStringExtra(UIKitConstants.IntentStrings.TEXTMESSAGE); + Intent intent = new Intent(CometChatMessageInfoScreenActivity.this, CometChatCollaborativeActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.URL, boardUrl); startActivity(intent); } }); - } else if (messageType.equals(StringContract.IntentStrings.WRITEBOARD)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.WRITEBOARD)) { writeBoardMessage.setVisibility(View.VISIBLE); writeBoardText.setText(getString(R.string.you_created_document)); joinWriteBoard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - String boardUrl = getIntent().getStringExtra(StringContract.IntentStrings.TEXTMESSAGE); - Intent intent = new Intent(CometChatMessageInfoScreenActivity.this, CometChatWebViewActivity.class); - intent.putExtra(StringContract.IntentStrings.URL, boardUrl); + String boardUrl = getIntent().getStringExtra(UIKitConstants.IntentStrings.TEXTMESSAGE); + Intent intent = new Intent(CometChatMessageInfoScreenActivity.this, CometChatCollaborativeActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.URL, boardUrl); startActivity(intent); } }); - } else if (messageType.equals(StringContract.IntentStrings.LOCATION)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.LOCATION)) { try { locationMessage.setVisibility(View.VISIBLE); JSONObject jsonObject = new JSONObject(message); double LATITUDE = jsonObject.getDouble("latitude"); double LONGITUDE = jsonObject.getDouble("longitude"); tvPlaceName.setVisibility(View.GONE); - String mapUrl = StringContract.MapUrl.MAPS_URL + LATITUDE + "," + LONGITUDE + "&key=" + StringContract.MapUrl.MAP_ACCESS_KEY; + String mapUrl = UIKitConstants.MapUrl.MAPS_URL + LATITUDE + "," + LONGITUDE + "&key=" + UIKitConstants.MapUrl.MAP_ACCESS_KEY; Glide.with(this) .load(mapUrl) .into(ivMap); } catch (JSONException e) { e.printStackTrace(); } - } else if (messageType.equals(StringContract.IntentStrings.GROUP_CALL)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.GROUP_CALL)) { meetingMessage.setVisibility(View.VISIBLE); joinMeetingBtn.setEnabled(false); - } else if (messageType.equals(StringContract.IntentStrings.POLLS)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.POLLS)) { pollsMessage.setVisibility(View.VISIBLE); try { JSONObject jsonObject = new JSONObject(message); diff --git a/uikit/src/main/java/adapter/ReceiptListAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/Message_Receipts/CometChatReceiptsAdapter.java similarity index 87% rename from uikit/src/main/java/adapter/ReceiptListAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/Message_Receipts/CometChatReceiptsAdapter.java index f33fa846..9ea7b3bd 100644 --- a/uikit/src/main/java/adapter/ReceiptListAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/Message_Receipts/CometChatReceiptsAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.messages.message_information.Message_Receipts; import android.content.Context; import android.view.LayoutInflater; @@ -9,25 +9,24 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import com.bumptech.glide.Glide; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.models.MessageReceipt; -import com.cometchat.pro.uikit.Avatar; +import com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar.CometChatAvatar; import com.cometchat.pro.uikit.R; import java.util.ArrayList; import java.util.List; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; -public class ReceiptListAdapter extends RecyclerView.Adapter { +public class CometChatReceiptsAdapter extends RecyclerView.Adapter { private Context context; private List messageReceiptList = new ArrayList<>(); private String loggedInUserUid = CometChat.getLoggedInUser().getUid(); - public ReceiptListAdapter(Context context) { + public CometChatReceiptsAdapter(Context context) { this.context = context; } @@ -35,7 +34,7 @@ public ReceiptListAdapter(Context context) { @NonNull @Override public ReceiptsHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { - return new ReceiptsHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.cometchat_receipts_view,viewGroup,false)); + return new ReceiptsHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.cometchat_receipts_row,viewGroup,false)); } @Override @@ -102,7 +101,7 @@ class ReceiptsHolder extends RecyclerView.ViewHolder { TextView tvDelivery; TextView tvRead; - Avatar ivAvatar; + CometChatAvatar ivAvatar; TextView tvName; ReceiptsHolder(@NonNull View itemView) { diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/CometChatReceiptsList.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/Message_Receipts/CometChatReceiptsList.java similarity index 90% rename from uikit/src/main/java/com/cometchat/pro/uikit/CometChatReceiptsList.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/Message_Receipts/CometChatReceiptsList.java index 1ebef60a..d1c6265b 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/CometChatReceiptsList.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/Message_Receipts/CometChatReceiptsList.java @@ -1,9 +1,8 @@ -package com.cometchat.pro.uikit; +package com.cometchat.pro.uikit.ui_components.messages.message_information.Message_Receipts; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; -import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -13,14 +12,10 @@ import com.cometchat.pro.models.MessageReceipt; import com.cometchat.pro.models.User; +import com.cometchat.pro.uikit.R; import java.util.List; -import listeners.ClickListener; -import listeners.OnItemClickListener; -import listeners.RecyclerTouchListener; -import viewmodel.ReceiptListViewModel; -import viewmodel.UserListViewModel; /** * Purpose - CometChatUserList class is a subclass of recyclerview and used as component by @@ -40,7 +35,7 @@ public class CometChatReceiptsList extends RecyclerView { private Context context; - private ReceiptListViewModel receiptListViewModel; + private CometChatReceiptsViewModel receiptListViewModel; private boolean showDelivery; @@ -85,7 +80,7 @@ public void setMessageReceiptList(List messageReceiptList) { private void setViewModel() { if (receiptListViewModel == null) { - receiptListViewModel = new ReceiptListViewModel(context,this,showDelivery,showRead); + receiptListViewModel = new CometChatReceiptsViewModel(context,this,showDelivery,showRead); } } diff --git a/uikit/src/main/java/viewmodel/ReceiptListViewModel.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/Message_Receipts/CometChatReceiptsViewModel.java similarity index 71% rename from uikit/src/main/java/viewmodel/ReceiptListViewModel.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/Message_Receipts/CometChatReceiptsViewModel.java index d4a6eedd..85e5088f 100644 --- a/uikit/src/main/java/viewmodel/ReceiptListViewModel.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_information/Message_Receipts/CometChatReceiptsViewModel.java @@ -1,44 +1,37 @@ -package viewmodel; +package com.cometchat.pro.uikit.ui_components.messages.message_information.Message_Receipts; import android.content.Context; import com.cometchat.pro.models.MessageReceipt; -import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.CometChatReceiptsList; -import com.cometchat.pro.uikit.CometChatUserList; import java.util.List; -import adapter.ReceiptListAdapter; -import adapter.UserListAdapter; -import listeners.StickyHeaderDecoration; - -public class ReceiptListViewModel { +public class CometChatReceiptsViewModel { private static final String TAG = "ReceiptListViewModel"; private Context context; - private ReceiptListAdapter receiptListAdapter; + private CometChatReceiptsAdapter receiptListAdapter; private CometChatReceiptsList receiptsList; - public ReceiptListViewModel(Context context, CometChatReceiptsList receiptsList, - boolean showDelivery,boolean showRead){ + public CometChatReceiptsViewModel(Context context, CometChatReceiptsList receiptsList, + boolean showDelivery, boolean showRead){ this.receiptsList = receiptsList; this.context=context; setReceiptListAdapter(receiptsList,showDelivery,showRead); } - private ReceiptListViewModel(){ + private CometChatReceiptsViewModel(){ } - private ReceiptListAdapter getAdapter() { + private CometChatReceiptsAdapter getAdapter() { if (receiptListAdapter==null){ - receiptListAdapter=new ReceiptListAdapter(context); + receiptListAdapter=new CometChatReceiptsAdapter(context); } return receiptListAdapter; } @@ -67,7 +60,7 @@ public void clear() } private void setReceiptListAdapter(CometChatReceiptsList cometChatReceiptsList, boolean showDelivery,boolean showRead){ - receiptListAdapter=new ReceiptListAdapter(context); + receiptListAdapter=new CometChatReceiptsAdapter(context); cometChatReceiptsList.showDelivery(showDelivery); cometChatReceiptsList.showRead(showRead); cometChatReceiptsList.setAdapter(receiptListAdapter); diff --git a/uikit/src/main/java/screen/messagelist/CometChatMessageScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_list/CometChatMessageList.java similarity index 81% rename from uikit/src/main/java/screen/messagelist/CometChatMessageScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_list/CometChatMessageList.java index 955e7cf9..a8f5bf80 100644 --- a/uikit/src/main/java/screen/messagelist/CometChatMessageScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_list/CometChatMessageList.java @@ -1,4 +1,4 @@ -package screen.messagelist; +package com.cometchat.pro.uikit.ui_components.messages.message_list; import android.Manifest; import android.animation.Animator; @@ -58,31 +58,34 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.transition.Transition; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.GroupMembersRequest; import com.cometchat.pro.core.MessagesRequest; import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.Action; import com.cometchat.pro.models.Attachment; +import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.CustomMessage; -import com.cometchat.pro.uikit.ComposeBox.ComposeBox; -import com.cometchat.pro.uikit.R; import com.cometchat.pro.models.Group; import com.cometchat.pro.models.GroupMember; -import com.cometchat.pro.uikit.Avatar; -import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.MediaMessage; import com.cometchat.pro.models.MessageReceipt; import com.cometchat.pro.models.TextMessage; import com.cometchat.pro.models.TypingIndicator; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.Reaction.OnEmojiClickListener; -import com.cometchat.pro.uikit.Reaction.ReactionDialog; -import com.cometchat.pro.uikit.Reaction.model.Reaction; -import com.cometchat.pro.uikit.SmartReplyList; -import com.cometchat.pro.uikit.Sticker.listener.StickerClickListener; -import com.cometchat.pro.uikit.Sticker.StickerView; + +import com.cometchat.pro.uikit.ui_components.messages.extensions.Extensions; +import com.cometchat.pro.uikit.ui_components.messages.forward_message.CometChatForwardMessageActivity; +import com.cometchat.pro.uikit.ui_components.messages.message_actions.CometChatMessageActions; +import com.cometchat.pro.uikit.ui_components.messages.message_actions.listener.MessageActionCloseListener; +import com.cometchat.pro.uikit.ui_components.shared.cometchatComposeBox.CometChatComposeBox; +import com.cometchat.pro.uikit.R; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.listener.OnReactionClickListener; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.CometChatReactionDialog; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.StickerView; +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.listener.StickerClickListener; +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.model.Sticker; import com.facebook.shimmer.ShimmerFrameLayout; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationServices; @@ -103,30 +106,27 @@ import java.util.Timer; import java.util.TimerTask; -import adapter.MessageAdapter; -import constant.StringContract; -import listeners.ComposeActionListener; -import listeners.ExtensionResponseListener; -import listeners.MessageActionCloseListener; -import listeners.OnItemClickListener; -import listeners.OnMessageLongClick; -import listeners.ReactionClickListener; -import listeners.LiveReactionListener; -import listeners.StickyHeaderDecoration; -import com.cometchat.pro.uikit.Sticker.model.Sticker; -import screen.CometChatForwardMessageScreenActivity; -import screen.CometChatGroupDetailScreenActivity; -import screen.CometChatMessageInfoScreenActivity; -import screen.CometChatUserDetailScreenActivity; -import screen.threadconversation.CometChatThreadMessageActivity; -import utils.CallUtils; -import utils.Extensions; -import utils.FontUtils; -import utils.MediaUtils; -import utils.KeyBoardUtils; -import com.cometchat.pro.uikit.Settings.UISettings; - -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.groups.group_details.CometChatGroupDetailActivity; +import com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar.CometChatAvatar; +import com.cometchat.pro.uikit.ui_components.shared.cometchatSmartReplies.CometChatSmartReplies; +import com.cometchat.pro.uikit.ui_components.users.user_details.CometChatUserDetailScreenActivity; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_components.shared.cometchatComposeBox.listener.ComposeActionListener; +import com.cometchat.pro.uikit.ui_components.messages.extensions.ExtensionResponseListener; +import com.cometchat.pro.uikit.ui_components.messages.live_reaction.LiveReactionListener; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_components.messages.message_actions.listener.OnMessageLongClick; +import com.cometchat.pro.uikit.ui_components.messages.live_reaction.ReactionClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.pattern_utils.PatternUtils; +import com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderDecoration; +import com.cometchat.pro.uikit.ui_resources.utils.CallUtils; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.keyboard_utils.KeyBoardUtils; +import com.cometchat.pro.uikit.ui_resources.utils.MediaUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_components.messages.message_information.CometChatMessageInfoScreenActivity; +import com.cometchat.pro.uikit.ui_components.messages.thread_message_list.CometChatThreadMessageListActivity; import static android.view.View.GONE; @@ -147,7 +147,7 @@ */ -public class CometChatMessageScreen extends Fragment implements View.OnClickListener, +public class CometChatMessageList extends Fragment implements View.OnClickListener, OnMessageLongClick, MessageActionCloseListener { private static final String TAG = "CometChatMessageScreen"; @@ -162,7 +162,7 @@ public class CometChatMessageScreen extends Fragment implements View.OnClickList private MessagesRequest messagesRequest; //Used to fetch messages. - private ComposeBox composeBox; + private CometChatComposeBox composeBox; private RecyclerView rvChatListView; //Used to display list of messages. @@ -170,14 +170,14 @@ public class CometChatMessageScreen extends Fragment implements View.OnClickList private LinearLayoutManager linearLayoutManager; - private SmartReplyList rvSmartReply; + private CometChatSmartReplies rvSmartReply; private ShimmerFrameLayout messageShimmer; /** * Avatar is a UI Kit Component which is used to display user and group avatars. */ - private Avatar userAvatar; + private CometChatAvatar userAvatar; private TextView tvName; @@ -267,7 +267,7 @@ public class CometChatMessageScreen extends Fragment implements View.OnClickList public int count = 0; - private MessageActionFragment messageActionFragment; + private CometChatMessageActions messageActionFragment; private LocationManager locationManager; private LocationListener locationListener; private Location location; @@ -290,7 +290,7 @@ public class CometChatMessageScreen extends Fragment implements View.OnClickList public ObjectAnimator animation; - public CometChatMessageScreen() { + public CometChatMessageList() { // Required empty public constructor } @@ -307,17 +307,17 @@ public void onCreate(Bundle savedInstanceState) { */ private void handleArguments() { if (getArguments() != null) { - Id = getArguments().getString(StringContract.IntentStrings.UID); - avatarUrl = getArguments().getString(StringContract.IntentStrings.AVATAR); - status = getArguments().getString(StringContract.IntentStrings.STATUS); - name = getArguments().getString(StringContract.IntentStrings.NAME); - type = getArguments().getString(StringContract.IntentStrings.TYPE); - if (type != null && type.equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - Id = getArguments().getString(StringContract.IntentStrings.GUID); - memberCount = getArguments().getInt(StringContract.IntentStrings.MEMBER_COUNT); - groupDesc = getArguments().getString(StringContract.IntentStrings.GROUP_DESC); - groupPassword = getArguments().getString(StringContract.IntentStrings.GROUP_PASSWORD); - groupType = getArguments().getString(StringContract.IntentStrings.GROUP_TYPE); + Id = getArguments().getString(UIKitConstants.IntentStrings.UID); + avatarUrl = getArguments().getString(UIKitConstants.IntentStrings.AVATAR); + status = getArguments().getString(UIKitConstants.IntentStrings.STATUS); + name = getArguments().getString(UIKitConstants.IntentStrings.NAME); + type = getArguments().getString(UIKitConstants.IntentStrings.TYPE); + if (type != null && type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + Id = getArguments().getString(UIKitConstants.IntentStrings.GUID); + memberCount = getArguments().getInt(UIKitConstants.IntentStrings.MEMBER_COUNT); + groupDesc = getArguments().getString(UIKitConstants.IntentStrings.GROUP_DESC); + groupPassword = getArguments().getString(UIKitConstants.IntentStrings.GROUP_PASSWORD); + groupType = getArguments().getString(UIKitConstants.IntentStrings.GROUP_TYPE); } } } @@ -325,7 +325,7 @@ private void handleArguments() { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - view = inflater.inflate(R.layout.fragment_chat_screen, container, false); + view = inflater.inflate(R.layout.fragment_cometchat_messagelist, container, false); initViewComponent(view); return view; } @@ -343,7 +343,7 @@ private void initViewComponent(View view) { messageShimmer = view.findViewById(R.id.shimmer_layout); composeBox = view.findViewById(R.id.message_box); composeBox.usedIn(CometChatMessageListActivity.class.getName()); - if (type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) + if (type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) composeBox.hideGroupCallOption(true); setComposeBoxListener(); @@ -425,7 +425,7 @@ public void onClickListener(Sticker sticker) { } catch (JSONException e) { e.printStackTrace(); } - sendCustomMessage(StringContract.IntentStrings.STICKERS,stickerData); + sendCustomMessage(UIKitConstants.IntentStrings.STICKERS,stickerData); stickerLayout.setVisibility(GONE); } }); @@ -548,7 +548,7 @@ private void checkOnGoingCall() { CometChat.getActiveCall().getReceiverUid() .equalsIgnoreCase(loggedInUser.getUid())) && CometChat.getActiveCall().getCallStatus(). - equals(CometChatConstants.CALL_STATUS_ONGOING) + equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null) { if(onGoingCallView!=null) @@ -585,7 +585,7 @@ public void onEditTextMediaSelected(InputContentInfoCompat inputContentInfo) { Log.e(TAG, "onEditTextMediaSelected: Path=" + inputContentInfo.getLinkUri().getPath() + "\nHost=" + inputContentInfo.getLinkUri().getFragment()); String messageType = inputContentInfo.getLinkUri().toString().substring(inputContentInfo.getLinkUri().toString().lastIndexOf('.')); - MediaMessage mediaMessage = new MediaMessage(Id, null, CometChatConstants.MESSAGE_TYPE_IMAGE, type); + MediaMessage mediaMessage = new MediaMessage(Id, null, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE, type); Attachment attachment = new Attachment(); attachment.setFileUrl(inputContentInfo.getLinkUri().toString()); attachment.setFileMimeType(inputContentInfo.getDescription().getMimeType(0)); @@ -621,18 +621,18 @@ public void afterTextChanged(Editable editable) { @Override public void onAudioActionClicked() { if (Utils.hasPermissions(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - startActivityForResult(MediaUtils.openAudio(getActivity()), StringContract.RequestCode.AUDIO); + startActivityForResult(MediaUtils.openAudio(getActivity()), UIKitConstants.RequestCode.AUDIO); } else { - requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, StringContract.RequestCode.AUDIO); + requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, UIKitConstants.RequestCode.AUDIO); } } @Override public void onCameraActionClicked() { if (Utils.hasPermissions(getContext(), CAMERA_PERMISSION)) { - startActivityForResult(MediaUtils.openCamera(getContext()), StringContract.RequestCode.CAMERA); + startActivityForResult(MediaUtils.openCamera(getContext()), UIKitConstants.RequestCode.CAMERA); } else { - requestPermissions(CAMERA_PERMISSION, StringContract.RequestCode.CAMERA); + requestPermissions(CAMERA_PERMISSION, UIKitConstants.RequestCode.CAMERA); } } @@ -640,25 +640,25 @@ public void onCameraActionClicked() { @Override public void onGalleryActionClicked() { if (Utils.hasPermissions(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - startActivityForResult(MediaUtils.openGallery(getActivity()), StringContract.RequestCode.GALLERY); + startActivityForResult(MediaUtils.openGallery(getActivity()), UIKitConstants.RequestCode.GALLERY); } else { - requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, StringContract.RequestCode.GALLERY); + requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, UIKitConstants.RequestCode.GALLERY); } } @Override public void onFileActionClicked() { if (Utils.hasPermissions(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - startActivityForResult(MediaUtils.getFileIntent(StringContract.IntentStrings.EXTRA_MIME_DOC), StringContract.RequestCode.FILE); + startActivityForResult(MediaUtils.getFileIntent(UIKitConstants.IntentStrings.EXTRA_MIME_DOC), UIKitConstants.RequestCode.FILE); } else { - requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, StringContract.RequestCode.FILE); + requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, UIKitConstants.RequestCode.FILE); } } @Override public void onSendActionClicked(EditText editText) { String message = editText.getText().toString().trim(); - String filterEmojiMessage = Utils.removeEmojiAndSymbol(message); + String filterEmojiMessage = PatternUtils.removeEmojiAndSymbol(message); editText.setText(""); editText.setHint(getString(R.string.message)); if (!UISettings.isSendEmojis()) { @@ -691,7 +691,7 @@ public void onSendActionClicked(EditText editText) { public void onVoiceNoteComplete(String string) { if (string != null) { File audioFile = new File(string); - sendMediaMessage(audioFile, CometChatConstants.MESSAGE_TYPE_AUDIO); + sendMediaMessage(audioFile, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO); } } @@ -707,7 +707,7 @@ public void onLocationActionClicked() { getLocation(); } } else { - requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, StringContract.RequestCode.LOCATION); + requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, UIKitConstants.RequestCode.LOCATION); } } @@ -768,12 +768,12 @@ public void OnResponseFailed(CometChatException e) { public void onVideoMeetingClicked() { JSONObject customData = new JSONObject(); try { - customData.put("callType",CometChatConstants.CALL_TYPE_VIDEO); + customData.put("callType", com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_VIDEO); customData.put("sessionID",Id); } catch (JSONException e) { e.printStackTrace(); } - sendCustomMessage(StringContract.IntentStrings.GROUP_CALL,customData); + sendCustomMessage(UIKitConstants.IntentStrings.GROUP_CALL,customData); } }); @@ -914,8 +914,8 @@ private void initAlert(JSONObject customData) { TextView address = view.findViewById(R.id.address); address.setText("Address: "+Utils.getAddress(context,LATITUDE,LONGITUDE)); ImageView mapView = view.findViewById(R.id.map_vw); - String mapUrl = StringContract.MapUrl.MAPS_URL +LATITUDE+","+LONGITUDE+"&key="+ - StringContract.MapUrl.MAP_ACCESS_KEY; + String mapUrl = UIKitConstants.MapUrl.MAPS_URL +LATITUDE+","+LONGITUDE+"&key="+ + UIKitConstants.MapUrl.MAP_ACCESS_KEY; Glide.with(this) .load(mapUrl) .into(mapView); @@ -923,7 +923,7 @@ private void initAlert(JSONObject customData) { builder.setPositiveButton(getString(R.string.share), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - sendCustomMessage(StringContract.IntentStrings.LOCATION, customData); + sendCustomMessage(UIKitConstants.IntentStrings.LOCATION, customData); } }).setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Override @@ -943,15 +943,15 @@ public void onClick(DialogInterface dialog, int which) { private void sendCustomMessage(String customType, JSONObject customData) { CustomMessage customMessage; - if (type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) - customMessage = new CustomMessage(Id, CometChatConstants.RECEIVER_TYPE_USER, customType, customData); + if (type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) + customMessage = new CustomMessage(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER, customType, customData); else - customMessage = new CustomMessage(Id, CometChatConstants.RECEIVER_TYPE_GROUP, customType, customData); + customMessage = new CustomMessage(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP, customType, customData); CometChat.sendCustomMessage(customMessage, new CometChat.CallbackListener() { @Override public void onSuccess(CustomMessage customMessage) { - if (customType.equalsIgnoreCase(StringContract.IntentStrings.GROUP_CALL)) + if (customType.equalsIgnoreCase(UIKitConstants.IntentStrings.GROUP_CALL)) CallUtils.startDirectCall(context,Utils.getDirectCallData(customMessage)); if (messageAdapter != null) { @@ -975,7 +975,7 @@ private void turnOnLocation() { builder.setPositiveButton(getString(R.string.on), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - startActivityForResult(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), StringContract.RequestCode.LOCATION); + startActivityForResult(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), UIKitConstants.RequestCode.LOCATION); } }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override @@ -1016,26 +1016,26 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis Log.d(TAG, "onRequestPermissionsResult: "); switch (requestCode) { - case StringContract.RequestCode.CAMERA: + case UIKitConstants.RequestCode.CAMERA: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) - startActivityForResult(MediaUtils.openCamera(getActivity()), StringContract.RequestCode.CAMERA); + startActivityForResult(MediaUtils.openCamera(getActivity()), UIKitConstants.RequestCode.CAMERA); else showSnackBar(view.findViewById(R.id.message_box), getResources().getString(R.string.grant_camera_permission)); break; - case StringContract.RequestCode.GALLERY: + case UIKitConstants.RequestCode.GALLERY: if (grantResults[0] == PackageManager.PERMISSION_GRANTED) - startActivityForResult(MediaUtils.openGallery(getActivity()), StringContract.RequestCode.GALLERY); + startActivityForResult(MediaUtils.openGallery(getActivity()), UIKitConstants.RequestCode.GALLERY); else showSnackBar(view.findViewById(R.id.message_box), getResources().getString(R.string.grant_storage_permission)); break; - case StringContract.RequestCode.FILE: + case UIKitConstants.RequestCode.FILE: if (grantResults[0] == PackageManager.PERMISSION_GRANTED) - startActivityForResult(MediaUtils.getFileIntent(StringContract.IntentStrings.EXTRA_MIME_DOC), StringContract.RequestCode.FILE); + startActivityForResult(MediaUtils.getFileIntent(UIKitConstants.IntentStrings.EXTRA_MIME_DOC), UIKitConstants.RequestCode.FILE); else showSnackBar(view.findViewById(R.id.message_box), getResources().getString(R.string.grant_storage_permission)); break; - case StringContract.RequestCode.LOCATION: + case UIKitConstants.RequestCode.LOCATION: if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { initLocation(); // locationManager = (LocationManager) Objects.requireNonNull(getContext()).getSystemService(Context.LOCATION_SERVICE); @@ -1167,15 +1167,15 @@ private void fetchMessage() { if (messagesRequest == null) { if (type != null) { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) messagesRequest = new MessagesRequest.MessagesRequestBuilder().setLimit(LIMIT) - .setTypes(StringContract.MessageRequest.messageTypesForUser) - .setCategories(StringContract.MessageRequest.messageCategoriesForUser) + .setTypes(UIKitConstants.MessageRequest.messageTypesForUser) + .setCategories(UIKitConstants.MessageRequest.messageCategoriesForUser) .hideReplies(true).setUID(Id).build(); else messagesRequest = new MessagesRequest.MessagesRequestBuilder().setLimit(LIMIT) - .setTypes(StringContract.MessageRequest.messageTypesForGroup) - .setCategories(StringContract.MessageRequest.messageCategoriesForGroup) + .setTypes(UIKitConstants.MessageRequest.messageTypesForGroup) + .setCategories(UIKitConstants.MessageRequest.messageCategoriesForGroup) .hideReplies(true).setGUID(Id).hideMessagesFromBlockedUsers(true).build(); } } @@ -1274,7 +1274,7 @@ private void setSmartReplyAdapter(List replyList) { */ private void initMessageAdapter(List messageList) { if (messageAdapter == null) { - messageAdapter = new MessageAdapter(getActivity(), messageList, CometChatMessageScreen.class.getName()); + messageAdapter = new MessageAdapter(getActivity(), messageList, CometChatMessageList.class.getName()); rvChatListView.setAdapter(messageAdapter); stickyHeaderDecoration = new StickyHeaderDecoration(messageAdapter); rvChatListView.addItemDecoration(stickyHeaderDecoration, 0); @@ -1299,16 +1299,16 @@ private void initMessageAdapter(List messageList) { */ private void sendTypingIndicator(boolean isEnd) { if (isEnd) { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) { - CometChat.endTyping(new TypingIndicator(Id, CometChatConstants.RECEIVER_TYPE_USER)); + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { + CometChat.endTyping(new TypingIndicator(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)); } else { - CometChat.endTyping(new TypingIndicator(Id, CometChatConstants.RECEIVER_TYPE_GROUP)); + CometChat.endTyping(new TypingIndicator(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)); } } else { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) { - CometChat.startTyping(new TypingIndicator(Id, CometChatConstants.RECEIVER_TYPE_USER)); + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { + CometChat.startTyping(new TypingIndicator(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)); } else { - CometChat.startTyping(new TypingIndicator(Id, CometChatConstants.RECEIVER_TYPE_GROUP)); + CometChat.startTyping(new TypingIndicator(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)); } } } @@ -1330,56 +1330,56 @@ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent d Log.d(TAG, "onActivityResult: "); switch (requestCode) { - case StringContract.RequestCode.AUDIO: + case UIKitConstants.RequestCode.AUDIO: if (data!=null) { File file = MediaUtils.getRealPath(getContext(),data.getData()); ContentResolver cr = getActivity().getContentResolver(); - sendMediaMessage(file,CometChatConstants.MESSAGE_TYPE_AUDIO); + sendMediaMessage(file, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO); } break; - case StringContract.RequestCode.GALLERY: + case UIKitConstants.RequestCode.GALLERY: if (data != null) { - resultIntentCode = StringContract.RequestCode.GALLERY; + resultIntentCode = UIKitConstants.RequestCode.GALLERY; File file = MediaUtils.getRealPath(getContext(), data.getData()); ContentResolver cr = getActivity().getContentResolver(); String mimeType = cr.getType(data.getData()); if (mimeType!=null && mimeType.contains("image")) { if (file.exists()) - sendMediaMessage(file, CometChatConstants.MESSAGE_TYPE_IMAGE); + sendMediaMessage(file, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE); else Snackbar.make(rvChatListView, R.string.file_not_exist, Snackbar.LENGTH_LONG).show(); } else { if (file.exists()) - sendMediaMessage(file, CometChatConstants.MESSAGE_TYPE_VIDEO); + sendMediaMessage(file, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO); else Snackbar.make(rvChatListView, R.string.file_not_exist, Snackbar.LENGTH_LONG).show(); } } break; - case StringContract.RequestCode.CAMERA: + case UIKitConstants.RequestCode.CAMERA: File file; - resultIntentCode = StringContract.RequestCode.CAMERA; + resultIntentCode = UIKitConstants.RequestCode.CAMERA; if (Build.VERSION.SDK_INT >= 29) { file = MediaUtils.getRealPath(getContext(), MediaUtils.uri); } else { file = new File(MediaUtils.pictureImagePath); } if (file.exists()) - sendMediaMessage(file, CometChatConstants.MESSAGE_TYPE_IMAGE); + sendMediaMessage(file, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE); else Snackbar.make(rvChatListView,R.string.file_not_exist,Snackbar.LENGTH_LONG).show(); break; - case StringContract.RequestCode.FILE: + case UIKitConstants.RequestCode.FILE: if (data != null) - sendMediaMessage(MediaUtils.getRealPath(getActivity(), data.getData()), CometChatConstants.MESSAGE_TYPE_FILE); + sendMediaMessage(MediaUtils.getRealPath(getActivity(), data.getData()), com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE); break; - case StringContract.RequestCode.BLOCK_USER: + case UIKitConstants.RequestCode.BLOCK_USER: name = data.getStringExtra(""); break; - case StringContract.RequestCode.LOCATION: + case UIKitConstants.RequestCode.LOCATION: locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { @@ -1427,10 +1427,10 @@ public void onError(CometChatException e) { private void sendMediaMessage(File file, String filetype) { MediaMessage mediaMessage; - if (type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) - mediaMessage = new MediaMessage(Id, file, filetype, CometChatConstants.RECEIVER_TYPE_USER); + if (type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) + mediaMessage = new MediaMessage(Id, file, filetype, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); else - mediaMessage = new MediaMessage(Id, file, filetype, CometChatConstants.RECEIVER_TYPE_GROUP); + mediaMessage = new MediaMessage(Id, file, filetype, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); JSONObject jsonObject = new JSONObject(); try { @@ -1441,7 +1441,7 @@ private void sendMediaMessage(File file, String filetype) { mediaMessage.setMetadata(jsonObject); mediaMessage.setMuid(""+System.currentTimeMillis()); - mediaMessage.setCategory(CometChatConstants.CATEGORY_MESSAGE); + mediaMessage.setCategory(com.cometchat.pro.constants.CometChatConstants.CATEGORY_MESSAGE); mediaMessage.setSender(loggedInUser); if (messageAdapter != null) { @@ -1495,7 +1495,7 @@ public void onSuccess(User user) { isBlockedByMe = false; blockUserLayout.setVisibility(GONE); avatarUrl = user.getAvatar(); - if (user.getStatus().equals(CometChatConstants.USER_STATUS_ONLINE)) { + if (user.getStatus().equals(com.cometchat.pro.constants.CometChatConstants.USER_STATUS_ONLINE)) { tvStatus.setTextColor(getActivity().getResources().getColor(R.color.colorPrimary)); } @@ -1569,15 +1569,15 @@ public void onError(CometChatException e) { */ private void sendMessage(String message) { TextMessage textMessage; - if (type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) - textMessage = new TextMessage(Id, message, CometChatConstants.RECEIVER_TYPE_USER); + if (type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) + textMessage = new TextMessage(Id, message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); else - textMessage = new TextMessage(Id, message, CometChatConstants.RECEIVER_TYPE_GROUP); + textMessage = new TextMessage(Id, message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); sendTypingIndicator(true); Log.e(TAG, "sendMessage: "+textMessage ); - textMessage.setCategory(CometChatConstants.CATEGORY_MESSAGE); + textMessage.setCategory(com.cometchat.pro.constants.CometChatConstants.CATEGORY_MESSAGE); textMessage.setSender(loggedInUser); textMessage.setMuid(System.currentTimeMillis()+""); if (messageAdapter != null) { @@ -1641,10 +1641,10 @@ private void editMessage(BaseMessage baseMessage, String message) { isEdit = false; TextMessage textMessage; - if (baseMessage.getReceiverType().equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) - textMessage = new TextMessage(baseMessage.getReceiverUid(), message, CometChatConstants.RECEIVER_TYPE_USER); + if (baseMessage.getReceiverType().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) + textMessage = new TextMessage(baseMessage.getReceiverUid(), message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); else - textMessage = new TextMessage(baseMessage.getReceiverUid(), message, CometChatConstants.RECEIVER_TYPE_GROUP); + textMessage = new TextMessage(baseMessage.getReceiverUid(), message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); sendTypingIndicator(true); textMessage.setId(baseMessage.getId()); CometChat.editMessage(textMessage, new CometChat.CallbackListener() { @@ -1673,43 +1673,43 @@ private void replyMessage(BaseMessage baseMessage, String message) { isReply = false; try { TextMessage textMessage; - if (type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) - textMessage = new TextMessage(Id, message, CometChatConstants.RECEIVER_TYPE_USER); + if (type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) + textMessage = new TextMessage(Id, message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); else - textMessage = new TextMessage(Id, message, CometChatConstants.RECEIVER_TYPE_GROUP); + textMessage = new TextMessage(Id, message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); JSONObject jsonObject = new JSONObject(); JSONObject replyObject = new JSONObject(); - if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_MESSAGE)) { - if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { - replyObject.put("type",CometChatConstants.MESSAGE_TYPE_TEXT); + if (baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_MESSAGE)) { + if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { + replyObject.put("type", com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT); replyObject.put("message", ((TextMessage) baseMessage).getText()); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) { - replyObject.put("type",CometChatConstants.MESSAGE_TYPE_IMAGE); + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) { + replyObject.put("type", com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE); replyObject.put("message", "image"); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_VIDEO)) { - replyObject.put("type",CometChatConstants.MESSAGE_TYPE_VIDEO); + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO)) { + replyObject.put("type", com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO); replyObject.put("message", "video"); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_FILE)) { - replyObject.put("type",CometChatConstants.MESSAGE_TYPE_FILE); + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE)) { + replyObject.put("type", com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE); replyObject.put("message", "file"); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_AUDIO)) { - replyObject.put("type", CometChatConstants.MESSAGE_TYPE_AUDIO); + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO)) { + replyObject.put("type", com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO); replyObject.put("message", "audio"); } - } else if (baseMessage.getType().equals(StringContract.IntentStrings.LOCATION)) { - replyObject.put("type",StringContract.IntentStrings.LOCATION); + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.LOCATION)) { + replyObject.put("type", UIKitConstants.IntentStrings.LOCATION); replyObject.put("message","location"); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.POLLS)) { - replyObject.put("type",StringContract.IntentStrings.POLLS); + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.POLLS)) { + replyObject.put("type", UIKitConstants.IntentStrings.POLLS); replyObject.put("message",((CustomMessage)baseMessage).getCustomData().getString("question")); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.STICKERS)) { - replyObject.put("type",StringContract.IntentStrings.STICKERS); + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.STICKERS)) { + replyObject.put("type", UIKitConstants.IntentStrings.STICKERS); replyObject.put("message","Sticker"); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.WHITEBOARD)) { - replyObject.put("type",StringContract.IntentStrings.WHITEBOARD); + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WHITEBOARD)) { + replyObject.put("type", UIKitConstants.IntentStrings.WHITEBOARD); replyObject.put("message","whiteBoard"); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.WRITEBOARD)) { - replyObject.put("type",StringContract.IntentStrings.WRITEBOARD); + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WRITEBOARD)) { + replyObject.put("type", UIKitConstants.IntentStrings.WRITEBOARD); replyObject.put("message","writeboard"); } replyObject.put("name",baseMessage.getSender().getName()); @@ -1823,13 +1823,13 @@ public void onMemberAddedToGroup(Action action, User addedby, User userAdded, Gr * @see CometChat#addUserListener(String, CometChat.UserListener) */ private void addUserListener() { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { CometChat.addUserListener(TAG, new CometChat.UserListener() { @Override public void onUserOnline(User user) { Log.d(TAG, "onUserOnline: " + user.toString()); if (user.getUid().equals(Id)) { - status = CometChatConstants.USER_STATUS_ONLINE; + status = com.cometchat.pro.constants.CometChatConstants.USER_STATUS_ONLINE; tvStatus.setText(user.getStatus()); tvStatus.setTextColor(getResources().getColor(R.color.colorPrimary)); } @@ -1844,7 +1844,7 @@ public void onUserOffline(User user) { else tvStatus.setTextColor(getResources().getColor(android.R.color.black)); tvStatus.setText(user.getStatus()); - status = CometChatConstants.USER_STATUS_OFFLINE; + status = com.cometchat.pro.constants.CometChatConstants.USER_STATUS_OFFLINE; } } }); @@ -1858,7 +1858,7 @@ public void onUserOffline(User user) { * @param baseMessage is object of BaseMessage.class. It is message which is been marked as read. */ private void markMessageAsRead(BaseMessage baseMessage) { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) CometChat.markAsRead(baseMessage.getId(), baseMessage.getSender().getUid(), baseMessage.getReceiverType()); else CometChat.markAsRead(baseMessage.getId(), baseMessage.getReceiverUid(), baseMessage.getReceiverType()); @@ -1934,7 +1934,7 @@ public void onMessageDeleted(BaseMessage message) { private void setMessageReciept(MessageReceipt messageReceipt) { if (messageAdapter != null) { if (messageReceipt!=null && messageReceipt.getReceiptType()!=null && - messageReceipt.getReceivertype().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + messageReceipt.getReceivertype().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { if (Id!=null &&messageReceipt.getSender()!=null && messageReceipt.getSender().getUid().equals(Id)) { if (messageReceipt.getReceiptType().equals(MessageReceipt.RECEIPT_TYPE_DELIVERED)) messageAdapter.setDeliveryReceipts(messageReceipt); @@ -1946,7 +1946,7 @@ private void setMessageReciept(MessageReceipt messageReceipt) { } private void setTypingIndicator(TypingIndicator typingIndicator,boolean isShow) { - if (typingIndicator.getReceiverType().equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) { + if (typingIndicator.getReceiverType().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { Log.e(TAG, "onTypingStarted: " + typingIndicator); if (Id != null && Id.equalsIgnoreCase(typingIndicator.getSender().getUid())) { typingIndicator(typingIndicator, isShow); @@ -1960,7 +1960,7 @@ private void setTypingIndicator(TypingIndicator typingIndicator,boolean isShow) private void onMessageReceived(BaseMessage message) { MediaUtils.playSendSound(context,R.raw.incoming_message); - if (message.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (message.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { if (Id != null && Id.equalsIgnoreCase(message.getSender().getUid())) { setMessage(message); } else if(Id != null && Id.equalsIgnoreCase(message.getReceiverUid()) && message.getSender().getUid().equalsIgnoreCase(loggedInUser.getUid())) { @@ -2024,7 +2024,7 @@ private void checkSmartReply(BaseMessage lastMessage) { private void typingIndicator(TypingIndicator typingIndicator, boolean show) { if (messageAdapter != null) { if (show) { - if (typingIndicator.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (typingIndicator.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { if (typingIndicator.getMetadata() == null) { if (UISettings.isShowTypingIndicators()) tvStatus.setText("is Typing..."); @@ -2040,7 +2040,7 @@ private void typingIndicator(TypingIndicator typingIndicator, boolean show) { setLiveReaction(); } } else { - if (typingIndicator.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (typingIndicator.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { if (typingIndicator.getMetadata() == null) tvStatus.setText(status); else { @@ -2122,8 +2122,8 @@ public void onResume() { Log.d(TAG, "onResume: "); rvChatListView.removeItemDecoration(stickyHeaderDecoration); checkOnGoingCall(); - if (!(resultIntentCode==StringContract.RequestCode.GALLERY || - resultIntentCode==StringContract.RequestCode.CAMERA)) { + if (!(resultIntentCode== UIKitConstants.RequestCode.GALLERY || + resultIntentCode== UIKitConstants.RequestCode.CAMERA)) { messagesRequest = null; messageAdapter = null; fetchMessage(); @@ -2134,7 +2134,7 @@ public void onResume() { messageActionFragment.dismiss(); if (type != null) { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { if (UISettings.isShowUserPresence()) { addUserListener(); tvStatus.setText(status); @@ -2187,57 +2187,57 @@ else if (id == R.id.btn_unblock_user) { unblockUser(); } else if (id == R.id.chatList_toolbar) { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { Intent intent = new Intent(getContext(), CometChatUserDetailScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.UID, Id); - intent.putExtra(StringContract.IntentStrings.NAME, name); - intent.putExtra(StringContract.IntentStrings.AVATAR, avatarUrl); - intent.putExtra(StringContract.IntentStrings.IS_BLOCKED_BY_ME, isBlockedByMe); - intent.putExtra(StringContract.IntentStrings.STATUS, status); - intent.putExtra(StringContract.IntentStrings.TYPE, type); + intent.putExtra(UIKitConstants.IntentStrings.UID, Id); + intent.putExtra(UIKitConstants.IntentStrings.NAME, name); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, avatarUrl); + intent.putExtra(UIKitConstants.IntentStrings.IS_BLOCKED_BY_ME, isBlockedByMe); + intent.putExtra(UIKitConstants.IntentStrings.STATUS, status); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, type); startActivity(intent); } else { - Intent intent = new Intent(getContext(), CometChatGroupDetailScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID, Id); - intent.putExtra(StringContract.IntentStrings.NAME, name); - intent.putExtra(StringContract.IntentStrings.AVATAR, avatarUrl); - intent.putExtra(StringContract.IntentStrings.TYPE, type); - intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,groupType); - intent.putExtra(StringContract.IntentStrings.MEMBER_SCOPE, loggedInUserScope); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER, groupOwnerId); - intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,memberCount); - intent.putExtra(StringContract.IntentStrings.GROUP_DESC,groupDesc); - intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,groupPassword); + Intent intent = new Intent(getContext(), CometChatGroupDetailActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.GUID, Id); + intent.putExtra(UIKitConstants.IntentStrings.NAME, name); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, avatarUrl); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, type); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_TYPE,groupType); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE, loggedInUserScope); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER, groupOwnerId); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,memberCount); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_DESC,groupDesc); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD,groupPassword); startActivity(intent); } } } private void startForwardMessageActivity() { - Intent intent = new Intent(getContext(), CometChatForwardMessageScreenActivity.class); - if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_MESSAGE)) { - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,CometChatConstants.CATEGORY_MESSAGE); - if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { - intent.putExtra(CometChatConstants.MESSAGE_TYPE_TEXT, ((TextMessage) baseMessage).getText()); - intent.putExtra(StringContract.IntentStrings.TYPE, CometChatConstants.MESSAGE_TYPE_TEXT); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE) || - baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_AUDIO) || - baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_VIDEO) || - baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_FILE)) { - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME, ((MediaMessage) baseMessage).getAttachment().getFileName()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL, ((MediaMessage) baseMessage).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE, ((MediaMessage) baseMessage).getAttachment().getFileMimeType()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION, ((MediaMessage) baseMessage).getAttachment().getFileExtension()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE, ((MediaMessage) baseMessage).getAttachment().getFileSize()); - intent.putExtra(StringContract.IntentStrings.TYPE, baseMessage.getType()); - } - } else if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_CUSTOM)) { - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,CometChatConstants.CATEGORY_CUSTOM); - intent.putExtra(StringContract.IntentStrings.TYPE, StringContract.IntentStrings.LOCATION); + Intent intent = new Intent(getContext(), CometChatForwardMessageActivity.class); + if (baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_MESSAGE)) { + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY, com.cometchat.pro.constants.CometChatConstants.CATEGORY_MESSAGE); + if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { + intent.putExtra(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT, ((TextMessage) baseMessage).getText()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT); + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE) || + baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO) || + baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO) || + baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE)) { + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME, ((MediaMessage) baseMessage).getAttachment().getFileName()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL, ((MediaMessage) baseMessage).getAttachment().getFileUrl()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE, ((MediaMessage) baseMessage).getAttachment().getFileMimeType()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION, ((MediaMessage) baseMessage).getAttachment().getFileExtension()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE, ((MediaMessage) baseMessage).getAttachment().getFileSize()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, baseMessage.getType()); + } + } else if (baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CUSTOM)) { + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY, com.cometchat.pro.constants.CometChatConstants.CATEGORY_CUSTOM); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, UIKitConstants.IntentStrings.LOCATION); try { - intent.putExtra(StringContract.IntentStrings.LOCATION_LATITUDE, + intent.putExtra(UIKitConstants.IntentStrings.LOCATION_LATITUDE, ((CustomMessage)baseMessage).getCustomData().getDouble("latitude")); - intent.putExtra(StringContract.IntentStrings.LOCATION_LONGITUDE, + intent.putExtra(UIKitConstants.IntentStrings.LOCATION_LONGITUDE, ((CustomMessage)baseMessage).getCustomData().getDouble("longitude")); } catch (Exception e) { Log.e(TAG, "startForwardMessageActivityError: "+e.getMessage()); @@ -2248,7 +2248,7 @@ private void startForwardMessageActivity() { } private void shareMessage() { - if (baseMessage!=null && baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + if (baseMessage!=null && baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_TITLE,getResources().getString(R.string.app_name)); @@ -2256,7 +2256,7 @@ private void shareMessage() { shareIntent.setType("text/plain"); Intent intent = Intent.createChooser(shareIntent, getResources().getString(R.string.share_message)); startActivity(intent); - } else if (baseMessage!=null && baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) { + } else if (baseMessage!=null && baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) { String mediaName = ((MediaMessage)baseMessage).getAttachment().getFileName(); Glide.with(context).asBitmap().load(((MediaMessage)baseMessage).getAttachment().getFileUrl()).into(new SimpleTarget() { @Override @@ -2273,63 +2273,63 @@ public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition baseMessagesList) { Log.e(TAG, "setLongMessageClick: " + baseMessagesList); isReply = false; isEdit = false; - messageActionFragment = new MessageActionFragment(); + messageActionFragment = new CometChatMessageActions(); replyMessageLayout.setVisibility(GONE); editMessageLayout.setVisibility(GONE); boolean shareVisible = UISettings.isEnableShareCopyForward(); @@ -2362,24 +2362,24 @@ public void setLongMessageClick(List baseMessagesList) { List meetingMessageList = new ArrayList<>(); for (BaseMessage baseMessage : baseMessagesList) { - if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { textMessageList.add(baseMessage); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE) || - baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_VIDEO) || - baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_FILE) || - baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_AUDIO)){ + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE) || + baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO) || + baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE) || + baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO)){ mediaMessageList.add(baseMessage); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.LOCATION)) { + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.LOCATION)) { locationMessageList.add(baseMessage); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.STICKERS)) { + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.STICKERS)) { stickerMessageList.add(baseMessage); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.POLLS)) { + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.POLLS)) { pollsMessageList.add(baseMessage); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.WHITEBOARD)) { + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WHITEBOARD)) { whiteBoardMessageList.add(baseMessage); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.WRITEBOARD)) { + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WRITEBOARD)) { writeBoardMessageList.add(baseMessage); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.GROUP_CALL)) { + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.GROUP_CALL)) { meetingMessageList.add(baseMessage); } } @@ -2398,7 +2398,7 @@ public void setLongMessageClick(List baseMessagesList) { editVisible = UISettings.isEnableEditingMessage(); } else { editVisible = false; - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) { + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))) { deleteVisible = (UISettings.isEnableDeleteMessage() || UISettings.isAllowModeratorToDeleteMessages()); } else { deleteVisible = false; @@ -2435,7 +2435,7 @@ public void setLongMessageClick(List baseMessagesList) { deleteVisible = UISettings.isEnableDeleteMessage(); editVisible = false; } else { - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))){ + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))){ deleteVisible = UISettings.isEnableDeleteMessage(); } else { deleteVisible = false; @@ -2475,7 +2475,7 @@ public void setLongMessageClick(List baseMessagesList) { deleteVisible = UISettings.isEnableDeleteMessage(); editVisible = false; } else { - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))){ + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))){ deleteVisible = (UISettings.isEnableDeleteMessage() || UISettings.isAllowModeratorToDeleteMessages()); } else { deleteVisible = false; @@ -2515,7 +2515,7 @@ public void setLongMessageClick(List baseMessagesList) { if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) { deleteVisible = UISettings.isEnableDeleteMessage(); } else { - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))){ + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))){ deleteVisible = (UISettings.isEnableDeleteMessage() || UISettings.isAllowModeratorToDeleteMessages()); } else { deleteVisible = false; @@ -2542,7 +2542,7 @@ public void setLongMessageClick(List baseMessagesList) { if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) deleteVisible = UISettings.isEnableDeleteMessage(); else { - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))){ + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))){ deleteVisible = (UISettings.isEnableDeleteMessage() || UISettings.isAllowModeratorToDeleteMessages()); } else { deleteVisible = false; @@ -2569,7 +2569,7 @@ public void setLongMessageClick(List baseMessagesList) { if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) deleteVisible = UISettings.isEnableDeleteMessage(); else { - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))){ + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))){ deleteVisible = (UISettings.isEnableDeleteMessage() || UISettings.isAllowModeratorToDeleteMessages()); } else { deleteVisible = false; @@ -2597,7 +2597,7 @@ public void setLongMessageClick(List baseMessagesList) { if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) deleteVisible = UISettings.isEnableDeleteMessage(); else { - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))){ + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))){ deleteVisible = (UISettings.isEnableDeleteMessage() || UISettings.isAllowModeratorToDeleteMessages()); } else { deleteVisible = false; @@ -2622,7 +2622,7 @@ public void setLongMessageClick(List baseMessagesList) { if (basemessage.getSender().getUid().equals(CometChat.getLoggedInUser().getUid())) deleteVisible = UISettings.isEnableDeleteMessage(); else { - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))){ + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))){ deleteVisible = (UISettings.isEnableDeleteMessage() || UISettings.isAllowModeratorToDeleteMessages()); } else { deleteVisible = false; @@ -2645,7 +2645,7 @@ public void setLongMessageClick(List baseMessagesList) { bundle.putBoolean("retryVisible",retryVisible); if (CometChat.isExtensionEnabled("reactions")) bundle.putBoolean("isReactionVisible",reactionVisible); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP) && + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP) && baseMessage.getSender().getUid().equals(loggedInUser.getUid())) bundle.putBoolean("messageInfoVisible",true); bundle.putString("type", CometChatMessageListActivity.class.getName()); @@ -2656,7 +2656,7 @@ public void setLongMessageClick(List baseMessagesList) { messageActionFragment.show(getFragmentManager(), messageActionFragment.getTag()); } } - messageActionFragment.setMessageActionListener(new MessageActionFragment.MessageActionListener() { + messageActionFragment.setMessageActionListener(new CometChatMessageActions.MessageActionListener() { @Override public void onThreadMessageClick() { startThreadActivity(); @@ -2664,7 +2664,7 @@ public void onThreadMessageClick() { @Override public void onEditMessageClick() { - if (baseMessage!=null&&baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + if (baseMessage!=null&&baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { isEdit = true; isReply = false; tvMessageTitle.setText(getResources().getString(R.string.edit_message)); @@ -2724,47 +2724,47 @@ public void onCopyMessageClick() { @Override public void onMessageInfoClick() { Intent intent = new Intent(context, CometChatMessageInfoScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { - intent.putExtra(StringContract.IntentStrings.TEXTMESSAGE, + intent.putExtra(UIKitConstants.IntentStrings.ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { + intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE, Extensions.checkProfanityMessage(baseMessage)); - } else if(baseMessage.getCategory().equals(CometChatConstants.CATEGORY_CUSTOM)){ + } else if(baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CUSTOM)){ if (((CustomMessage)baseMessage).getCustomData()!=null) - intent.putExtra(StringContract.IntentStrings.CUSTOM_MESSAGE, + intent.putExtra(UIKitConstants.IntentStrings.CUSTOM_MESSAGE, ((CustomMessage) baseMessage).getCustomData().toString()); - if (baseMessage.getType().equals(StringContract.IntentStrings.LOCATION)) { - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE, - StringContract.IntentStrings.LOCATION); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.STICKERS)) { - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,StringContract.IntentStrings.STICKERS); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.WHITEBOARD)) { - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE, - StringContract.IntentStrings.WHITEBOARD); - intent.putExtra(StringContract.IntentStrings.TEXTMESSAGE,Extensions.getWhiteBoardUrl(baseMessage)); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.WRITEBOARD)) { - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE, - StringContract.IntentStrings.WRITEBOARD); - intent.putExtra(StringContract.IntentStrings.TEXTMESSAGE,Extensions.getWriteBoardUrl(baseMessage)); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.GROUP_CALL)) { - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE, - StringContract.IntentStrings.GROUP_CALL); + if (baseMessage.getType().equals(UIKitConstants.IntentStrings.LOCATION)) { + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, + UIKitConstants.IntentStrings.LOCATION); + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.STICKERS)) { + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.STICKERS); + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WHITEBOARD)) { + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, + UIKitConstants.IntentStrings.WHITEBOARD); + intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE,Extensions.getWhiteBoardUrl(baseMessage)); + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WRITEBOARD)) { + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, + UIKitConstants.IntentStrings.WRITEBOARD); + intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE,Extensions.getWriteBoardUrl(baseMessage)); + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.GROUP_CALL)) { + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, + UIKitConstants.IntentStrings.GROUP_CALL); } else { - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE, - StringContract.IntentStrings.POLLS); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, + UIKitConstants.IntentStrings.POLLS); } } else { boolean isImageNotSafe = Extensions.getImageModeration(context,baseMessage); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL, + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL, ((MediaMessage)baseMessage).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME, + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME, ((MediaMessage)baseMessage).getAttachment().getFileName()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE, + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE, ((MediaMessage)baseMessage).getAttachment().getFileSize()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION, + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION, ((MediaMessage)baseMessage).getAttachment().getFileExtension()); - intent.putExtra(StringContract.IntentStrings.IMAGE_MODERATION,isImageNotSafe); + intent.putExtra(UIKitConstants.IntentStrings.IMAGE_MODERATION,isImageNotSafe); } context.startActivity(intent); } @@ -2772,8 +2772,8 @@ public void onMessageInfoClick() { @Override public void onReactionClick(Reaction reaction) { if (reaction.getName().equals("add_emoji")) { - ReactionDialog reactionDialog = new ReactionDialog(); - reactionDialog.setOnEmojiClick(new OnEmojiClickListener() { + CometChatReactionDialog reactionDialog = new CometChatReactionDialog(); + reactionDialog.setOnEmojiClick(new OnReactionClickListener() { @Override public void onEmojiClicked(Reaction emojicon) { sendReaction(emojicon); @@ -2834,7 +2834,7 @@ public void onError(CometChatException e) { public void onRetryClick() { if (baseMessage!=null) { messageAdapter.remove(baseMessage); - if (baseMessage.getType().equalsIgnoreCase(CometChatConstants.MESSAGE_TYPE_TEXT)) + if (baseMessage.getType().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) sendMessage(((TextMessage)baseMessage).getText()); } } @@ -2873,26 +2873,26 @@ private void replyMessage() { replyTitle.setText(baseMessage.getSender().getName()); replyMessage.setCompoundDrawablesWithIntrinsicBounds(0,0,0,0); replyMedia.setVisibility(View.VISIBLE); - if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { replyMessage.setText(((TextMessage) baseMessage).getText()); replyMedia.setVisibility(GONE); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) { + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) { replyMessage.setText(getResources().getString(R.string.shared_a_image)); Glide.with(context).load(((MediaMessage) baseMessage).getAttachment().getFileUrl()).into(replyMedia); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_AUDIO)) { + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO)) { String messageStr = String.format(getResources().getString(R.string.shared_a_audio), Utils.getFileSize(((MediaMessage) baseMessage).getAttachment().getFileSize())); replyMessage.setText(messageStr); replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_library_music_24dp, 0, 0, 0); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_VIDEO)) { + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO)) { replyMessage.setText(getResources().getString(R.string.shared_a_video)); Glide.with(context).load(((MediaMessage) baseMessage).getAttachment().getFileUrl()).into(replyMedia); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_FILE)) { + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE)) { String messageStr = String.format(getResources().getString(R.string.shared_a_file), Utils.getFileSize(((MediaMessage) baseMessage).getAttachment().getFileSize())); replyMessage.setText(messageStr); replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_insert_drive_file_black_24dp, 0, 0, 0); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.LOCATION)) { + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.LOCATION)) { try { JSONObject jsonObject = ((CustomMessage) baseMessage).getCustomData(); String messageStr = String.format(getString(R.string.shared_location), @@ -2902,14 +2902,14 @@ private void replyMessage() { }catch (Exception e) { Log.e(TAG, "replyMessageError: "+e.getMessage() ); } - } else if (baseMessage.getType().equals(StringContract.IntentStrings.STICKERS)) { + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.STICKERS)) { replyMessage.setText(getResources().getString(R.string.shared_a_sticker)); try { Glide.with(context).load(((CustomMessage) baseMessage).getCustomData().getString("url")).into(replyMedia); } catch (JSONException e) { e.printStackTrace(); } - } else if (baseMessage.getType().equals(StringContract.IntentStrings.POLLS)) { + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.POLLS)) { try { JSONObject jsonObject = ((CustomMessage) baseMessage).getCustomData(); String messageStr = String.format(getString(R.string.shared_a_polls),jsonObject.getString("question")); @@ -2917,11 +2917,11 @@ private void replyMessage() { }catch (Exception e) { Log.e(TAG, "replyMessageError: "+e.getMessage() ); } - } else if (baseMessage.getType().equals(StringContract.IntentStrings.WHITEBOARD)) { + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WHITEBOARD)) { replyMessage.setText(getString(R.string.shared_a_whiteboard)); replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_whiteboard_24dp, 0, 0, 0); - } else if (baseMessage.getType().equals(StringContract.IntentStrings.WRITEBOARD)) { + } else if (baseMessage.getType().equals(UIKitConstants.IntentStrings.WRITEBOARD)) { replyMessage.setText(getString(R.string.shared_a_writeboard)); replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_writeboard_24dp, 0, 0, 0); diff --git a/uikit/src/main/java/screen/messagelist/CometChatMessageListActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_list/CometChatMessageListActivity.java similarity index 62% rename from uikit/src/main/java/screen/messagelist/CometChatMessageListActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_list/CometChatMessageListActivity.java index 4917d6ee..ec89a954 100644 --- a/uikit/src/main/java/screen/messagelist/CometChatMessageListActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_list/CometChatMessageListActivity.java @@ -1,4 +1,4 @@ -package screen.messagelist; +package com.cometchat.pro.uikit.ui_components.messages.message_list; import android.content.DialogInterface; import android.content.Intent; @@ -15,17 +15,15 @@ import androidx.emoji.text.EmojiCompat; import androidx.fragment.app.Fragment; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.uikit.R; import java.util.List; -import adapter.MessageAdapter; -import constant.StringContract; -import listeners.MessageActionCloseListener; -import listeners.OnMessageLongClick; -import com.cometchat.pro.uikit.Settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_components.messages.message_actions.listener.MessageActionCloseListener; +import com.cometchat.pro.uikit.ui_components.messages.message_actions.listener.OnMessageLongClick; +import com.cometchat.pro.uikit.ui_settings.UISettings; /** @@ -38,8 +36,8 @@ It passes parameters like UID (userID) ,AVATAR (userAvatar) ,NAME (userName) ,ST It passes parameters like GUID (groupID) ,AVATAR (groupIcon) ,NAME (groupName) ,GROUP_OWNER (groupOwner) to CometChatMessageScreen.class if TYPE is CometChatConstant.RECEIVER_TYPE_GROUP - @see CometChatConstants - @see CometChatMessageScreen + @see com.cometchat.pro.constants.CometChatConstants + @see CometChatMessageList */ @@ -50,7 +48,7 @@ public class CometChatMessageListActivity extends AppCompatActivity implements M private OnMessageLongClick messageLongClick; - Fragment fragment = new CometChatMessageScreen(); + Fragment fragment = new CometChatMessageList(); @Override protected void onCreate(Bundle savedInstanceState) { @@ -66,23 +64,23 @@ protected void onCreate(Bundle savedInstanceState) { if (getIntent()!=null) { Bundle bundle = new Bundle(); - bundle.putString(StringContract.IntentStrings.AVATAR, getIntent().getStringExtra(StringContract.IntentStrings.AVATAR)); - bundle.putString(StringContract.IntentStrings.NAME, getIntent().getStringExtra(StringContract.IntentStrings.NAME)); - bundle.putString(StringContract.IntentStrings.TYPE,getIntent().getStringExtra(StringContract.IntentStrings.TYPE)); + bundle.putString(UIKitConstants.IntentStrings.AVATAR, getIntent().getStringExtra(UIKitConstants.IntentStrings.AVATAR)); + bundle.putString(UIKitConstants.IntentStrings.NAME, getIntent().getStringExtra(UIKitConstants.IntentStrings.NAME)); + bundle.putString(UIKitConstants.IntentStrings.TYPE,getIntent().getStringExtra(UIKitConstants.IntentStrings.TYPE)); - if (getIntent().hasExtra(StringContract.IntentStrings.TYPE)&& - getIntent().getStringExtra(StringContract.IntentStrings.TYPE).equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (getIntent().hasExtra(UIKitConstants.IntentStrings.TYPE)&& + getIntent().getStringExtra(UIKitConstants.IntentStrings.TYPE).equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { - bundle.putString(StringContract.IntentStrings.UID, getIntent().getStringExtra(StringContract.IntentStrings.UID)); - bundle.putString(StringContract.IntentStrings.STATUS, getIntent().getStringExtra(StringContract.IntentStrings.STATUS)); + bundle.putString(UIKitConstants.IntentStrings.UID, getIntent().getStringExtra(UIKitConstants.IntentStrings.UID)); + bundle.putString(UIKitConstants.IntentStrings.STATUS, getIntent().getStringExtra(UIKitConstants.IntentStrings.STATUS)); }else { - bundle.putString(StringContract.IntentStrings.GUID, getIntent().getStringExtra(StringContract.IntentStrings.GUID)); - bundle.putString(StringContract.IntentStrings.GROUP_OWNER,getIntent().getStringExtra(StringContract.IntentStrings.GROUP_OWNER)); - bundle.putInt(StringContract.IntentStrings.MEMBER_COUNT,getIntent().getIntExtra(StringContract.IntentStrings.MEMBER_COUNT,0)); - bundle.putString(StringContract.IntentStrings.GROUP_TYPE,getIntent().getStringExtra(StringContract.IntentStrings.GROUP_TYPE)); - bundle.putString(StringContract.IntentStrings.GROUP_DESC,getIntent().getStringExtra(StringContract.IntentStrings.GROUP_DESC)); - bundle.putString(StringContract.IntentStrings.GROUP_PASSWORD,getIntent().getStringExtra(StringContract.IntentStrings.GROUP_PASSWORD)); + bundle.putString(UIKitConstants.IntentStrings.GUID, getIntent().getStringExtra(UIKitConstants.IntentStrings.GUID)); + bundle.putString(UIKitConstants.IntentStrings.GROUP_OWNER,getIntent().getStringExtra(UIKitConstants.IntentStrings.GROUP_OWNER)); + bundle.putInt(UIKitConstants.IntentStrings.MEMBER_COUNT,getIntent().getIntExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,0)); + bundle.putString(UIKitConstants.IntentStrings.GROUP_TYPE,getIntent().getStringExtra(UIKitConstants.IntentStrings.GROUP_TYPE)); + bundle.putString(UIKitConstants.IntentStrings.GROUP_DESC,getIntent().getStringExtra(UIKitConstants.IntentStrings.GROUP_DESC)); + bundle.putString(UIKitConstants.IntentStrings.GROUP_PASSWORD,getIntent().getStringExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD)); } fragment.setArguments(bundle); getSupportFragmentManager().beginTransaction().replace(R.id.ChatFragment, fragment).commit(); diff --git a/uikit/src/main/java/adapter/MessageAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_list/MessageAdapter.java similarity index 85% rename from uikit/src/main/java/adapter/MessageAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_list/MessageAdapter.java index 0c17da5c..3835a31f 100644 --- a/uikit/src/main/java/adapter/MessageAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/message_list/MessageAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.messages.message_list; import android.app.AlertDialog; import android.content.Context; @@ -37,7 +37,6 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.request.target.CustomTarget; import com.bumptech.glide.request.transition.Transition; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.Call; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; @@ -45,13 +44,17 @@ import com.cometchat.pro.models.Attachment; import com.cometchat.pro.models.CustomMessage; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Avatar; + +import com.cometchat.pro.uikit.ui_components.messages.extensions.Extensions; +import com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar.CometChatAvatar; import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.MediaMessage; import com.cometchat.pro.models.MessageReceipt; import com.cometchat.pro.models.TextMessage; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.Settings.UISettings; + +import com.cometchat.pro.uikit.ui_resources.utils.pattern_utils.PatternUtils; +import com.cometchat.pro.uikit.ui_settings.UISettings; import com.google.android.material.button.MaterialButton; import com.google.android.material.chip.Chip; import com.google.android.material.chip.ChipGroup; @@ -64,17 +67,15 @@ import java.util.HashMap; import java.util.List; -import constant.StringContract; -import listeners.StickyHeaderAdapter; -import screen.CometChatMediaViewActivity; -import screen.CometChatReactionInfoScreenActivity; -import screen.messagelist.CometChatMessageListActivity; -import screen.threadconversation.CometChatThreadMessageActivity; -import utils.CallUtils; -import utils.Extensions; -import utils.FontUtils; -import utils.MediaUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderAdapter; +import com.cometchat.pro.uikit.ui_components.messages.media_view.CometChatMediaViewActivity; +import com.cometchat.pro.uikit.ui_components.messages.extensions.Reactions.CometChatReactionInfoActivity; +import com.cometchat.pro.uikit.ui_components.messages.thread_message_list.CometChatThreadMessageListActivity; +import com.cometchat.pro.uikit.ui_resources.utils.CallUtils; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.MediaUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - MessageAdapter is a subclass of RecyclerView Adapter which is used to display @@ -455,7 +456,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) prevMessage = messageList.get(i -1); } - isPrevActionMessage = (prevMessage!=null && (prevMessage.getCategory().equals(CometChatConstants.CATEGORY_ACTION) || prevMessage.getCategory().equals(CometChatConstants.CATEGORY_CALL))); + isPrevActionMessage = (prevMessage!=null && (prevMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_ACTION) || prevMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL))); isNextMessage = (nextMessage!=null && baseMessage.getSender().getUid().equals(nextMessage.getSender().getUid())); isPreviousMessage = (prevMessage!=null && baseMessage.getSender().getUid().equals(prevMessage.getSender().getUid())); @@ -558,10 +559,10 @@ else if(!isNextMessage) { private void setPollsData(PollMessageViewHolder viewHolder, int i) { BaseMessage baseMessage = messageList.get(i); if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); - } else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + } else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); viewHolder.ivUser.setVisibility(View.VISIBLE); @@ -580,37 +581,37 @@ private void setPollsData(PollMessageViewHolder viewHolder, int i) { viewHolder.tvThreadReplyCount.setVisibility(View.GONE); } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); // intent.putExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE,baseMessage.toString()); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO, Extensions.getReactionsOnMessage(baseMessage)); try { JSONObject option = ((CustomMessage) baseMessage).getCustomData().getJSONObject("options"); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE, StringContract.IntentStrings.POLLS); - intent.putExtra(StringContract.IntentStrings.POLL_QUESTION, + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.POLLS); + intent.putExtra(UIKitConstants.IntentStrings.POLL_QUESTION, ((CustomMessage) baseMessage).getCustomData().getString("question")); - intent.putExtra(StringContract.IntentStrings.POLL_OPTION,option.toString()); - intent.putExtra(StringContract.IntentStrings.POLL_VOTE_COUNT,Extensions.getVoteCount(baseMessage)); - intent.putExtra(StringContract.IntentStrings.POLL_RESULT, Extensions.getVoterInfo(baseMessage,option.length())); + intent.putExtra(UIKitConstants.IntentStrings.POLL_OPTION,option.toString()); + intent.putExtra(UIKitConstants.IntentStrings.POLL_VOTE_COUNT,Extensions.getVoteCount(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.POLL_RESULT, Extensions.getVoterInfo(baseMessage,option.length())); }catch (Exception e) { Log.e(TAG, "startThreadActivityError: "+e.getMessage()); } - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); @@ -698,7 +699,7 @@ public void onError(CometChatException e) { } catch (Exception e) { Log.e(TAG, "setPollsData: "+e.getMessage()+"\n"+viewHolder.totalCount.getText()); } - Utils.setHyperLinkSupport(context,viewHolder.tvQuestion); + PatternUtils.setHyperLinkSupport(context,viewHolder.tvQuestion); showMessageTime(viewHolder,baseMessage); // if (messageList.get(messageList.size()-1).equals(baseMessage)) // { @@ -730,11 +731,11 @@ private void setGroupCallMessageData(GroupCallMessageViewHolder viewHolder, int BaseMessage baseMessage = messageList.get(i); if (baseMessage!=null) { if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); } - else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); viewHolder.ivUser.setVisibility(View.VISIBLE); @@ -769,28 +770,28 @@ public void onClick(View v) { viewHolder.tvThreadReplyCount.setVisibility(View.GONE); } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - - intent.putExtra(StringContract.IntentStrings.TEXTMESSAGE,Extensions.getWriteBoardUrl(baseMessage)); - - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + + intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE,Extensions.getWriteBoardUrl(baseMessage)); + + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); @@ -834,11 +835,11 @@ private void setWriteBoardData(WriteBoardViewHolder viewHolder,int i) { BaseMessage baseMessage = messageList.get(i); if (baseMessage!=null) { if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); } - else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); @@ -871,28 +872,28 @@ public void onClick(View v) { viewHolder.tvThreadReplyCount.setVisibility(View.GONE); } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - - intent.putExtra(StringContract.IntentStrings.TEXTMESSAGE,Extensions.getWhiteBoardUrl(baseMessage)); - - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + + intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE,Extensions.getWhiteBoardUrl(baseMessage)); + + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); @@ -936,11 +937,11 @@ private void setWhiteBoardData(WhiteBoardViewHolder viewHolder,int i) { BaseMessage baseMessage = messageList.get(i); if (baseMessage!=null) { if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); } - else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); @@ -976,28 +977,28 @@ public void onClick(View v) { viewHolder.tvThreadReplyCount.setVisibility(View.GONE); } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - - intent.putExtra(StringContract.IntentStrings.TEXTMESSAGE,Extensions.getWriteBoardUrl(baseMessage)); - - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + + intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE,Extensions.getWriteBoardUrl(baseMessage)); + + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); @@ -1049,10 +1050,10 @@ public boolean onLongClick(View view) { private void setLocationData(LocationMessageViewHolder viewHolder, int i) { BaseMessage baseMessage = messageList.get(i); if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); - } else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + } else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); viewHolder.ivUser.setVisibility(View.VISIBLE); @@ -1071,35 +1072,35 @@ private void setLocationData(LocationMessageViewHolder viewHolder, int i) { viewHolder.tvThreadReplyCount.setVisibility(View.GONE); } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); // intent.putExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE,baseMessage.toString()); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); try { - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE, StringContract.IntentStrings.LOCATION); - intent.putExtra(StringContract.IntentStrings.LOCATION_LATITUDE, + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.LOCATION); + intent.putExtra(UIKitConstants.IntentStrings.LOCATION_LATITUDE, ((CustomMessage) baseMessage).getCustomData().getDouble("latitude")); - intent.putExtra(StringContract.IntentStrings.LOCATION_LONGITUDE, + intent.putExtra(UIKitConstants.IntentStrings.LOCATION_LONGITUDE, ((CustomMessage) baseMessage).getCustomData().getDouble("longitude")); }catch (Exception e) { Log.e(TAG, "startThreadActivityError: "+e.getMessage()); } - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); @@ -1107,7 +1108,7 @@ private void setLocationData(LocationMessageViewHolder viewHolder, int i) { LATITUDE = ((CustomMessage) baseMessage).getCustomData().getDouble("latitude"); LONGITUDE = ((CustomMessage) baseMessage).getCustomData().getDouble("longitude"); viewHolder.tvAddress.setText(Utils.getAddress(context, LATITUDE, LONGITUDE)); - String mapUrl = StringContract.MapUrl.MAPS_URL +LATITUDE+","+LONGITUDE+"&key="+ StringContract.MapUrl.MAP_ACCESS_KEY; + String mapUrl = UIKitConstants.MapUrl.MAPS_URL +LATITUDE+","+LONGITUDE+"&key="+ UIKitConstants.MapUrl.MAP_ACCESS_KEY; Glide.with(context) .load(mapUrl) .diskCacheStrategy(DiskCacheStrategy.ALL) @@ -1191,10 +1192,10 @@ private void setAudioData(AudioMessageViewHolder viewHolder, int i) { if (baseMessage!=null&&baseMessage.getDeletedAt()==0) { if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { viewHolder.playBtn.setImageTintList(ColorStateList.valueOf(context.getResources().getColor(R.color.textColorWhite))); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); - } else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + } else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); viewHolder.ivUser.setVisibility(View.VISIBLE); @@ -1216,30 +1217,30 @@ private void setAudioData(AudioMessageViewHolder viewHolder, int i) { viewHolder.tvThreadReplyCount.setVisibility(View.GONE); } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); // intent.putExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE,baseMessage.toString()); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((MediaMessage)baseMessage).getAttachment().getFileName()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,((MediaMessage)baseMessage).getAttachment().getFileExtension()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((MediaMessage)baseMessage).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,((MediaMessage)baseMessage).getAttachment().getFileSize()); - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((MediaMessage)baseMessage).getAttachment().getFileName()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,((MediaMessage)baseMessage).getAttachment().getFileExtension()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((MediaMessage)baseMessage).getAttachment().getFileUrl()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,((MediaMessage)baseMessage).getAttachment().getFileSize()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); @@ -1258,13 +1259,13 @@ private void setAudioData(AudioMessageViewHolder viewHolder, int i) { @Override public void onClick(View v) { Intent intent = new Intent(context,CometChatMediaViewActivity.class); - intent.putExtra(StringContract.IntentStrings.MEDIA_SIZE, + intent.putExtra(UIKitConstants.IntentStrings.MEDIA_SIZE, ((MediaMessage)baseMessage).getAttachment().getFileSize()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,CometChatConstants.MESSAGE_TYPE_AUDIO); - intent.putExtra(StringContract.IntentStrings.INTENT_MEDIA_MESSAGE, + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO); + intent.putExtra(UIKitConstants.IntentStrings.INTENT_MEDIA_MESSAGE, ((MediaMessage)baseMessage).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); context.startActivity(intent); } }); @@ -1304,10 +1305,10 @@ private void setFileData(FileMessageViewHolder viewHolder, int i) { if (baseMessage!=null&&baseMessage.getDeletedAt()==0) { if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); - } else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + } else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); viewHolder.ivUser.setVisibility(View.VISIBLE); @@ -1333,30 +1334,30 @@ private void setFileData(FileMessageViewHolder viewHolder, int i) { viewHolder.tvThreadReplyCount.setVisibility(View.GONE); } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); // intent.putExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE,baseMessage.toString()); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((MediaMessage)baseMessage).getAttachment().getFileName()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,((MediaMessage)baseMessage).getAttachment().getFileExtension()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((MediaMessage)baseMessage).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,((MediaMessage)baseMessage).getAttachment().getFileSize()); - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((MediaMessage)baseMessage).getAttachment().getFileName()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,((MediaMessage)baseMessage).getAttachment().getFileExtension()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((MediaMessage)baseMessage).getAttachment().getFileUrl()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,((MediaMessage)baseMessage).getAttachment().getFileSize()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); @@ -1414,10 +1415,10 @@ private void setImageData(ImageMessageViewHolder viewHolder, int i) { BaseMessage baseMessage = messageList.get(i); if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); - } else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + } else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); viewHolder.ivUser.setVisibility(View.VISIBLE); @@ -1471,30 +1472,30 @@ private void setImageData(ImageMessageViewHolder viewHolder, int i) { } } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); // intent.putExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE,baseMessage.toString()); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((MediaMessage)baseMessage).getAttachment().getFileName()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,((MediaMessage)baseMessage).getAttachment().getFileExtension()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((MediaMessage)baseMessage).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,((MediaMessage)baseMessage).getAttachment().getFileSize()); - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((MediaMessage)baseMessage).getAttachment().getFileName()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,((MediaMessage)baseMessage).getAttachment().getFileExtension()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((MediaMessage)baseMessage).getAttachment().getFileUrl()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,((MediaMessage)baseMessage).getAttachment().getFileSize()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); @@ -1579,12 +1580,12 @@ public void onLoadCleared(@Nullable Drawable placeholder) { private void openMediaViewActivity(BaseMessage baseMessage) { if (((MediaMessage)baseMessage).getAttachment()!=null) { Intent intent = new Intent(context, CometChatMediaViewActivity.class); - intent.putExtra(StringContract.IntentStrings.NAME, baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.UID, baseMessage.getSender().getUid()); - intent.putExtra(StringContract.IntentStrings.SENTAT, baseMessage.getSentAt()); - intent.putExtra(StringContract.IntentStrings.INTENT_MEDIA_MESSAGE, + intent.putExtra(UIKitConstants.IntentStrings.NAME, baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.UID, baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT, baseMessage.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.INTENT_MEDIA_MESSAGE, ((MediaMessage) baseMessage).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE, baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, baseMessage.getType()); context.startActivity(intent); } } @@ -1605,10 +1606,10 @@ private void setStickerData(StickerMessageViewHolder viewHolder, int i) { BaseMessage baseMessage = messageList.get(i); if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); - } else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + } else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); viewHolder.ivUser.setVisibility(View.VISIBLE); @@ -1636,32 +1637,32 @@ private void setStickerData(StickerMessageViewHolder viewHolder, int i) { viewHolder.tvThreadReplyCount.setVisibility(View.GONE); } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); // intent.putExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE,baseMessage.toString()); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,StringContract.IntentStrings.STICKERS); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, UIKitConstants.IntentStrings.STICKERS); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); try { - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((CustomMessage)baseMessage).getCustomData().getString("name")); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((CustomMessage)baseMessage).getCustomData().getString("url")); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((CustomMessage)baseMessage).getCustomData().getString("name")); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((CustomMessage)baseMessage).getCustomData().getString("url")); } catch (JSONException e) { e.printStackTrace(); } - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); @@ -1698,10 +1699,10 @@ private void setVideoData(VideoMessageViewHolder viewHolder, int i) { BaseMessage baseMessage = messageList.get(i); if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); - } else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + } else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); viewHolder.ivUser.setVisibility(View.VISIBLE); @@ -1723,30 +1724,30 @@ private void setVideoData(VideoMessageViewHolder viewHolder, int i) { viewHolder.tvThreadReplyCount.setVisibility(View.GONE); } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); // intent.putExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE,baseMessage.toString()); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((MediaMessage)baseMessage).getAttachment().getFileName()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,((MediaMessage)baseMessage).getAttachment().getFileExtension()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((MediaMessage)baseMessage).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,((MediaMessage)baseMessage).getAttachment().getFileSize()); - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((MediaMessage)baseMessage).getAttachment().getFileName()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,((MediaMessage)baseMessage).getAttachment().getFileExtension()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((MediaMessage)baseMessage).getAttachment().getFileUrl()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,((MediaMessage)baseMessage).getAttachment().getFileSize()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); @@ -1798,10 +1799,10 @@ private void setDeleteData(DeleteMessageViewHolder viewHolder, int i) { BaseMessage baseMessage = messageList.get(i); if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); - } else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + } else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); @@ -1856,30 +1857,30 @@ private void setActionData(ActionMessageViewHolder viewHolder, int i) { viewHolder.textView.setTypeface(fontUtils.getTypeFace(FontUtils.robotoMedium)); if (baseMessage instanceof Action) { String actionMessage = ""; - if (((Action) baseMessage).getAction().equals(CometChatConstants.ActionKeys.ACTION_JOINED)) + if (((Action) baseMessage).getAction().equals(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_JOINED)) actionMessage = ((User)((Action) baseMessage).getActioBy()).getName()+" "+context.getString(R.string.joined); - else if (((Action)baseMessage).getAction().equals(CometChatConstants.ActionKeys.ACTION_MEMBER_ADDED)) + else if (((Action)baseMessage).getAction().equals(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_MEMBER_ADDED)) actionMessage = ((User)((Action) baseMessage).getActioBy()).getName()+" " +context.getString(R.string.added)+" "+((User)((Action) baseMessage).getActionOn()).getName(); - else if (((Action) baseMessage).getAction().equals(CometChatConstants.ActionKeys.ACTION_KICKED)) + else if (((Action) baseMessage).getAction().equals(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_KICKED)) actionMessage = ((User)((Action) baseMessage).getActioBy()).getName()+" " +context.getString(R.string.kicked_by)+" "+((User)((Action) baseMessage).getActionOn()).getName(); - else if (((Action) baseMessage).getAction().equals(CometChatConstants.ActionKeys.ACTION_BANNED)) + else if (((Action) baseMessage).getAction().equals(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_BANNED)) actionMessage = ((User)((Action) baseMessage).getActioBy()).getName()+" " +context.getString(R.string.ban)+" "+((User)((Action) baseMessage).getActionOn()).getName(); - else if (((Action) baseMessage).getAction().equals(CometChatConstants.ActionKeys.ACTION_UNBANNED)) + else if (((Action) baseMessage).getAction().equals(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_UNBANNED)) actionMessage = ((User)((Action) baseMessage).getActioBy()).getName()+" " +context.getString(R.string.unban)+" "+((User)((Action) baseMessage).getActionOn()).getName(); - else if (((Action) baseMessage).getAction().equals(CometChatConstants.ActionKeys.ACTION_LEFT)) + else if (((Action) baseMessage).getAction().equals(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_LEFT)) actionMessage = ((User)((Action)baseMessage).getActioBy()).getName()+" "+context.getString(R.string.left); - else if (((Action) baseMessage).getAction().equals(CometChatConstants.ActionKeys.ACTION_SCOPE_CHANGED)) - if (((Action)baseMessage).getNewScope().equals(CometChatConstants.SCOPE_MODERATOR)) { + else if (((Action) baseMessage).getAction().equals(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_SCOPE_CHANGED)) + if (((Action)baseMessage).getNewScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR)) { actionMessage = ((User) ((Action) baseMessage).getActioBy()).getName() + " " + context.getString(R.string.made) + " " + ((User) ((Action) baseMessage).getActionOn()).getName() + " " + context.getString(R.string.moderator); - } else if (((Action)baseMessage).getNewScope().equals(CometChatConstants.SCOPE_ADMIN)) { + } else if (((Action)baseMessage).getNewScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN)) { actionMessage = ((User) ((Action) baseMessage).getActioBy()).getName() + " " + context.getString(R.string.made) + " " + ((User) ((Action) baseMessage).getActionOn()).getName() + " " + context.getString(R.string.admin); - } else if (((Action)baseMessage).getNewScope().equals(CometChatConstants.SCOPE_PARTICIPANT)) { + } else if (((Action)baseMessage).getNewScope().equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_PARTICIPANT)) { actionMessage = ((User) ((Action) baseMessage).getActioBy()).getName() + " " + context.getString(R.string.made) + " " + ((User) ((Action) baseMessage).getActionOn()).getName() + " " + context.getString(R.string.participant); } @@ -1892,18 +1893,18 @@ else if (baseMessage instanceof Call) { Call call = ((Call) baseMessage); String callMessageText = ""; boolean isMissed = false,isIncoming = false,isVideo = false; - if (call.getCallStatus().equals(CometChatConstants.CALL_STATUS_INITIATED)) { + if (call.getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_INITIATED)) { callMessageText = call.getSender().getName() + " " + context.getString(R.string.initiated); } - else if(call.getCallStatus().equals(CometChatConstants.CALL_STATUS_UNANSWERED) || - call.getCallStatus().equals(CometChatConstants.CALL_STATUS_CANCELLED)) { + else if(call.getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_UNANSWERED) || + call.getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_CANCELLED)) { callMessageText = context.getResources().getString(R.string.missed_call); isMissed = true; - } else if(call.getCallStatus().equals(CometChatConstants.CALL_STATUS_REJECTED)) { + } else if(call.getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_REJECTED)) { callMessageText = context.getResources().getString(R.string.rejected_call); - } else if(call.getCallStatus().equals(CometChatConstants.CALL_STATUS_ONGOING)) { + } else if(call.getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ONGOING)) { callMessageText = context.getString(R.string.ongoing); - } else if (call.getCallStatus().equals(CometChatConstants.CALL_STATUS_ENDED)){ + } else if (call.getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ENDED)){ callMessageText = context.getString(R.string.ended); } else { callMessageText = call.getCallStatus(); @@ -1914,7 +1915,7 @@ else if(call.getCallStatus().equals(CometChatConstants.CALL_STATUS_UNANSWERED) | isIncoming = true; } - if(call.getType().equals(CometChatConstants.CALL_TYPE_VIDEO)) + if(call.getType().equals(com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_VIDEO)) { callMessageText = callMessageText+" "+context.getResources().getString(R.string.video_call); isVideo = true; @@ -1983,7 +1984,7 @@ private void setStatusIcon(ProgressBar progressBar,TextView txtTime, BaseMessage if (UISettings.isShowReadDeliveryReceipts()) { if (baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { if (baseMessage.getReceiverType()!=null && baseMessage.getReceiverType() - .equals(CometChatConstants.RECEIVER_TYPE_USER)) { + .equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { if (progressBar!=null) progressBar.setVisibility(View.GONE); if (baseMessage.getReadAt() != 0) { @@ -2031,10 +2032,10 @@ private void setTextData(TextMessageViewHolder viewHolder, int i) { BaseMessage baseMessage = messageList.get(i); if (baseMessage!=null) { if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); - } else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + } else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); @@ -2087,35 +2088,35 @@ public void onClick(DialogInterface dialog, int which) { String message = metaData.getString("message"); viewHolder.replyLayout.setVisibility(View.VISIBLE); viewHolder.replyUser.setText(metaData.getString("name")); - if (messageType.equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { viewHolder.replyMessage.setText(message); viewHolder.replyMessage.setCompoundDrawablesWithIntrinsicBounds(0,0,0,0); - } else if (messageType.equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) { + } else if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) { viewHolder.replyMessage.setText(context.getResources().getString(R.string.shared_a_image)); viewHolder.replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_photo,0,0,0); - } else if (messageType.equals(CometChatConstants.MESSAGE_TYPE_AUDIO)) { + } else if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO)) { viewHolder.replyMessage.setText(String.format(context.getResources().getString(R.string.shared_a_audio),"")); viewHolder.replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_library_music_24dp,0,0,0); - } else if (messageType.equals(CometChatConstants.MESSAGE_TYPE_VIDEO)) { + } else if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO)) { viewHolder.replyMessage.setText(context.getResources().getString(R.string.shared_a_video)); viewHolder.replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_videocam_24dp,0,0,0); - } else if (messageType.equals(CometChatConstants.MESSAGE_TYPE_FILE)) { + } else if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE)) { viewHolder.replyMessage.setText(String.format(context.getResources().getString(R.string.shared_a_file),"")); viewHolder.replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_insert_drive_file_black_24dp,0,0,0); - } else if (messageType.equals(StringContract.IntentStrings.LOCATION)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.LOCATION)) { viewHolder.replyMessage.setText(String.format(context .getString(R.string.shared_location),"").trim()); viewHolder.replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_near_me_24dp,0,0,0); - } else if (messageType.equals(StringContract.IntentStrings.POLLS)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.POLLS)) { viewHolder.replyMessage.setText(String.format(context.getString(R.string.shared_a_polls),message)); viewHolder.replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_poll_24dp,0,0,0); - } else if (messageType.equals(StringContract.IntentStrings.STICKERS)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.STICKERS)) { viewHolder.replyMessage.setText(String.format(context.getString(R.string.shared_a_sticker))); viewHolder.replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.default_sticker,0,0,0); - } else if (messageType.equals(StringContract.IntentStrings.WHITEBOARD)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.WHITEBOARD)) { viewHolder.replyMessage.setText(context.getString(R.string.shared_a_whiteboard)); viewHolder.replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_whiteboard_24dp,0,0,0); - } else if (messageType.equals(StringContract.IntentStrings.WRITEBOARD)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.WRITEBOARD)) { viewHolder.replyMessage.setText(context.getString(R.string.shared_a_writeboard)); viewHolder.replyMessage.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_writeboard_24dp,0,0,0); } @@ -2144,28 +2145,28 @@ public boolean onLongClick(View view) { viewHolder.tvThreadReplyCount.setVisibility(View.GONE); } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); // intent.putExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE,baseMessage.toString()); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - intent.putExtra(StringContract.IntentStrings.TEXTMESSAGE,((TextMessage)baseMessage).getText()); - - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE,((TextMessage)baseMessage).getText()); + + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); @@ -2178,7 +2179,7 @@ public boolean onLongClick(View view) { if (processed instanceof Spannable) { Spannable spannable = (Spannable) processed; count = spannable.getSpans(0, spannable.length() - 1, EmojiSpan.class).length; - if (Utils.removeEmojiAndSymbol(txtMessage).trim().length() == 0) { + if (PatternUtils.removeEmojiAndSymbol(txtMessage).trim().length() == 0) { if (UISettings.isSendEmojisLargeSize()) { if (count == 1) { viewHolder.txtMessage.setTextSize((int) Utils.dpToPx(context, 32)); @@ -2209,7 +2210,7 @@ public boolean onLongClick(View view) { viewHolder.txtMessage.setText(message); viewHolder.txtMessage.setTypeface(fontUtils.getTypeFace(FontUtils.robotoRegular)); - Utils.setHyperLinkSupport(context,viewHolder.txtMessage); + PatternUtils.setHyperLinkSupport(context,viewHolder.txtMessage); viewHolder.txtMessage.setOnLongClickListener(new View.OnLongClickListener() { @Override @@ -2289,8 +2290,8 @@ private void setReactionSupport(BaseMessage baseMessage, ChipGroup reactionLayou chip.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { - Intent intent = new Intent(context, CometChatReactionInfoScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,baseMessage.getMetadata().toString()); + Intent intent = new Intent(context, CometChatReactionInfoActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,baseMessage.getMetadata().toString()); context.startActivity(intent); return true; } @@ -2330,10 +2331,10 @@ private void setCustomData(CustomMessageViewHolder viewHolder, int i) { BaseMessage baseMessage = messageList.get(i); if (baseMessage!=null) { if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); - } else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + } else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); @@ -2422,10 +2423,10 @@ private void setLinkData(LinkMessageViewHolder viewHolder, int i) { if (baseMessage!=null) { if (!baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { viewHolder.tvUser.setVisibility(View.GONE); viewHolder.ivUser.setVisibility(View.GONE); - } else if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { + } else if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { if (isUserDetailVisible) { viewHolder.tvUser.setVisibility(View.VISIBLE); @@ -2482,40 +2483,40 @@ private void setLinkData(LinkMessageViewHolder viewHolder, int i) { viewHolder.tvThreadReplyCount.setVisibility(View.GONE); } viewHolder.tvThreadReplyCount.setOnClickListener(view -> { - Intent intent = new Intent(context, CometChatThreadMessageActivity.class); + Intent intent = new Intent(context, CometChatThreadMessageListActivity.class); // intent.putExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE,baseMessage.toString()); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); - intent.putExtra(StringContract.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.PARENT_ID,baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) - intent.putExtra(StringContract.IntentStrings.TEXTMESSAGE,((TextMessage)baseMessage).getText()); + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,baseMessage.getSender().getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.REPLY_COUNT,baseMessage.getReplyCount()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.PARENT_ID,baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,baseMessage.getCategory()); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,Extensions.getReactionsOnMessage(baseMessage)); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) + intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE,((TextMessage)baseMessage).getText()); else { - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((MediaMessage)baseMessage).getAttachment().getFileName()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,((MediaMessage)baseMessage).getAttachment().getFileExtension()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((MediaMessage)baseMessage).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,((MediaMessage)baseMessage).getAttachment().getFileSize()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,((MediaMessage)baseMessage).getAttachment().getFileName()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,((MediaMessage)baseMessage).getAttachment().getFileExtension()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL,((MediaMessage)baseMessage).getAttachment().getFileUrl()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,((MediaMessage)baseMessage).getAttachment().getFileSize()); } - intent.putExtra(StringContract.IntentStrings.TYPE,baseMessage.getReceiverType()); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - intent.putExtra(StringContract.IntentStrings.GUID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,baseMessage.getReceiverType()); + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + intent.putExtra(UIKitConstants.IntentStrings.GUID,baseMessage.getReceiverUid()); } else { if (baseMessage.getReceiverUid().equals(loggedInUser.getUid())) - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); else - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getReceiverUid()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getReceiverUid()); } context.startActivity(intent); }); - Utils.setHyperLinkSupport(context,viewHolder.message); + PatternUtils.setHyperLinkSupport(context,viewHolder.message); showMessageTime(viewHolder, baseMessage); String finalUrl = url; @@ -2594,10 +2595,10 @@ public void setLongClickSelectedItem(BaseMessage baseMessage) { * @param avatar is a object of Avatar * @param avatarUrl is a String. It is url of avatar. * @param name is a String. It is a name of groupMember. - * @see Avatar + * @see CometChatAvatar * */ - private void setAvatar(Avatar avatar, String avatarUrl, String name) { + private void setAvatar(CometChatAvatar avatar, String avatarUrl, String name) { if (avatarUrl != null && !avatarUrl.isEmpty()) Glide.with(context).load(avatarUrl).into(avatar); @@ -2621,7 +2622,7 @@ public long getHeaderId(int var1) { @Override public DateItemHolder onCreateHeaderViewHolder(ViewGroup var1) { - View view = LayoutInflater.from(var1.getContext()).inflate(R.layout.cc_message_list_header, + View view = LayoutInflater.from(var1.getContext()).inflate(R.layout.cometchat_messagedate_header, var1, false); return new DateItemHolder(view); @@ -2656,10 +2657,10 @@ private int getItemViewTypes(int position) { BaseMessage baseMessage = messageList.get(position); HashMap extensionList = Extensions.extensionCheck(baseMessage); if (baseMessage.getDeletedAt()==0) { - if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_MESSAGE)) { + if (baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_MESSAGE)) { switch (baseMessage.getType()) { - case CometChatConstants.MESSAGE_TYPE_TEXT: + case com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT: if (baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { if (extensionList != null && extensionList.containsKey("linkPreview") && extensionList.get("linkPreview") != null) return RIGHT_LINK_MESSAGE; @@ -2675,25 +2676,25 @@ else if (baseMessage.getMetadata()!=null && baseMessage.getMetadata().has("reply else return LEFT_TEXT_MESSAGE; } - case CometChatConstants.MESSAGE_TYPE_AUDIO: + case com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO: if (baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { return RIGHT_AUDIO_MESSAGE; } else { return LEFT_AUDIO_MESSAGE; } - case CometChatConstants.MESSAGE_TYPE_IMAGE: + case com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE: if (baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { return RIGHT_IMAGE_MESSAGE; } else { return LEFT_IMAGE_MESSAGE; } - case CometChatConstants.MESSAGE_TYPE_VIDEO: + case com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO: if (baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { return RIGHT_VIDEO_MESSAGE; } else { return LEFT_VIDEO_MESSAGE; } - case CometChatConstants.MESSAGE_TYPE_FILE: + case com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE: if (baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { return RIGHT_FILE_MESSAGE; } else { @@ -2703,39 +2704,39 @@ else if (baseMessage.getMetadata()!=null && baseMessage.getMetadata().has("reply return -1; } } else { - if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_ACTION)) { + if (baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_ACTION)) { return ACTION_MESSAGE; - } else if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_CALL)) { + } else if (baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL)) { return CALL_MESSAGE; - } else if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_CUSTOM)){ + } else if (baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CUSTOM)){ if (baseMessage.getSender().getUid().equals(loggedInUser.getUid())) { - if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.LOCATION)) + if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.LOCATION)) return RIGHT_LOCATION_CUSTOM_MESSAGE; - else if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.POLLS)) + else if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.POLLS)) return RIGHT_POLLS_CUSTOM_MESSAGE; - else if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.STICKERS)) + else if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.STICKERS)) return RIGHT_STICKER_MESSAGE; - else if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.WHITEBOARD)) + else if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.WHITEBOARD)) return RIGHT_WHITEBOARD_MESSAGE; - else if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.WRITEBOARD)) + else if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.WRITEBOARD)) return RIGHT_WRITEBOARD_MESSAGE; - else if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.GROUP_CALL)) + else if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.GROUP_CALL)) return RIGHT_GROUP_CALL_MESSAGE; else return RIGHT_CUSTOM_MESSAGE; } else - if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.LOCATION)) + if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.LOCATION)) return LEFT_LOCATION_CUSTOM_MESSAGE; - else if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.POLLS)) + else if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.POLLS)) return LEFT_POLLS_CUSTOM_MESSAGE; - else if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.STICKERS)) + else if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.STICKERS)) return LEFT_STICKER_MESSAGE; - else if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.WHITEBOARD)) + else if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.WHITEBOARD)) return LEFT_WHITEBOARD_MESSAGE; - else if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.WRITEBOARD)) + else if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.WRITEBOARD)) return LEFT_WRITEBOARD_MESSAGE; - else if (baseMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.GROUP_CALL)) + else if (baseMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.GROUP_CALL)) return LEFT_GROUP_CALL_MESSAGE; else return LEFT_CUSTOM_MESSAGE; @@ -2885,7 +2886,7 @@ class ImageMessageViewHolder extends RecyclerView.ViewHolder { private ImageView imageView; private CardView cardView; private ProgressBar progressBar; - private Avatar ivUser; + private CometChatAvatar ivUser; public TextView txtTime,tvUser; private RelativeLayout rlMessageBubble; private TextView tvThreadReplyCount; @@ -2927,7 +2928,7 @@ class VideoMessageViewHolder extends RecyclerView.ViewHolder { private ImageView playBtn; private CardView cardView; private ProgressBar progressBar; - private Avatar ivUser; + private CometChatAvatar ivUser; public TextView txtTime,tvUser; private RelativeLayout rlMessageBubble; private TextView tvThreadReplyCount; @@ -2957,7 +2958,7 @@ public class FileMessageViewHolder extends RecyclerView.ViewHolder { private TextView fileSize; private TextView tvUser; private View view; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout cvMessageView; private RelativeLayout rlMessageBubble; private TextView tvThreadReplyCount; @@ -2990,7 +2991,7 @@ public class DeleteMessageViewHolder extends RecyclerView.ViewHolder { public TextView tvUser; private ImageView imgStatus; private int type; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; private TextView tvThreadReplyCount; private LinearLayout lvReplyAvatar; @@ -3024,7 +3025,7 @@ public class TextMessageViewHolder extends RecyclerView.ViewHolder { private ImageView imgStatus; private int type; - private Avatar ivUser; //sender avatar + private CometChatAvatar ivUser; //sender avatar public TextView tvUser; //sender name private RelativeLayout sentimentVw; //sentiment extension layout @@ -3071,7 +3072,7 @@ public class CustomMessageViewHolder extends RecyclerView.ViewHolder { public TextView tvUser; private ImageView imgStatus; private int type; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; @@ -3095,7 +3096,7 @@ public class StickerMessageViewHolder extends RecyclerView.ViewHolder { public TextView tvThreadReplyCount; public TextView txtTime; public TextView tvUser; - public Avatar ivUser; + public CometChatAvatar ivUser; private ChipGroup reactionLayout; public int type; @@ -3131,7 +3132,7 @@ public class LocationMessageViewHolder extends RecyclerView.ViewHolder { public TextView tvThreadReplyCount; public TextView txtTime; public TextView tvUser; - public Avatar ivUser; + public CometChatAvatar ivUser; private ChipGroup reactionLayout; @@ -3169,7 +3170,7 @@ public class PollMessageViewHolder extends RecyclerView.ViewHolder { public TextView tvThreadReplyCount; public TextView txtTime; public TextView tvUser; - public Avatar ivUser; + public CometChatAvatar ivUser; private ChipGroup reactionLayout; @@ -3202,7 +3203,7 @@ public class GroupCallMessageViewHolder extends RecyclerView.ViewHolder { public TextView txtTime; public TextView tvUser; private int type; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; private ChipGroup reactionLayout; @@ -3237,7 +3238,7 @@ public class WhiteBoardViewHolder extends RecyclerView.ViewHolder { public TextView txtTime; public TextView tvUser; private int type; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; private ChipGroup reactionLayout; @@ -3271,7 +3272,7 @@ public class WriteBoardViewHolder extends RecyclerView.ViewHolder { public TextView txtTime; public TextView tvUser; private int type; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; private ChipGroup reactionLayout; @@ -3303,7 +3304,7 @@ public class AudioMessageViewHolder extends RecyclerView.ViewHolder { private ImageView playBtn; private int type; private TextView tvUser; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; private TextView txtTime; private TextView tvThreadReplyCount; @@ -3337,7 +3338,7 @@ public class LinkMessageViewHolder extends RecyclerView.ViewHolder { private ImageView linkImg; private int type; private TextView tvUser; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; private TextView tvThreadReplyCount; diff --git a/uikit/src/main/java/screen/threadconversation/CometChatThreadMessageScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/thread_message_list/CometChatThreadMessageList.java similarity index 80% rename from uikit/src/main/java/screen/threadconversation/CometChatThreadMessageScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/thread_message_list/CometChatThreadMessageList.java index 35d9d68a..b6bf8075 100644 --- a/uikit/src/main/java/screen/threadconversation/CometChatThreadMessageScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/thread_message_list/CometChatThreadMessageList.java @@ -1,4 +1,4 @@ -package screen.threadconversation; +package com.cometchat.pro.uikit.ui_components.messages.thread_message_list; import android.Manifest; import android.animation.Animator; @@ -61,7 +61,6 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.transition.Transition; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.MessagesRequest; import com.cometchat.pro.exceptions.CometChatException; @@ -74,14 +73,18 @@ import com.cometchat.pro.models.TextMessage; import com.cometchat.pro.models.TypingIndicator; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.Avatar; -import com.cometchat.pro.uikit.ComposeBox.ComposeBox; + +import com.cometchat.pro.uikit.ui_components.messages.extensions.Extensions; +import com.cometchat.pro.uikit.ui_components.messages.forward_message.CometChatForwardMessageActivity; +import com.cometchat.pro.uikit.ui_components.messages.message_actions.CometChatMessageActions; +import com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar.CometChatAvatar; +import com.cometchat.pro.uikit.ui_components.shared.cometchatComposeBox.CometChatComposeBox; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Reaction.OnEmojiClickListener; -import com.cometchat.pro.uikit.Reaction.ReactionDialog; -import com.cometchat.pro.uikit.Reaction.model.Reaction; -import com.cometchat.pro.uikit.Settings.UISettings; -import com.cometchat.pro.uikit.SmartReplyList; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.listener.OnReactionClickListener; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.CometChatReactionDialog; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_components.shared.cometchatSmartReplies.CometChatSmartReplies; import com.facebook.shimmer.ShimmerFrameLayout; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationServices; @@ -104,27 +107,23 @@ import java.util.Timer; import java.util.TimerTask; -import adapter.ThreadAdapter; -import constant.StringContract; -import listeners.ComposeActionListener; -import listeners.LiveReactionListener; -import listeners.MessageActionCloseListener; -import listeners.OnItemClickListener; -import listeners.OnMessageLongClick; -import listeners.ReactionClickListener; -import listeners.StickyHeaderDecoration; -import screen.CometChatForwardMessageScreenActivity; -import screen.CometChatGroupDetailScreenActivity; -import screen.CometChatMessageInfoScreenActivity; -import screen.CometChatUserDetailScreenActivity; -import screen.CometChatWebViewActivity; -import screen.messagelist.MessageActionFragment; -import utils.CallUtils; -import utils.Extensions; -import utils.FontUtils; -import utils.KeyBoardUtils; -import utils.MediaUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_components.shared.cometchatComposeBox.listener.ComposeActionListener; +import com.cometchat.pro.uikit.ui_components.messages.live_reaction.LiveReactionListener; +import com.cometchat.pro.uikit.ui_components.messages.message_actions.listener.MessageActionCloseListener; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_components.messages.message_actions.listener.OnMessageLongClick; +import com.cometchat.pro.uikit.ui_components.messages.live_reaction.ReactionClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderDecoration; +import com.cometchat.pro.uikit.ui_components.groups.group_details.CometChatGroupDetailActivity; +import com.cometchat.pro.uikit.ui_components.messages.message_information.CometChatMessageInfoScreenActivity; +import com.cometchat.pro.uikit.ui_components.users.user_details.CometChatUserDetailScreenActivity; +import com.cometchat.pro.uikit.ui_components.messages.extensions.Collaborative.CometChatCollaborativeActivity; +import com.cometchat.pro.uikit.ui_resources.utils.CallUtils; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.keyboard_utils.KeyBoardUtils; +import com.cometchat.pro.uikit.ui_resources.utils.MediaUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; import static android.view.View.GONE; import static android.view.View.VISIBLE; @@ -146,7 +145,7 @@ */ -public class CometChatThreadMessageScreen extends Fragment implements View.OnClickListener, +public class CometChatThreadMessageList extends Fragment implements View.OnClickListener, OnMessageLongClick, MessageActionCloseListener { private static final String TAG = "CometChatThreadScreen"; @@ -155,21 +154,21 @@ public class CometChatThreadMessageScreen extends Fragment implements View.OnCli private String name = ""; private String conversationName = ""; private MessagesRequest messagesRequest; //Used to fetch messages. - private ComposeBox composeBox; + private CometChatComposeBox composeBox; private MediaRecorder mediaRecorder; private MediaPlayer mediaPlayer; private String audioFileNameWithPath; private RecyclerView rvChatListView; //Used to display list of messages. private ThreadAdapter messageAdapter; private LinearLayoutManager linearLayoutManager; - private SmartReplyList rvSmartReply; + private CometChatSmartReplies rvSmartReply; private ShimmerFrameLayout messageShimmer; /** * Avatar is a UI Kit Component which is used to display user and group avatars. */ private TextView tvName; private TextView tvTypingIndicator; - private Avatar senderAvatar; + private CometChatAvatar senderAvatar; private TextView senderName; private TextView tvSentAt; private String Id; @@ -264,17 +263,19 @@ public class CometChatThreadMessageScreen extends Fragment implements View.OnCli private ArrayList pollResult; private TextView totalCount; private int voteCount; - private MessageActionFragment messageActionFragment; + private CometChatMessageActions messageActionFragment; private ImageView imageView; private FrameLayout container; public ObjectAnimator animation; + private int resultIntentCode; + private ImageView addReaction; private ChipGroup reactionLayout; private HashMap reactionInfo = new HashMap<>(); - public CometChatThreadMessageScreen() { + public CometChatThreadMessageList() { // Required empty public constructor } @@ -291,49 +292,49 @@ public void onCreate(Bundle savedInstanceState) { */ private void handleArguments() { if (getArguments() != null) { - parentId = getArguments().getInt(StringContract.IntentStrings.PARENT_ID,0); - replyCount = getArguments().getInt(StringContract.IntentStrings.REPLY_COUNT,0); - type = getArguments().getString(StringContract.IntentStrings.TYPE); - Id = getArguments().getString(StringContract.IntentStrings.ID); - avatarUrl = getArguments().getString(StringContract.IntentStrings.AVATAR); - name = getArguments().getString(StringContract.IntentStrings.NAME); - conversationName = getArguments().getString(StringContract.IntentStrings.CONVERSATION_NAME); - messageType = getArguments().getString(StringContract.IntentStrings.MESSAGE_TYPE); - messageSentAt = getArguments().getLong(StringContract.IntentStrings.SENTAT); - parentMessageCategory = getArguments().getString(StringContract.IntentStrings.MESSAGE_CATEGORY); - if (messageType.equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { - message = getArguments().getString(StringContract.IntentStrings.TEXTMESSAGE); - } else if (messageType.equals(StringContract.IntentStrings.LOCATION)) { - parentMessageLatitude = getArguments().getDouble(StringContract.IntentStrings.LOCATION_LATITUDE); - parentMessageLongitude = getArguments().getDouble(StringContract.IntentStrings.LOCATION_LONGITUDE); - - } else if (messageType.equals(StringContract.IntentStrings.POLLS)) { - pollQuestion = getArguments().getString(StringContract.IntentStrings.POLL_QUESTION); - pollOptions = getArguments().getString(StringContract.IntentStrings.POLL_OPTION); - pollResult = getArguments().getStringArrayList(StringContract.IntentStrings.POLL_RESULT); - voteCount = getArguments().getInt(StringContract.IntentStrings.POLL_VOTE_COUNT); - } else if (messageType.equals(StringContract.IntentStrings.STICKERS)) { - message = getArguments().getString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL); - messageFileName = getArguments().getString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME); - } else if (messageType.equals(StringContract.IntentStrings.WHITEBOARD) || - messageType.equals(StringContract.IntentStrings.WRITEBOARD)) { - message = getArguments().getString(StringContract.IntentStrings.TEXTMESSAGE); + parentId = getArguments().getInt(UIKitConstants.IntentStrings.PARENT_ID,0); + replyCount = getArguments().getInt(UIKitConstants.IntentStrings.REPLY_COUNT,0); + type = getArguments().getString(UIKitConstants.IntentStrings.TYPE); + Id = getArguments().getString(UIKitConstants.IntentStrings.ID); + avatarUrl = getArguments().getString(UIKitConstants.IntentStrings.AVATAR); + name = getArguments().getString(UIKitConstants.IntentStrings.NAME); + conversationName = getArguments().getString(UIKitConstants.IntentStrings.CONVERSATION_NAME); + messageType = getArguments().getString(UIKitConstants.IntentStrings.MESSAGE_TYPE); + messageSentAt = getArguments().getLong(UIKitConstants.IntentStrings.SENTAT); + parentMessageCategory = getArguments().getString(UIKitConstants.IntentStrings.MESSAGE_CATEGORY); + if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { + message = getArguments().getString(UIKitConstants.IntentStrings.TEXTMESSAGE); + } else if (messageType.equals(UIKitConstants.IntentStrings.LOCATION)) { + parentMessageLatitude = getArguments().getDouble(UIKitConstants.IntentStrings.LOCATION_LATITUDE); + parentMessageLongitude = getArguments().getDouble(UIKitConstants.IntentStrings.LOCATION_LONGITUDE); + + } else if (messageType.equals(UIKitConstants.IntentStrings.POLLS)) { + pollQuestion = getArguments().getString(UIKitConstants.IntentStrings.POLL_QUESTION); + pollOptions = getArguments().getString(UIKitConstants.IntentStrings.POLL_OPTION); + pollResult = getArguments().getStringArrayList(UIKitConstants.IntentStrings.POLL_RESULT); + voteCount = getArguments().getInt(UIKitConstants.IntentStrings.POLL_VOTE_COUNT); + } else if (messageType.equals(UIKitConstants.IntentStrings.STICKERS)) { + message = getArguments().getString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL); + messageFileName = getArguments().getString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME); + } else if (messageType.equals(UIKitConstants.IntentStrings.WHITEBOARD) || + messageType.equals(UIKitConstants.IntentStrings.WRITEBOARD)) { + message = getArguments().getString(UIKitConstants.IntentStrings.TEXTMESSAGE); } else { - message = getArguments().getString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL); - messageFileName = getArguments().getString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME); - messageExtension = getArguments().getString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION); - messageSize = getArguments().getInt(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE, 0); - messageMimeType = getArguments().getString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE); + message = getArguments().getString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL); + messageFileName = getArguments().getString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME); + messageExtension = getArguments().getString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION); + messageSize = getArguments().getInt(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE, 0); + messageMimeType = getArguments().getString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE); } - reactionInfo = (HashMap) getArguments().getSerializable(StringContract.IntentStrings.REACTION_INFO); + reactionInfo = (HashMap) getArguments().getSerializable(UIKitConstants.IntentStrings.REACTION_INFO); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - view = inflater.inflate(R.layout.fragment_thread_message, container, false); + view = inflater.inflate(R.layout.fragment_cometchat_thread_message, container, false); initViewComponent(view); return view; } @@ -378,17 +379,17 @@ private void initViewComponent(View view) { pollOptionsLL = view.findViewById(R.id.options_group); totalCount = view.findViewById(R.id.total_votes); - if (messageType.equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) { + if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) { imageMessage.setVisibility(View.VISIBLE); Glide.with(context).load(message).into(imageMessage); - } else if (messageType.equals(CometChatConstants.MESSAGE_TYPE_VIDEO)) { + } else if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO)) { videoMessage.setVisibility(VISIBLE); MediaController mediacontroller = new MediaController(getContext()); mediacontroller.setAnchorView(videoMessage); videoMessage.setMediaController(mediacontroller); videoMessage.setVideoURI(Uri.parse(message)); - } else if (messageType.equals(CometChatConstants.MESSAGE_TYPE_FILE) || - messageType.equals(CometChatConstants.MESSAGE_TYPE_AUDIO)) { + } else if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE) || + messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO)) { fileMessage.setVisibility(VISIBLE); if (messageFileName!=null) fileName.setText(messageFileName); @@ -396,14 +397,14 @@ private void initViewComponent(View view) { fileExtension.setText(messageExtension); fileSize.setText(Utils.getFileSize(messageSize)); - } else if (messageType.equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + } else if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { textMessage.setVisibility(View.VISIBLE); textMessage.setText(message); - } else if (messageType.equals(StringContract.IntentStrings.STICKERS)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.STICKERS)) { ivForwardMessage.setVisibility(GONE); stickerMessage.setVisibility(View.VISIBLE); Glide.with(context).load(message).into(stickerMessage); - } else if (messageType.equals(StringContract.IntentStrings.WHITEBOARD)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.WHITEBOARD)) { ivForwardMessage.setVisibility(GONE); whiteboardMessage.setVisibility(View.VISIBLE); if (name.equals(loggedInUser.getName())) @@ -414,12 +415,12 @@ private void initViewComponent(View view) { @Override public void onClick(View view) { String boardUrl = message; - Intent intent = new Intent(context, CometChatWebViewActivity.class); - intent.putExtra(StringContract.IntentStrings.URL, boardUrl); + Intent intent = new Intent(context, CometChatCollaborativeActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.URL, boardUrl); startActivity(intent); } }); - } else if (messageType.equals(StringContract.IntentStrings.WRITEBOARD)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.WRITEBOARD)) { ivForwardMessage.setVisibility(GONE); writeboardMessage.setVisibility(View.VISIBLE); if (name.equals(loggedInUser.getName())) @@ -430,21 +431,21 @@ public void onClick(View view) { @Override public void onClick(View view) { String boardUrl = message; - Intent intent = new Intent(context, CometChatWebViewActivity.class); - intent.putExtra(StringContract.IntentStrings.URL, boardUrl); + Intent intent = new Intent(context, CometChatCollaborativeActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.URL, boardUrl); startActivity(intent); } }); - } else if (messageType.equals(StringContract.IntentStrings.LOCATION)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.LOCATION)) { initLocation(); locationMessage.setVisibility(VISIBLE); addressView.setText(Utils.getAddress(context, parentMessageLatitude, parentMessageLongitude)); - String mapUrl = StringContract.MapUrl.MAPS_URL +parentMessageLatitude+","+parentMessageLongitude+"&key="+ StringContract.MapUrl.MAP_ACCESS_KEY; + String mapUrl = UIKitConstants.MapUrl.MAPS_URL +parentMessageLatitude+","+parentMessageLongitude+"&key="+ UIKitConstants.MapUrl.MAP_ACCESS_KEY; Glide.with(context) .load(mapUrl) .diskCacheStrategy(DiskCacheStrategy.ALL) .into(mapView); - } else if (messageType.equals(StringContract.IntentStrings.POLLS)) { + } else if (messageType.equals(UIKitConstants.IntentStrings.POLLS)) { ivForwardMessage.setVisibility(GONE); pollMessage.setVisibility(VISIBLE); totalCount.setText(voteCount+" Votes"); @@ -529,8 +530,8 @@ public void onError(CometChatException e) { addReaction.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - ReactionDialog reactionDialog = new ReactionDialog(); - reactionDialog.setOnEmojiClick(new OnEmojiClickListener() { + CometChatReactionDialog reactionDialog = new CometChatReactionDialog(); + reactionDialog.setOnEmojiClick(new OnReactionClickListener() { @Override public void onEmojiClicked(Reaction emojicon) { JSONObject body=new JSONObject(); @@ -565,7 +566,7 @@ public void onError(CometChatException e) { composeBox = view.findViewById(R.id.message_box); messageShimmer = view.findViewById(R.id.shimmer_layout); composeBox = view.findViewById(R.id.message_box); - composeBox.usedIn(CometChatThreadMessageActivity.class.getName()); + composeBox.usedIn(CometChatThreadMessageListActivity.class.getName()); composeBox.hidePollOption(true); composeBox.hideStickerOption(true); composeBox.hideWriteBoardOption(true); @@ -646,7 +647,7 @@ public void run() { sentAt.setText(String.format(getString(R.string.sentattxt),Utils.getLastMessageDate(messageSentAt))); tvReplyCount = view.findViewById(R.id.thread_reply_count); rvChatListView = view.findViewById(R.id.rv_message_list); - if (parentMessageCategory.equals(CometChatConstants.CATEGORY_CUSTOM)) { + if (parentMessageCategory.equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CUSTOM)) { ivMoreOption.setVisibility(GONE); } if (replyCount>0) { @@ -778,7 +779,7 @@ public void onError(CometChatException e) { } private void checkOnGoingCall() { - if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null) { + if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null) { if(onGoingCallView!=null) onGoingCallView.setVisibility(View.VISIBLE); if(onGoingCallTxt!=null) { @@ -833,18 +834,18 @@ public void afterTextChanged(Editable editable) { @Override public void onAudioActionClicked() { if (Utils.hasPermissions(getContext(),Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - startActivityForResult(MediaUtils.openAudio(getActivity()),StringContract.RequestCode.AUDIO); + startActivityForResult(MediaUtils.openAudio(getActivity()), UIKitConstants.RequestCode.AUDIO); } else { - requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},StringContract.RequestCode.AUDIO); + requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, UIKitConstants.RequestCode.AUDIO); } } @Override public void onCameraActionClicked() { if (Utils.hasPermissions(getContext(), CAMERA_PERMISSION)) { - startActivityForResult(MediaUtils.openCamera(getContext()), StringContract.RequestCode.CAMERA); + startActivityForResult(MediaUtils.openCamera(getContext()), UIKitConstants.RequestCode.CAMERA); } else { - requestPermissions(CAMERA_PERMISSION, StringContract.RequestCode.CAMERA); + requestPermissions(CAMERA_PERMISSION, UIKitConstants.RequestCode.CAMERA); } } @@ -852,18 +853,18 @@ public void onCameraActionClicked() { @Override public void onGalleryActionClicked() { if (Utils.hasPermissions(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - startActivityForResult(MediaUtils.openGallery(getActivity()), StringContract.RequestCode.GALLERY); + startActivityForResult(MediaUtils.openGallery(getActivity()), UIKitConstants.RequestCode.GALLERY); } else { - requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, StringContract.RequestCode.GALLERY); + requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, UIKitConstants.RequestCode.GALLERY); } } @Override public void onFileActionClicked() { if (Utils.hasPermissions(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - startActivityForResult(MediaUtils.getFileIntent(StringContract.IntentStrings.EXTRA_MIME_DOC), StringContract.RequestCode.FILE); + startActivityForResult(MediaUtils.getFileIntent(UIKitConstants.IntentStrings.EXTRA_MIME_DOC), UIKitConstants.RequestCode.FILE); } else { - requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, StringContract.RequestCode.FILE); + requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, UIKitConstants.RequestCode.FILE); } } @@ -890,7 +891,7 @@ public void onSendActionClicked(EditText editText) { public void onVoiceNoteComplete(String string) { if (string != null) { File audioFile = new File(string); - sendMediaMessage(audioFile, CometChatConstants.MESSAGE_TYPE_AUDIO); + sendMediaMessage(audioFile, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO); } } @Override @@ -906,7 +907,7 @@ public void onLocationActionClicked() { getLocation(); } } else { - requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, StringContract.RequestCode.LOCATION); + requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, UIKitConstants.RequestCode.LOCATION); } } }); @@ -948,8 +949,8 @@ private void initAlert(JSONObject customData) { TextView address = view.findViewById(R.id.address); address.setText("Address: "+Utils.getAddress(context,LATITUDE,LONGITUDE)); ImageView mapView = view.findViewById(R.id.map_vw); - String mapUrl = StringContract.MapUrl.MAPS_URL +LATITUDE+","+LONGITUDE+"&key="+ - StringContract.MapUrl.MAP_ACCESS_KEY; + String mapUrl = UIKitConstants.MapUrl.MAPS_URL +LATITUDE+","+LONGITUDE+"&key="+ + UIKitConstants.MapUrl.MAP_ACCESS_KEY; Glide.with(this) .load(mapUrl) .diskCacheStrategy(DiskCacheStrategy.NONE) @@ -973,10 +974,10 @@ public void onClick(DialogInterface dialog, int which) { private void sendCustomMessage(String customType, JSONObject customData) { CustomMessage customMessage; - if (type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) - customMessage = new CustomMessage(Id, CometChatConstants.RECEIVER_TYPE_USER, customType, customData); + if (type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) + customMessage = new CustomMessage(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER, customType, customData); else - customMessage = new CustomMessage(Id, CometChatConstants.RECEIVER_TYPE_GROUP, customType, customData); + customMessage = new CustomMessage(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP, customType, customData); customMessage.setParentMessageId(parentId); CometChat.sendCustomMessage(customMessage, new CometChat.CallbackListener() { @@ -1005,7 +1006,7 @@ private void turnOnLocation() { builder.setPositiveButton("ON", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - startActivityForResult(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), StringContract.RequestCode.LOCATION); + startActivityForResult(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), UIKitConstants.RequestCode.LOCATION); } }).setNegativeButton("Close", new DialogInterface.OnClickListener() { @Override @@ -1028,7 +1029,7 @@ private void initLocation() { e.printStackTrace(); } } else { - requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, StringContract.RequestCode.LOCATION); + requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, UIKitConstants.RequestCode.LOCATION); } } @@ -1036,10 +1037,10 @@ private void editThread(String editMessage) { isEdit = false; TextMessage textmessage; - if (type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) - textmessage = new TextMessage(Id, editMessage, CometChatConstants.RECEIVER_TYPE_USER); + if (type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) + textmessage = new TextMessage(Id, editMessage, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); else - textmessage = new TextMessage(Id, editMessage, CometChatConstants.RECEIVER_TYPE_GROUP); + textmessage = new TextMessage(Id, editMessage, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); sendTypingIndicator(true); textmessage.setId(parentId); CometChat.editMessage(textmessage, new CometChat.CallbackListener() { @@ -1062,26 +1063,26 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis Log.d(TAG, "onRequestPermissionsResult: "); switch (requestCode) { - case StringContract.RequestCode.CAMERA: + case UIKitConstants.RequestCode.CAMERA: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) - startActivityForResult(MediaUtils.openCamera(getActivity()), StringContract.RequestCode.CAMERA); + startActivityForResult(MediaUtils.openCamera(getActivity()), UIKitConstants.RequestCode.CAMERA); else showSnackBar(view.findViewById(R.id.message_box), getResources().getString(R.string.grant_camera_permission)); break; - case StringContract.RequestCode.GALLERY: + case UIKitConstants.RequestCode.GALLERY: if (grantResults[0] == PackageManager.PERMISSION_GRANTED) - startActivityForResult(MediaUtils.openGallery(getActivity()), StringContract.RequestCode.GALLERY); + startActivityForResult(MediaUtils.openGallery(getActivity()), UIKitConstants.RequestCode.GALLERY); else showSnackBar(view.findViewById(R.id.message_box), getResources().getString(R.string.grant_storage_permission)); break; - case StringContract.RequestCode.FILE: + case UIKitConstants.RequestCode.FILE: if (grantResults[0] == PackageManager.PERMISSION_GRANTED) - startActivityForResult(MediaUtils.getFileIntent(StringContract.IntentStrings.EXTRA_MIME_DOC), StringContract.RequestCode.FILE); + startActivityForResult(MediaUtils.getFileIntent(UIKitConstants.IntentStrings.EXTRA_MIME_DOC), UIKitConstants.RequestCode.FILE); else showSnackBar(view.findViewById(R.id.message_box), getResources().getString(R.string.grant_storage_permission)); break; - case StringContract.RequestCode.LOCATION: + case UIKitConstants.RequestCode.LOCATION: if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { } else showSnackBar(view.findViewById(R.id.message_box), getResources().getString(R.string.grant_location_permission)); @@ -1186,10 +1187,10 @@ private List filterBaseMessages(List baseMessages) { for(BaseMessage baseMessage : baseMessages) { Log.e(TAG, "filterBaseMessages: "+baseMessage.getSentAt()); - if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_ACTION)) { + if (baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_ACTION)) { Action action = ((Action)baseMessage); - if (action.getAction().equals(CometChatConstants.ActionKeys.ACTION_MESSAGE_DELETED) || - action.getAction().equals(CometChatConstants.ActionKeys.ACTION_MESSAGE_EDITED)) { + if (action.getAction().equals(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_MESSAGE_DELETED) || + action.getAction().equals(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_MESSAGE_EDITED)) { } else { tempList.add(baseMessage); @@ -1258,16 +1259,16 @@ private void initMessageAdapter(List messageList) { */ private void sendTypingIndicator(boolean isEnd) { if (isEnd) { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) { - CometChat.endTyping(new TypingIndicator(Id, CometChatConstants.RECEIVER_TYPE_USER)); + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { + CometChat.endTyping(new TypingIndicator(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)); } else { - CometChat.endTyping(new TypingIndicator(Id, CometChatConstants.RECEIVER_TYPE_GROUP)); + CometChat.endTyping(new TypingIndicator(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)); } } else { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) { - CometChat.startTyping(new TypingIndicator(Id, CometChatConstants.RECEIVER_TYPE_USER)); + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { + CometChat.startTyping(new TypingIndicator(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)); } else { - CometChat.startTyping(new TypingIndicator(Id, CometChatConstants.RECEIVER_TYPE_GROUP)); + CometChat.startTyping(new TypingIndicator(Id, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)); } } } @@ -1289,55 +1290,56 @@ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent d Log.d(TAG, "onActivityResult: "); switch (requestCode) { - case StringContract.RequestCode.AUDIO: + case UIKitConstants.RequestCode.AUDIO: if (data!=null) { File file = MediaUtils.getRealPath(getContext(),data.getData()); ContentResolver cr = getActivity().getContentResolver(); - sendMediaMessage(file,CometChatConstants.MESSAGE_TYPE_AUDIO); + sendMediaMessage(file, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO); } break; - case StringContract.RequestCode.GALLERY: + case UIKitConstants.RequestCode.GALLERY: if (data != null) { - + resultIntentCode = UIKitConstants.RequestCode.GALLERY; File file = MediaUtils.getRealPath(getContext(), data.getData()); ContentResolver cr = getActivity().getContentResolver(); String mimeType = cr.getType(data.getData()); if (mimeType!=null && mimeType.contains("image")) { if (file.exists()) - sendMediaMessage(file, CometChatConstants.MESSAGE_TYPE_IMAGE); + sendMediaMessage(file, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE); else Snackbar.make(rvChatListView, R.string.file_not_exist, Snackbar.LENGTH_LONG).show(); } else { if (file.exists()) - sendMediaMessage(file, CometChatConstants.MESSAGE_TYPE_VIDEO); + sendMediaMessage(file, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO); else Snackbar.make(rvChatListView, R.string.file_not_exist, Snackbar.LENGTH_LONG).show(); } } break; - case StringContract.RequestCode.CAMERA: + case UIKitConstants.RequestCode.CAMERA: File file; + resultIntentCode = UIKitConstants.RequestCode.CAMERA; if (Build.VERSION.SDK_INT >= 29) { file = MediaUtils.getRealPath(getContext(), MediaUtils.uri); } else { file = new File(MediaUtils.pictureImagePath); } if (file.exists()) - sendMediaMessage(file, CometChatConstants.MESSAGE_TYPE_IMAGE); + sendMediaMessage(file, com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE); else Snackbar.make(rvChatListView,R.string.file_not_exist,Snackbar.LENGTH_LONG).show(); break; - case StringContract.RequestCode.FILE: + case UIKitConstants.RequestCode.FILE: if (data != null) - sendMediaMessage(MediaUtils.getRealPath(getActivity(), data.getData()), CometChatConstants.MESSAGE_TYPE_FILE); + sendMediaMessage(MediaUtils.getRealPath(getActivity(), data.getData()), com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE); break; - case StringContract.RequestCode.BLOCK_USER: + case UIKitConstants.RequestCode.BLOCK_USER: name = data.getStringExtra(""); break; - case StringContract.RequestCode.LOCATION: + case UIKitConstants.RequestCode.LOCATION: locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { @@ -1363,10 +1365,10 @@ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent d private void sendMediaMessage(File file, String filetype) { MediaMessage mediaMessage; - if (type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) - mediaMessage = new MediaMessage(Id, file, filetype, CometChatConstants.RECEIVER_TYPE_USER); + if (type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) + mediaMessage = new MediaMessage(Id, file, filetype, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); else - mediaMessage = new MediaMessage(Id, file, filetype, CometChatConstants.RECEIVER_TYPE_GROUP); + mediaMessage = new MediaMessage(Id, file, filetype, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); JSONObject jsonObject = new JSONObject(); try { @@ -1377,7 +1379,7 @@ private void sendMediaMessage(File file, String filetype) { mediaMessage.setMetadata(jsonObject); mediaMessage.setMuid(""+System.currentTimeMillis()); - mediaMessage.setCategory(CometChatConstants.CATEGORY_MESSAGE); + mediaMessage.setCategory(com.cometchat.pro.constants.CometChatConstants.CATEGORY_MESSAGE); mediaMessage.setSender(loggedInUser); if (messageAdapter != null) { @@ -1488,15 +1490,15 @@ public void onError(CometChatException e) { */ private void sendMessage(String message) { TextMessage textMessage; - if (type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) - textMessage = new TextMessage(Id, message, CometChatConstants.RECEIVER_TYPE_USER); + if (type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) + textMessage = new TextMessage(Id, message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); else - textMessage = new TextMessage(Id, message, CometChatConstants.RECEIVER_TYPE_GROUP); + textMessage = new TextMessage(Id, message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); textMessage.setParentMessageId(parentId); sendTypingIndicator(true); - textMessage.setCategory(CometChatConstants.CATEGORY_MESSAGE); + textMessage.setCategory(com.cometchat.pro.constants.CometChatConstants.CATEGORY_MESSAGE); textMessage.setSender(loggedInUser); textMessage.setMuid(System.currentTimeMillis()+""); if (messageAdapter != null) { @@ -1569,10 +1571,10 @@ private void editMessage(BaseMessage baseMessage, String message) { isEdit = false; isParent = true; TextMessage textMessage; - if (baseMessage.getReceiverType().equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) - textMessage = new TextMessage(baseMessage.getReceiverUid(), message, CometChatConstants.RECEIVER_TYPE_USER); + if (baseMessage.getReceiverType().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) + textMessage = new TextMessage(baseMessage.getReceiverUid(), message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); else - textMessage = new TextMessage(baseMessage.getReceiverUid(), message, CometChatConstants.RECEIVER_TYPE_GROUP); + textMessage = new TextMessage(baseMessage.getReceiverUid(), message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); sendTypingIndicator(true); textMessage.setId(baseMessage.getId()); CometChat.editMessage(textMessage, new CometChat.CallbackListener() { @@ -1601,26 +1603,26 @@ private void replyMessage(BaseMessage baseMessage, String message) { isReply = false; try { TextMessage textMessage; - if (type.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) - textMessage = new TextMessage(Id, message, CometChatConstants.RECEIVER_TYPE_USER); + if (type.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) + textMessage = new TextMessage(Id, message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); else - textMessage = new TextMessage(Id, message, CometChatConstants.RECEIVER_TYPE_GROUP); + textMessage = new TextMessage(Id, message, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); JSONObject jsonObject = new JSONObject(); JSONObject replyObject = new JSONObject(); - if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { - replyObject.put("type",CometChatConstants.MESSAGE_TYPE_TEXT); + if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { + replyObject.put("type", com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT); replyObject.put("message", ((TextMessage) baseMessage).getText()); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) { - replyObject.put("type",CometChatConstants.MESSAGE_TYPE_IMAGE); + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) { + replyObject.put("type", com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE); replyObject.put("message", "image"); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_VIDEO)) { - replyObject.put("type",CometChatConstants.MESSAGE_TYPE_VIDEO); + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO)) { + replyObject.put("type", com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO); replyObject.put("message", "video"); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_FILE)) { - replyObject.put("type",CometChatConstants.MESSAGE_TYPE_FILE); + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE)) { + replyObject.put("type", com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE); replyObject.put("message", "file"); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_AUDIO)) { - replyObject.put("type", CometChatConstants.MESSAGE_TYPE_AUDIO); + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO)) { + replyObject.put("type", com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO); replyObject.put("message", "audio"); } replyObject.put("name",baseMessage.getSender().getName()); @@ -1669,7 +1671,7 @@ private void scrollToBottom() { * @param baseMessage is object of BaseMessage.class. It is message which is been marked as read. */ private void markMessageAsRead(BaseMessage baseMessage) { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) CometChat.markAsRead(baseMessage.getId(), baseMessage.getSender().getUid(), baseMessage.getReceiverType()); else CometChat.markAsRead(baseMessage.getId(), baseMessage.getReceiverUid(), baseMessage.getReceiverType()); @@ -1751,7 +1753,7 @@ public void onMessageDeleted(BaseMessage message) { private void setMessageReciept(MessageReceipt messageReceipt) { if (messageAdapter != null) { - if (messageReceipt.getReceivertype().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (messageReceipt.getReceivertype().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { if (Id!=null && messageReceipt.getSender().getUid().equals(Id)) { if (messageReceipt.getReceiptType().equals(MessageReceipt.RECEIPT_TYPE_DELIVERED)) messageAdapter.setDeliveryReceipts(messageReceipt); @@ -1763,7 +1765,7 @@ private void setMessageReciept(MessageReceipt messageReceipt) { } private void setTypingIndicator(TypingIndicator typingIndicator,boolean isShow) { - if (typingIndicator.getReceiverType().equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) { + if (typingIndicator.getReceiverType().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { Log.e(TAG, "onTypingStarted: " + typingIndicator); if (Id != null && Id.equalsIgnoreCase(typingIndicator.getSender().getUid())) { if (typingIndicator.getMetadata() == null) @@ -1778,7 +1780,7 @@ private void setTypingIndicator(TypingIndicator typingIndicator,boolean isShow) private void onMessageReceived(BaseMessage message) { noReplyMessages.setVisibility(GONE); MediaUtils.playSendSound(context,R.raw.incoming_message); - if (message.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (message.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { if (Id != null && Id.equalsIgnoreCase(message.getSender().getUid())) { if (message.getParentMessageId()==parentId) setMessage(message); @@ -1852,7 +1854,7 @@ private void checkSmartReply(BaseMessage lastMessage) { private void typingIndicator(TypingIndicator typingIndicator, boolean show) { if (messageAdapter != null) { if (show) { - if (typingIndicator.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (typingIndicator.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { if (typingIndicator.getMetadata() == null) { if (UISettings.isShowTypingIndicators()) tvTypingIndicator.setText("is Typing..."); @@ -1923,18 +1925,21 @@ public void onPause() { public void onResume() { super.onResume(); Log.d(TAG, "onResume: "); - messageAdapter = null; - messagesRequest = null; + if (!(resultIntentCode== UIKitConstants.RequestCode.GALLERY || + resultIntentCode== UIKitConstants.RequestCode.CAMERA)) { + messagesRequest = null; + messageAdapter = null; + isNoMoreMessages = false; + fetchMessage(); + } checkOnGoingCall(); - fetchMessage(); - isNoMoreMessages = false; addMessageListener(); - if (messageActionFragment!=null) + if (messageActionFragment!=null && messageActionFragment.getFragmentManager()!=null) messageActionFragment.dismiss(); if (type != null) { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { new Thread(this::getUser).start(); } else { new Thread(this::getGroup).start(); @@ -1966,9 +1971,9 @@ public void onClick(View view) { } } else if (id == R.id.ic_more_option) { - MessageActionFragment messageActionFragment = new MessageActionFragment(); + CometChatMessageActions messageActionFragment = new CometChatMessageActions(); Bundle bundle = new Bundle(); - if (messageType.equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { bundle.putBoolean("translateVisible",true); bundle.putBoolean("copyVisible", true); } @@ -1976,13 +1981,13 @@ else if (id == R.id.ic_more_option) { bundle.putBoolean("copyVisible",false); bundle.putBoolean("forwardVisible",true); - if (name.equals(loggedInUser.getName()) && messageType.equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + if (name.equals(loggedInUser.getName()) && messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { bundle.putBoolean("editVisible",true); } else { bundle.putBoolean("editVisible",false); } - bundle.putString("type", CometChatThreadMessageActivity.class.getName()); + bundle.putString("type", CometChatThreadMessageListActivity.class.getName()); messageActionFragment.setArguments(bundle); showBottomSheet(messageActionFragment); isParent = true; @@ -2014,22 +2019,22 @@ else if (id == R.id.btn_unblock_user) { unblockUser(); } else if (id == R.id.chatList_toolbar) { - if (type.equals(CometChatConstants.RECEIVER_TYPE_USER)) { + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) { Intent intent = new Intent(getContext(), CometChatUserDetailScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.UID, Id); - intent.putExtra(StringContract.IntentStrings.NAME, conversationName); - intent.putExtra(StringContract.IntentStrings.AVATAR, avatarUrl); - intent.putExtra(StringContract.IntentStrings.IS_BLOCKED_BY_ME, isBlockedByMe); - intent.putExtra(StringContract.IntentStrings.TYPE, type); + intent.putExtra(UIKitConstants.IntentStrings.UID, Id); + intent.putExtra(UIKitConstants.IntentStrings.NAME, conversationName); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, avatarUrl); + intent.putExtra(UIKitConstants.IntentStrings.IS_BLOCKED_BY_ME, isBlockedByMe); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, type); startActivity(intent); } else { - Intent intent = new Intent(getContext(), CometChatGroupDetailScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID, Id); - intent.putExtra(StringContract.IntentStrings.NAME, conversationName); - intent.putExtra(StringContract.IntentStrings.AVATAR, avatarUrl); - intent.putExtra(StringContract.IntentStrings.TYPE, type); - intent.putExtra(StringContract.IntentStrings.MEMBER_SCOPE, loggedInUserScope); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER, groupOwnerId); + Intent intent = new Intent(getContext(), CometChatGroupDetailActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.GUID, Id); + intent.putExtra(UIKitConstants.IntentStrings.NAME, conversationName); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, avatarUrl); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, type); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_SCOPE, loggedInUserScope); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER, groupOwnerId); startActivity(intent); } } @@ -2041,7 +2046,7 @@ public void setLongMessageClick(List baseMessagesList) { isReply = false; isEdit = false; isParent = false; - messageActionFragment = new MessageActionFragment(); + messageActionFragment = new CometChatMessageActions(); replyMessageLayout.setVisibility(GONE); editMessageLayout.setVisibility(GONE); boolean copyVisible = UISettings.isEnableShareCopyForward(); @@ -2056,13 +2061,13 @@ public void setLongMessageClick(List baseMessagesList) { List mediaMessageList = new ArrayList<>(); List locationMessageList = new ArrayList<>(); for (BaseMessage baseMessage : baseMessagesList) { - if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { textMessageList.add(baseMessage); } - else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE) || - baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_VIDEO) || - baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_FILE) || - baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_AUDIO) ){ + else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE) || + baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO) || + baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE) || + baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO) ){ mediaMessageList.add(baseMessage); } else { @@ -2083,7 +2088,7 @@ else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE) || } else { editVisible = false; forwardVisible = true; - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))) { + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))) { deleteVisible = true; } else { deleteVisible = false; @@ -2106,7 +2111,7 @@ else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE) || editVisible = false; forwardVisible = true; } else { - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))){ + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))){ deleteVisible = true; } else { deleteVisible = false; @@ -2131,7 +2136,7 @@ else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE) || deleteVisible = true; editVisible = false; } else { - if (loggedInUserScope!=null && (loggedInUserScope.equals(CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(CometChatConstants.SCOPE_MODERATOR))){ + if (loggedInUserScope!=null && (loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_ADMIN) || loggedInUserScope.equals(com.cometchat.pro.constants.CometChatConstants.SCOPE_MODERATOR))){ deleteVisible = true; } else { deleteVisible = false; @@ -2152,10 +2157,10 @@ else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE) || bundle.putBoolean("translateVisible",translateVisible); if (CometChat.isExtensionEnabled("reactions")) bundle.putBoolean("isReactionVisible",reactionVisible); - if (baseMessage.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_GROUP) && + if (baseMessage.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP) && baseMessage.getSender().getUid().equals(loggedInUser.getUid())) bundle.putBoolean("messageInfoVisible",true); - bundle.putString("type", CometChatThreadMessageActivity.class.getName()); + bundle.putString("type", CometChatThreadMessageListActivity.class.getName()); messageActionFragment.setArguments(bundle); if (baseMessage.getSentAt()!=0) { if (editVisible || copyVisible || threadVisible || deleteVisible @@ -2165,9 +2170,9 @@ else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE) || } } - private void showBottomSheet(MessageActionFragment messageActionFragment) { + private void showBottomSheet(CometChatMessageActions messageActionFragment) { messageActionFragment.show(getFragmentManager(),messageActionFragment.getTag()); - messageActionFragment.setMessageActionListener(new MessageActionFragment.MessageActionListener() { + messageActionFragment.setMessageActionListener(new CometChatMessageActions.MessageActionListener() { @Override public void onThreadMessageClick() { @@ -2239,31 +2244,31 @@ public void onMessageInfoClick() { if (isParent){ } else { - intent.putExtra(StringContract.IntentStrings.ID, baseMessage.getId()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE, baseMessage.getType()); - intent.putExtra(StringContract.IntentStrings.SENTAT, baseMessage.getSentAt()); - if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { - intent.putExtra(StringContract.IntentStrings.TEXTMESSAGE, + intent.putExtra(UIKitConstants.IntentStrings.ID, baseMessage.getId()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT, baseMessage.getSentAt()); + if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { + intent.putExtra(UIKitConstants.IntentStrings.TEXTMESSAGE, Extensions.checkProfanityMessage(baseMessage)); - } else if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_CUSTOM)) { + } else if (baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CUSTOM)) { if (((CustomMessage)baseMessage).getCustomData()!=null) - intent.putExtra(StringContract.IntentStrings.CUSTOM_MESSAGE, + intent.putExtra(UIKitConstants.IntentStrings.CUSTOM_MESSAGE, ((CustomMessage) baseMessage).getCustomData().toString()); - if (baseMessage.getType().equals(StringContract.IntentStrings.LOCATION)) { - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE, - StringContract.IntentStrings.LOCATION); + if (baseMessage.getType().equals(UIKitConstants.IntentStrings.LOCATION)) { + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE, + UIKitConstants.IntentStrings.LOCATION); } } else { boolean isImageNotSafe = Extensions.getImageModeration(context, baseMessage); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL, + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL, ((MediaMessage) baseMessage).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME, + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME, ((MediaMessage) baseMessage).getAttachment().getFileName()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE, + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE, ((MediaMessage) baseMessage).getAttachment().getFileSize()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION, + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION, ((MediaMessage) baseMessage).getAttachment().getFileExtension()); - intent.putExtra(StringContract.IntentStrings.IMAGE_MODERATION, isImageNotSafe); + intent.putExtra(UIKitConstants.IntentStrings.IMAGE_MODERATION, isImageNotSafe); } } context.startActivity(intent); @@ -2272,8 +2277,8 @@ public void onMessageInfoClick() { @Override public void onReactionClick(Reaction reaction) { if (reaction.getName().equals("add_emoji")) { - ReactionDialog reactionDialog = new ReactionDialog(); - reactionDialog.setOnEmojiClick(new OnEmojiClickListener() { + CometChatReactionDialog reactionDialog = new CometChatReactionDialog(); + reactionDialog.setOnEmojiClick(new OnReactionClickListener() { @Override public void onEmojiClicked(Reaction emojicon) { sendReaction(emojicon); @@ -2378,7 +2383,7 @@ public void onError(CometChatException e) { }); } private void editParentMessage() { - if (message!=null&&messageType.equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + if (message!=null&&messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { isEdit = true; isReply = false; tvMessageTitle.setText(getResources().getString(R.string.edit_message)); @@ -2390,7 +2395,7 @@ private void editParentMessage() { } private void shareMessage() { - if (baseMessage!=null && baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_TEXT)) { + if (baseMessage!=null && baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_TITLE,getResources().getString(R.string.app_name)); @@ -2398,7 +2403,7 @@ private void shareMessage() { shareIntent.setType("text/plain"); Intent intent = Intent.createChooser(shareIntent, getResources().getString(R.string.share_message)); startActivity(intent); - } else if (baseMessage!=null && baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) { + } else if (baseMessage!=null && baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) { String mediaName = ((MediaMessage)baseMessage).getAttachment().getFileName(); Glide.with(context).asBitmap().load(((MediaMessage)baseMessage).getAttachment().getFileUrl()).into(new SimpleTarget() { @Override @@ -2416,7 +2421,7 @@ public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition pollResult; + + private int voteCount; + + private HashMap reactionInfo; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_cometchat_message_list); + + if (UISettings.getColor() !=null) { + getWindow().setStatusBarColor(Color.parseColor(UISettings.getColor())); + } + EmojiCompat.Config config = new BundledEmojiCompatConfig(this); + EmojiCompat.init(config); + + if (getIntent()!=null) { + Bundle bundle = new Bundle(); +// if (getIntent().hasExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE)) +// baseMessage = getIntent().getStringExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY)) + messageCategory = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_CATEGORY); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.LOCATION_LONGITUDE)) + longitude = getIntent().getDoubleExtra(UIKitConstants.IntentStrings.LOCATION_LONGITUDE,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.LOCATION_LATITUDE)) + latitude = getIntent().getDoubleExtra(UIKitConstants.IntentStrings.LOCATION_LATITUDE,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.CONVERSATION_NAME)) + conversationName = getIntent().getStringExtra(UIKitConstants.IntentStrings.CONVERSATION_NAME); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.PARENT_ID)) + messageId = getIntent().getIntExtra(UIKitConstants.IntentStrings.PARENT_ID,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.REPLY_COUNT)) + replyCount = getIntent().getIntExtra(UIKitConstants.IntentStrings.REPLY_COUNT,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.AVATAR)) + avatar = getIntent().getStringExtra(UIKitConstants.IntentStrings.AVATAR); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.NAME)) + name = getIntent().getStringExtra(UIKitConstants.IntentStrings.NAME); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE)) + messageType = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.UID)) + uid = getIntent().getStringExtra(UIKitConstants.IntentStrings.UID); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.SENTAT)) + sentAt = getIntent().getLongExtra(UIKitConstants.IntentStrings.SENTAT,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.TEXTMESSAGE)) + message = getIntent().getStringExtra(UIKitConstants.IntentStrings.TEXTMESSAGE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME)) + messagefileName = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE)) + mediaSize = getIntent().getIntExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,0); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL)) + mediaUrl = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION)) + mediaExtension = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.TYPE)) + type = getIntent().getStringExtra(UIKitConstants.IntentStrings.TYPE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE)) + mediaMime = getIntent().getStringExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.POLL_QUESTION)) + pollQuestion = getIntent().getStringExtra(UIKitConstants.IntentStrings.POLL_QUESTION); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.POLL_OPTION)) + pollOptions = getIntent().getStringExtra(UIKitConstants.IntentStrings.POLL_OPTION); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.POLL_RESULT)) + pollResult = getIntent().getStringArrayListExtra(UIKitConstants.IntentStrings.POLL_RESULT); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.POLL_VOTE_COUNT)) + voteCount = getIntent().getIntExtra(UIKitConstants.IntentStrings.POLL_VOTE_COUNT,0); + if (type.equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) { + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GUID)) + Id = getIntent().getStringExtra(UIKitConstants.IntentStrings.GUID); + } else{ + if (getIntent().hasExtra(UIKitConstants.IntentStrings.UID)) + Id = getIntent().getStringExtra(UIKitConstants.IntentStrings.UID); + } + bundle.putString(UIKitConstants.IntentStrings.MESSAGE_CATEGORY,messageCategory); + bundle.putString(UIKitConstants.IntentStrings.ID,Id); + bundle.putString(UIKitConstants.IntentStrings.CONVERSATION_NAME,conversationName); + bundle.putString(UIKitConstants.IntentStrings.TYPE,type); + bundle.putString(UIKitConstants.IntentStrings.AVATAR, avatar); + bundle.putString(UIKitConstants.IntentStrings.NAME, name); + bundle.putInt(UIKitConstants.IntentStrings.PARENT_ID,messageId); + bundle.putInt(UIKitConstants.IntentStrings.REPLY_COUNT,replyCount); + bundle.putString(UIKitConstants.IntentStrings.MESSAGE_TYPE,messageType); + bundle.putString(UIKitConstants.IntentStrings.UID, uid); + bundle.putLong(UIKitConstants.IntentStrings.SENTAT, sentAt); + + if (getIntent().hasExtra(UIKitConstants.IntentStrings.REACTION_INFO)) { + reactionInfo = (HashMap) getIntent().getSerializableExtra(UIKitConstants.IntentStrings.REACTION_INFO); + bundle.putSerializable(UIKitConstants.IntentStrings.REACTION_INFO, reactionInfo); + } + + if (messageType.equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT)) + bundle.putString(UIKitConstants.IntentStrings.TEXTMESSAGE,message); + else if (messageType.equals(UIKitConstants.IntentStrings.LOCATION)) { + bundle.putDouble(UIKitConstants.IntentStrings.LOCATION_LATITUDE,latitude); + bundle.putDouble(UIKitConstants.IntentStrings.LOCATION_LONGITUDE,longitude); + } else if (messageType.equals(UIKitConstants.IntentStrings.POLLS)) { + bundle.putStringArrayList(UIKitConstants.IntentStrings.POLL_RESULT,pollResult); + bundle.putString(UIKitConstants.IntentStrings.POLL_QUESTION,pollQuestion); + bundle.putString(UIKitConstants.IntentStrings.POLL_OPTION,pollOptions); + bundle.putInt(UIKitConstants.IntentStrings.POLL_VOTE_COUNT,voteCount); + } else if (messageType.equals(UIKitConstants.IntentStrings.STICKERS)) { + bundle.putString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL,mediaUrl); + bundle.putString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,messagefileName); + } else if (messageType.equals(UIKitConstants.IntentStrings.WHITEBOARD) || + messageType.equals(UIKitConstants.IntentStrings.WRITEBOARD)) { + bundle.putString(UIKitConstants.IntentStrings.TEXTMESSAGE,message); + } else { + bundle.putString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_URL,mediaUrl); + bundle.putString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,messagefileName); + bundle.putString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,mediaExtension); + bundle.putInt(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,mediaSize); + bundle.putString(UIKitConstants.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE,mediaMime); + } + + fragment.setArguments(bundle); + getSupportFragmentManager().beginTransaction().replace(R.id.ChatFragment, fragment).commit(); + } + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { + super.onActivityResult(requestCode,resultCode,data); + Log.d(TAG, "onActivityResult: "); + + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + Log.d(TAG, "onRequestPermissionsResult: "); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + return super.onCreateOptionsMenu(menu); + } + + @Override + public void onBackPressed() { + super.onBackPressed(); + } + + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + return super.onOptionsItemSelected(item); + } + + @Override + public void setLongMessageClick(List baseMessage) { + if (fragment!=null) + ((OnMessageLongClick)fragment).setLongMessageClick(baseMessage); + } + + + @Override + protected void onResume() { + super.onResume(); + } + + @Override + protected void onPause() { + super.onPause(); + } + + public void handleDialogClose(DialogInterface dialog) { + ((MessageActionCloseListener)fragment).handleDialogClose(dialog); + dialog.dismiss(); + } +} diff --git a/uikit/src/main/java/adapter/ThreadAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/thread_message_list/ThreadAdapter.java similarity index 94% rename from uikit/src/main/java/adapter/ThreadAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/thread_message_list/ThreadAdapter.java index cc199201..57f9105b 100644 --- a/uikit/src/main/java/adapter/ThreadAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/messages/thread_message_list/ThreadAdapter.java @@ -1,7 +1,6 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.messages.thread_message_list; import android.app.AlertDialog; -import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -10,7 +9,6 @@ import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.Typeface; -import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.media.MediaPlayer; import android.net.Uri; @@ -20,7 +18,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; @@ -36,45 +33,40 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.request.target.CustomTarget; -import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.transition.Transition; -import com.cometchat.pro.constants.CometChatConstants; -import com.cometchat.pro.core.Call; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; -import com.cometchat.pro.models.Action; +import com.cometchat.pro.models.Attachment; import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.CustomMessage; import com.cometchat.pro.models.MediaMessage; import com.cometchat.pro.models.MessageReceipt; import com.cometchat.pro.models.TextMessage; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.Avatar; + +import com.cometchat.pro.uikit.ui_components.messages.extensions.Extensions; +import com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar.CometChatAvatar; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Settings.UISettings; + +import com.cometchat.pro.uikit.ui_resources.utils.pattern_utils.PatternUtils; +import com.cometchat.pro.uikit.ui_settings.UISettings; import com.google.android.material.button.MaterialButton; import com.google.android.material.chip.Chip; import com.google.android.material.chip.ChipGroup; -import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; -import java.util.Date; import java.util.HashMap; import java.util.List; -import constant.StringContract; -import listeners.StickyHeaderAdapter; -import screen.CometChatMediaViewActivity; -import screen.CometChatReactionInfoScreenActivity; -import screen.threadconversation.CometChatThreadMessageActivity; -import utils.Extensions; -import utils.FontUtils; -import utils.MediaUtils; -import utils.Utils; -import utils.ZoomIv; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_components.messages.media_view.CometChatMediaViewActivity; +import com.cometchat.pro.uikit.ui_components.messages.extensions.Reactions.CometChatReactionInfoActivity; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.MediaUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - ThreadeAdapter is a subclass of RecyclerView Adapter which is used to display @@ -160,7 +152,7 @@ public ThreadAdapter(Context context, List messageList, String type setMessageList(messageList); this.context = context; try { - messageLongClick = (CometChatThreadMessageActivity)context; + messageLongClick = (CometChatThreadMessageListActivity)context; }catch (Exception e) { e.printStackTrace(); } @@ -391,7 +383,7 @@ private void setLocationData(BaseMessage baseMessage, TextView tvAddress, ImageV LATITUDE = ((CustomMessage) baseMessage).getCustomData().getDouble("latitude"); LONGITUDE = ((CustomMessage) baseMessage).getCustomData().getDouble("longitude"); tvAddress.setText(Utils.getAddress(context, LATITUDE, LONGITUDE)); - String mapUrl = StringContract.MapUrl.MAPS_URL +LATITUDE+","+LONGITUDE+"&key="+ StringContract.MapUrl.MAP_ACCESS_KEY; + String mapUrl = UIKitConstants.MapUrl.MAPS_URL +LATITUDE+","+LONGITUDE+"&key="+ UIKitConstants.MapUrl.MAP_ACCESS_KEY; Glide.with(context) .load(mapUrl) .diskCacheStrategy(DiskCacheStrategy.ALL) @@ -550,17 +542,28 @@ private void setImageData(ImageMessageViewHolder viewHolder, int i) { boolean isImageNotSafe = Extensions.getImageModeration(context,baseMessage); String smallUrl = Extensions.getThumbnailGeneration(context,baseMessage); viewHolder.imageView.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_defaulf_image)); - if (smallUrl!=null) { - if (((MediaMessage)baseMessage).getAttachment().getFileExtension().equalsIgnoreCase(".gif")) { - setImageDrawable(viewHolder,smallUrl,true,false); + Attachment attachment = ((MediaMessage)baseMessage).getAttachment(); + if (attachment!=null) { + if (smallUrl != null) { + if (((MediaMessage) baseMessage).getAttachment().getFileExtension().equalsIgnoreCase(".gif")) { + setImageDrawable(viewHolder, smallUrl, true, false); + } else { + setImageDrawable(viewHolder, smallUrl, false, isImageNotSafe); + } } else { - setImageDrawable(viewHolder,smallUrl,false,isImageNotSafe); + if (((MediaMessage) baseMessage).getAttachment().getFileExtension().equalsIgnoreCase(".gif")) + setImageDrawable(viewHolder, ((MediaMessage) baseMessage).getAttachment().getFileUrl(), true, false); + else + setImageDrawable(viewHolder, ((MediaMessage) baseMessage).getAttachment().getFileUrl(), false, isImageNotSafe); + } + } + if (baseMessage.getMetadata()!=null) { + try { + String filePath = baseMessage.getMetadata().getString("path"); + Glide.with(context).load(filePath).diskCacheStrategy(DiskCacheStrategy.NONE).into(viewHolder.imageView); + } catch (JSONException e) { + e.printStackTrace(); } - } else { - if (((MediaMessage)baseMessage).getAttachment().getFileExtension().equalsIgnoreCase(".gif")) - setImageDrawable(viewHolder,((MediaMessage)baseMessage).getAttachment().getFileUrl(),true,false); - else - setImageDrawable(viewHolder,((MediaMessage)baseMessage).getAttachment().getFileUrl(),false,isImageNotSafe); } if (isImageNotSafe) { viewHolder.sensitiveLayout.setVisibility(View.VISIBLE); @@ -644,12 +647,12 @@ public void onLoadCleared(@Nullable Drawable placeholder) { private void openMediaViewActivity(BaseMessage baseMessage) { Intent intent = new Intent(context, CometChatMediaViewActivity.class); - intent.putExtra(StringContract.IntentStrings.NAME,baseMessage.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.UID,baseMessage.getSender().getUid()); - intent.putExtra(StringContract.IntentStrings.SENTAT,baseMessage.getSentAt()); - intent.putExtra(StringContract.IntentStrings.INTENT_MEDIA_MESSAGE, + intent.putExtra(UIKitConstants.IntentStrings.NAME,baseMessage.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.UID,baseMessage.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,baseMessage.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.INTENT_MEDIA_MESSAGE, ((MediaMessage)baseMessage).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,baseMessage.getType()); context.startActivity(intent); } @@ -860,7 +863,7 @@ public void onClick(DialogInterface dialog, int which) { if (processed instanceof Spannable) { Spannable spannable = (Spannable) processed; count = spannable.getSpans(0, spannable.length() - 1, EmojiSpan.class).length; - if (Utils.removeEmojiAndSymbol(txtMessage).trim().length() == 0) { + if (PatternUtils.removeEmojiAndSymbol(txtMessage).trim().length() == 0) { if (count == 1) { viewHolder.txtMessage.setTextSize((int) Utils.dpToPx(context, 32)); } else if (count == 2) { @@ -890,7 +893,7 @@ else if (CometChat.isExtensionEnabled("data-masking")) viewHolder.txtMessage.setTextColor(context.getResources().getColor(R.color.primaryTextColor)); - Utils.setHyperLinkSupport(context,viewHolder.txtMessage); + PatternUtils.setHyperLinkSupport(context,viewHolder.txtMessage); showMessageTime(viewHolder, baseMessage); if (messageList.get(messageList.size()-1).equals(baseMessage)) { @@ -979,8 +982,8 @@ private void setReactionSupport(BaseMessage baseMessage, ChipGroup reactionLayou chip.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { - Intent intent = new Intent(context, CometChatReactionInfoScreenActivity.class); - intent.putExtra(StringContract.IntentStrings.REACTION_INFO,baseMessage.getMetadata().toString()); + Intent intent = new Intent(context, CometChatReactionInfoActivity.class); + intent.putExtra(UIKitConstants.IntentStrings.REACTION_INFO,baseMessage.getMetadata().toString()); context.startActivity(intent); return true; } @@ -1071,7 +1074,7 @@ private void setLinkData(LinkMessageViewHolder viewHolder, int i) { } } } - Utils.setHyperLinkSupport(context,viewHolder.message); + PatternUtils.setHyperLinkSupport(context,viewHolder.message); showMessageTime(viewHolder, baseMessage); String finalUrl = url; viewHolder.linkVisit.setOnClickListener(new View.OnClickListener() { @@ -1146,10 +1149,10 @@ public void setLongClickSelectedItem(BaseMessage baseMessage) { * @param avatar is a object of Avatar * @param avatarUrl is a String. It is url of avatar. * @param name is a String. It is a name of groupMember. - * @see Avatar + * @see CometChatAvatar * */ - private void setAvatar(Avatar avatar, String avatarUrl, String name) { + private void setAvatar(CometChatAvatar avatar, String avatarUrl, String name) { if (avatarUrl != null && !avatarUrl.isEmpty()) Glide.with(context).load(avatarUrl).into(avatar); @@ -1208,29 +1211,29 @@ private int getItemViewTypes(int position) { BaseMessage baseMessage = messageList.get(position); HashMap extensionList = Extensions.extensionCheck(baseMessage); if (baseMessage.getDeletedAt()==0) { - if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_MESSAGE)) { + if (baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_MESSAGE)) { switch (baseMessage.getType()) { - case CometChatConstants.MESSAGE_TYPE_TEXT: + case com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_TEXT: if (extensionList != null && extensionList.containsKey("linkPreview") && extensionList.get("linkPreview") != null) return LINK_MESSAGE; else if (baseMessage.getMetadata()!=null && baseMessage.getMetadata().has("reply")) return REPLY_TEXT_MESSAGE; else return TEXT_MESSAGE; - case CometChatConstants.MESSAGE_TYPE_AUDIO: + case com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO: return AUDIO_MESSAGE; - case CometChatConstants.MESSAGE_TYPE_IMAGE: + case com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE: return IMAGE_MESSAGE; - case CometChatConstants.MESSAGE_TYPE_VIDEO: + case com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO: return VIDEO_MESSAGE; - case CometChatConstants.MESSAGE_TYPE_FILE: + case com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE: return FILE_MESSAGE; default: return -1; } } else { - if (baseMessage.getCategory().equals(CometChatConstants.CATEGORY_CUSTOM)){ + if (baseMessage.getCategory().equals(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CUSTOM)){ if (baseMessage.getType().equalsIgnoreCase("LOCATION")) return LOCATION_CUSTOM_MESSAGE; else @@ -1373,7 +1376,7 @@ class ImageMessageViewHolder extends RecyclerView.ViewHolder { private ImageView imageView; private CardView cardView; private ProgressBar progressBar; - private Avatar ivUser; + private CometChatAvatar ivUser; public TextView txtTime,tvUser; private RelativeLayout rlMessageBubble; @@ -1401,7 +1404,7 @@ class VideoMessageViewHolder extends RecyclerView.ViewHolder { private ImageView playBtn; private CardView cardView; private ProgressBar progressBar; - private Avatar ivUser; + private CometChatAvatar ivUser; public TextView txtTime,tvUser; private RelativeLayout rlMessageBubble; private ChipGroup reactionLayout; @@ -1429,7 +1432,7 @@ public class FileMessageViewHolder extends RecyclerView.ViewHolder { private TextView fileSize; private TextView tvUser; private View view; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; private ChipGroup reactionLayout; private ProgressBar progressBar; @@ -1458,7 +1461,7 @@ public class DeleteMessageViewHolder extends RecyclerView.ViewHolder { public TextView tvUser; private ImageView imgStatus; private int type; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; DeleteMessageViewHolder(@NonNull View view) { @@ -1484,7 +1487,7 @@ public class TextMessageViewHolder extends RecyclerView.ViewHolder { public TextView tvUser; private ImageView imgStatus; private int type; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; private RelativeLayout replyLayout; private TextView replyUser; @@ -1525,7 +1528,7 @@ public class CustomMessageViewHolder extends RecyclerView.ViewHolder { public TextView tvUser; private ImageView imgStatus; private int type; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; @@ -1557,7 +1560,7 @@ public class LocationMessageViewHolder extends RecyclerView.ViewHolder { public TextView txtTime; public TextView tvUser; - public Avatar ivUser; + public CometChatAvatar ivUser; public ChipGroup reactionLayout; public LocationMessageViewHolder(View itemView) { @@ -1584,7 +1587,7 @@ public class AudioMessageViewHolder extends RecyclerView.ViewHolder { private ImageView playBtn; private int type; private TextView tvUser; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; private TextView txtTime; private ChipGroup reactionLayout; @@ -1616,7 +1619,7 @@ public class LinkMessageViewHolder extends RecyclerView.ViewHolder { private ImageView linkImg; private int type; private TextView tvUser; - private Avatar ivUser; + private CometChatAvatar ivUser; private RelativeLayout rlMessageBubble; private ChipGroup reactionLayout; private ProgressBar progressBar; diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Avatar.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatAvatar/CometChatAvatar.java similarity index 94% rename from uikit/src/main/java/com/cometchat/pro/uikit/Avatar.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatAvatar/CometChatAvatar.java index 28f6c519..cf6351d9 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Avatar.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatAvatar/CometChatAvatar.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit; +package com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar; import android.app.Activity; import android.content.Context; @@ -31,8 +31,9 @@ import com.cometchat.pro.models.Group; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.R; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - This class is a subclass of AppCompatImageView, It is a component which is been used by developer @@ -45,13 +46,13 @@ * Modified on - 20th January 2020 * */ -@BindingMethods(value = {@BindingMethod(type = Avatar.class, attribute = "app:avatar", method = "setAvatar"), - @BindingMethod(type = Avatar.class, attribute = "app:avatar_name", method = "setInitials")}) -public class Avatar extends AppCompatImageView { +@BindingMethods(value = {@BindingMethod(type = CometChatAvatar.class, attribute = "app:avatar", method = "setAvatar"), + @BindingMethod(type = CometChatAvatar.class, attribute = "app:avatar_name", method = "setInitials")}) +public class CometChatAvatar extends AppCompatImageView { - private static final String TAG = Avatar.class.getSimpleName(); + private static final String TAG = CometChatAvatar.class.getSimpleName(); - private final Class avatar = Avatar.class; + private final Class avatar = CometChatAvatar.class; private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP; @@ -103,7 +104,7 @@ public class Avatar extends AppCompatImageView { String avatarUrl; /* - * Image width and height (both are same and constant, defined in dimens.xml + * Image width and height (both are same and com.cometchat.pro.uikit.UI_Resources.constant, defined in dimens.xml * We cache them in this field * */ private int imageSize; @@ -130,19 +131,19 @@ public class Avatar extends AppCompatImageView { private float borderRadius; - public Avatar(Context context) { + public CometChatAvatar(Context context) { super(context); this.context = context; } - public Avatar(Context context, AttributeSet attrs) { + public CometChatAvatar(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; getAttributes(attrs); init(); } - public Avatar(Context context, AttributeSet attrs, int defStyleAttr) { + public CometChatAvatar(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.context = context; getAttributes(attrs); diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/BadgeCount.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatBadgeCount/CometChatBadgeCount.java similarity index 87% rename from uikit/src/main/java/com/cometchat/pro/uikit/BadgeCount.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatBadgeCount/CometChatBadgeCount.java index ed99b981..149faf5e 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/BadgeCount.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatBadgeCount/CometChatBadgeCount.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit; +package com.cometchat.pro.uikit.ui_components.shared.cometchatBadgeCount; import android.content.Context; import android.content.res.TypedArray; @@ -14,6 +14,7 @@ import androidx.databinding.BindingMethod; import androidx.databinding.BindingMethods; +import com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar.CometChatAvatar; import com.cometchat.pro.uikit.R; /** @@ -28,8 +29,8 @@ * */ -@BindingMethods(value = {@BindingMethod(type = Avatar.class, attribute = "app:count", method = "setCount")}) -public class BadgeCount extends LinearLayout { +@BindingMethods(value = {@BindingMethod(type = CometChatAvatar.class, attribute = "app:count", method = "setCount")}) +public class CometChatBadgeCount extends LinearLayout { private TextView tvCount; //Used to display count @@ -41,17 +42,17 @@ public class BadgeCount extends LinearLayout { private int countBackgroundColor; //Used to store background color of count. - public BadgeCount(Context context) { + public CometChatBadgeCount(Context context) { super(context); initViewComponent(context, null, -1); } - public BadgeCount(Context context, AttributeSet attrs) { + public CometChatBadgeCount(Context context, AttributeSet attrs) { super(context, attrs); initViewComponent(context, attrs, -1); } - public BadgeCount(Context context, AttributeSet attrs, int defStyleAttr) { + public CometChatBadgeCount(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initViewComponent(context, attrs, defStyleAttr); } @@ -66,7 +67,7 @@ public BadgeCount(Context context, AttributeSet attrs, int defStyleAttr) { */ private void initViewComponent(Context context, AttributeSet attributeSet, int defStyleAttr) { - View view = View.inflate(context, R.layout.cc_badge_count, null); + View view = View.inflate(context, R.layout.cometchat_badge_count, null); TypedArray a = getContext().getTheme().obtainStyledAttributes( attributeSet, R.styleable.BadgeCount, diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/CometChatCallList.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatCalls/CometChatCalls.java similarity index 86% rename from uikit/src/main/java/com/cometchat/pro/uikit/CometChatCallList.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatCalls/CometChatCalls.java index a5f4d55a..bec8fe57 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/CometChatCallList.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatCalls/CometChatCalls.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit; +package com.cometchat.pro.uikit.ui_components.shared.cometchatCalls; import android.content.Context; import android.util.AttributeSet; @@ -14,17 +14,15 @@ import com.cometchat.pro.core.Call; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.models.BaseMessage; -import com.cometchat.pro.models.Conversation; import com.cometchat.pro.models.Group; import com.cometchat.pro.models.User; +import com.cometchat.pro.uikit.R; import java.util.List; -import listeners.ClickListener; -import listeners.OnItemClickListener; -import listeners.RecyclerTouchListener; -import viewmodel.CallViewModel; -import viewmodel.ConversationViewModel; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; /** @@ -41,26 +39,26 @@ * */ -@BindingMethods( value ={@BindingMethod(type = CometChatCallList.class, attribute = "app:calllist", method = "setCallList")}) -public class CometChatCallList extends RecyclerView { +@BindingMethods( value ={@BindingMethod(type = CometChatCalls.class, attribute = "app:calllist", method = "setCallList")}) +public class CometChatCalls extends RecyclerView { private Context context; - private CallViewModel callViewModel; + private CometChatCallsViewModel callViewModel; - public CometChatCallList(@NonNull Context context) { + public CometChatCalls(@NonNull Context context) { super(context); this.context=context; setViewModel(); } - public CometChatCallList(@NonNull Context context, @Nullable AttributeSet attrs) { + public CometChatCalls(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); this.context=context; setViewModel(); } - public CometChatCallList(@NonNull Context context, @Nullable AttributeSet attrs, int defStyle) { + public CometChatCalls(@NonNull Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context=context; setViewModel(); @@ -68,7 +66,7 @@ public CometChatCallList(@NonNull Context context, @Nullable AttributeSet attrs, private void setViewModel(){ if (callViewModel==null) - callViewModel=new CallViewModel(context,this); + callViewModel=new CometChatCallsViewModel(context,this); } diff --git a/uikit/src/main/java/adapter/CallListAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatCalls/CometChatCallsAdapter.java similarity index 93% rename from uikit/src/main/java/adapter/CallListAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatCalls/CometChatCallsAdapter.java index 9626aa32..5e8449e2 100644 --- a/uikit/src/main/java/adapter/CallListAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatCalls/CometChatCallsAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.shared.cometchatCalls; import android.content.Context; import android.content.res.ColorStateList; @@ -19,14 +19,14 @@ import com.cometchat.pro.models.Group; import com.cometchat.pro.models.User; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.databinding.CallListRowBinding; import java.util.ArrayList; import java.util.List; -import utils.FontUtils; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.databinding.CometchatCallListRowBinding; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - CallListAdapter is a subclass of RecyclerView Adapter which is used to display @@ -38,7 +38,7 @@ * */ -public class CallListAdapter extends RecyclerView.Adapter { +public class CometChatCallsAdapter extends RecyclerView.Adapter { private Context context; @@ -53,7 +53,7 @@ public class CallListAdapter extends RecyclerView.Adapter callList) { + public CometChatCallsAdapter(Context context, List callList) { this.callList = callList; this.context = context; fontUtils=FontUtils.getInstance(context); @@ -64,7 +64,7 @@ public CallListAdapter(Context context, List callList) { * * @param context */ - public CallListAdapter(Context context) { + public CometChatCallsAdapter(Context context) { this.context = context; fontUtils=FontUtils.getInstance(context); @@ -75,7 +75,7 @@ public CallListAdapter(Context context) { public CallViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); - CallListRowBinding callListRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.call_list_row, parent, false); + CometchatCallListRowBinding callListRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.cometchat_call_list_row, parent, false); return new CallViewHolder(callListRowBinding); } @@ -290,9 +290,9 @@ public void resetAdapterList() { class CallViewHolder extends RecyclerView.ViewHolder { - CallListRowBinding callListRowBinding; + CometchatCallListRowBinding callListRowBinding; - CallViewHolder(CallListRowBinding callListRowBinding) { + CallViewHolder(CometchatCallListRowBinding callListRowBinding) { super(callListRowBinding.getRoot()); this.callListRowBinding = callListRowBinding; } diff --git a/uikit/src/main/java/viewmodel/CallViewModel.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatCalls/CometChatCallsViewModel.java similarity index 64% rename from uikit/src/main/java/viewmodel/CallViewModel.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatCalls/CometChatCallsViewModel.java index 2109f93c..62b36690 100644 --- a/uikit/src/main/java/viewmodel/CallViewModel.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatCalls/CometChatCallsViewModel.java @@ -1,37 +1,32 @@ -package viewmodel; +package com.cometchat.pro.uikit.ui_components.shared.cometchatCalls; import android.content.Context; import com.cometchat.pro.core.Call; import com.cometchat.pro.models.BaseMessage; -import com.cometchat.pro.models.Conversation; -import com.cometchat.pro.uikit.CometChatCallList; import java.util.List; -import adapter.CallListAdapter; -import adapter.ConversationListAdapter; - -public class CallViewModel { +public class CometChatCallsViewModel { private Context context; - private CallListAdapter callListAdapter; + private CometChatCallsAdapter callListAdapter; - private CometChatCallList callListView; + private CometChatCalls callListView; - private CallViewModel(){ + private CometChatCallsViewModel(){ } - public CallViewModel(Context context, CometChatCallList cometChatCallList){ + public CometChatCallsViewModel(Context context, CometChatCalls cometChatCallList){ this.callListView=cometChatCallList; this.context=context; setAdapter(); } - private CallListAdapter getAdapter(){ + private CometChatCallsAdapter getAdapter(){ if (callListAdapter==null){ - callListAdapter=new CallListAdapter(context); + callListAdapter=new CometChatCallsAdapter(context); } return callListAdapter; } @@ -42,7 +37,7 @@ public void add(Call call){ } private void setAdapter(){ - callListAdapter=new CallListAdapter(context); + callListAdapter=new CometChatCallsAdapter(context); callListView.setAdapter(callListAdapter); } diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/ComposeBox/ComposeBox.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/CometChatComposeBox.java similarity index 95% rename from uikit/src/main/java/com/cometchat/pro/uikit/ComposeBox/ComposeBox.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/CometChatComposeBox.java index 61482272..9da45960 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/ComposeBox/ComposeBox.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/CometChatComposeBox.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.ComposeBox; +package com.cometchat.pro.uikit.ui_components.shared.cometchatComposeBox; import android.Manifest; import android.app.Activity; @@ -38,15 +38,15 @@ import java.util.Timer; import java.util.TimerTask; -import constant.StringContract; -import listeners.ComposeActionListener; -import utils.AudioVisualizer.AudioRecordView; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_components.shared.cometchatComposeBox.listener.ComposeActionListener; +import com.cometchat.pro.uikit.ui_resources.utils.audio_visualizer.AudioRecordView; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; -public class ComposeBox extends RelativeLayout implements View.OnClickListener { +public class CometChatComposeBox extends RelativeLayout implements View.OnClickListener { - private static final String TAG = ComposeBox.class.getName(); + private static final String TAG = CometChatComposeBox.class.getName(); private AudioRecordView audioRecordView; @@ -60,7 +60,7 @@ public class ComposeBox extends RelativeLayout implements View.OnClickListener { private Timer timer = new Timer(); - private ComposeBoxActionFragment composeBoxActionFragment; + private CometChatComposeBoxActions composeBoxActionFragment; private String audioFileNameWithPath; @@ -98,24 +98,24 @@ public class ComposeBox extends RelativeLayout implements View.OnClickListener { isFileVisible = true,isLocationVisible = true,isPollVisible = true,isStickerVisible = true, isWhiteBoardVisible = true, isWriteBoardVisible = true, isGroupCallVisible = true; - public ComposeBox(Context context) { + public CometChatComposeBox(Context context) { super(context); initViewComponent(context,null,-1,-1); } - public ComposeBox(Context context, AttributeSet attrs) { + public CometChatComposeBox(Context context, AttributeSet attrs) { super(context, attrs); initViewComponent(context,attrs,-1,-1); } - public ComposeBox(Context context, AttributeSet attrs, int defStyleAttr) { + public CometChatComposeBox(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initViewComponent(context,attrs,defStyleAttr,-1); } private void initViewComponent(Context context,AttributeSet attributeSet,int defStyleAttr,int defStyleRes){ - View view =View.inflate(context, R.layout.layout_compose_box,null); + View view =View.inflate(context, R.layout.cometchat_compose_box,null); TypedArray a = getContext().getTheme().obtainStyledAttributes(attributeSet, R.styleable.ComposeBox, 0, 0); color = a.getColor(R.styleable.ComposeBox_color,getResources().getColor(R.color.colorPrimary)); @@ -176,8 +176,8 @@ public void onAudioFocusChange(int focusChange) { ivCamera.setOnClickListener(this); - composeBoxActionFragment = new ComposeBoxActionFragment(); - composeBoxActionFragment.setComposeBoxActionListener(new ComposeBoxActionFragment.ComposeBoxActionListener() { + composeBoxActionFragment = new CometChatComposeBoxActions(); + composeBoxActionFragment.setComposeBoxActionListener(new CometChatComposeBoxActions.ComposeBoxActionListener() { @Override public void onGalleryClick() { composeActionListener.onGalleryActionClicked(); @@ -438,7 +438,7 @@ public void onClick(View view) { } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { ((Activity)context).requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO,Manifest.permission.WRITE_EXTERNAL_STORAGE}, - StringContract.RequestCode.RECORD); + UIKitConstants.RequestCode.RECORD); } } } @@ -491,7 +491,7 @@ private void startPlayingAudio(String path) { mediaPlayer.start(); } else { ((Activity)context).requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, - StringContract.RequestCode.READ_STORAGE); + UIKitConstants.RequestCode.READ_STORAGE); } final int duration = mediaPlayer.getDuration(); diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/ComposeBox/ComposeBoxActionFragment.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/CometChatComposeBoxActions.java similarity index 97% rename from uikit/src/main/java/com/cometchat/pro/uikit/ComposeBox/ComposeBoxActionFragment.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/CometChatComposeBoxActions.java index b6639ca3..f9e46942 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/ComposeBox/ComposeBoxActionFragment.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/CometChatComposeBoxActions.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.ComposeBox; +package com.cometchat.pro.uikit.ui_components.shared.cometchatComposeBox; import android.os.Bundle; import android.view.LayoutInflater; @@ -13,7 +13,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog; import com.google.android.material.bottomsheet.BottomSheetDialogFragment; -public class ComposeBoxActionFragment extends BottomSheetDialogFragment { +public class CometChatComposeBoxActions extends BottomSheetDialogFragment { private TextView galleryMessage; private TextView cameraMessage; @@ -62,7 +62,7 @@ public void onCreate(Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - View view = inflater.inflate(R.layout.fragment_composebox_actions, container, false); + View view = inflater.inflate(R.layout.cometchat_composebox_actions, container, false); view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/ComposeBox/CometChatEditText.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/CometChatEditText.java similarity index 90% rename from uikit/src/main/java/com/cometchat/pro/uikit/ComposeBox/CometChatEditText.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/CometChatEditText.java index acb91637..8bb08433 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/ComposeBox/CometChatEditText.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/CometChatEditText.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.ComposeBox; +package com.cometchat.pro.uikit.ui_components.shared.cometchatComposeBox; import android.content.ContentResolver; import android.content.Context; @@ -7,7 +7,6 @@ import android.util.Log; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; -import android.view.inputmethod.InputContentInfo; import androidx.appcompat.widget.AppCompatEditText; import androidx.core.os.BuildCompat; @@ -15,16 +14,6 @@ import androidx.core.view.inputmethod.InputConnectionCompat; import androidx.core.view.inputmethod.InputContentInfoCompat; -import com.cometchat.pro.constants.CometChatConstants; -import com.cometchat.pro.core.CometChat; -import com.cometchat.pro.exceptions.CometChatException; -import com.cometchat.pro.models.MediaMessage; - -import java.io.File; - -import utils.MediaUtils; -import utils.Utils; - public class CometChatEditText extends AppCompatEditText { private static final String TAG = "CometChatEditText"; diff --git a/uikit/src/main/java/listeners/ComposeActionListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/listener/ComposeActionListener.java similarity index 95% rename from uikit/src/main/java/listeners/ComposeActionListener.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/listener/ComposeActionListener.java index d754f1c5..26341540 100644 --- a/uikit/src/main/java/listeners/ComposeActionListener.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatComposeBox/listener/ComposeActionListener.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_components.shared.cometchatComposeBox.listener; import android.text.Editable; import android.view.View; diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/CometChatConversationList.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatConversations/CometChatConversations.java similarity index 82% rename from uikit/src/main/java/com/cometchat/pro/uikit/CometChatConversationList.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatConversations/CometChatConversations.java index 2164d0a3..7f5464f1 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/CometChatConversationList.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatConversations/CometChatConversations.java @@ -1,8 +1,7 @@ -package com.cometchat.pro.uikit; +package com.cometchat.pro.uikit.ui_components.shared.cometchatConversations; import android.content.Context; import android.util.AttributeSet; -import android.util.Log; import android.view.View; import androidx.annotation.NonNull; @@ -12,24 +11,17 @@ import androidx.recyclerview.widget.RecyclerView; import com.cometchat.pro.constants.CometChatConstants; -import com.cometchat.pro.core.CometChat; import com.cometchat.pro.helpers.CometChatHelper; -import com.cometchat.pro.models.Action; import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.Conversation; -import com.cometchat.pro.models.CustomMessage; -import com.cometchat.pro.models.Group; -import com.cometchat.pro.models.MediaMessage; import com.cometchat.pro.models.MessageReceipt; -import com.cometchat.pro.models.TextMessage; -import com.cometchat.pro.models.User; +import com.cometchat.pro.uikit.R; import java.util.List; -import listeners.ClickListener; -import listeners.OnItemClickListener; -import listeners.RecyclerTouchListener; -import viewmodel.ConversationViewModel; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; /** @@ -45,26 +37,26 @@ * */ -@BindingMethods( value ={@BindingMethod(type = CometChatConversationList.class, attribute = "app:conversationlist", method = "setConversationList")}) -public class CometChatConversationList extends RecyclerView { +@BindingMethods( value ={@BindingMethod(type = CometChatConversations.class, attribute = "app:conversationlist", method = "setConversationList")}) +public class CometChatConversations extends RecyclerView { private Context context; - private ConversationViewModel conversationViewModel; + private CometChatConversationsViewModel conversationViewModel; - public CometChatConversationList(@NonNull Context context) { + public CometChatConversations(@NonNull Context context) { super(context); this.context=context; setViewModel(); } - public CometChatConversationList(@NonNull Context context, @Nullable AttributeSet attrs) { + public CometChatConversations(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); this.context=context; setViewModel(); } - public CometChatConversationList(@NonNull Context context, @Nullable AttributeSet attrs, int defStyle) { + public CometChatConversations(@NonNull Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context=context; setViewModel(); @@ -72,7 +64,7 @@ public CometChatConversationList(@NonNull Context context, @Nullable AttributeSe private void setViewModel(){ if (conversationViewModel==null) - conversationViewModel=new ConversationViewModel(context,this); + conversationViewModel=new CometChatConversationsViewModel(context,this); } /** @@ -143,7 +135,7 @@ public void onLongClick(View var1, int var2) { * This method is used to perform search operation in a list of conversations. * @param searchString is a String object which will be searched in conversation. * - * @see ConversationViewModel#searchConversation(String) + * @see CometChatConversationsViewModel#searchConversation(String) */ public void searchConversation(String searchString) { conversationViewModel.searchConversation(searchString); @@ -180,7 +172,7 @@ public void setReciept(MessageReceipt messageReceipt) { /** * This method is used to clear a list of conversation present in CometChatConversationList Component - * @see ConversationViewModel#clear() + * @see CometChatConversationsViewModel#clear() */ public void clearList() { if (conversationViewModel!=null) diff --git a/uikit/src/main/java/adapter/ConversationListAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatConversations/CometChatConversationsAdapter.java similarity index 94% rename from uikit/src/main/java/adapter/ConversationListAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatConversations/CometChatConversationsAdapter.java index a6745489..3ea44c1f 100644 --- a/uikit/src/main/java/adapter/ConversationListAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatConversations/CometChatConversationsAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.shared.cometchatConversations; import android.content.Context; @@ -18,7 +18,6 @@ import com.cometchat.pro.core.CometChat; import com.cometchat.pro.models.MessageReceipt; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.databinding.ConversationListRowBinding; import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.Conversation; import com.cometchat.pro.models.Group; @@ -28,10 +27,11 @@ import java.util.ArrayList; import java.util.List; -import utils.Extensions; -import utils.FontUtils; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.databinding.CometchatConversationListRowBinding; +import com.cometchat.pro.uikit.ui_components.messages.extensions.Extensions; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - ConversationListAdapter is a subclass of RecyclerView Adapter which is used to display @@ -44,7 +44,7 @@ * */ -public class ConversationListAdapter extends RecyclerView.Adapter implements Filterable { +public class CometChatConversationsAdapter extends RecyclerView.Adapter implements Filterable { private Context context; @@ -68,7 +68,7 @@ public class ConversationListAdapter extends RecyclerView.Adapter conversationList) { + public CometChatConversationsAdapter(Context context, List conversationList) { this.conversationList = conversationList; this.filterConversationList = conversationList; this.context = context; @@ -80,7 +80,7 @@ public ConversationListAdapter(Context context, List conversationL * * @param context */ - public ConversationListAdapter(Context context) { + public CometChatConversationsAdapter(Context context) { this.context = context; fontUtils=FontUtils.getInstance(context); @@ -91,7 +91,7 @@ public ConversationListAdapter(Context context) { public ConversationViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); - ConversationListRowBinding conversationListRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.conversation_list_row, parent, false); + CometchatConversationListRowBinding conversationListRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.cometchat_conversation_list_row, parent, false); return new ConversationViewHolder(conversationListRowBinding); } @@ -380,9 +380,9 @@ protected void publishResults(CharSequence charSequence, FilterResults filterRes class ConversationViewHolder extends RecyclerView.ViewHolder { - ConversationListRowBinding conversationListRowBinding; + CometchatConversationListRowBinding conversationListRowBinding; - ConversationViewHolder(ConversationListRowBinding conversationListRowBinding) { + ConversationViewHolder(CometchatConversationListRowBinding conversationListRowBinding) { super(conversationListRowBinding.getRoot()); this.conversationListRowBinding = conversationListRowBinding; } diff --git a/uikit/src/main/java/viewmodel/ConversationViewModel.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatConversations/CometChatConversationsViewModel.java similarity index 75% rename from uikit/src/main/java/viewmodel/ConversationViewModel.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatConversations/CometChatConversationsViewModel.java index bf25dae9..8ed8b3be 100644 --- a/uikit/src/main/java/viewmodel/ConversationViewModel.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatConversations/CometChatConversationsViewModel.java @@ -1,34 +1,30 @@ -package viewmodel; +package com.cometchat.pro.uikit.ui_components.shared.cometchatConversations; import android.content.Context; import android.util.Log; -import com.cometchat.pro.core.ConversationsRequest; import com.cometchat.pro.models.Conversation; import com.cometchat.pro.models.MessageReceipt; -import com.cometchat.pro.uikit.CometChatConversationList; import java.util.List; -import adapter.ConversationListAdapter; - -public class ConversationViewModel { +public class CometChatConversationsViewModel { private Context context; - private ConversationListAdapter conversationListAdapter; + private CometChatConversationsAdapter conversationListAdapter; - private ConversationViewModel(){ + private CometChatConversationsViewModel(){ } - public ConversationViewModel(Context context,CometChatConversationList cometChatConversationList){ + public CometChatConversationsViewModel(Context context, CometChatConversations cometChatConversationList){ this.context=context; setAdapter(cometChatConversationList); } - private ConversationListAdapter getAdapter(){ + private CometChatConversationsAdapter getAdapter(){ if (conversationListAdapter==null){ - conversationListAdapter=new ConversationListAdapter(context); + conversationListAdapter=new CometChatConversationsAdapter(context); } return conversationListAdapter; } @@ -38,9 +34,9 @@ public void add(Conversation conversation){ conversationListAdapter.add(conversation); } - private void setAdapter(CometChatConversationList cometChatConversationList){ + private void setAdapter(CometChatConversations cometChatConversationList){ if (conversationListAdapter==null) - conversationListAdapter=new ConversationListAdapter(context); + conversationListAdapter=new CometChatConversationsAdapter(context); cometChatConversationList.setAdapter(conversationListAdapter); } diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/CometChatGroupList.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatGroups/CometChatGroups.java similarity index 81% rename from uikit/src/main/java/com/cometchat/pro/uikit/CometChatGroupList.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatGroups/CometChatGroups.java index b107a09e..ed701000 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/CometChatGroupList.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatGroups/CometChatGroups.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit; +package com.cometchat.pro.uikit.ui_components.shared.cometchatGroups; import android.content.Context; import android.content.res.TypedArray; @@ -12,13 +12,13 @@ import androidx.recyclerview.widget.RecyclerView; import com.cometchat.pro.models.Group; +import com.cometchat.pro.uikit.R; import java.util.List; -import listeners.ClickListener; -import listeners.OnItemClickListener; -import listeners.RecyclerTouchListener; -import viewmodel.GroupListViewModel; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; /** * Purpose - CometChatGroupList class is a subclass of recyclerview and used as component by @@ -33,28 +33,28 @@ * */ -@BindingMethods( value ={@BindingMethod(type = CometChatGroupList.class, attribute = "app:grouplist", method = "setGroupList")}) -public class CometChatGroupList extends RecyclerView { +@BindingMethods( value ={@BindingMethod(type = CometChatGroups.class, attribute = "app:grouplist", method = "setGroupList")}) +public class CometChatGroups extends RecyclerView { private Context context; - private GroupListViewModel groupListViewModel; + private CometChatGroupsViewModel groupListViewModel; - public CometChatGroupList(@NonNull Context context) { + public CometChatGroups(@NonNull Context context) { super(context); this.context=context; setViewModel(); } - public CometChatGroupList(@NonNull Context context, @Nullable AttributeSet attrs) { + public CometChatGroups(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); getAttributes(attrs); this.context=context; setViewModel(); } - public CometChatGroupList(@NonNull Context context, @Nullable AttributeSet attrs, int defStyle) { + public CometChatGroups(@NonNull Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); getAttributes(attrs); this.context=context; @@ -69,7 +69,7 @@ private void getAttributes(AttributeSet attributeSet){ private void setViewModel(){ if(groupListViewModel==null){ - groupListViewModel=new GroupListViewModel(context,this); + groupListViewModel=new CometChatGroupsViewModel(context,this); } } @@ -159,7 +159,7 @@ public void searchGroupList(List groups) { /** * This method is used to clear a list of groups present in CometChatGroupList Component. * - * @see GroupListViewModel#clear() + * @see CometChatGroupsViewModel#clear() */ public void clear() { groupListViewModel.clear(); diff --git a/uikit/src/main/java/adapter/GroupListAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatGroups/CometChatGroupsAdapter.java similarity index 93% rename from uikit/src/main/java/adapter/GroupListAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatGroups/CometChatGroupsAdapter.java index 470e9696..db24ee25 100644 --- a/uikit/src/main/java/adapter/GroupListAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatGroups/CometChatGroupsAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.shared.cometchatGroups; import android.content.Context; import android.content.res.ColorStateList; @@ -12,15 +12,15 @@ import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Settings.UISettings; +import com.cometchat.pro.uikit.ui_settings.UISettings; import com.cometchat.pro.uikit.databinding.GroupListRowBinding; import com.cometchat.pro.models.Group; import java.util.ArrayList; import java.util.List; -import utils.FontUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - GroupListAdapter is a subclass of RecyclerView Adapter which is used to display @@ -33,7 +33,7 @@ */ -public class GroupListAdapter extends RecyclerView.Adapter { +public class CometChatGroupsAdapter extends RecyclerView.Adapter { private Context context; @@ -46,7 +46,7 @@ public class GroupListAdapter extends RecyclerView.Adapter groupList) { + public CometChatGroupsAdapter(Context context, List groupList) { this.groupList = groupList; this.context = context; diff --git a/uikit/src/main/java/viewmodel/GroupListViewModel.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatGroups/CometChatGroupsViewModel.java similarity index 73% rename from uikit/src/main/java/viewmodel/GroupListViewModel.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatGroups/CometChatGroupsViewModel.java index dcfd23d9..44febf31 100644 --- a/uikit/src/main/java/viewmodel/GroupListViewModel.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatGroups/CometChatGroupsViewModel.java @@ -1,54 +1,51 @@ -package viewmodel; +package com.cometchat.pro.uikit.ui_components.shared.cometchatGroups; import android.content.Context; import com.cometchat.pro.core.GroupsRequest; import com.cometchat.pro.models.Group; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.CometChatGroupList; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import adapter.GroupListAdapter; - -public class GroupListViewModel { +public class CometChatGroupsViewModel { private Context context; private GroupsRequest groupsRequest; - private GroupListAdapter groupListAdapter; + private CometChatGroupsAdapter groupListAdapter; private List groupList = new ArrayList<>(); private HashMap groupHashMap = new HashMap<>(); - private CometChatGroupList groupListView; + private CometChatGroups groupListView; private static final String TAG = "GroupListViewModel"; - private GroupListViewModel (){ + private CometChatGroupsViewModel(){ } - public GroupListViewModel(Context context,CometChatGroupList cometChatGroupList){ + public CometChatGroupsViewModel(Context context, CometChatGroups cometChatGroupList){ this.groupListView=cometChatGroupList; this.context=context; setGroupListAdapter(cometChatGroupList); } - private GroupListAdapter getAdapter(){ + private CometChatGroupsAdapter getAdapter(){ if (groupListAdapter==null){ - groupListAdapter=new GroupListAdapter(context); + groupListAdapter=new CometChatGroupsAdapter(context); } return groupListAdapter; } - private void setGroupListAdapter(CometChatGroupList cometChatGroupList){ - groupListAdapter=new GroupListAdapter(context); + private void setGroupListAdapter(CometChatGroups cometChatGroupList){ + groupListAdapter=new CometChatGroupsAdapter(context); cometChatGroupList.setAdapter(groupListAdapter); } diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/ReactionDialog.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/CometChatReactionDialog.java similarity index 64% rename from uikit/src/main/java/com/cometchat/pro/uikit/Reaction/ReactionDialog.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/CometChatReactionDialog.java index 80b25271..5dc63f65 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/ReactionDialog.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/CometChatReactionDialog.java @@ -1,9 +1,7 @@ -package com.cometchat.pro.uikit.Reaction; +package com.cometchat.pro.uikit.ui_components.shared.cometchatReaction; import android.app.Dialog; -import android.content.Context; import android.os.Bundle; -import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; @@ -16,20 +14,23 @@ import androidx.fragment.app.Fragment; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Reaction.fragment.FragmentEmojiNature; -import com.cometchat.pro.uikit.Reaction.fragment.FragmentEmojiObject; -import com.cometchat.pro.uikit.Reaction.fragment.FragmentEmojiPeople; -import com.cometchat.pro.uikit.Reaction.fragment.FragmentEmojiPlaces; -import com.cometchat.pro.uikit.Reaction.model.Reaction; + +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.fragment.FragmentReaction; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.fragment.FragmentReactionNature; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.fragment.FragmentReactionObject; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.fragment.FragmentReactionPeople; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.fragment.FragmentReactionPlaces; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.listener.OnReactionClickListener; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; import com.google.android.material.bottomnavigation.BottomNavigationView; -public class ReactionDialog extends DialogFragment implements OnEmojiClickListener, BottomNavigationView.OnNavigationItemSelectedListener { +public class CometChatReactionDialog extends DialogFragment implements OnReactionClickListener, BottomNavigationView.OnNavigationItemSelectedListener { private BottomNavigationView bottomNavigationView; private FrameLayout frameLayout; - private OnEmojiClickListener emojiClickListener; + private OnReactionClickListener emojiClickListener; // CONSTRUCTOR @Override @@ -43,7 +44,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) { frameLayout = view.findViewById(R.id.frame); bottomNavigationView = view.findViewById(R.id.bottom_navigation); bottomNavigationView.setOnNavigationItemSelectedListener(this); - FragmentEmoji fragmentEmoji = new FragmentEmojiPeople(); + FragmentReaction fragmentEmoji = new FragmentReactionPeople(); fragmentEmoji.addEmojiconClickListener(emojiClickListener); loadFragment(fragmentEmoji); } @@ -70,21 +71,21 @@ public void onEmojiClicked(Reaction emojicon) { emojiClickListener.onEmojiClicked(emojicon); } - public void setOnEmojiClick(OnEmojiClickListener emojiClickListener) { + public void setOnEmojiClick(OnReactionClickListener emojiClickListener) { this.emojiClickListener = emojiClickListener; } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { int itemId = item.getItemId(); - FragmentEmoji fragment = null; + FragmentReaction fragment = null; if (itemId == R.id.menu_people) { - fragment = new FragmentEmojiPeople(); + fragment = new FragmentReactionPeople(); } else if (itemId == R.id.menu_places) { - fragment = new FragmentEmojiPlaces(); + fragment = new FragmentReactionPlaces(); } else if (itemId == R.id.menu_nature) { - fragment = new FragmentEmojiNature(); + fragment = new FragmentReactionNature(); } else if (itemId == R.id.menu_object) { - fragment = new FragmentEmojiObject(); + fragment = new FragmentReactionObject(); } fragment.addEmojiconClickListener(emojiClickListener); return loadFragment(fragment); diff --git a/uikit/src/main/java/utils/ReactionUtils.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/ReactionUtils.java similarity index 99% rename from uikit/src/main/java/utils/ReactionUtils.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/ReactionUtils.java index a99421b5..a0f78b64 100644 --- a/uikit/src/main/java/utils/ReactionUtils.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/ReactionUtils.java @@ -1,6 +1,6 @@ -package utils; +package com.cometchat.pro.uikit.ui_components.shared.cometchatReaction; -import com.cometchat.pro.uikit.Reaction.model.Reaction; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; import java.util.ArrayList; import java.util.List; diff --git a/uikit/src/main/java/adapter/EmojiAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/adapter/EmojiAdapter.java similarity index 89% rename from uikit/src/main/java/adapter/EmojiAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/adapter/EmojiAdapter.java index 0e55a039..9a02c11e 100644 --- a/uikit/src/main/java/adapter/EmojiAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/adapter/EmojiAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.adapter; import android.content.Context; import android.view.View; @@ -8,7 +8,7 @@ import androidx.emoji.widget.EmojiTextView; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Reaction.model.Reaction; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; import java.util.List; diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/FragmentEmoji.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReaction.java similarity index 68% rename from uikit/src/main/java/com/cometchat/pro/uikit/Reaction/FragmentEmoji.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReaction.java index 0334d402..40909796 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/FragmentEmoji.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReaction.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.Reaction; +package com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.fragment; import android.content.Context; import android.os.Bundle; @@ -10,13 +10,15 @@ import androidx.fragment.app.Fragment; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Reaction.model.Reaction; -public class FragmentEmoji extends Fragment implements AdapterView.OnItemClickListener { +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.listener.OnReactionClickListener; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; + +public class FragmentReaction extends Fragment implements AdapterView.OnItemClickListener { public static final String TAG = "FragmentEmoji"; - private OnEmojiClickListener mOnEmojiconClickedListener; + private OnReactionClickListener mOnEmojiconClickedListener; private View mRootView; @Override @@ -38,7 +40,7 @@ public void onAttach(Context context) { super.onAttach(context); } - public void addEmojiconClickListener(OnEmojiClickListener listener) { + public void addEmojiconClickListener(OnReactionClickListener listener) { this.mOnEmojiconClickedListener = listener; } } \ No newline at end of file diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiNature.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionNature.java similarity index 79% rename from uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiNature.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionNature.java index f045fc02..4d8a825d 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiNature.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionNature.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.Reaction.fragment; +package com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.fragment; import android.os.Bundle; import android.os.Parcelable; @@ -8,13 +8,13 @@ import android.widget.GridView; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Reaction.FragmentEmoji; -import com.cometchat.pro.uikit.Reaction.model.Reaction; -import adapter.EmojiAdapter; -import utils.ReactionUtils; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; -public class FragmentEmojiNature extends FragmentEmoji { +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.adapter.EmojiAdapter; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.ReactionUtils; + +public class FragmentReactionNature extends FragmentReaction { public static final String TAG = "FragmentEmojiNature"; diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiObject.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionObject.java similarity index 79% rename from uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiObject.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionObject.java index 241288bd..398aa224 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiObject.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionObject.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.Reaction.fragment; +package com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.fragment; import android.os.Bundle; import android.os.Parcelable; @@ -8,13 +8,13 @@ import android.widget.GridView; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Reaction.FragmentEmoji; -import com.cometchat.pro.uikit.Reaction.model.Reaction; -import adapter.EmojiAdapter; -import utils.ReactionUtils; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; -public class FragmentEmojiObject extends FragmentEmoji { +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.adapter.EmojiAdapter; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.ReactionUtils; + +public class FragmentReactionObject extends FragmentReaction { public static final String TAG = "FragmentEmojiObjects"; diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiPeople.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionPeople.java similarity index 66% rename from uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiPeople.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionPeople.java index edcd3359..a5913cd8 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiPeople.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionPeople.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.Reaction.fragment; +package com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.fragment; import android.os.Bundle; import android.os.Parcelable; @@ -8,14 +8,14 @@ import android.widget.GridView; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Reaction.FragmentEmoji; -import com.cometchat.pro.uikit.Reaction.model.Reaction; -import adapter.EmojiAdapter; -import constant.StringContract; -import utils.ReactionUtils; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; -public class FragmentEmojiPeople extends FragmentEmoji { +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.adapter.EmojiAdapter; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.ReactionUtils; + +public class FragmentReactionPeople extends FragmentReaction { public static final String TAG = "FragmentEmojiPeople"; @@ -38,14 +38,14 @@ public void onViewCreated(View view, Bundle savedInstanceState) { this.mData = ReactionUtils.getPeopleList(); this.mUseSystemDefault = false; } else { - Parcelable[] parcels = bundle.getParcelableArray(StringContract.Emoji.EMOJI_KEY); + Parcelable[] parcels = bundle.getParcelableArray(UIKitConstants.Emoji.EMOJI_KEY); this.mData = new Reaction[parcels.length]; for (int i = 0; i < parcels.length; i++) { this.mData[i] = (Reaction) parcels[i]; } - this.mUseSystemDefault = bundle.getBoolean(StringContract.Emoji.USE_SYSTEM_DEFAULT_KEY); + this.mUseSystemDefault = bundle.getBoolean(UIKitConstants.Emoji.USE_SYSTEM_DEFAULT_KEY); } gridView.setAdapter(new EmojiAdapter(view.getContext(), this.mData)); gridView.setOnItemClickListener(this); diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiPlaces.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionPlaces.java similarity index 79% rename from uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiPlaces.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionPlaces.java index 3e6c0992..a3a1f16b 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/fragment/FragmentEmojiPlaces.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/fragment/FragmentReactionPlaces.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.Reaction.fragment; +package com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.fragment; import android.os.Bundle; import android.os.Parcelable; @@ -8,13 +8,13 @@ import android.widget.GridView; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Reaction.FragmentEmoji; -import com.cometchat.pro.uikit.Reaction.model.Reaction; -import adapter.EmojiAdapter; -import utils.ReactionUtils; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; -public class FragmentEmojiPlaces extends FragmentEmoji { +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.adapter.EmojiAdapter; +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.ReactionUtils; + +public class FragmentReactionPlaces extends FragmentReaction { public static final String TAG = "FragmentEmojiPlaces"; diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/listener/OnReactionClickListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/listener/OnReactionClickListener.java new file mode 100644 index 00000000..d80309b9 --- /dev/null +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/listener/OnReactionClickListener.java @@ -0,0 +1,7 @@ +package com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.listener; + +import com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model.Reaction; + +public interface OnReactionClickListener { + void onEmojiClicked(Reaction emojicon); +} diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/model/Reaction.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/model/Reaction.java similarity index 92% rename from uikit/src/main/java/com/cometchat/pro/uikit/Reaction/model/Reaction.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/model/Reaction.java index 75f7ab20..bc809b83 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Reaction/model/Reaction.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatReaction/model/Reaction.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.Reaction.model; +package com.cometchat.pro.uikit.ui_components.shared.cometchatReaction.model; import android.os.Parcel; import android.os.Parcelable; diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/SharedMediaView.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/CometChatSharedMedia.java similarity index 82% rename from uikit/src/main/java/com/cometchat/pro/uikit/SharedMediaView.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/CometChatSharedMedia.java index f59a8f74..346d16c6 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/SharedMediaView.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/CometChatSharedMedia.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit; +package com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia; import android.content.Context; import android.content.res.ColorStateList; @@ -14,17 +14,19 @@ import androidx.fragment.app.FragmentActivity; import androidx.viewpager.widget.ViewPager; -import com.cometchat.pro.uikit.SharedMedia.SharedFilesFragment; -import com.cometchat.pro.uikit.SharedMedia.SharedImagesFragment; -import com.cometchat.pro.uikit.SharedMedia.SharedVideosFragment; +import com.cometchat.pro.uikit.R; + +import com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.adapter.TabAdapter; +import com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.fragments.CometChatSharedFiles; +import com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.fragments.CometChatSharedImages; +import com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.fragments.CometChatSharedVideos; import com.google.android.material.tabs.TabLayout; -import adapter.TabAdapter; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; -public class SharedMediaView extends RelativeLayout { +public class CometChatSharedMedia extends RelativeLayout { private Context context; @@ -40,20 +42,20 @@ public class SharedMediaView extends RelativeLayout { private TabAdapter adapter; - public SharedMediaView(Context context) { + public CometChatSharedMedia(Context context) { super(context); this.context = context; initViewComponent(context,null,-1,-1); } - public SharedMediaView(Context context, AttributeSet attrs) { + public CometChatSharedMedia(Context context, AttributeSet attrs) { super(context, attrs); this.attrs = attrs; this.context = context; initViewComponent(context,attrs,-1,-1); } - public SharedMediaView(Context context, AttributeSet attrs, int defStyleAttr) { + public CometChatSharedMedia(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.context = context; this.attrs = attrs; @@ -75,13 +77,13 @@ private void initViewComponent(Context context,AttributeSet attributeSet,int def viewPager = this.findViewById(R.id.viewPager); tabLayout = view.findViewById(R.id.tabLayout); adapter = new TabAdapter(((FragmentActivity)context).getSupportFragmentManager()); - SharedImagesFragment images = new SharedImagesFragment(); + CometChatSharedImages images = new CometChatSharedImages(); images.setArguments(bundle); adapter.addFragment(images, getResources().getString(R.string.images)); - SharedVideosFragment videos = new SharedVideosFragment(); + CometChatSharedVideos videos = new CometChatSharedVideos(); videos.setArguments(bundle); adapter.addFragment(videos, getResources().getString(R.string.videos)); - SharedFilesFragment files = new SharedFilesFragment(); + CometChatSharedFiles files = new CometChatSharedFiles(); files.setArguments(bundle); adapter.addFragment(files, getResources().getString(R.string.files)); viewPager.setAdapter(adapter); diff --git a/uikit/src/main/java/adapter/SharedMediaAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/adapter/CometChatSharedMediaAdapter.java similarity index 77% rename from uikit/src/main/java/adapter/SharedMediaAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/adapter/CometChatSharedMediaAdapter.java index c03f4c7e..90c3e8e7 100644 --- a/uikit/src/main/java/adapter/SharedMediaAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/adapter/CometChatSharedMediaAdapter.java @@ -1,11 +1,9 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.adapter; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -14,31 +12,21 @@ import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.databinding.DataBindingUtil; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; -import com.bumptech.glide.request.target.SimpleTarget; -import com.bumptech.glide.request.transition.Transition; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.MediaMessage; -import com.cometchat.pro.models.User; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.databinding.UserListRowBinding; -import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.List; -import constant.StringContract; -import listeners.StickyHeaderAdapter; -import screen.CometChatMediaViewActivity; -import utils.Extensions; -import utils.FontUtils; -import utils.MediaUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.messages.extensions.Extensions; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_components.messages.media_view.CometChatMediaViewActivity; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.MediaUtils; /** * Purpose - UserListAdapter is a subclass of RecyclerView Adapter which is used to display @@ -50,7 +38,7 @@ * */ -public class SharedMediaAdapter extends RecyclerView.Adapter { +public class CometChatSharedMediaAdapter extends RecyclerView.Adapter { private Context context; @@ -71,7 +59,7 @@ public class SharedMediaAdapter extends RecyclerView.Adapter messageArrayList) { + public CometChatSharedMediaAdapter(Context context, List messageArrayList) { setMessageList(messageArrayList); this.context = context; fontUtils = FontUtils.getInstance(context); @@ -100,11 +88,11 @@ public int getItemViewType(int position) { private int getItemViewTypes(int position) { BaseMessage baseMessage = messageArrayList.get(position); - if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) { + if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) { return SHARED_MEDIA_IMAGE; - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_VIDEO)) { + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO)) { return SHARED_MEDIA_VIDEO; - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_FILE)) { + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE)) { return SHARED_MEDIA_FILE; } @@ -119,19 +107,19 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); switch (i) { case SHARED_MEDIA_IMAGE: - view = layoutInflater.inflate(R.layout.shared_media_image_row, parent, false); + view = layoutInflater.inflate(R.layout.cometchat_shared_media_image_row, parent, false); return new ImageViewHolder(view); case SHARED_MEDIA_VIDEO: - view = layoutInflater.inflate(R.layout.shared_media_video_row, parent, false); + view = layoutInflater.inflate(R.layout.cometchat_shared_media_video_row, parent, false); return new VideoViewHolder(view); case SHARED_MEDIA_FILE: - view = layoutInflater.inflate(R.layout.shared_media_file_row, parent, false); + view = layoutInflater.inflate(R.layout.cometchat_shared_media_file_row, parent, false); return new FileViewHolder(view); default: - view = layoutInflater.inflate(R.layout.shared_media_image_row, parent, false); + view = layoutInflater.inflate(R.layout.cometchat_shared_media_image_row, parent, false); return new FileViewHolder(view); } @@ -142,9 +130,9 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) { BaseMessage baseMessage = messageArrayList.get(i); - if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) { + if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) { setImageData((ImageViewHolder) viewHolder, i); - } else if (baseMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_FILE)) { + } else if (baseMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE)) { setFileData((FileViewHolder) viewHolder, i); } else { setVideoData((VideoViewHolder) viewHolder, i); @@ -156,12 +144,12 @@ private void setVideoData(VideoViewHolder viewHolder, int i) { Glide.with(context).load(((MediaMessage) message).getAttachment().getFileUrl()).into(viewHolder.imageView); viewHolder.imageView.setOnClickListener(view ->{ Intent intent = new Intent(context, CometChatMediaViewActivity.class); - intent.putExtra(StringContract.IntentStrings.NAME,message.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.UID,message.getSender().getUid()); - intent.putExtra(StringContract.IntentStrings.SENTAT,message.getSentAt()); - intent.putExtra(StringContract.IntentStrings.INTENT_MEDIA_MESSAGE, + intent.putExtra(UIKitConstants.IntentStrings.NAME,message.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.UID,message.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,message.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.INTENT_MEDIA_MESSAGE, ((MediaMessage)message).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,message.getType()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,message.getType()); context.startActivity(intent); }); viewHolder.itemView.setTag(R.string.baseMessage, message); @@ -217,12 +205,12 @@ public void onClick(DialogInterface dialog, int which) { alert.create().show(); } else { Intent intent = new Intent(context, CometChatMediaViewActivity.class); - intent.putExtra(StringContract.IntentStrings.NAME,message.getSender().getName()); - intent.putExtra(StringContract.IntentStrings.UID,message.getSender().getUid()); - intent.putExtra(StringContract.IntentStrings.SENTAT,message.getSentAt()); - intent.putExtra(StringContract.IntentStrings.INTENT_MEDIA_MESSAGE, + intent.putExtra(UIKitConstants.IntentStrings.NAME,message.getSender().getName()); + intent.putExtra(UIKitConstants.IntentStrings.UID,message.getSender().getUid()); + intent.putExtra(UIKitConstants.IntentStrings.SENTAT,message.getSentAt()); + intent.putExtra(UIKitConstants.IntentStrings.INTENT_MEDIA_MESSAGE, ((MediaMessage)message).getAttachment().getFileUrl()); - intent.putExtra(StringContract.IntentStrings.MESSAGE_TYPE,message.getType()); + intent.putExtra(UIKitConstants.IntentStrings.MESSAGE_TYPE,message.getType()); context.startActivity(intent); } }); diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/adapter/TabAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/adapter/TabAdapter.java new file mode 100644 index 00000000..3fc56337 --- /dev/null +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/adapter/TabAdapter.java @@ -0,0 +1,39 @@ +package com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.adapter; + +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; + +import java.util.ArrayList; +import java.util.List; + + +public class TabAdapter extends FragmentStatePagerAdapter { + private final List mFragmentList = new ArrayList<>(); + private final List mFragmentTitleList = new ArrayList<>(); + private final List mFragmentIconList = new ArrayList<>(); + public TabAdapter(FragmentManager fm) { + super(fm); + } + + @Override + public Fragment getItem(int position) { + return mFragmentList.get(position); + + } + public void addFragment(Fragment fragment, String title) { + mFragmentList.add(fragment); + mFragmentTitleList.add(title); + } + + @Nullable + @Override + public CharSequence getPageTitle(int position) { + return mFragmentTitleList.get(position); + } + @Override + public int getCount() { + return mFragmentList.size(); + } +} diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/SharedMedia/SharedFilesFragment.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/fragments/CometChatSharedFiles.java similarity index 91% rename from uikit/src/main/java/com/cometchat/pro/uikit/SharedMedia/SharedFilesFragment.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/fragments/CometChatSharedFiles.java index 1bf51771..c34d7e3f 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/SharedMedia/SharedFilesFragment.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/fragments/CometChatSharedFiles.java @@ -1,7 +1,6 @@ -package com.cometchat.pro.uikit.SharedMedia; +package com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.fragments; import android.os.Bundle; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -18,7 +17,6 @@ import com.cometchat.pro.core.MessagesRequest; import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.BaseMessage; -import com.cometchat.pro.models.MediaMessage; import com.cometchat.pro.uikit.R; import com.google.android.material.snackbar.Snackbar; @@ -26,10 +24,7 @@ import java.util.Arrays; import java.util.List; -import adapter.SharedMediaAdapter; -import listeners.ClickListener; -import listeners.RecyclerTouchListener; -import utils.MediaUtils; +import com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.adapter.CometChatSharedMediaAdapter; /** * Purpose - It is a Fragment which is used in SharedMedia to display Files sent or recieved to a @@ -40,9 +35,9 @@ * Modified On - 23rd March 2020 * */ -public class SharedFilesFragment extends Fragment { +public class CometChatSharedFiles extends Fragment { private RecyclerView rvFiles; - private SharedMediaAdapter adapter; + private CometChatSharedMediaAdapter adapter; private String Id; private String type; private MessagesRequest messagesRequest; @@ -51,7 +46,7 @@ public class SharedFilesFragment extends Fragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.shared_media_view,container,false); + View view = inflater.inflate(R.layout.fragment_cometchat_shared_media,container,false); rvFiles = view.findViewById(R.id.rvFiles); noMedia = view.findViewById(R.id.no_media_available); rvFiles.setLayoutManager(new GridLayoutManager(getContext(),2)); @@ -123,14 +118,14 @@ private void checkMediaVisble() { /** * This method is used to setAdapter for File messages. * @param baseMessageList is object of List which contains list of messages. - * @see SharedMediaAdapter + * @see CometChatSharedMediaAdapter */ private void setAdapter(List baseMessageList) { List filteredList = removeDeletedMessage(baseMessageList); messageList.addAll(filteredList); if (adapter==null) { - adapter = new SharedMediaAdapter(getContext(),filteredList); + adapter = new CometChatSharedMediaAdapter(getContext(),filteredList); rvFiles.setAdapter(adapter); } else diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/SharedMedia/SharedImagesFragment.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/fragments/CometChatSharedImages.java similarity index 87% rename from uikit/src/main/java/com/cometchat/pro/uikit/SharedMedia/SharedImagesFragment.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/fragments/CometChatSharedImages.java index a8a97370..3eccbd45 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/SharedMedia/SharedImagesFragment.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/fragments/CometChatSharedImages.java @@ -1,9 +1,5 @@ -package com.cometchat.pro.uikit.SharedMedia; +package com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.fragments; -import android.app.Dialog; -import android.graphics.Bitmap; -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; @@ -17,15 +13,11 @@ import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.bumptech.glide.Glide; -import com.bumptech.glide.request.target.SimpleTarget; -import com.bumptech.glide.request.transition.Transition; import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.MessagesRequest; import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.BaseMessage; -import com.cometchat.pro.models.MediaMessage; import com.cometchat.pro.uikit.R; import com.google.android.material.snackbar.Snackbar; @@ -33,10 +25,7 @@ import java.util.Arrays; import java.util.List; -import adapter.SharedMediaAdapter; -import listeners.ClickListener; -import listeners.RecyclerTouchListener; -import utils.ZoomIv; +import com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.adapter.CometChatSharedMediaAdapter; /** * Purpose - It is a Fragment which is used in SharedMedia to display Images sent or received to a @@ -47,10 +36,10 @@ * Modified On - 23rd March 2020 * */ -public class SharedImagesFragment extends Fragment { +public class CometChatSharedImages extends Fragment { private RecyclerView rvFiles; - private SharedMediaAdapter adapter; + private CometChatSharedMediaAdapter adapter; private String Id; private String type; private List messageList = new ArrayList<>(); @@ -59,7 +48,7 @@ public class SharedImagesFragment extends Fragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.shared_media_view,container,false); + View view = inflater.inflate(R.layout.fragment_cometchat_shared_media,container,false); rvFiles = view.findViewById(R.id.rvFiles); rvFiles.setLayoutManager(new GridLayoutManager(getContext(),2)); noMedia = view.findViewById(R.id.no_media_available); @@ -131,7 +120,7 @@ private void checkMediaVisble() { /** * This method is used to setAdapter for Image messages. * @param baseMessageList is object of List which contains list of messages. - * @see SharedMediaAdapter + * @see CometChatSharedMediaAdapter */ private void setImageAdapter(List baseMessageList) { @@ -139,7 +128,7 @@ private void setImageAdapter(List baseMessageList) { messageList.addAll(filteredList); if (adapter==null) { - adapter = new SharedMediaAdapter(getContext(),filteredList); + adapter = new CometChatSharedMediaAdapter(getContext(),filteredList); rvFiles.setAdapter(adapter); } else diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/SharedMedia/SharedVideosFragment.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/fragments/CometChatSharedVideos.java similarity index 90% rename from uikit/src/main/java/com/cometchat/pro/uikit/SharedMedia/SharedVideosFragment.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/fragments/CometChatSharedVideos.java index 64d93988..a238aeda 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/SharedMedia/SharedVideosFragment.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSharedMedia/fragments/CometChatSharedVideos.java @@ -1,7 +1,6 @@ -package com.cometchat.pro.uikit.SharedMedia; +package com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.fragments; import android.os.Bundle; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -18,7 +17,6 @@ import com.cometchat.pro.core.MessagesRequest; import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.BaseMessage; -import com.cometchat.pro.models.MediaMessage; import com.cometchat.pro.uikit.R; import com.google.android.material.snackbar.Snackbar; @@ -26,14 +24,11 @@ import java.util.Arrays; import java.util.List; -import adapter.SharedMediaAdapter; -import listeners.ClickListener; -import listeners.RecyclerTouchListener; -import utils.MediaUtils; +import com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.adapter.CometChatSharedMediaAdapter; -public class SharedVideosFragment extends Fragment { +public class CometChatSharedVideos extends Fragment { private RecyclerView rvFiles; - private SharedMediaAdapter adapter; + private CometChatSharedMediaAdapter adapter; private String Id; private String type; private MessagesRequest messagesRequest; @@ -42,7 +37,7 @@ public class SharedVideosFragment extends Fragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.shared_media_view,container,false); + View view = inflater.inflate(R.layout.fragment_cometchat_shared_media,container,false); rvFiles = view.findViewById(R.id.rvFiles); rvFiles.setLayoutManager(new GridLayoutManager(getContext(),2)); noMedia = view.findViewById(R.id.no_media_available); @@ -115,14 +110,14 @@ private void checkMediaVisble() { /** * This method is used to setAdapter for Video messages. * @param baseMessageList is object of List which contains list of messages. - * @see SharedMediaAdapter + * @see CometChatSharedMediaAdapter */ private void setAdapter(List baseMessageList) { List filteredList = removeDeletedMessage(baseMessageList); messageList.addAll(filteredList); if (adapter==null) { - adapter = new SharedMediaAdapter(getContext(),filteredList); + adapter = new CometChatSharedMediaAdapter(getContext(),filteredList); rvFiles.setAdapter(adapter); } else diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/SmartReplyList.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSmartReplies/CometChatSmartReplies.java similarity index 78% rename from uikit/src/main/java/com/cometchat/pro/uikit/SmartReplyList.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSmartReplies/CometChatSmartReplies.java index 26bff461..eca0e0d7 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/SmartReplyList.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSmartReplies/CometChatSmartReplies.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit; +package com.cometchat.pro.uikit.ui_components.shared.cometchatSmartReplies; import android.content.Context; import android.content.res.TypedArray; @@ -11,14 +11,13 @@ import androidx.databinding.BindingMethods; import androidx.recyclerview.widget.RecyclerView; -import com.cometchat.pro.models.User; +import com.cometchat.pro.uikit.R; import java.util.List; -import listeners.ClickListener; -import listeners.OnItemClickListener; -import listeners.RecyclerTouchListener; -import viewmodel.SmartReplyViewModel; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; /** * Purpose - SmartReply class is a subclass of recyclerview and used as component by @@ -31,26 +30,26 @@ * Modified on - 23rd March 2020 * */ -@BindingMethods(value = {@BindingMethod(type = CometChatUserList.class, attribute = "app:replylist", method = "setSmartReplyList")}) -public class SmartReplyList extends RecyclerView { +@BindingMethods(value = {@BindingMethod(type = CometChatSmartReplies.class, attribute = "app:replylist", method = "setSmartReplyList")}) +public class CometChatSmartReplies extends RecyclerView { private Context context; private SmartReplyViewModel smartReplyViewModel; - public SmartReplyList(@NonNull Context context) { + public CometChatSmartReplies(@NonNull Context context) { super(context); setContext(context); } - public SmartReplyList(@NonNull Context context, @Nullable AttributeSet attrs) { + public CometChatSmartReplies(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); setContext(context); getAttributes(attrs); setSmartReplyViewModel(); } - public SmartReplyList(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + public CometChatSmartReplies(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setContext(context); getAttributes(attrs); diff --git a/uikit/src/main/java/adapter/SmartReplyListAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSmartReplies/SmartRepliesAdapter.java similarity index 86% rename from uikit/src/main/java/adapter/SmartReplyListAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSmartReplies/SmartRepliesAdapter.java index 73010e19..e7277b86 100644 --- a/uikit/src/main/java/adapter/SmartReplyListAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSmartReplies/SmartRepliesAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.shared.cometchatSmartReplies; import android.content.Context; import android.view.LayoutInflater; @@ -15,7 +15,7 @@ import java.util.ArrayList; import java.util.List; -import utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; /** * Purpose - UserListAdapter is a subclass of RecyclerView Adapter which is used to display @@ -27,7 +27,7 @@ * */ -public class SmartReplyListAdapter extends RecyclerView.Adapter { +public class SmartRepliesAdapter extends RecyclerView.Adapter { private Context context; @@ -42,7 +42,7 @@ public class SmartReplyListAdapter extends RecyclerView.Adapter replyArrayList) { + public SmartRepliesAdapter(Context context, List replyArrayList) { this.replyArrayList = replyArrayList; this.context= context; fontUtils=FontUtils.getInstance(context); @@ -63,7 +63,7 @@ public SmartReplyListAdapter(Context context, List replyArrayList) { @Override public SmartReplyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) { - View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.reply_list_row, parent, false); + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.cometchat_smartreply_row, parent, false); return new SmartReplyViewHolder(view); } diff --git a/uikit/src/main/java/viewmodel/SmartReplyViewModel.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSmartReplies/SmartReplyViewModel.java similarity index 50% rename from uikit/src/main/java/viewmodel/SmartReplyViewModel.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSmartReplies/SmartReplyViewModel.java index 8d989898..779bc557 100644 --- a/uikit/src/main/java/viewmodel/SmartReplyViewModel.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatSmartReplies/SmartReplyViewModel.java @@ -1,38 +1,33 @@ -package viewmodel; +package com.cometchat.pro.uikit.ui_components.shared.cometchatSmartReplies; import android.content.Context; -import com.cometchat.pro.uikit.SmartReplyList; - import java.util.List; -import adapter.SmartReplyListAdapter; -import listeners.OnItemClickListener; - public class SmartReplyViewModel { private static final String TAG = "SmartReplyViewModel"; private Context context; - private SmartReplyListAdapter smartReplyListAdapter; + private SmartRepliesAdapter smartReplyListAdapter; - private SmartReplyList smartReplyList; + private CometChatSmartReplies smartReplyList; - public SmartReplyViewModel(Context context, SmartReplyList smartReplyList) { + public SmartReplyViewModel(Context context, CometChatSmartReplies smartReplyList) { this.context = context; this.smartReplyList = smartReplyList; setSmartReplyAdapter(smartReplyList); } - private void setSmartReplyAdapter(SmartReplyList smartReplyList) { - smartReplyListAdapter=new SmartReplyListAdapter(context); + private void setSmartReplyAdapter(CometChatSmartReplies smartReplyList) { + smartReplyListAdapter=new SmartRepliesAdapter(context); smartReplyList.setAdapter(smartReplyListAdapter); } - private SmartReplyListAdapter getAdapter(){ + private SmartRepliesAdapter getAdapter(){ if (smartReplyListAdapter==null){ - smartReplyListAdapter=new SmartReplyListAdapter(context); + smartReplyListAdapter=new SmartRepliesAdapter(context); } return smartReplyListAdapter; } diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Sticker/StickerFragment.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/StickerFragment.java similarity index 81% rename from uikit/src/main/java/com/cometchat/pro/uikit/Sticker/StickerFragment.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/StickerFragment.java index fb0cdfb4..130727df 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Sticker/StickerFragment.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/StickerFragment.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.Sticker; +package com.cometchat.pro.uikit.ui_components.shared.cometchatStickers; import android.os.Bundle; import android.util.Log; @@ -13,15 +13,15 @@ import androidx.recyclerview.widget.RecyclerView; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Sticker.listener.StickerClickListener; -import com.cometchat.pro.uikit.Sticker.model.Sticker; +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.listener.StickerClickListener; +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.model.Sticker; import java.util.ArrayList; import java.util.List; -import adapter.StickersAdapter; -import listeners.ClickListener; -import listeners.RecyclerTouchListener; +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.adapter.StickersAdapter; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; /** * Purpose - It is a Fragment which is used in StickerView to display stickers sent or received to a diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Sticker/StickerView.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/StickerView.java similarity index 93% rename from uikit/src/main/java/com/cometchat/pro/uikit/Sticker/StickerView.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/StickerView.java index ccb09363..db0d69c6 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Sticker/StickerView.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/StickerView.java @@ -1,7 +1,6 @@ -package com.cometchat.pro.uikit.Sticker; +package com.cometchat.pro.uikit.ui_components.shared.cometchatStickers; import android.content.Context; -import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.drawable.Drawable; @@ -9,7 +8,6 @@ import android.os.Parcelable; import android.util.AttributeSet; import android.view.View; -import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RelativeLayout; @@ -19,17 +17,16 @@ import com.bumptech.glide.Glide; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Settings.UISettings; -import com.cometchat.pro.uikit.Sticker.listener.StickerClickListener; -import com.cometchat.pro.uikit.Sticker.model.Sticker; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.listener.StickerClickListener; +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.model.Sticker; import com.google.android.material.tabs.TabLayout; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import adapter.StickerTabAdapter; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.adapter.StickerTabAdapter; public class StickerView extends RelativeLayout implements StickerClickListener { diff --git a/uikit/src/main/java/adapter/StickerTabAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/adapter/StickerTabAdapter.java similarity index 81% rename from uikit/src/main/java/adapter/StickerTabAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/adapter/StickerTabAdapter.java index b8a05148..c6cec837 100644 --- a/uikit/src/main/java/adapter/StickerTabAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/adapter/StickerTabAdapter.java @@ -1,24 +1,14 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.adapter; import android.content.Context; import android.graphics.drawable.Drawable; import android.text.SpannableStringBuilder; -import android.text.Spanned; -import android.text.style.DynamicDrawableSpan; -import android.text.style.ImageSpan; -import android.util.Log; -import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentStatePagerAdapter; -import com.bumptech.glide.Glide; -import com.bumptech.glide.request.target.CustomTarget; -import com.bumptech.glide.request.transition.Transition; -import com.cometchat.pro.uikit.R; - import java.util.ArrayList; import java.util.List; diff --git a/uikit/src/main/java/adapter/StickersAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/adapter/StickersAdapter.java similarity index 95% rename from uikit/src/main/java/adapter/StickersAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/adapter/StickersAdapter.java index 1dcd8903..84669c3b 100644 --- a/uikit/src/main/java/adapter/StickersAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/adapter/StickersAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.adapter; import android.content.Context; import android.view.LayoutInflater; @@ -17,7 +17,7 @@ import java.util.Comparator; import java.util.List; -import com.cometchat.pro.uikit.Sticker.model.Sticker; +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.model.Sticker; /** * Purpose - UserListAdapter is a subclass of RecyclerView Adapter which is used to display diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/listener/StickerClickListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/listener/StickerClickListener.java new file mode 100644 index 00000000..515f47ae --- /dev/null +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/listener/StickerClickListener.java @@ -0,0 +1,7 @@ +package com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.listener; + +import com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.model.Sticker; + +public interface StickerClickListener { + void onClickListener(Sticker sticker); +} diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Sticker/model/Sticker.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/model/Sticker.java similarity index 93% rename from uikit/src/main/java/com/cometchat/pro/uikit/Sticker/model/Sticker.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/model/Sticker.java index 79d31b49..d6f7758e 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Sticker/model/Sticker.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatStickers/model/Sticker.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.Sticker.model; +package com.cometchat.pro.uikit.ui_components.shared.cometchatStickers.model; import android.os.Parcel; import android.os.Parcelable; diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/StatusIndicator.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUserPresence/CometChatUserPresence.java similarity index 85% rename from uikit/src/main/java/com/cometchat/pro/uikit/StatusIndicator.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUserPresence/CometChatUserPresence.java index 9bcc5627..54feea2c 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/StatusIndicator.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUserPresence/CometChatUserPresence.java @@ -1,7 +1,6 @@ -package com.cometchat.pro.uikit; +package com.cometchat.pro.uikit.ui_components.shared.cometchatUserPresence; import android.content.Context; -import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; @@ -11,7 +10,6 @@ import android.view.View; import androidx.annotation.ColorInt; -import androidx.annotation.ColorRes; import androidx.databinding.BindingMethod; import androidx.databinding.BindingMethods; @@ -27,8 +25,8 @@ * */ -@BindingMethods(value ={@BindingMethod(type = StatusIndicator.class, attribute = "app:user_status", method = "setUserStatus")}) -public class StatusIndicator extends View { +@BindingMethods(value ={@BindingMethod(type = CometChatUserPresence.class, attribute = "app:user_status", method = "setUserStatus")}) +public class CometChatUserPresence extends View { private Paint paint; RectF rectF; @@ -40,18 +38,18 @@ public class StatusIndicator extends View { protected static final int OFFLINE = 0; protected static final int ONLINE = 1; - public StatusIndicator(Context context) { + public CometChatUserPresence(Context context) { super(context); init(); } - public StatusIndicator(Context context, AttributeSet attrs) { + public CometChatUserPresence(Context context, AttributeSet attrs) { super(context, attrs); getAttributes(attrs); init(); } - public StatusIndicator(Context context, AttributeSet attrs, int defStyleAttr) { + public CometChatUserPresence(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); getAttributes(attrs); init(); diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/CometChatUserList.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUsers/CometChatUsers.java similarity index 86% rename from uikit/src/main/java/com/cometchat/pro/uikit/CometChatUserList.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUsers/CometChatUsers.java index b16afbe3..a57a35b0 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/CometChatUserList.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUsers/CometChatUsers.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit; +package com.cometchat.pro.uikit.ui_components.shared.cometchatUsers; import android.content.Context; import android.content.res.TypedArray; @@ -12,13 +12,13 @@ import androidx.recyclerview.widget.RecyclerView; import com.cometchat.pro.models.User; +import com.cometchat.pro.uikit.R; import java.util.List; -import listeners.ClickListener; -import listeners.OnItemClickListener; -import listeners.RecyclerTouchListener; -import viewmodel.UserListViewModel; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; /** * Purpose - CometChatUserList class is a subclass of recyclerview and used as component by @@ -33,8 +33,8 @@ * */ -@BindingMethods(value = {@BindingMethod(type = CometChatUserList.class, attribute = "app:userlist", method = "setUserList")}) -public class CometChatUserList extends RecyclerView { +@BindingMethods(value = {@BindingMethod(type = CometChatUsers.class, attribute = "app:userlist", method = "setUserList")}) +public class CometChatUsers extends RecyclerView { private Context context; @@ -42,20 +42,20 @@ public class CometChatUserList extends RecyclerView { private boolean showHeader; - public CometChatUserList(@NonNull Context context) { + public CometChatUsers(@NonNull Context context) { super(context); this.context = context; setViewModel(); } - public CometChatUserList(@NonNull Context context, @Nullable AttributeSet attrs) { + public CometChatUsers(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); this.context = context; getAttributes(attrs); setViewModel(); } - public CometChatUserList(@NonNull Context context, @Nullable AttributeSet attrs, int defStyle) { + public CometChatUsers(@NonNull Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; getAttributes(attrs); diff --git a/uikit/src/main/java/adapter/UserListAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUsers/CometChatUsersAdapter.java similarity index 90% rename from uikit/src/main/java/adapter/UserListAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUsers/CometChatUsersAdapter.java index 59db1ff1..707ee57c 100644 --- a/uikit/src/main/java/adapter/UserListAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUsers/CometChatUsersAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.shared.cometchatUsers; import android.content.Context; import android.view.LayoutInflater; @@ -11,16 +11,16 @@ import androidx.recyclerview.widget.RecyclerView; import com.cometchat.pro.constants.CometChatConstants; -import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.databinding.UserListRowBinding; import com.cometchat.pro.models.User; +import com.cometchat.pro.uikit.R; import java.util.ArrayList; import java.util.List; -import listeners.StickyHeaderAdapter; -import utils.FontUtils; -import utils.Utils; +import com.cometchat.pro.uikit.databinding.CometchatUserListRowBinding; +import com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderAdapter; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - UserListAdapter is a subclass of RecyclerView Adapter which is used to display @@ -32,8 +32,8 @@ * */ -public class UserListAdapter extends RecyclerView.Adapter - implements StickyHeaderAdapter { +public class CometChatUsersAdapter extends RecyclerView.Adapter + implements StickyHeaderAdapter { private Context context; @@ -48,7 +48,7 @@ public class UserListAdapter extends RecyclerView.Adapter userArrayList) { + public CometChatUsersAdapter(Context context, List userArrayList) { this.userArrayList = userArrayList; this.context= context; fontUtils=FontUtils.getInstance(context); @@ -71,7 +71,7 @@ public UserViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); - UserListRowBinding userListRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.user_list_row, parent, false); + CometchatUserListRowBinding userListRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.cometchat_user_list_row, parent, false); return new UserViewHolder(userListRowBinding); } @@ -188,7 +188,7 @@ public long getHeaderId(int var1) { @Override public InitialHolder onCreateHeaderViewHolder(ViewGroup var1) { - return new InitialHolder(LayoutInflater.from(var1.getContext()).inflate(R.layout.cc_initial_header, var1, false)); + return new InitialHolder(LayoutInflater.from(var1.getContext()).inflate(R.layout.cometchat_userlist_header, var1, false)); } @Override @@ -264,8 +264,8 @@ public void clear() { class UserViewHolder extends RecyclerView.ViewHolder { - UserListRowBinding userListRowBinding; - UserViewHolder(UserListRowBinding userListRowBinding) { + CometchatUserListRowBinding userListRowBinding; + UserViewHolder(CometchatUserListRowBinding userListRowBinding) { super(userListRowBinding.getRoot()); this.userListRowBinding = userListRowBinding; diff --git a/uikit/src/main/java/viewmodel/UserListViewModel.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUsers/UserListViewModel.java similarity index 75% rename from uikit/src/main/java/viewmodel/UserListViewModel.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUsers/UserListViewModel.java index b30e4f94..82c0b263 100644 --- a/uikit/src/main/java/viewmodel/UserListViewModel.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/shared/cometchatUsers/UserListViewModel.java @@ -1,14 +1,12 @@ -package viewmodel; +package com.cometchat.pro.uikit.ui_components.shared.cometchatUsers; import android.content.Context; -import com.cometchat.pro.uikit.CometChatUserList; import com.cometchat.pro.models.User; import java.util.List; -import adapter.UserListAdapter; -import listeners.StickyHeaderDecoration; +import com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderDecoration; public class UserListViewModel { @@ -16,13 +14,13 @@ public class UserListViewModel { private Context context; - private UserListAdapter userListAdapter; + private CometChatUsersAdapter userListAdapter; - private CometChatUserList userListView; + private CometChatUsers userListView; - public UserListViewModel(Context context,CometChatUserList cometChatUserList,boolean showHeader){ + public UserListViewModel(Context context, CometChatUsers cometChatUserList, boolean showHeader){ this.userListView=cometChatUserList; this.context=context; setUserListAdapter(cometChatUserList,showHeader); @@ -32,9 +30,9 @@ private UserListViewModel(){ } - private UserListAdapter getAdapter() { + private CometChatUsersAdapter getAdapter() { if (userListAdapter==null){ - userListAdapter=new UserListAdapter(context); + userListAdapter=new CometChatUsersAdapter(context); } return userListAdapter; } @@ -71,8 +69,8 @@ public void clear() if (userListAdapter!=null) userListAdapter.clear(); } - private void setUserListAdapter(CometChatUserList cometChatUserList,boolean showHeader){ - userListAdapter=new UserListAdapter(context); + private void setUserListAdapter(CometChatUsers cometChatUserList, boolean showHeader){ + userListAdapter=new CometChatUsersAdapter(context); if(showHeader) { StickyHeaderDecoration stickyHeaderDecoration = new StickyHeaderDecoration(userListAdapter); cometChatUserList.addItemDecoration(stickyHeaderDecoration, 0); diff --git a/uikit/src/main/java/screen/CometChatUserInfoScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/userprofile/CometChatUserProfile.java similarity index 86% rename from uikit/src/main/java/screen/CometChatUserInfoScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/userprofile/CometChatUserProfile.java index 68325aee..ffd1bbbf 100644 --- a/uikit/src/main/java/screen/CometChatUserInfoScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/userprofile/CometChatUserProfile.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.userprofile; import android.app.AlertDialog; import android.content.Intent; @@ -23,21 +23,22 @@ import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.User; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.databinding.FragmentMoreInfoScreenBinding; -import com.cometchat.pro.uikit.Avatar; +import com.cometchat.pro.uikit.databinding.FragmentCometchatUserProfileBinding; +import com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar.CometChatAvatar; import com.google.android.material.button.MaterialButton; import com.google.android.material.textfield.TextInputEditText; -import constant.StringContract; -import utils.FontUtils; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; +import com.cometchat.pro.uikit.ui_components.userprofile.privacy_security.CometChatMorePrivacyActivity; -public class CometChatUserInfoScreen extends Fragment { +public class CometChatUserProfile extends Fragment { - private Avatar notificationIv; + private CometChatAvatar notificationIv; private AlertDialog.Builder dialog; - FragmentMoreInfoScreenBinding moreInfoScreenBinding; + FragmentCometchatUserProfileBinding moreInfoScreenBinding; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -47,7 +48,7 @@ public void onCreate(Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - moreInfoScreenBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_more_info_screen, container, false); + moreInfoScreenBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_cometchat_user_profile, container, false); moreInfoScreenBinding.setUser(CometChat.getLoggedInUser()); moreInfoScreenBinding.ivUser.setAvatar(CometChat.getLoggedInUser()); @@ -56,7 +57,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, moreInfoScreenBinding.privacyAndSecurity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - startActivity(new Intent(getContext(), CometChatMorePrivacyScreenActivity.class)); + startActivity(new Intent(getContext(), CometChatMorePrivacyActivity.class)); } }); @@ -89,8 +90,8 @@ public void onClick(View v) { private void updateUserDialog() { dialog = new AlertDialog.Builder(getContext()); - View view = LayoutInflater.from(getContext()).inflate(R.layout.update_user,null); - Avatar avatar = view.findViewById(R.id.user_avatar); + View view = LayoutInflater.from(getContext()).inflate(R.layout.cometchat_update_user_dialog,null); + CometChatAvatar avatar = view.findViewById(R.id.user_avatar); avatar.setAvatar(CometChat.getLoggedInUser()); TextInputEditText avatar_url = view.findViewById(R.id.avatar_url_edt); avatar_url.setText(CometChat.getLoggedInUser().getAvatar()); @@ -155,7 +156,7 @@ public void onClick(View v) { } private void updateUser(User user) { - CometChat.updateUser(user, StringContract.AppInfo.AUTH_KEY, new CometChat.CallbackListener() { + CometChat.updateUser(user, UIKitConstants.AppInfo.AUTH_KEY, new CometChat.CallbackListener() { @Override public void onSuccess(User user) { if (getContext()!=null) diff --git a/uikit/src/main/java/screen/CometChatMorePrivacyScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/userprofile/privacy_security/CometChatMorePrivacyActivity.java similarity index 84% rename from uikit/src/main/java/screen/CometChatMorePrivacyScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/userprofile/privacy_security/CometChatMorePrivacyActivity.java index 0f4b8d92..2fcf816a 100644 --- a/uikit/src/main/java/screen/CometChatMorePrivacyScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/userprofile/privacy_security/CometChatMorePrivacyActivity.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.userprofile.privacy_security; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; @@ -21,12 +21,12 @@ import java.util.List; -import screen.blockuserlist.CometChatBlockUserListScreenActivity; -import utils.FontUtils; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.users.block_users.CometChatBlockUserListActivity; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; -public class CometChatMorePrivacyScreenActivity extends AppCompatActivity { +public class CometChatMorePrivacyActivity extends AppCompatActivity { private TextView tvBlockUserCount; @@ -39,7 +39,7 @@ public class CometChatMorePrivacyScreenActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_comet_chat_more_privacy_screen); + setContentView(R.layout.activity_cometchat_more_privacy); blockUserTv = findViewById(R.id.blocked_user_tv); tvBlockUserCount = findViewById(R.id.tv_blocked_user_count); @@ -67,7 +67,7 @@ protected void onCreate(Bundle savedInstanceState) { } public void blockUserList(View view) { - startActivity(new Intent(this, CometChatBlockUserListScreenActivity.class)); + startActivity(new Intent(this, CometChatBlockUserListActivity.class)); } public void getBlockCount() { @@ -90,7 +90,7 @@ public void onSuccess(List users) { @Override public void onError(CometChatException e) { Snackbar.make(tvBlockUserCount,getResources().getString(R.string.block_user_list_error),Snackbar.LENGTH_SHORT).show(); - Toast.makeText(CometChatMorePrivacyScreenActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show(); + Toast.makeText(CometChatMorePrivacyActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show(); } }); } diff --git a/uikit/src/main/java/adapter/BlockedListAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/block_users/BlockedListAdapter.java similarity index 90% rename from uikit/src/main/java/adapter/BlockedListAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/block_users/BlockedListAdapter.java index da55a332..30741b92 100644 --- a/uikit/src/main/java/adapter/BlockedListAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/block_users/BlockedListAdapter.java @@ -1,10 +1,9 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.users.block_users; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.TextView; import androidx.annotation.NonNull; import androidx.databinding.DataBindingUtil; @@ -12,15 +11,13 @@ import com.cometchat.pro.models.User; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.databinding.UserListRowBinding; import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import listeners.StickyHeaderAdapter; -import utils.FontUtils; -import utils.Utils; +import com.cometchat.pro.uikit.databinding.CometchatUserListRowBinding; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - BlockListAdapter is a subclass of RecyclerView Adapter which is used to display the list of blocked @@ -59,7 +56,7 @@ public BlockedViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); - UserListRowBinding userListRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.user_list_row, parent, false); + CometchatUserListRowBinding userListRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.cometchat_user_list_row, parent, false); return new BlockedViewHolder(userListRowBinding); } @@ -142,8 +139,8 @@ public void removeUser(User user) { class BlockedViewHolder extends RecyclerView.ViewHolder { - UserListRowBinding userListRowBinding; - BlockedViewHolder(UserListRowBinding userListRowBinding) { + CometchatUserListRowBinding userListRowBinding; + BlockedViewHolder(CometchatUserListRowBinding userListRowBinding) { super(userListRowBinding.getRoot()); this.userListRowBinding = userListRowBinding; diff --git a/uikit/src/main/java/screen/blockuserlist/CometChatBlockUserListScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/block_users/CometChatBlockUserList.java similarity index 93% rename from uikit/src/main/java/screen/blockuserlist/CometChatBlockUserListScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/block_users/CometChatBlockUserList.java index 19f450cf..cc607a1c 100644 --- a/uikit/src/main/java/screen/blockuserlist/CometChatBlockUserListScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/block_users/CometChatBlockUserList.java @@ -1,4 +1,4 @@ -package screen.blockuserlist; +package com.cometchat.pro.uikit.ui_components.users.block_users; import android.content.DialogInterface; import android.os.Bundle; @@ -28,11 +28,10 @@ import java.util.HashMap; import java.util.List; -import adapter.BlockedListAdapter; -import listeners.ClickListener; -import listeners.RecyclerTouchListener; -import utils.FontUtils; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.ClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.recycler_touch.RecyclerTouchListener; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - CometChatBlockUserListScreen.class is a screen used to display List of blocked users. @@ -45,7 +44,7 @@ */ -public class CometChatBlockUserListScreen extends Fragment { +public class CometChatBlockUserList extends Fragment { private static final String TAG = "CometChatGroupMember"; private int LIMIT = 100; @@ -72,7 +71,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - View view = inflater.inflate(R.layout.block_user_screen, container, false); + View view = inflater.inflate(R.layout.fragment_cometchat_block_user, container, false); setHasOptionsMenu(true); rvUserList = view.findViewById(R.id.rv_blocked_user_list); noBlockUserLayout = view.findViewById(R.id.no_block_user); diff --git a/uikit/src/main/java/screen/blockuserlist/CometChatBlockUserListScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/block_users/CometChatBlockUserListActivity.java similarity index 76% rename from uikit/src/main/java/screen/blockuserlist/CometChatBlockUserListScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/block_users/CometChatBlockUserListActivity.java index c0c0cc2d..92fa56c2 100644 --- a/uikit/src/main/java/screen/blockuserlist/CometChatBlockUserListScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/block_users/CometChatBlockUserListActivity.java @@ -1,4 +1,4 @@ -package screen.blockuserlist; +package com.cometchat.pro.uikit.ui_components.users.block_users; import android.graphics.Color; import android.os.Bundle; @@ -11,9 +11,9 @@ import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Settings.UISettings; +import com.cometchat.pro.uikit.ui_settings.UISettings; -public class CometChatBlockUserListScreenActivity extends AppCompatActivity { +public class CometChatBlockUserListActivity extends AppCompatActivity { private Fragment fragment; @@ -23,8 +23,8 @@ public class CometChatBlockUserListScreenActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_block_screen); - Fragment fragment = new CometChatBlockUserListScreen(); + setContentView(R.layout.activity_screen); + Fragment fragment = new CometChatBlockUserList(); getSupportFragmentManager().beginTransaction().replace(R.id.frame_fragment,fragment).commit(); if (UISettings.getColor()!=null) getWindow().setStatusBarColor(Color.parseColor(UISettings.getColor())); diff --git a/uikit/src/main/java/screen/CometChatUserDetailScreenActivity.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/user_details/CometChatUserDetailScreenActivity.java similarity index 83% rename from uikit/src/main/java/screen/CometChatUserDetailScreenActivity.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/user_details/CometChatUserDetailScreenActivity.java index e6a8ff19..0b3bfbfa 100644 --- a/uikit/src/main/java/screen/CometChatUserDetailScreenActivity.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/user_details/CometChatUserDetailScreenActivity.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.users.user_details; import android.app.AlertDialog; import android.content.DialogInterface; @@ -21,7 +21,6 @@ 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; @@ -31,9 +30,11 @@ import com.cometchat.pro.models.Group; import com.cometchat.pro.models.GroupMember; import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.Avatar; + +import com.cometchat.pro.uikit.ui_components.messages.message_list.CometChatMessageListActivity; +import com.cometchat.pro.uikit.ui_components.shared.cometchatAvatar.CometChatAvatar; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.SharedMediaView; +import com.cometchat.pro.uikit.ui_components.shared.cometchatSharedMedia.CometChatSharedMedia; import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.snackbar.Snackbar; @@ -42,16 +43,15 @@ import java.util.HashMap; import java.util.List; -import adapter.CallHistoryAdapter; -import constant.StringContract; -import screen.messagelist.CometChatMessageListActivity; -import utils.CallUtils; -import utils.FontUtils; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.users.user_details.callHistroy.CallHistoryAdapter; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_resources.utils.CallUtils; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; public class CometChatUserDetailScreenActivity extends AppCompatActivity { - private Avatar userAvatar; + private CometChatAvatar userAvatar; private TextView userStatus, userName, addBtn; @@ -95,7 +95,7 @@ public class CometChatUserDetailScreenActivity extends AppCompatActivity { private MessagesRequest messageRequest; - private SharedMediaView sharedMediaView; + private CometChatSharedMedia sharedMediaView; private LinearLayout sharedMediaLayout; @@ -110,7 +110,7 @@ public class CometChatUserDetailScreenActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_user_detail_screen); + setContentView(R.layout.activity_cometchat_user_detail); fontUtils= FontUtils.getInstance(this); initComponent(); @@ -152,7 +152,7 @@ private void initComponent() { sharedMediaLayout = findViewById(R.id.shared_media_layout); sharedMediaView = findViewById(R.id.shared_media_view); sharedMediaView.setRecieverId(uid); - sharedMediaView.setRecieverType(CometChatConstants.RECEIVER_TYPE_USER); + sharedMediaView.setRecieverType(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); sharedMediaView.reload(); if (!UISettings.isViewSharedMedia()) @@ -174,11 +174,11 @@ private void initComponent() { tvSendMessage.setOnClickListener(view -> { if (isAddMember || fromCallList){ Intent intent=new Intent(CometChatUserDetailScreenActivity.this, CometChatMessageListActivity.class); - intent.putExtra(StringContract.IntentStrings.TYPE,CometChatConstants.RECEIVER_TYPE_USER); - intent.putExtra(StringContract.IntentStrings.UID,uid); - intent.putExtra(StringContract.IntentStrings.NAME,name); - intent.putExtra(StringContract.IntentStrings.AVATAR,avatar); - intent.putExtra(StringContract.IntentStrings.STATUS,CometChatConstants.USER_STATUS_OFFLINE); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); + intent.putExtra(UIKitConstants.IntentStrings.UID,uid); + intent.putExtra(UIKitConstants.IntentStrings.NAME,name); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR,avatar); + intent.putExtra(UIKitConstants.IntentStrings.STATUS, com.cometchat.pro.constants.CometChatConstants.USER_STATUS_OFFLINE); startActivity(intent); }else onBackPressed(); @@ -215,11 +215,11 @@ private void initComponent() { callBtn.setOnClickListener(view -> { callBtn.setClickable(false); - checkOnGoingCall(CometChatConstants.CALL_TYPE_AUDIO); + checkOnGoingCall(com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_AUDIO); }); videoCallBtn.setOnClickListener(view ->{ videoCallBtn.setClickable(false); - checkOnGoingCall(CometChatConstants.CALL_TYPE_VIDEO); + checkOnGoingCall(com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_VIDEO); }); } @@ -238,7 +238,7 @@ private void checkDarkMode() { } private void checkOnGoingCall(String callType) { - if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null) { + if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(getResources().getString(R.string.ongoing_call)) .setMessage(getResources().getString(R.string.ongoing_call_message)) @@ -258,7 +258,7 @@ public void onClick(DialogInterface dialog, int which) { } else { // CallUtils.initiateCall(CometChatUserDetailScreenActivity.this,uid,CometChatConstants.RECEIVER_TYPE_USER,callType); - Call call = new Call(uid,CometChatConstants.RECEIVER_TYPE_USER,callType); + Call call = new Call(uid, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER,callType); CometChat.initiateCall(call, new CometChat.CallbackListener() { @Override public void onSuccess(Call call) { @@ -283,41 +283,41 @@ public void onError(CometChatException e) { private void handleIntent() { - if (getIntent().hasExtra(StringContract.IntentStrings.IS_ADD_MEMBER)) { - isAddMember = getIntent().getBooleanExtra(StringContract.IntentStrings.IS_ADD_MEMBER, false); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.IS_ADD_MEMBER)) { + isAddMember = getIntent().getBooleanExtra(UIKitConstants.IntentStrings.IS_ADD_MEMBER, false); } - if (getIntent().hasExtra(StringContract.IntentStrings.FROM_CALL_LIST)) { - fromCallList = getIntent().getBooleanExtra(StringContract.IntentStrings.FROM_CALL_LIST,false); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.FROM_CALL_LIST)) { + fromCallList = getIntent().getBooleanExtra(UIKitConstants.IntentStrings.FROM_CALL_LIST,false); } - if (getIntent().hasExtra(StringContract.IntentStrings.IS_BLOCKED_BY_ME)){ - isBlocked=getIntent().getBooleanExtra(StringContract.IntentStrings.IS_BLOCKED_BY_ME,false); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.IS_BLOCKED_BY_ME)){ + isBlocked=getIntent().getBooleanExtra(UIKitConstants.IntentStrings.IS_BLOCKED_BY_ME,false); setBlockUnblock(); } - if (getIntent().hasExtra(StringContract.IntentStrings.GUID)) { - guid = getIntent().getStringExtra(StringContract.IntentStrings.GUID); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GUID)) { + guid = getIntent().getStringExtra(UIKitConstants.IntentStrings.GUID); } - if (getIntent().hasExtra(StringContract.IntentStrings.UID)) { - uid = getIntent().getStringExtra(StringContract.IntentStrings.UID); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.UID)) { + uid = getIntent().getStringExtra(UIKitConstants.IntentStrings.UID); } - if (getIntent().hasExtra(StringContract.IntentStrings.GROUP_NAME)) { - groupName = getIntent().getStringExtra(StringContract.IntentStrings.GROUP_NAME); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.GROUP_NAME)) { + groupName = getIntent().getStringExtra(UIKitConstants.IntentStrings.GROUP_NAME); } - if (getIntent().hasExtra(StringContract.IntentStrings.NAME)) { - name = getIntent().getStringExtra(StringContract.IntentStrings.NAME); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.NAME)) { + name = getIntent().getStringExtra(UIKitConstants.IntentStrings.NAME); userName.setText(name); } - if (getIntent().hasExtra(StringContract.IntentStrings.AVATAR)) { - avatar = getIntent().getStringExtra(StringContract.IntentStrings.AVATAR); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.AVATAR)) { + avatar = getIntent().getStringExtra(UIKitConstants.IntentStrings.AVATAR); } - if (getIntent().hasExtra(StringContract.IntentStrings.STATUS)) { - String status = getIntent().getStringExtra(StringContract.IntentStrings.STATUS); + if (getIntent().hasExtra(UIKitConstants.IntentStrings.STATUS)) { + String status = getIntent().getStringExtra(UIKitConstants.IntentStrings.STATUS); - if (status != null && status.equals(CometChatConstants.USER_STATUS_ONLINE)) + if (status != null && status.equals(com.cometchat.pro.constants.CometChatConstants.USER_STATUS_ONLINE)) userStatus.setTextColor(getResources().getColor(R.color.colorPrimary)); userStatus.setText(status); @@ -345,7 +345,7 @@ private void fetchCallHistory() { if (messageRequest==null) { messageRequest = new MessagesRequest.MessagesRequestBuilder().setUID(uid) - .setCategories(Arrays.asList(CometChatConstants.CATEGORY_CALL)) + .setCategories(Arrays.asList(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL)) .setLimit(30).build(); } messageRequest.fetchPrevious(new CometChat.CallbackListener>() { @@ -406,7 +406,7 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) { private void addMember() { List userList = new ArrayList<>(); - userList.add(new GroupMember(uid, CometChatConstants.SCOPE_PARTICIPANT)); + userList.add(new GroupMember(uid, com.cometchat.pro.constants.CometChatConstants.SCOPE_PARTICIPANT)); CometChat.addMembersToGroup(guid, userList, null, new CometChat.CallbackListener>() { @Override public void onSuccess(HashMap stringStringHashMap) { diff --git a/uikit/src/main/java/adapter/CallHistoryAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/user_details/callHistroy/CallHistoryAdapter.java similarity index 94% rename from uikit/src/main/java/adapter/CallHistoryAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/user_details/callHistroy/CallHistoryAdapter.java index 7a32bc5e..7d87c6ac 100644 --- a/uikit/src/main/java/adapter/CallHistoryAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/user_details/callHistroy/CallHistoryAdapter.java @@ -1,4 +1,4 @@ -package adapter; +package com.cometchat.pro.uikit.ui_components.users.user_details.callHistroy; import android.content.Context; import android.view.LayoutInflater; @@ -13,17 +13,14 @@ import com.cometchat.pro.core.CometChat; import com.cometchat.pro.models.BaseMessage; import com.cometchat.pro.models.Conversation; -import com.cometchat.pro.models.Group; -import com.cometchat.pro.models.User; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.databinding.CallHistoryRowBinding; -import com.cometchat.pro.uikit.databinding.CallListRowBinding; import java.util.ArrayList; import java.util.List; -import utils.FontUtils; -import utils.Utils; +import com.cometchat.pro.uikit.databinding.CometchatCallHistoryRowBinding; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /** * Purpose - CallHistoryAdapter is a subclass of RecyclerView Adapter which is used to display @@ -72,7 +69,7 @@ public CallHistoryAdapter(Context context) { public CallViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); - CallHistoryRowBinding callHistoryRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.call_history_row, parent, false); + CometchatCallHistoryRowBinding callHistoryRowBinding = DataBindingUtil.inflate(layoutInflater, R.layout.cometchat_call_history_row, parent, false); return new CallViewHolder(callHistoryRowBinding); } @@ -251,9 +248,9 @@ public void resetAdapterList() { class CallViewHolder extends RecyclerView.ViewHolder { - CallHistoryRowBinding callHistoryRowBinding; + CometchatCallHistoryRowBinding callHistoryRowBinding; - CallViewHolder(CallHistoryRowBinding callHistoryRowBinding) { + CallViewHolder(CometchatCallHistoryRowBinding callHistoryRowBinding) { super(callHistoryRowBinding.getRoot()); this.callHistoryRowBinding = callHistoryRowBinding; } diff --git a/uikit/src/main/java/screen/CometChatUserListScreen.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/user_list/CometChatUserList.java similarity index 92% rename from uikit/src/main/java/screen/CometChatUserListScreen.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/user_list/CometChatUserList.java index c4b3b8c9..bd9f09cf 100644 --- a/uikit/src/main/java/screen/CometChatUserListScreen.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_components/users/user_list/CometChatUserList.java @@ -1,4 +1,4 @@ -package screen; +package com.cometchat.pro.uikit.ui_components.users.user_list; /* * Copyright 2019 The Android Open Source Project @@ -42,7 +42,6 @@ import com.cometchat.pro.core.CometChat; import com.cometchat.pro.core.UsersRequest; import com.cometchat.pro.exceptions.CometChatException; -import com.cometchat.pro.uikit.CometChatUserList; import com.cometchat.pro.uikit.R; import com.cometchat.pro.models.User; import com.facebook.shimmer.ShimmerFrameLayout; @@ -50,11 +49,12 @@ import java.util.ArrayList; import java.util.List; -import adapter.UserListAdapter; -import listeners.OnItemClickListener; -import utils.FontUtils; -import com.cometchat.pro.uikit.Settings.UISettings; -import utils.Utils; +import com.cometchat.pro.uikit.ui_components.shared.cometchatUsers.CometChatUsers; +import com.cometchat.pro.uikit.ui_components.shared.cometchatUsers.CometChatUsersAdapter; +import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener; +import com.cometchat.pro.uikit.ui_resources.utils.FontUtils; +import com.cometchat.pro.uikit.ui_settings.UISettings; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; /* @@ -71,7 +71,7 @@ */ -public class CometChatUserListScreen extends Fragment { +public class CometChatUserList extends Fragment { private static final String TAG = "CometChatUserListScreen"; @@ -83,11 +83,11 @@ public class CometChatUserListScreen extends Fragment { private boolean isSearching; - private UserListAdapter userListAdapter; + private CometChatUsersAdapter userListAdapter; private UsersRequest usersRequest; // Use to fetch users - private CometChatUserList rvUserList; // Use to display list of users + private CometChatUsers rvUserList; // Use to display list of users private EditText etSearch; // Use to perform search operation on list of users. @@ -103,7 +103,7 @@ public class CometChatUserListScreen extends Fragment { private List userList = new ArrayList<>(); - public CometChatUserListScreen() { + public CometChatUserList() { // Required empty public constructor } @@ -111,7 +111,7 @@ public CometChatUserListScreen() { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - View view = inflater.inflate(R.layout.fragment_user_list_screen, container, false); + View view = inflater.inflate(R.layout.fragment_cometchat_userlist, container, false); title = view.findViewById(R.id.tv_title); title.setTypeface(FontUtils.getInstance(getActivity()).getTypeFace(FontUtils.robotoMedium)); rvUserList = view.findViewById(R.id.rv_user_list); diff --git a/uikit/src/main/java/constant/StringContract.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/constants/UIKitConstants.java similarity index 91% rename from uikit/src/main/java/constant/StringContract.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/constants/UIKitConstants.java index 9984f019..a2d56e67 100644 --- a/uikit/src/main/java/constant/StringContract.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/constants/UIKitConstants.java @@ -1,13 +1,12 @@ -package constant; +package com.cometchat.pro.uikit.ui_resources.constants; import com.cometchat.pro.constants.CometChatConstants; -import com.cometchat.pro.uikit.R; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class StringContract { +public class UIKitConstants { public static class AppInfo { public static String AUTH_KEY = ""; @@ -180,11 +179,11 @@ public static class MessageRequest { CometChatConstants.MESSAGE_TYPE_VIDEO, CometChatConstants.MESSAGE_TYPE_FILE, //Custom Messages - StringContract.IntentStrings.LOCATION, - StringContract.IntentStrings.POLLS, - StringContract.IntentStrings.STICKERS, - StringContract.IntentStrings.WHITEBOARD, - StringContract.IntentStrings.WRITEBOARD + UIKitConstants.IntentStrings.LOCATION, + UIKitConstants.IntentStrings.POLLS, + UIKitConstants.IntentStrings.STICKERS, + UIKitConstants.IntentStrings.WHITEBOARD, + UIKitConstants.IntentStrings.WRITEBOARD )) ; public static List messageTypesForGroup = new ArrayList<>(Arrays.asList( CometChatConstants.MESSAGE_TYPE_CUSTOM, @@ -196,12 +195,12 @@ public static class MessageRequest { //For Group Actions CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER, //Custom Messages - StringContract.IntentStrings.LOCATION, - StringContract.IntentStrings.POLLS, - StringContract.IntentStrings.STICKERS, - StringContract.IntentStrings.WHITEBOARD, - StringContract.IntentStrings.WRITEBOARD, - StringContract.IntentStrings.GROUP_CALL + UIKitConstants.IntentStrings.LOCATION, + UIKitConstants.IntentStrings.POLLS, + UIKitConstants.IntentStrings.STICKERS, + UIKitConstants.IntentStrings.WHITEBOARD, + UIKitConstants.IntentStrings.WRITEBOARD, + UIKitConstants.IntentStrings.GROUP_CALL )); public static List messageCategoriesForGroup = new ArrayList<>(Arrays.asList( diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/AnimUtil.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/AnimUtil.java new file mode 100644 index 00000000..96cc95a0 --- /dev/null +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/AnimUtil.java @@ -0,0 +1,38 @@ +package com.cometchat.pro.uikit.ui_resources.utils; + +import android.animation.AnimatorSet; +import android.animation.ObjectAnimator; +import android.view.View; +import android.view.animation.AccelerateDecelerateInterpolator; +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; + +public class AnimUtil { + + private static boolean isStartRecorded = false; + + public static void stopBlinkAnimation(View view) + { + view.clearAnimation(); + view.setAlpha(1.0f); + } + + public static void blinkAnimation(View view) { + Animation anim = new AlphaAnimation(0.0f, 1.0f); + anim.setDuration(700); //You can manage the time of the blink with this parameter + anim.setStartOffset(20); + anim.setRepeatMode(Animation.REVERSE); + anim.setRepeatCount(Animation.INFINITE); + view.startAnimation(anim); + } + + public static void start(View view) { + AnimatorSet set = new AnimatorSet(); + ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 2.0f); + ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 2.0f); + set.setDuration(150); + set.setInterpolator(new AccelerateDecelerateInterpolator()); + set.playTogether(scaleY, scaleX); + set.start(); + } +} diff --git a/uikit/src/main/java/utils/CallUtils.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/CallUtils.java similarity index 80% rename from uikit/src/main/java/utils/CallUtils.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/CallUtils.java index 6cc4fce5..88c96eca 100644 --- a/uikit/src/main/java/utils/CallUtils.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/CallUtils.java @@ -1,14 +1,12 @@ -package utils; +package com.cometchat.pro.uikit.ui_resources.utils; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.util.Log; -import android.widget.Toast; import androidx.annotation.NonNull; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.Call; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; @@ -17,9 +15,9 @@ import com.cometchat.pro.uikit.R; import com.google.android.material.snackbar.Snackbar; -import constant.StringContract; -import screen.CometChatCallActivity; -import screen.CometChatStartCallActivity; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; +import com.cometchat.pro.uikit.ui_components.calls.call_manager.CometChatCallActivity; +import com.cometchat.pro.uikit.ui_components.calls.call_manager.CometChatStartCallActivity; /** * Purpose - This class contains all the static methods which are useful for hanlde calling in UIKit. @@ -53,9 +51,9 @@ public static void initiateCall(Context context, String recieverID, String recei CometChat.initiateCall(call, new CometChat.CallbackListener() { @Override public void onSuccess(Call call) { - if (receiverType.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_USER)) + if (receiverType.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) startCallIntent(context,((User)call.getCallReceiver()),call.getType(),true,call.getSessionId()); - else if (receiverType.equalsIgnoreCase(CometChatConstants.RECEIVER_TYPE_GROUP)) + else if (receiverType.equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP)) startGroupCallIntent(context,((Group)call.getCallReceiver()),call.getType(),true,call.getSessionId()); } @@ -79,10 +77,10 @@ public void onError(CometChatException e) { public static void startCallIntent(Context context, User user, String type, boolean isOutgoing, @NonNull String sessionId) { Intent videoCallIntent = new Intent(context, CometChatCallActivity.class); - videoCallIntent.putExtra(StringContract.IntentStrings.NAME, user.getName()); - videoCallIntent.putExtra(StringContract.IntentStrings.UID,user.getUid()); - videoCallIntent.putExtra(StringContract.IntentStrings.SESSION_ID,sessionId); - videoCallIntent.putExtra(StringContract.IntentStrings.AVATAR, user.getAvatar()); + videoCallIntent.putExtra(UIKitConstants.IntentStrings.NAME, user.getName()); + videoCallIntent.putExtra(UIKitConstants.IntentStrings.UID,user.getUid()); + videoCallIntent.putExtra(UIKitConstants.IntentStrings.SESSION_ID,sessionId); + videoCallIntent.putExtra(UIKitConstants.IntentStrings.AVATAR, user.getAvatar()); videoCallIntent.setAction(type); videoCallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (isOutgoing) { @@ -106,10 +104,10 @@ public static void startCallIntent(Context context, User user, String type, public static void startGroupCallIntent(Context context, Group group, String type, boolean isOutgoing, @NonNull String sessionId) { Intent videoCallIntent = new Intent(context, CometChatCallActivity.class); - videoCallIntent.putExtra(StringContract.IntentStrings.NAME, group.getName()); - videoCallIntent.putExtra(StringContract.IntentStrings.UID,group.getGuid()); - videoCallIntent.putExtra(StringContract.IntentStrings.SESSION_ID,sessionId); - videoCallIntent.putExtra(StringContract.IntentStrings.AVATAR, group.getIcon()); + videoCallIntent.putExtra(UIKitConstants.IntentStrings.NAME, group.getName()); + videoCallIntent.putExtra(UIKitConstants.IntentStrings.UID,group.getGuid()); + videoCallIntent.putExtra(UIKitConstants.IntentStrings.SESSION_ID,sessionId); + videoCallIntent.putExtra(UIKitConstants.IntentStrings.AVATAR, group.getIcon()); videoCallIntent.setAction(type); videoCallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); @@ -131,8 +129,8 @@ public static void startGroupCallIntent(Context context, Group group, String typ public static void startCall(Context context, Call call) { Intent intent = new Intent(context, CometChatStartCallActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.putExtra(StringContract.IntentStrings.TYPE,call.getReceiverType()); - intent.putExtra(StringContract.IntentStrings.SESSION_ID,call.getSessionId()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,call.getReceiverType()); + intent.putExtra(UIKitConstants.IntentStrings.SESSION_ID,call.getSessionId()); ((Activity)context).finish(); context.startActivity(intent); } @@ -140,9 +138,9 @@ public static void startCall(Context context, Call call) { public static void startDirectCall(Context context, Call call) { Intent intent = new Intent(context, CometChatStartCallActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.putExtra(StringContract.IntentStrings.TYPE,call.getReceiverType()); - intent.putExtra(StringContract.IntentStrings.SESSION_ID,call.getSessionId()); - intent.putExtra(StringContract.IntentStrings.GROUP_CALL_TYPE,call.getType()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,call.getReceiverType()); + intent.putExtra(UIKitConstants.IntentStrings.SESSION_ID,call.getSessionId()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_CALL_TYPE,call.getType()); context.startActivity(intent); } @@ -153,8 +151,8 @@ public static void startDirectCall(Context context, Call call) { public static void joinOnGoingCall(Context context,Call call) { Intent intent = new Intent(context, CometChatStartCallActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.putExtra(StringContract.IntentStrings.TYPE,call.getReceiverType()); - intent.putExtra(StringContract.IntentStrings.SESSION_ID,call.getSessionId()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE,call.getReceiverType()); + intent.putExtra(UIKitConstants.IntentStrings.SESSION_ID,call.getSessionId()); context.startActivity(intent); } diff --git a/uikit/src/main/java/utils/FontUtils.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/FontUtils.java similarity index 92% rename from uikit/src/main/java/utils/FontUtils.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/FontUtils.java index e3dcdae0..53d7a1dd 100644 --- a/uikit/src/main/java/utils/FontUtils.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/FontUtils.java @@ -1,12 +1,8 @@ -package utils; +package com.cometchat.pro.uikit.ui_resources.utils; import android.content.Context; import android.graphics.Typeface; -import java.lang.ref.WeakReference; - -import javax.inject.Singleton; - public class FontUtils { private static FontUtils _instance; diff --git a/uikit/src/main/java/utils/MediaUtils.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/MediaUtils.java old mode 100755 new mode 100644 similarity index 98% rename from uikit/src/main/java/utils/MediaUtils.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/MediaUtils.java index 52f7f14f..681bd4dd --- a/uikit/src/main/java/utils/MediaUtils.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/MediaUtils.java @@ -1,4 +1,4 @@ -package utils; +package com.cometchat.pro.uikit.ui_resources.utils; import android.annotation.SuppressLint; import android.app.Activity; @@ -30,7 +30,7 @@ import androidx.loader.content.CursorLoader; import com.cometchat.pro.uikit.BuildConfig; -import com.cometchat.pro.uikit.Settings.UISettings; +import com.cometchat.pro.uikit.ui_settings.UISettings; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -44,9 +44,9 @@ import java.util.Date; import java.util.List; -import static utils.Utils.generateFileName; -import static utils.Utils.getDocumentCacheDir; -import static utils.Utils.getFileName; +import static com.cometchat.pro.uikit.ui_resources.utils.Utils.generateFileName; +import static com.cometchat.pro.uikit.ui_resources.utils.Utils.getDocumentCacheDir; +import static com.cometchat.pro.uikit.ui_resources.utils.Utils.getFileName; public class MediaUtils { diff --git a/uikit/src/main/java/utils/Utils.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/Utils.java similarity index 83% rename from uikit/src/main/java/utils/Utils.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/Utils.java index 4785820f..8d7de52b 100644 --- a/uikit/src/main/java/utils/Utils.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/Utils.java @@ -1,8 +1,7 @@ -package utils; +package com.cometchat.pro.uikit.ui_resources.utils; import android.content.ContentUris; import android.content.Context; -import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; @@ -21,7 +20,6 @@ import android.text.format.DateFormat; import android.util.DisplayMetrics; import android.util.Log; -import android.util.Patterns; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.TextView; @@ -34,7 +32,6 @@ import androidx.renderscript.RenderScript; import androidx.renderscript.ScriptIntrinsicBlur; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.Call; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.helpers.Logger; @@ -46,7 +43,7 @@ import com.cometchat.pro.models.TextMessage; import com.cometchat.pro.models.User; import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.Settings.UISettings; + import com.google.android.material.appbar.MaterialToolbar; import org.json.JSONObject; @@ -56,7 +53,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.text.SimpleDateFormat; @@ -65,80 +61,14 @@ import java.util.Date; import java.util.List; import java.util.Locale; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import constant.StringContract; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; import kotlin.ranges.RangesKt; public class Utils { private static final String TAG = "Utils"; - public static void setHyperLinkSupport(Context context,TextView txtMessage) { - new PatternBuilder(). - addPattern(Pattern.compile("(^|[\\s.:;?\\-\\]<\\(])" + - "((https?://|www\\.|pic\\.)[-\\w;/?:@&=+$\\|\\_.!~*\\|'()\\[\\]%#,☺]+[\\w/#](\\(\\))?)" + - "(?=$|[\\s',\\|\\(\\).:;?\\-\\[\\]>\\)])"), - context.getResources().getColor(UISettings.getUrlColor()), - new PatternBuilder.SpannableClickedListener() { - @Override - public void onSpanClicked(String text) { - if (!text.trim().contains("http")) { - text = "http://"+text; - } - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse(text.trim())); - context.startActivity(Intent.createChooser(intent, "Url")); - } - }).into(txtMessage); - new PatternBuilder(). - addPattern(Patterns.PHONE, context.getResources().getColor(UISettings.getPhoneColor()), - new PatternBuilder.SpannableClickedListener() { - @Override - public void onSpanClicked(String text) { - Intent intent = new Intent(Intent.ACTION_DIAL,Uri.parse(text)); - intent.setData(Uri.parse("tel:"+text)); - context.startActivity(Intent.createChooser(intent, "Dial")); - } - }).into(txtMessage); - new PatternBuilder(). - addPattern(Pattern.compile("[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}"), - context.getResources().getColor(UISettings.getEmailColor()), - new PatternBuilder.SpannableClickedListener() { - @Override - public void onSpanClicked(String text) { - Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" +text)); - intent.putExtra(Intent.EXTRA_EMAIL, text); - context.startActivity(Intent.createChooser(intent, "Mail")); - } - }).into(txtMessage); - } - - - /** - * Below method is used to remove the emojis from string - * @param content is a String object - * @return a String value without emojis. - */ - public static String removeEmojiAndSymbol(String content) { - String utf8tweet = ""; - try { - byte[] utf8Bytes = content.getBytes("UTF-8"); - utf8tweet = new String(utf8Bytes, "UTF-8"); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - Pattern unicodeOutliers = Pattern.compile( - "[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]", - Pattern.UNICODE_CASE | - Pattern.CASE_INSENSITIVE); - Matcher unicodeOutlierMatcher = unicodeOutliers.matcher(utf8tweet); - utf8tweet = unicodeOutlierMatcher.replaceAll(" "); - return utf8tweet; - } - - public static boolean isDarkMode(Context context) { int nightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; @@ -232,7 +162,7 @@ public static String getLastMessage(Context context,BaseMessage lastMessage) { switch (lastMessage.getCategory()) { - case CometChatConstants.CATEGORY_MESSAGE: + case com.cometchat.pro.constants.CometChatConstants.CATEGORY_MESSAGE: if (lastMessage instanceof TextMessage) { @@ -244,13 +174,13 @@ public static String getLastMessage(Context context,BaseMessage lastMessage) { } else if (lastMessage instanceof MediaMessage) { if (lastMessage.getDeletedAt()==0) { - if (lastMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_IMAGE)) + if (lastMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_IMAGE)) message = context.getString(R.string.message_image); - else if (lastMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_VIDEO)) + else if (lastMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_VIDEO)) message = context.getString(R.string.message_video); - else if (lastMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_FILE)) + else if (lastMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_FILE)) message = context.getString(R.string.message_file); - else if (lastMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_AUDIO)) + else if (lastMessage.getType().equals(com.cometchat.pro.constants.CometChatConstants.MESSAGE_TYPE_AUDIO)) message = context.getString(R.string.message_audio); } else message = context.getString(R.string.this_message_deleted); @@ -264,19 +194,19 @@ else if (lastMessage.getType().equals(CometChatConstants.MESSAGE_TYPE_AUDIO)) // } } break; - case CometChatConstants.CATEGORY_CUSTOM: + case com.cometchat.pro.constants.CometChatConstants.CATEGORY_CUSTOM: if (lastMessage.getDeletedAt()==0) { - if (lastMessage.getType().equals(StringContract.IntentStrings.LOCATION)) + if (lastMessage.getType().equals(UIKitConstants.IntentStrings.LOCATION)) message = context.getString(R.string.custom_message_location); - else if (lastMessage.getType().equals(StringContract.IntentStrings.POLLS)) + else if (lastMessage.getType().equals(UIKitConstants.IntentStrings.POLLS)) message = context.getString(R.string.custom_message_poll); - else if (lastMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.STICKERS)) + else if (lastMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.STICKERS)) message = context.getString(R.string.custom_message_sticker); - else if (lastMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.WHITEBOARD)) + else if (lastMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.WHITEBOARD)) message = context.getString(R.string.custom_message_whiteboard); - else if (lastMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.WRITEBOARD)) + else if (lastMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.WRITEBOARD)) message = context.getString(R.string.custom_message_document); - else if (lastMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.GROUP_CALL)) + else if (lastMessage.getType().equalsIgnoreCase(UIKitConstants.IntentStrings.GROUP_CALL)) message = context.getString(R.string.custom_message_meeting); else message = String.format(context.getString(R.string.you_received), lastMessage.getType()); @@ -284,23 +214,23 @@ else if (lastMessage.getType().equalsIgnoreCase(StringContract.IntentStrings.GRO message = context.getString(R.string.this_message_deleted); break; - case CometChatConstants.CATEGORY_ACTION: + case com.cometchat.pro.constants.CometChatConstants.CATEGORY_ACTION: message = ((Action) lastMessage).getMessage(); break; - case CometChatConstants.CATEGORY_CALL: - if (((Call)lastMessage).getCallStatus().equalsIgnoreCase(CometChatConstants.CALL_STATUS_ENDED) || - ((Call) lastMessage).getCallStatus().equalsIgnoreCase(CometChatConstants.CALL_STATUS_CANCELLED)) { - if (lastMessage.getType().equalsIgnoreCase(CometChatConstants.CALL_TYPE_AUDIO)) + case com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL: + if (((Call)lastMessage).getCallStatus().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ENDED) || + ((Call) lastMessage).getCallStatus().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_CANCELLED)) { + if (lastMessage.getType().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_AUDIO)) message = context.getString(R.string.incoming_audio_call); else message = context.getString(R.string.incoming_video_call); - } else if (((Call)lastMessage).getCallStatus().equalsIgnoreCase(CometChatConstants.CALL_STATUS_ONGOING)) { + } else if (((Call)lastMessage).getCallStatus().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ONGOING)) { message = context.getString(R.string.ongoing_call); - } else if (((Call) lastMessage).getCallStatus().equalsIgnoreCase(CometChatConstants.CALL_STATUS_CANCELLED) || - ((Call) lastMessage).getCallStatus().equalsIgnoreCase(CometChatConstants.CALL_STATUS_UNANSWERED) || - ((Call) lastMessage).getCallStatus().equalsIgnoreCase(CometChatConstants.CALL_STATUS_BUSY)) { - if (lastMessage.getType().equalsIgnoreCase(CometChatConstants.CALL_TYPE_AUDIO)) + } else if (((Call) lastMessage).getCallStatus().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_CANCELLED) || + ((Call) lastMessage).getCallStatus().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_UNANSWERED) || + ((Call) lastMessage).getCallStatus().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_BUSY)) { + if (lastMessage.getType().equalsIgnoreCase(com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_AUDIO)) message = context.getString(R.string.missed_voice_call); else message = context.getString(R.string.missed_video_call); @@ -333,7 +263,7 @@ public static GroupMember UserToGroupMember(User user, boolean isScopeUpdate, St if (isScopeUpdate) groupMember = new GroupMember(user.getUid(), newScope); else - groupMember = new GroupMember(user.getUid(), CometChatConstants.SCOPE_PARTICIPANT); + groupMember = new GroupMember(user.getUid(), com.cometchat.pro.constants.CometChatConstants.SCOPE_PARTICIPANT); groupMember.setAvatar(user.getAvatar()); groupMember.setName(user.getName()); @@ -754,7 +684,7 @@ public static void showKeyBoard(Context context,View mainLayout) { public static Call getDirectCallData(BaseMessage baseMessage) { Call call = null; - String callType = CometChatConstants.CALL_TYPE_VIDEO; + String callType = com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_VIDEO; try { if (((CustomMessage)baseMessage).getCustomData() != null) { JSONObject customObject = ((CustomMessage)baseMessage).getCustomData(); diff --git a/uikit/src/main/java/utils/AudioVisualizer/AudioBarConstant.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/audio_visualizer/AudioBarConstant.java similarity index 89% rename from uikit/src/main/java/utils/AudioVisualizer/AudioBarConstant.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/audio_visualizer/AudioBarConstant.java index ab176e16..2c8bbd2e 100644 --- a/uikit/src/main/java/utils/AudioVisualizer/AudioBarConstant.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/audio_visualizer/AudioBarConstant.java @@ -1,4 +1,4 @@ -package utils.AudioVisualizer; +package com.cometchat.pro.uikit.ui_resources.utils.audio_visualizer; import android.graphics.Color; diff --git a/uikit/src/main/java/utils/AudioVisualizer/AudioRecordView.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/audio_visualizer/AudioRecordView.java similarity index 98% rename from uikit/src/main/java/utils/AudioVisualizer/AudioRecordView.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/audio_visualizer/AudioRecordView.java index 34eb5a61..5680c78a 100644 --- a/uikit/src/main/java/utils/AudioVisualizer/AudioRecordView.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/audio_visualizer/AudioRecordView.java @@ -1,4 +1,4 @@ -package utils.AudioVisualizer; +package com.cometchat.pro.uikit.ui_resources.utils.audio_visualizer; import android.content.Context; import android.content.res.TypedArray; @@ -16,11 +16,9 @@ import org.jetbrains.annotations.NotNull; import java.util.ArrayList; -import java.util.Collection; -import java.util.List; import kotlin.jvm.internal.Intrinsics; -import utils.Utils; +import com.cometchat.pro.uikit.ui_resources.utils.Utils; public class AudioRecordView extends View { diff --git a/uikit/src/main/java/utils/CameraPreview.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/camera_preview/CameraPreview.java similarity index 99% rename from uikit/src/main/java/utils/CameraPreview.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/camera_preview/CameraPreview.java index aa006f10..522b8263 100644 --- a/uikit/src/main/java/utils/CameraPreview.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/camera_preview/CameraPreview.java @@ -1,4 +1,4 @@ -package utils; +package com.cometchat.pro.uikit.ui_resources.utils.camera_preview; import android.Manifest; import android.app.Activity; diff --git a/uikit/src/main/java/listeners/CustomAlertDialogHelper.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/custom_alertDialog/CustomAlertDialogHelper.java similarity index 97% rename from uikit/src/main/java/listeners/CustomAlertDialogHelper.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/custom_alertDialog/CustomAlertDialogHelper.java index 6f621162..67658652 100644 --- a/uikit/src/main/java/listeners/CustomAlertDialogHelper.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/custom_alertDialog/CustomAlertDialogHelper.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_resources.utils.custom_alertDialog; import android.content.Context; import android.content.DialogInterface; diff --git a/uikit/src/main/java/listeners/OnAlertDialogButtonClickListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/custom_alertDialog/OnAlertDialogButtonClickListener.java similarity index 74% rename from uikit/src/main/java/listeners/OnAlertDialogButtonClickListener.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/custom_alertDialog/OnAlertDialogButtonClickListener.java index dd3ee960..abd52f5c 100644 --- a/uikit/src/main/java/listeners/OnAlertDialogButtonClickListener.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/custom_alertDialog/OnAlertDialogButtonClickListener.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_resources.utils.custom_alertDialog; import android.view.View; diff --git a/uikit/src/main/java/listeners/OnItemClickListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/item_clickListener/OnItemClickListener.java similarity index 82% rename from uikit/src/main/java/listeners/OnItemClickListener.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/item_clickListener/OnItemClickListener.java index c290326c..b00ea570 100644 --- a/uikit/src/main/java/listeners/OnItemClickListener.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/item_clickListener/OnItemClickListener.java @@ -1,7 +1,4 @@ -package listeners; - -import com.cometchat.pro.models.Group; -import com.cometchat.pro.models.User; +package com.cometchat.pro.uikit.ui_resources.utils.item_clickListener; /* diff --git a/uikit/src/main/java/utils/KeyBoardUtils.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/keyboard_utils/KeyBoardUtils.java old mode 100755 new mode 100644 similarity index 95% rename from uikit/src/main/java/utils/KeyBoardUtils.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/keyboard_utils/KeyBoardUtils.java index fc50873b..8b3ac567 --- a/uikit/src/main/java/utils/KeyBoardUtils.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/keyboard_utils/KeyBoardUtils.java @@ -1,4 +1,4 @@ -package utils; +package com.cometchat.pro.uikit.ui_resources.utils.keyboard_utils; import android.app.Activity; import android.view.View; diff --git a/uikit/src/main/java/utils/KeyboardVisibilityListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/keyboard_utils/KeyboardVisibilityListener.java old mode 100755 new mode 100644 similarity index 62% rename from uikit/src/main/java/utils/KeyboardVisibilityListener.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/keyboard_utils/KeyboardVisibilityListener.java index b5f5e972..fc188d5e --- a/uikit/src/main/java/utils/KeyboardVisibilityListener.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/keyboard_utils/KeyboardVisibilityListener.java @@ -1,4 +1,4 @@ -package utils; +package com.cometchat.pro.uikit.ui_resources.utils.keyboard_utils; public interface KeyboardVisibilityListener { diff --git a/uikit/src/main/java/utils/PatternBuilder.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/pattern_utils/PatternBuilder.java similarity index 97% rename from uikit/src/main/java/utils/PatternBuilder.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/pattern_utils/PatternBuilder.java index 9b3c9abf..99d99978 100644 --- a/uikit/src/main/java/utils/PatternBuilder.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/pattern_utils/PatternBuilder.java @@ -1,17 +1,13 @@ -package utils; +package com.cometchat.pro.uikit.ui_resources.utils.pattern_utils; -import android.graphics.Typeface; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextPaint; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; -import android.text.style.URLSpan; import android.view.View; import android.widget.TextView; -import androidx.annotation.NonNull; - import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/pattern_utils/PatternUtils.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/pattern_utils/PatternUtils.java new file mode 100644 index 00000000..c63577be --- /dev/null +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/pattern_utils/PatternUtils.java @@ -0,0 +1,78 @@ +package com.cometchat.pro.uikit.ui_resources.utils.pattern_utils; + +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +import android.util.Patterns; +import android.widget.TextView; + +import java.io.UnsupportedEncodingException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.cometchat.pro.uikit.ui_settings.UISettings; + +public class PatternUtils { + public static void setHyperLinkSupport(Context context, TextView txtMessage) { + new PatternBuilder(). + addPattern(Pattern.compile("(^|[\\s.:;?\\-\\]<\\(])" + + "((https?://|www\\.|pic\\.)[-\\w;/?:@&=+$\\|\\_.!~*\\|'()\\[\\]%#,☺]+[\\w/#](\\(\\))?)" + + "(?=$|[\\s',\\|\\(\\).:;?\\-\\[\\]>\\)])"), + context.getResources().getColor(UISettings.getUrlColor()), + new PatternBuilder.SpannableClickedListener() { + @Override + public void onSpanClicked(String text) { + if (!text.trim().contains("http")) { + text = "http://"+text; + } + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(text.trim())); + context.startActivity(Intent.createChooser(intent, "Url")); + } + }).into(txtMessage); + new PatternBuilder(). + addPattern(Patterns.PHONE, context.getResources().getColor(UISettings.getPhoneColor()), + new PatternBuilder.SpannableClickedListener() { + @Override + public void onSpanClicked(String text) { + Intent intent = new Intent(Intent.ACTION_DIAL,Uri.parse(text)); + intent.setData(Uri.parse("tel:"+text)); + context.startActivity(Intent.createChooser(intent, "Dial")); + } + }).into(txtMessage); + new PatternBuilder(). + addPattern(Pattern.compile("[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}"), + context.getResources().getColor(UISettings.getEmailColor()), + new PatternBuilder.SpannableClickedListener() { + @Override + public void onSpanClicked(String text) { + Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" +text)); + intent.putExtra(Intent.EXTRA_EMAIL, text); + context.startActivity(Intent.createChooser(intent, "Mail")); + } + }).into(txtMessage); + } + + + /** + * Below method is used to remove the emojis from string + * @param content is a String object + * @return a String value without emojis. + */ + public static String removeEmojiAndSymbol(String content) { + String utf8tweet = ""; + try { + byte[] utf8Bytes = content.getBytes("UTF-8"); + utf8tweet = new String(utf8Bytes, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + Pattern unicodeOutliers = Pattern.compile( + "[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]", + Pattern.UNICODE_CASE | + Pattern.CASE_INSENSITIVE); + Matcher unicodeOutlierMatcher = unicodeOutliers.matcher(utf8tweet); + utf8tweet = unicodeOutlierMatcher.replaceAll(" "); + return utf8tweet; + } +} diff --git a/uikit/src/main/java/listeners/ClickListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/recycler_touch/ClickListener.java similarity index 71% rename from uikit/src/main/java/listeners/ClickListener.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/recycler_touch/ClickListener.java index abdc7934..242d3db0 100644 --- a/uikit/src/main/java/listeners/ClickListener.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/recycler_touch/ClickListener.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_resources.utils.recycler_touch; import android.view.View; diff --git a/uikit/src/main/java/listeners/RecyclerTouchListener.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/recycler_touch/RecyclerTouchListener.java similarity index 95% rename from uikit/src/main/java/listeners/RecyclerTouchListener.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/recycler_touch/RecyclerTouchListener.java index 3854e0af..cfb24993 100644 --- a/uikit/src/main/java/listeners/RecyclerTouchListener.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/recycler_touch/RecyclerTouchListener.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_resources.utils.recycler_touch; import android.content.Context; import android.view.GestureDetector; diff --git a/uikit/src/main/java/listeners/StickyHeaderAdapter.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/sticker_header/StickyHeaderAdapter.java old mode 100755 new mode 100644 similarity index 81% rename from uikit/src/main/java/listeners/StickyHeaderAdapter.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/sticker_header/StickyHeaderAdapter.java index ec8c38e2..4cc470cf --- a/uikit/src/main/java/listeners/StickyHeaderAdapter.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/sticker_header/StickyHeaderAdapter.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_resources.utils.sticker_header; import android.view.ViewGroup; import androidx.recyclerview.widget.RecyclerView; diff --git a/uikit/src/main/java/listeners/StickyHeaderDecoration.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/sticker_header/StickyHeaderDecoration.java old mode 100755 new mode 100644 similarity index 98% rename from uikit/src/main/java/listeners/StickyHeaderDecoration.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/sticker_header/StickyHeaderDecoration.java index 7b2a8cab..518f62ea --- a/uikit/src/main/java/listeners/StickyHeaderDecoration.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/sticker_header/StickyHeaderDecoration.java @@ -1,4 +1,4 @@ -package listeners; +package com.cometchat.pro.uikit.ui_resources.utils.sticker_header; import android.graphics.Canvas; import android.graphics.Rect; diff --git a/uikit/src/main/java/utils/ZoomIv.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/zoom_imageView/ZoomImageView.java similarity index 98% rename from uikit/src/main/java/utils/ZoomIv.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/zoom_imageView/ZoomImageView.java index c810277b..ea7c1fcc 100644 --- a/uikit/src/main/java/utils/ZoomIv.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/zoom_imageView/ZoomImageView.java @@ -1,4 +1,4 @@ -package utils; +package com.cometchat.pro.uikit.ui_resources.utils.zoom_imageView; import android.content.Context; @@ -11,7 +11,7 @@ import android.view.View; import android.widget.ImageView; -public class ZoomIv extends ImageView +public class ZoomImageView extends ImageView { Matrix matrix = new Matrix(); @@ -35,7 +35,7 @@ public class ZoomIv extends ImageView ScaleGestureDetector mScaleDetector; Context context; - public ZoomIv(Context context, AttributeSet attr) + public ZoomImageView(Context context, AttributeSet attr) { super(context, attr); super.setClickable(true); diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Settings/UIKitSettings.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_settings/UIKitSettings.java similarity index 68% rename from uikit/src/main/java/com/cometchat/pro/uikit/Settings/UIKitSettings.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_settings/UIKitSettings.java index e699e215..bb251fb3 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Settings/UIKitSettings.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_settings/UIKitSettings.java @@ -1,17 +1,16 @@ -package com.cometchat.pro.uikit.Settings; +package com.cometchat.pro.uikit.ui_settings; import android.content.Context; import android.content.Intent; -import com.cometchat.pro.constants.CometChatConstants; import com.cometchat.pro.core.CometChat; import com.cometchat.pro.exceptions.CometChatException; import com.cometchat.pro.models.Group; import com.cometchat.pro.models.User; import com.cometchat.pro.uikit.R; -import constant.StringContract; -import screen.messagelist.CometChatMessageListActivity; +import com.cometchat.pro.uikit.ui_components.messages.message_list.CometChatMessageListActivity; +import com.cometchat.pro.uikit.ui_resources.constants.UIKitConstants; public class UIKitSettings { @@ -31,11 +30,11 @@ public static void setMessagingSoundEnable(boolean isEnable) { } public static void setAppID(String appID) { - StringContract.AppInfo.APP_ID = appID; + UIKitConstants.AppInfo.APP_ID = appID; } public static void setAuthKey(String authKey) { - StringContract.AppInfo.AUTH_KEY = authKey; + UIKitConstants.AppInfo.AUTH_KEY = authKey; } public static void setCallSoundEnable(boolean isEnable) { UISettings.enableCallSounds = isEnable; @@ -60,21 +59,21 @@ public static void setHyperLinkUrlColor(int color) { @Deprecated public static void showCallNotification(boolean isVisible) { if (!isVisible) { - StringContract.MessageRequest.messageCategoriesForGroup - .remove(CometChatConstants.CATEGORY_CALL); - StringContract.MessageRequest.messageTypesForUser - .remove(CometChatConstants.CATEGORY_CALL); + UIKitConstants.MessageRequest.messageCategoriesForGroup + .remove(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL); + UIKitConstants.MessageRequest.messageTypesForUser + .remove(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL); } else { - if (!StringContract.MessageRequest.messageCategoriesForGroup - .contains(CometChatConstants.CATEGORY_CALL)) { - StringContract.MessageRequest.messageCategoriesForGroup - .add(CometChatConstants.CATEGORY_CALL); + if (!UIKitConstants.MessageRequest.messageCategoriesForGroup + .contains(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL)) { + UIKitConstants.MessageRequest.messageCategoriesForGroup + .add(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL); } - if (!StringContract.MessageRequest.messageCategoriesForUser - .contains(CometChatConstants.CATEGORY_CALL)) { - StringContract.MessageRequest.messageCategoriesForUser - .add(CometChatConstants.CATEGORY_CALL); + if (!UIKitConstants.MessageRequest.messageCategoriesForUser + .contains(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL)) { + UIKitConstants.MessageRequest.messageCategoriesForUser + .add(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL); } } @@ -83,21 +82,21 @@ public static void showCallNotification(boolean isVisible) { public static void hideCallActions(boolean isHidden) { UISettings.hideCallNotification = isHidden; if (isHidden) { - StringContract.MessageRequest.messageCategoriesForGroup - .remove(CometChatConstants.CATEGORY_CALL); - StringContract.MessageRequest.messageTypesForUser - .remove(CometChatConstants.CATEGORY_CALL); + UIKitConstants.MessageRequest.messageCategoriesForGroup + .remove(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL); + UIKitConstants.MessageRequest.messageTypesForUser + .remove(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL); } else { - if (!StringContract.MessageRequest.messageCategoriesForGroup - .contains(CometChatConstants.CATEGORY_CALL)) { - StringContract.MessageRequest.messageCategoriesForGroup - .add(CometChatConstants.CATEGORY_CALL); + if (!UIKitConstants.MessageRequest.messageCategoriesForGroup + .contains(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL)) { + UIKitConstants.MessageRequest.messageCategoriesForGroup + .add(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL); } - if (!StringContract.MessageRequest.messageCategoriesForUser - .contains(CometChatConstants.CATEGORY_CALL)) { - StringContract.MessageRequest.messageCategoriesForUser - .add(CometChatConstants.CATEGORY_CALL); + if (!UIKitConstants.MessageRequest.messageCategoriesForUser + .contains(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL)) { + UIKitConstants.MessageRequest.messageCategoriesForUser + .add(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL); } } @@ -106,13 +105,13 @@ public static void hideCallActions(boolean isHidden) { @Deprecated public static void showGroupNotification(boolean isVisible) { if (!isVisible) { - StringContract.MessageRequest.messageTypesForGroup - .remove(CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER); + UIKitConstants.MessageRequest.messageTypesForGroup + .remove(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER); } else { - if (!StringContract.MessageRequest.messageTypesForGroup - .contains(CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER)) { - StringContract.MessageRequest.messageTypesForGroup - .add(CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER); + if (!UIKitConstants.MessageRequest.messageTypesForGroup + .contains(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER)) { + UIKitConstants.MessageRequest.messageTypesForGroup + .add(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER); } } } @@ -120,13 +119,13 @@ public static void showGroupNotification(boolean isVisible) { public static void hideGroupActions(boolean isHidden) { UISettings.hideGroupNotification = isHidden; if (isHidden) { - StringContract.MessageRequest.messageTypesForGroup - .remove(CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER); + UIKitConstants.MessageRequest.messageTypesForGroup + .remove(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER); } else { - if (!StringContract.MessageRequest.messageTypesForGroup - .contains(CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER)) { - StringContract.MessageRequest.messageTypesForGroup - .add(CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER); + if (!UIKitConstants.MessageRequest.messageTypesForGroup + .contains(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER)) { + UIKitConstants.MessageRequest.messageTypesForGroup + .add(com.cometchat.pro.constants.CometChatConstants.ActionKeys.ACTION_TYPE_GROUP_MEMBER); } } } @@ -136,11 +135,11 @@ public void chatWithUser(String uid, CometChat.CallbackListener callbackListener @Override public void onSuccess(User user) { Intent intent = new Intent(context, CometChatMessageListActivity.class); - intent.putExtra(StringContract.IntentStrings.UID, user.getUid()); - intent.putExtra(StringContract.IntentStrings.AVATAR, user.getAvatar()); - intent.putExtra(StringContract.IntentStrings.STATUS, user.getStatus()); - intent.putExtra(StringContract.IntentStrings.NAME, user.getName()); - intent.putExtra(StringContract.IntentStrings.TYPE, CometChatConstants.RECEIVER_TYPE_USER); + intent.putExtra(UIKitConstants.IntentStrings.UID, user.getUid()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, user.getAvatar()); + intent.putExtra(UIKitConstants.IntentStrings.STATUS, user.getStatus()); + intent.putExtra(UIKitConstants.IntentStrings.NAME, user.getName()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } @@ -158,15 +157,15 @@ public void chatWithGroup(String guid, CometChat.CallbackListener callbackListen public void onSuccess(Group group) { if (group.isJoined()) { Intent intent = new Intent(context, CometChatMessageListActivity.class); - intent.putExtra(StringContract.IntentStrings.GUID, group.getGuid()); - intent.putExtra(StringContract.IntentStrings.AVATAR, group.getIcon()); - intent.putExtra(StringContract.IntentStrings.GROUP_OWNER,group.getOwner()); - intent.putExtra(StringContract.IntentStrings.NAME, group.getName()); - intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,group.getGroupType()); - intent.putExtra(StringContract.IntentStrings.TYPE, CometChatConstants.RECEIVER_TYPE_GROUP); - intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,group.getMembersCount()); - intent.putExtra(StringContract.IntentStrings.GROUP_DESC,group.getDescription()); - intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,group.getPassword()); + intent.putExtra(UIKitConstants.IntentStrings.GUID, group.getGuid()); + intent.putExtra(UIKitConstants.IntentStrings.AVATAR, group.getIcon()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_OWNER,group.getOwner()); + intent.putExtra(UIKitConstants.IntentStrings.NAME, group.getName()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_TYPE,group.getGroupType()); + intent.putExtra(UIKitConstants.IntentStrings.TYPE, com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_GROUP); + intent.putExtra(UIKitConstants.IntentStrings.MEMBER_COUNT,group.getMembersCount()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_DESC,group.getDescription()); + intent.putExtra(UIKitConstants.IntentStrings.GROUP_PASSWORD,group.getPassword()); context.startActivity(intent); } else { callbackListener.onError(new CometChatException("ERR_NOT_A_MEMBER", diff --git a/uikit/src/main/java/com/cometchat/pro/uikit/Settings/UISettings.java b/uikit/src/main/java/com/cometchat/pro/uikit/ui_settings/UISettings.java similarity index 99% rename from uikit/src/main/java/com/cometchat/pro/uikit/Settings/UISettings.java rename to uikit/src/main/java/com/cometchat/pro/uikit/ui_settings/UISettings.java index c52ac967..6644e814 100644 --- a/uikit/src/main/java/com/cometchat/pro/uikit/Settings/UISettings.java +++ b/uikit/src/main/java/com/cometchat/pro/uikit/ui_settings/UISettings.java @@ -1,4 +1,4 @@ -package com.cometchat.pro.uikit.Settings; +package com.cometchat.pro.uikit.ui_settings; import com.cometchat.pro.uikit.R; diff --git a/uikit/src/main/java/listeners/OnRecordClickListener.java b/uikit/src/main/java/listeners/OnRecordClickListener.java deleted file mode 100644 index f8118d6d..00000000 --- a/uikit/src/main/java/listeners/OnRecordClickListener.java +++ /dev/null @@ -1,7 +0,0 @@ -package listeners; - -import android.view.View; - -public interface OnRecordClickListener { - void onClick(View v); -} \ No newline at end of file diff --git a/uikit/src/main/java/listeners/RecordListener.java b/uikit/src/main/java/listeners/RecordListener.java deleted file mode 100644 index c26fe78a..00000000 --- a/uikit/src/main/java/listeners/RecordListener.java +++ /dev/null @@ -1,8 +0,0 @@ -package listeners; - -public interface RecordListener { - void onStart(); - void onCancel(); - void onFinish(long time); - void onLessTime(); -} \ No newline at end of file diff --git a/uikit/src/main/java/listeners/UserListViewListener.java b/uikit/src/main/java/listeners/UserListViewListener.java deleted file mode 100644 index 9a91caa6..00000000 --- a/uikit/src/main/java/listeners/UserListViewListener.java +++ /dev/null @@ -1,34 +0,0 @@ -package listeners; - -import android.view.View; - -import com.cometchat.pro.models.User; - -public interface UserListViewListener { - - /** - * Get Single click event on UserList - * - * {@inheritDoc} - * @param user user object of the class - * @param position position of the clicked user in the list - * @param view view reference of the item clicked - * @see User - * - */ - void onClick(User user, int position,View view); - - - /** - * - * Get Long click event on UserList - *{@inheritDoc} - * @param user user object of the class - * @param position position of the clicked user in the list - * @param view view reference of the item clicked - * @see User - * - */ - void onLongClick(User user, int position,View view); - -} diff --git a/uikit/src/main/java/screen/threadconversation/CometChatThreadMessageActivity.java b/uikit/src/main/java/screen/threadconversation/CometChatThreadMessageActivity.java deleted file mode 100644 index 2670e3b4..00000000 --- a/uikit/src/main/java/screen/threadconversation/CometChatThreadMessageActivity.java +++ /dev/null @@ -1,270 +0,0 @@ -package screen.threadconversation; - -import android.content.DialogInterface; -import android.content.Intent; -import android.graphics.Color; -import android.os.Bundle; -import android.util.Log; -import android.view.Menu; -import android.view.MenuItem; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; -import androidx.emoji.bundled.BundledEmojiCompatConfig; -import androidx.emoji.text.EmojiCompat; -import androidx.fragment.app.Fragment; - -import com.cometchat.pro.constants.CometChatConstants; -import com.cometchat.pro.models.BaseMessage; -import com.cometchat.pro.uikit.R; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import adapter.ThreadAdapter; -import constant.StringContract; -import listeners.MessageActionCloseListener; -import listeners.OnMessageLongClick; - -import com.cometchat.pro.uikit.Reaction.model.Reaction; -import com.cometchat.pro.uikit.Settings.UISettings; - -/** - -* Purpose - CometChatMessageListActivity.class is a Activity used to display messages using CometChatMessageScreen.class. It takes - parameter like TYPE to differentiate between User MessageScreen & Group MessageScreen. - - It passes parameters like UID (userID) ,AVATAR (userAvatar) ,NAME (userName) ,STATUS (userStatus) to CometChatMessageScreen.class - if TYPE is CometChatConstant.RECEIVER_TYPE_USER - - It passes parameters like GUID (groupID) ,AVATAR (groupIcon) ,NAME (groupName) ,GROUP_OWNER (groupOwner) to CometChatMessageScreen.class - if TYPE is CometChatConstant.RECEIVER_TYPE_GROUP - - @see CometChatConstants - @see CometChatThreadMessageScreen - - -*/ - -public class CometChatThreadMessageActivity extends AppCompatActivity implements ThreadAdapter.OnMessageLongClick { - - private static final String TAG = "CometChatMessageListAct"; - - private OnMessageLongClick messageLongClick; - - Fragment fragment = new CometChatThreadMessageScreen(); - - private String avatar; - - private String name; - - private String uid; - - private String messageType; - - private String message; - - private String messagefileName; - - private String mediaUrl; - - private String mediaExtension; - - private int messageId; - - private int mediaSize; - - private String mediaMime; - - private String type; - - private String Id; - - private long sentAt; - - private String messageCategory; - - private double latitude; - - private double longitude; - - private int replyCount; - - private String conversationName; - - private String baseMessage; - - private String pollQuestion; - - private String pollOptions; - - private ArrayList pollResult; - - private int voteCount; - - private HashMap reactionInfo; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_cometchat_message_list); - - if (UISettings.getColor() !=null) { - getWindow().setStatusBarColor(Color.parseColor(UISettings.getColor())); - } - EmojiCompat.Config config = new BundledEmojiCompatConfig(this); - EmojiCompat.init(config); - - if (getIntent()!=null) { - Bundle bundle = new Bundle(); -// if (getIntent().hasExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE)) -// baseMessage = getIntent().getStringExtra(StringContract.IntentStrings.PARENT_BASEMESSAGE); - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_CATEGORY)) - messageCategory = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_CATEGORY); - if (getIntent().hasExtra(StringContract.IntentStrings.LOCATION_LONGITUDE)) - longitude = getIntent().getDoubleExtra(StringContract.IntentStrings.LOCATION_LONGITUDE,0); - if (getIntent().hasExtra(StringContract.IntentStrings.LOCATION_LATITUDE)) - latitude = getIntent().getDoubleExtra(StringContract.IntentStrings.LOCATION_LATITUDE,0); - if (getIntent().hasExtra(StringContract.IntentStrings.CONVERSATION_NAME)) - conversationName = getIntent().getStringExtra(StringContract.IntentStrings.CONVERSATION_NAME); - if (getIntent().hasExtra(StringContract.IntentStrings.PARENT_ID)) - messageId = getIntent().getIntExtra(StringContract.IntentStrings.PARENT_ID,0); - if (getIntent().hasExtra(StringContract.IntentStrings.REPLY_COUNT)) - replyCount = getIntent().getIntExtra(StringContract.IntentStrings.REPLY_COUNT,0); - if (getIntent().hasExtra(StringContract.IntentStrings.AVATAR)) - avatar = getIntent().getStringExtra(StringContract.IntentStrings.AVATAR); - if (getIntent().hasExtra(StringContract.IntentStrings.NAME)) - name = getIntent().getStringExtra(StringContract.IntentStrings.NAME); - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE)) - messageType = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE); - if (getIntent().hasExtra(StringContract.IntentStrings.UID)) - uid = getIntent().getStringExtra(StringContract.IntentStrings.UID); - if (getIntent().hasExtra(StringContract.IntentStrings.SENTAT)) - sentAt = getIntent().getLongExtra(StringContract.IntentStrings.SENTAT,0); - if (getIntent().hasExtra(StringContract.IntentStrings.TEXTMESSAGE)) - message = getIntent().getStringExtra(StringContract.IntentStrings.TEXTMESSAGE); - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME)) - messagefileName = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME); - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE)) - mediaSize = getIntent().getIntExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,0); - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL)) - mediaUrl = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL); - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION)) - mediaExtension = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION); - if (getIntent().hasExtra(StringContract.IntentStrings.TYPE)) - type = getIntent().getStringExtra(StringContract.IntentStrings.TYPE); - if (getIntent().hasExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE)) - mediaMime = getIntent().getStringExtra(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE); - if (getIntent().hasExtra(StringContract.IntentStrings.POLL_QUESTION)) - pollQuestion = getIntent().getStringExtra(StringContract.IntentStrings.POLL_QUESTION); - if (getIntent().hasExtra(StringContract.IntentStrings.POLL_OPTION)) - pollOptions = getIntent().getStringExtra(StringContract.IntentStrings.POLL_OPTION); - if (getIntent().hasExtra(StringContract.IntentStrings.POLL_RESULT)) - pollResult = getIntent().getStringArrayListExtra(StringContract.IntentStrings.POLL_RESULT); - if (getIntent().hasExtra(StringContract.IntentStrings.POLL_VOTE_COUNT)) - voteCount = getIntent().getIntExtra(StringContract.IntentStrings.POLL_VOTE_COUNT,0); - if (type.equals(CometChatConstants.RECEIVER_TYPE_GROUP)) { - if (getIntent().hasExtra(StringContract.IntentStrings.GUID)) - Id = getIntent().getStringExtra(StringContract.IntentStrings.GUID); - } else{ - if (getIntent().hasExtra(StringContract.IntentStrings.UID)) - Id = getIntent().getStringExtra(StringContract.IntentStrings.UID); - } - bundle.putString(StringContract.IntentStrings.MESSAGE_CATEGORY,messageCategory); - bundle.putString(StringContract.IntentStrings.ID,Id); - bundle.putString(StringContract.IntentStrings.CONVERSATION_NAME,conversationName); - bundle.putString(StringContract.IntentStrings.TYPE,type); - bundle.putString(StringContract.IntentStrings.AVATAR, avatar); - bundle.putString(StringContract.IntentStrings.NAME, name); - bundle.putInt(StringContract.IntentStrings.PARENT_ID,messageId); - bundle.putInt(StringContract.IntentStrings.REPLY_COUNT,replyCount); - bundle.putString(StringContract.IntentStrings.MESSAGE_TYPE,messageType); - bundle.putString(StringContract.IntentStrings.UID, uid); - bundle.putLong(StringContract.IntentStrings.SENTAT, sentAt); - - if (getIntent().hasExtra(StringContract.IntentStrings.REACTION_INFO)) { - reactionInfo = (HashMap) getIntent().getSerializableExtra(StringContract.IntentStrings.REACTION_INFO); - bundle.putSerializable(StringContract.IntentStrings.REACTION_INFO, reactionInfo); - } - - if (messageType.equals(CometChatConstants.MESSAGE_TYPE_TEXT)) - bundle.putString(StringContract.IntentStrings.TEXTMESSAGE,message); - else if (messageType.equals(StringContract.IntentStrings.LOCATION)) { - bundle.putDouble(StringContract.IntentStrings.LOCATION_LATITUDE,latitude); - bundle.putDouble(StringContract.IntentStrings.LOCATION_LONGITUDE,longitude); - } else if (messageType.equals(StringContract.IntentStrings.POLLS)) { - bundle.putStringArrayList(StringContract.IntentStrings.POLL_RESULT,pollResult); - bundle.putString(StringContract.IntentStrings.POLL_QUESTION,pollQuestion); - bundle.putString(StringContract.IntentStrings.POLL_OPTION,pollOptions); - bundle.putInt(StringContract.IntentStrings.POLL_VOTE_COUNT,voteCount); - } else if (messageType.equals(StringContract.IntentStrings.STICKERS)) { - bundle.putString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL,mediaUrl); - bundle.putString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,messagefileName); - } else if (messageType.equals(StringContract.IntentStrings.WHITEBOARD) || - messageType.equals(StringContract.IntentStrings.WRITEBOARD)) { - bundle.putString(StringContract.IntentStrings.TEXTMESSAGE,message); - } else { - bundle.putString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_URL,mediaUrl); - bundle.putString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_NAME,messagefileName); - bundle.putString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_EXTENSION,mediaExtension); - bundle.putInt(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_SIZE,mediaSize); - bundle.putString(StringContract.IntentStrings.MESSAGE_TYPE_IMAGE_MIME_TYPE,mediaMime); - } - - fragment.setArguments(bundle); - getSupportFragmentManager().beginTransaction().replace(R.id.ChatFragment, fragment).commit(); - } - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { - super.onActivityResult(requestCode,resultCode,data); - Log.d(TAG, "onActivityResult: "); - - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - Log.d(TAG, "onRequestPermissionsResult: "); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - return super.onCreateOptionsMenu(menu); - } - - @Override - public void onBackPressed() { - super.onBackPressed(); - } - - @Override - public boolean onOptionsItemSelected(@NonNull MenuItem item) { - return super.onOptionsItemSelected(item); - } - - @Override - public void setLongMessageClick(List baseMessage) { - if (fragment!=null) - ((OnMessageLongClick)fragment).setLongMessageClick(baseMessage); - } - - - @Override - protected void onResume() { - super.onResume(); - } - - @Override - protected void onPause() { - super.onPause(); - } - - public void handleDialogClose(DialogInterface dialog) { - ((MessageActionCloseListener)fragment).handleDialogClose(dialog); - dialog.dismiss(); - } -} diff --git a/uikit/src/main/java/utils/AnimUtil.java b/uikit/src/main/java/utils/AnimUtil.java deleted file mode 100644 index 31a089df..00000000 --- a/uikit/src/main/java/utils/AnimUtil.java +++ /dev/null @@ -1,119 +0,0 @@ -package utils; - -import android.animation.AnimatorSet; -import android.animation.ObjectAnimator; -import android.animation.ValueAnimator; -import android.view.View; -import android.view.animation.AccelerateDecelerateInterpolator; -import android.view.animation.AlphaAnimation; -import android.view.animation.Animation; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.RelativeLayout; - -import com.google.android.material.snackbar.Snackbar; - -public class AnimUtil { - - private static AlphaAnimation alphaAnimation; - - private static boolean isStartRecorded = false; - - public static void stopBlinkAnimation(View view) - { - view.clearAnimation(); - view.setAlpha(1.0f); - } - - public static void blinkAnimation(View view) { - Animation anim = new AlphaAnimation(0.0f, 1.0f); - anim.setDuration(700); //You can manage the time of the blink with this parameter - anim.setStartOffset(20); - anim.setRepeatMode(Animation.REVERSE); - anim.setRepeatCount(Animation.INFINITE); - view.startAnimation(anim); - } - - public static void start(View view) { - AnimatorSet set = new AnimatorSet(); - ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 2.0f); - ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 2.0f); - set.setDuration(150); - set.setInterpolator(new AccelerateDecelerateInterpolator()); - set.playTogether(scaleY, scaleX); - set.start(); - } - - public static void stop(View view) { - AnimatorSet set = new AnimatorSet(); - ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1.0f); - - - ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1.0f); - set.setDuration(150); - set.setInterpolator(new AccelerateDecelerateInterpolator()); - set.playTogether(scaleY, scaleX); - set.start(); - } - - - public static void setStartRecorded(boolean startRecorded) { - isStartRecorded = startRecorded; - } - - public static void clearAlphaAnimation(boolean hideView,ImageView recordMic) { - alphaAnimation.cancel(); - alphaAnimation.reset(); - recordMic.clearAnimation(); - if (hideView) { - recordMic.setVisibility(View.GONE); - } - } - - public static void animateMic(ImageView recordMic) { - alphaAnimation = new AlphaAnimation(0.0f, 1.0f); - alphaAnimation.setDuration(500); - alphaAnimation.setRepeatMode(Animation.REVERSE); - alphaAnimation.setRepeatCount(Animation.INFINITE); - recordMic.startAnimation(alphaAnimation); - } - - public static void resetSmallMic(ImageView recordMic) { - recordMic.setAlpha(1.0f); - recordMic.setScaleX(1.0f); - recordMic.setScaleY(1.0f); - } - -// public static void moveSlideToCancel(final RecordMicButton recordMicButton, FrameLayout layout, float initialX, float difX) { -// -// final ValueAnimator positionAnimator = -// ValueAnimator.ofFloat(recordMicButton.getX(), initialX); -// -// positionAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); -// positionAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { -// @Override -// public void onAnimationUpdate(ValueAnimator animation) { -// float x = (Float) animation.getAnimatedValue(); -// recordMicButton.setX(x); -// -// } -// }); -// -// recordMicButton.stopScale(); -// positionAnimator.setDuration(0); -// positionAnimator.start(); -// -// -// // if the move event was not called ,then the difX will still 0 and there is no need to move it back -// if (difX != 0) { -// float x = initialX - difX; -// layout.animate() -// .x(x) -// .setDuration(0) -// .start(); -// } -// -// -// } - -} diff --git a/uikit/src/main/java/utils/CometChatBind.java b/uikit/src/main/java/utils/CometChatBind.java deleted file mode 100644 index 00fec1d1..00000000 --- a/uikit/src/main/java/utils/CometChatBind.java +++ /dev/null @@ -1,88 +0,0 @@ -package utils; - -import android.content.Context; -import android.view.View; - -import androidx.databinding.BindingAdapter; - -import com.cometchat.pro.core.UsersRequest; -import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.CometChatGroupList; -import com.cometchat.pro.models.Group; -import com.cometchat.pro.models.User; - -import java.util.HashMap; -import java.util.List; - -import adapter.GroupListAdapter; -import adapter.UserListAdapter; -import listeners.ClickListener; -import listeners.UserListViewListener; -import listeners.RecyclerTouchListener; - -import com.cometchat.pro.uikit.CometChatUserList; - - -public class CometChatBind { - - private static UsersRequest usersRequest = null; - - private static UserListAdapter userListAdapter; - - private static GroupListAdapter groupListAdapter; - - private static HashMap userHashMap = new HashMap<>(); - - private static HashMap groupHashMap = new HashMap<>(); - - private static UserListViewListener onClickListener; - - private static Context context; - - @BindingAdapter(value = {"android:data_source"}) - public static void setData(CometChatUserList userListView, List users) { - - if (users!=null) { - for (User user : users) { - userHashMap.put(user.getUid(), user); - } - - } - } - - @BindingAdapter(value = {"android:data_source","android:context"} ) - public static void setData(CometChatGroupList groupListView, Context c, List groups) { - context=c; - if (groups!=null) { - for (Group group : groups) { - groupHashMap.put(group.getGuid(), group); - } - } - } - - - @BindingAdapter(value = {"android:itemClickListener"}) - public static void setClickListener(CometChatUserList userListView, Context context) { - try { - - onClickListener = (UserListViewListener) context; - - userListView.addOnItemTouchListener(new RecyclerTouchListener(context, userListView, new ClickListener() { - @Override - public void onClick(View var1, int var2) { - User user = (User) var1.getTag(R.string.user); - onClickListener.onClick(user, var2, var1); - } - - @Override - public void onLongClick(View var1, int var2) { - User user = (User) var1.getTag(R.string.user); - onClickListener.onLongClick(user, var2, var1); - } - })); - - } catch (ClassCastException | NullPointerException e) { - e.printStackTrace(); - } - } -} diff --git a/uikit/src/main/java/utils/FooterDecoration.java b/uikit/src/main/java/utils/FooterDecoration.java deleted file mode 100644 index e38fb9f2..00000000 --- a/uikit/src/main/java/utils/FooterDecoration.java +++ /dev/null @@ -1,90 +0,0 @@ -package utils; - -import android.app.Activity; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.PorterDuff; -import android.graphics.Rect; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.ImageView; -import android.widget.RelativeLayout; - -import androidx.annotation.DrawableRes; -import androidx.annotation.IdRes; -import androidx.annotation.LayoutRes; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.cometchat.pro.core.CometChat; -import com.cometchat.pro.models.User; -import com.cometchat.pro.uikit.Avatar; -import com.cometchat.pro.uikit.R; -import com.cometchat.pro.uikit.SmartReplyList; - -import java.util.ArrayList; -import java.util.List; - -import adapter.SmartReplyListAdapter; -import adapter.UserListAdapter; - -public class FooterDecoration extends RecyclerView.ItemDecoration { - - private UserListAdapter adapter; - private View mLayout; - private int viewResID; - private Activity activity; - private List replylist = new ArrayList<>(); - private final String TAG = FooterDecoration.class.getSimpleName(); - - public FooterDecoration(final Activity activity, RecyclerView parent, @LayoutRes int resId) { - // inflate and measure the layout - mLayout = LayoutInflater.from(activity).inflate(resId, parent, false); - mLayout.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), - View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); -// this.viewResID = imageViewResID; - this.adapter = adapter; - this.activity = activity; - } - - - @Override - public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { - super.onDraw(c, parent, state); - // layout basically just gets drawn on the reserved space on top of the first view - mLayout.layout(parent.getLeft(), 0, parent.getRight(), mLayout.getMeasuredHeight()); - for (int i = 0; i < parent.getChildCount(); i++) { - View view = parent.getChildAt(i); - if (parent.getChildAdapterPosition(view) == parent.getAdapter().getItemCount() - 1) { - c.save(); - c.translate(0, view.getBottom()); - mLayout.draw(c); - c.restore(); -// Avatar avatar = mLayout.findViewById(R.id.uservw); -// avatar.setAvatar(CometChat.getLoggedInUser()); - -// final RecyclerView userList = mLayout.findViewById(viewResID); -// userList.setAdapter(adapter); -// for(int u=0;u<5;u++) { -// User user = new User(); -// user.setUid("user"+u); -// user.setName("testuser"+u); -// adapter.add(user); -// } -// userList.setBackgroundColor(Color.RED); -// ((RelativeLayout)(userList.getParent())).setBackgroundColor(Color.RED); - - break; - } - } - } - - @Override - public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { - if (parent.getChildAdapterPosition(view) == parent.getAdapter().getItemCount() - 1) { - outRect.set(0, 0, 0, mLayout.getMeasuredHeight()); - } else { - outRect.setEmpty(); - } - } -} diff --git a/uikit/src/main/java/utils/PreferenceUtil.java b/uikit/src/main/java/utils/PreferenceUtil.java deleted file mode 100644 index cb17ce5c..00000000 --- a/uikit/src/main/java/utils/PreferenceUtil.java +++ /dev/null @@ -1,47 +0,0 @@ -package utils; - -import android.content.Context; -import android.content.SharedPreferences; - -public class PreferenceUtil { - - private static final String PREFERENCE_NAME = "UI KIT"; - - private static PreferenceUtil INSTANCE=null; - - private static Context context; - - private static SharedPreferences sharedPreferences; - - private PreferenceUtil(Context appContext) { - context = appContext; - } - - public static PreferenceUtil getInstance(Context appContext) { - - if (INSTANCE==null) - INSTANCE=new PreferenceUtil(appContext); - - return INSTANCE; - } - - public void saveString(String key,String value) { - sharedPreferences = context.getSharedPreferences(PREFERENCE_NAME, 0); - SharedPreferences.Editor editor = sharedPreferences.edit(); - editor.putString(key, value); - editor.apply(); - } - - public boolean saveStringWithConfirmation(String key,String value){ - sharedPreferences = context.getSharedPreferences(PREFERENCE_NAME, 0); - SharedPreferences.Editor editor = sharedPreferences.edit(); - editor.putString(key, value); - return editor.commit(); - } - - public String getString(String key) { - sharedPreferences = context.getSharedPreferences(PREFERENCE_NAME, 0); - return sharedPreferences.getString(key, ""); - } - -} diff --git a/uikit/src/main/res/layout/activity_comet_chat_call.xml b/uikit/src/main/res-components/calls/layout/activity_cometchat_callmanager.xml similarity index 95% rename from uikit/src/main/res/layout/activity_comet_chat_call.xml rename to uikit/src/main/res-components/calls/layout/activity_cometchat_callmanager.xml index 469a530a..c99f5945 100644 --- a/uikit/src/main/res/layout/activity_comet_chat_call.xml +++ b/uikit/src/main/res-components/calls/layout/activity_cometchat_callmanager.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context="screen.CometChatCallActivity"> + tools:context="com.cometchat.pro.uikit.ui_components.calls.call_manager.CometChatCallActivity"> - - + tools:context="com.cometchat.pro.uikit.ui_components.calls.call_manager.CometChatStartCallActivity"> - - + tools:context="com.cometchat.pro.uikit.ui_components.chats.CometChatConversationList"> diff --git a/uikit/src/main/res/layout/fragment_missed_call.xml b/uikit/src/main/res-components/calls/layout/fragment_cometchat_missed_call.xml similarity index 94% rename from uikit/src/main/res/layout/fragment_missed_call.xml rename to uikit/src/main/res-components/calls/layout/fragment_cometchat_missed_call.xml index e9ad9b88..38528f51 100644 --- a/uikit/src/main/res/layout/fragment_missed_call.xml +++ b/uikit/src/main/res-components/calls/layout/fragment_cometchat_missed_call.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" xmlns:tools="http://schemas.android.com/tools"> - - - - + tools:context="com.cometchat.pro.uikit.ui_components.chats.CometChatConversationList"> - + - + - + - + - + - + - + - + - + - + - + diff --git a/uikit/src/main/res/layout/conversation_placeholder.xml b/uikit/src/main/res-components/chats/layout/conversation_shimmer_row.xml similarity index 94% rename from uikit/src/main/res/layout/conversation_placeholder.xml rename to uikit/src/main/res-components/chats/layout/conversation_shimmer_row.xml index c5a31da9..8cb6b9a3 100644 --- a/uikit/src/main/res/layout/conversation_placeholder.xml +++ b/uikit/src/main/res-components/chats/layout/conversation_shimmer_row.xml @@ -9,7 +9,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> - - + tools:context="com.cometchat.pro.uikit.ui_components.chats.CometChatConversationList"> - diff --git a/uikit/src/main/res/layout/activity_cometchat_unified.xml b/uikit/src/main/res-components/cometchatui/layout/activity_cometchat_unified.xml similarity index 100% rename from uikit/src/main/res/layout/activity_cometchat_unified.xml rename to uikit/src/main/res-components/cometchatui/layout/activity_cometchat_unified.xml diff --git a/uikit/src/main/res/layout/activity_comet_chat_ban_member_screen.xml b/uikit/src/main/res-components/groups/layout/activity_cometchat_ban_members.xml similarity index 87% rename from uikit/src/main/res/layout/activity_comet_chat_ban_member_screen.xml rename to uikit/src/main/res-components/groups/layout/activity_cometchat_ban_members.xml index 1b5d96bc..8b65794b 100644 --- a/uikit/src/main/res/layout/activity_comet_chat_ban_member_screen.xml +++ b/uikit/src/main/res-components/groups/layout/activity_cometchat_ban_members.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent" - tools:context="screen.banmembers.CometChatBanMemberScreenActivity"> + tools:context="com.cometchat.pro.uikit.ui_components.groups.banned_members.CometChatBanMembersActivity"> - - diff --git a/uikit/src/main/res/layout/user_list_row.xml b/uikit/src/main/res-components/groups/layout/cometchat_group_member_row.xml similarity index 94% rename from uikit/src/main/res/layout/user_list_row.xml rename to uikit/src/main/res-components/groups/layout/cometchat_group_member_row.xml index 84618be9..20da4f8f 100644 --- a/uikit/src/main/res/layout/user_list_row.xml +++ b/uikit/src/main/res-components/groups/layout/cometchat_group_member_row.xml @@ -11,7 +11,7 @@ android:background="?attr/selectableItemBackground" android:layout_height="72dp"> - - - + tools:context="com.cometchat.pro.uikit.ui_components.groups.group_members.CometChatGroupMemberList"> + tools:context="com.cometchat.pro.uikit.ui_components.groups.admin_moderator_list.CometChatAdminModeratorList"> + tools:context="com.cometchat.pro.uikit.ui_components.groups.group_list.CometChatGroupList"> + tools:context="com.cometchat.pro.uikit.ui_components.groups.group_list.CometChatGroupList"> - - - - - - - - - - - - - diff --git a/uikit/src/main/res/layout/message_right_whiteboard_item.xml b/uikit/src/main/res-components/messagebubbles/layout/message_right_whiteboard_item.xml similarity index 100% rename from uikit/src/main/res/layout/message_right_whiteboard_item.xml rename to uikit/src/main/res-components/messagebubbles/layout/message_right_whiteboard_item.xml diff --git a/uikit/src/main/res/layout/message_right_writeboard_item.xml b/uikit/src/main/res-components/messagebubbles/layout/message_right_writeboard_item.xml similarity index 100% rename from uikit/src/main/res/layout/message_right_writeboard_item.xml rename to uikit/src/main/res-components/messagebubbles/layout/message_right_writeboard_item.xml diff --git a/uikit/src/main/res/layout/thread_location_message_item.xml b/uikit/src/main/res-components/messagebubbles/layout/thread_location_message_item.xml similarity index 98% rename from uikit/src/main/res/layout/thread_location_message_item.xml rename to uikit/src/main/res-components/messagebubbles/layout/thread_location_message_item.xml index 5eb2c21d..409ff84e 100644 --- a/uikit/src/main/res/layout/thread_location_message_item.xml +++ b/uikit/src/main/res-components/messagebubbles/layout/thread_location_message_item.xml @@ -14,7 +14,7 @@ android:layout_height="wrap_content"> - - - - - - - - diff --git a/uikit/src/main/res/layout/activity_comet_chat_media_view.xml b/uikit/src/main/res-components/messages/layout/activity_cometchat_media_view.xml similarity index 93% rename from uikit/src/main/res/layout/activity_comet_chat_media_view.xml rename to uikit/src/main/res-components/messages/layout/activity_cometchat_media_view.xml index 9ea51a7c..1cbaa904 100644 --- a/uikit/src/main/res/layout/activity_comet_chat_media_view.xml +++ b/uikit/src/main/res-components/messages/layout/activity_cometchat_media_view.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:background="@color/darkModeBackground" android:layout_height="match_parent" - tools:context="screen.CometChatMediaViewActivity"> + tools:context="com.cometchat.pro.uikit.ui_components.messages.media_view.CometChatMediaViewActivity"> - + tools:context="com.cometchat.pro.uikit.ui_components.messages.message_information.CometChatMessageInfoScreenActivity"> - + android:layout_height="match_parent"> + tools:context="com.cometchat.pro.uikit.ui_components.messages.extensions.Reactions.CometChatReactionInfoActivity"> diff --git a/uikit/src/main/res/layout/activity_cometchat_webview.xml b/uikit/src/main/res-components/messages/layout/activity_cometchat_webview.xml similarity index 72% rename from uikit/src/main/res/layout/activity_cometchat_webview.xml rename to uikit/src/main/res-components/messages/layout/activity_cometchat_webview.xml index c01a27a4..84fb146a 100644 --- a/uikit/src/main/res/layout/activity_cometchat_webview.xml +++ b/uikit/src/main/res-components/messages/layout/activity_cometchat_webview.xml @@ -5,4 +5,4 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/webview" - tools:context="screen.CometChatWebViewActivity"/> \ No newline at end of file + tools:context="com.cometchat.pro.uikit.ui_components.messages.extensions.Collaborative.CometChatCollaborativeActivity"/> \ No newline at end of file diff --git a/uikit/src/main/res/layout/block_user_message_layout.xml b/uikit/src/main/res-components/messages/layout/cometchat_block_user_message_view.xml similarity index 98% rename from uikit/src/main/res/layout/block_user_message_layout.xml rename to uikit/src/main/res-components/messages/layout/cometchat_block_user_message_view.xml index 38e33fbc..c144f229 100644 --- a/uikit/src/main/res/layout/block_user_message_layout.xml +++ b/uikit/src/main/res-components/messages/layout/cometchat_block_user_message_view.xml @@ -1,6 +1,7 @@ - - - @@ -26,11 +26,11 @@ android:layout_height="match_parent" android:layout_below="@+id/chatList_toolbar" /> - + - + - + - - @@ -63,7 +63,7 @@ android:layout_width="match_parent" android:layout_alignParentBottom="true" android:layout_height="wrap_content"> - - + \ No newline at end of file diff --git a/uikit/src/main/res/layout/fragment_thread_message.xml b/uikit/src/main/res-components/messages/layout/fragment_cometchat_thread_message.xml similarity index 97% rename from uikit/src/main/res/layout/fragment_thread_message.xml rename to uikit/src/main/res-components/messages/layout/fragment_cometchat_thread_message.xml index 535e42da..3e19293c 100644 --- a/uikit/src/main/res/layout/fragment_thread_message.xml +++ b/uikit/src/main/res-components/messages/layout/fragment_cometchat_thread_message.xml @@ -4,7 +4,7 @@ android:animateLayoutChanges="true" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"> - @@ -30,7 +30,7 @@ - - + - + - - - + \ No newline at end of file diff --git a/uikit/src/main/res/layout/message_placeholder.xml b/uikit/src/main/res-components/messages/layout/message_placeholder.xml similarity index 97% rename from uikit/src/main/res/layout/message_placeholder.xml rename to uikit/src/main/res-components/messages/layout/message_placeholder.xml index be54e465..dc72e75e 100644 --- a/uikit/src/main/res/layout/message_placeholder.xml +++ b/uikit/src/main/res-components/messages/layout/message_placeholder.xml @@ -9,7 +9,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> - + tools:context="com.cometchat.pro.uikit.ui_components.chats.CometChatConversationList"> - diff --git a/uikit/src/main/res/layout/fragment_emoji_objects.xml b/uikit/src/main/res-components/others/layout/fragment_emoji_objects.xml similarity index 100% rename from uikit/src/main/res/layout/fragment_emoji_objects.xml rename to uikit/src/main/res-components/others/layout/fragment_emoji_objects.xml diff --git a/uikit/src/main/res/layout/fragment_stickers_view.xml b/uikit/src/main/res-components/others/layout/fragment_stickers_view.xml similarity index 100% rename from uikit/src/main/res/layout/fragment_stickers_view.xml rename to uikit/src/main/res-components/others/layout/fragment_stickers_view.xml diff --git a/uikit/src/main/res/layout/group_list_row.xml b/uikit/src/main/res-components/others/layout/group_list_row.xml similarity index 94% rename from uikit/src/main/res/layout/group_list_row.xml rename to uikit/src/main/res-components/others/layout/group_list_row.xml index e711899c..8fd064d4 100644 --- a/uikit/src/main/res/layout/group_list_row.xml +++ b/uikit/src/main/res-components/others/layout/group_list_row.xml @@ -16,7 +16,7 @@ android:background="?attr/selectableItemBackground" android:layout_height="72dp"> - - - - - + tools:context="com.cometchat.pro.uikit.ui_components.userprofile.privacy_security.CometChatMorePrivacyActivity"> - - - - + + + + + + + + + + + + + + + + + + diff --git a/uikit/src/main/res/layout/cc_initial_header.xml b/uikit/src/main/res-components/users/layout/cometchat_userlist_header.xml similarity index 100% rename from uikit/src/main/res/layout/cc_initial_header.xml rename to uikit/src/main/res-components/users/layout/cometchat_userlist_header.xml diff --git a/uikit/src/main/res/layout/block_user_screen.xml b/uikit/src/main/res-components/users/layout/fragment_cometchat_block_user.xml similarity index 100% rename from uikit/src/main/res/layout/block_user_screen.xml rename to uikit/src/main/res-components/users/layout/fragment_cometchat_block_user.xml diff --git a/uikit/src/main/res/layout/fragment_user_list_screen.xml b/uikit/src/main/res-components/users/layout/fragment_cometchat_userlist.xml similarity index 94% rename from uikit/src/main/res/layout/fragment_user_list_screen.xml rename to uikit/src/main/res-components/users/layout/fragment_cometchat_userlist.xml index df4f6f15..82ca6fd1 100644 --- a/uikit/src/main/res/layout/fragment_user_list_screen.xml +++ b/uikit/src/main/res-components/users/layout/fragment_cometchat_userlist.xml @@ -70,16 +70,16 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"/> - - + diff --git a/uikit/src/main/res/layout/user_list_placeholder.xml b/uikit/src/main/res-components/users/layout/user_shimmer.xml similarity index 68% rename from uikit/src/main/res/layout/user_list_placeholder.xml rename to uikit/src/main/res-components/users/layout/user_shimmer.xml index ac70f1ae..1859796b 100644 --- a/uikit/src/main/res/layout/user_list_placeholder.xml +++ b/uikit/src/main/res-components/users/layout/user_shimmer.xml @@ -6,7 +6,7 @@ android:focusable="true" android:focusableInTouchMode="true" android:orientation="vertical" - tools:context="screen.CometChatConversationListScreen"> + tools:context="com.cometchat.pro.uikit.ui_components.chats.CometChatConversationList"> - + - + - + - + - + - + - + - + - + - + - + diff --git a/uikit/src/main/res/layout/user_item_placeholder.xml b/uikit/src/main/res-components/users/layout/user_shimmer_item.xml similarity index 93% rename from uikit/src/main/res/layout/user_item_placeholder.xml rename to uikit/src/main/res-components/users/layout/user_shimmer_item.xml index 9ea115f2..3d83fcfc 100644 --- a/uikit/src/main/res/layout/user_item_placeholder.xml +++ b/uikit/src/main/res-components/users/layout/user_shimmer_item.xml @@ -9,7 +9,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/uikit/src/main/res/layout/cometchat_reply_message.xml b/uikit/src/main/res/layout/cometchat_reply_message.xml deleted file mode 100644 index 7fdfd286..00000000 --- a/uikit/src/main/res/layout/cometchat_reply_message.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/uikit/src/main/res/layout/image_dialog_view.xml b/uikit/src/main/res/layout/image_dialog_view.xml deleted file mode 100644 index 1129b1a6..00000000 --- a/uikit/src/main/res/layout/image_dialog_view.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/uikit/src/main/res/layout/layout_smart_reply_view.xml b/uikit/src/main/res/layout/layout_smart_reply_view.xml deleted file mode 100644 index 97afb7f1..00000000 --- a/uikit/src/main/res/layout/layout_smart_reply_view.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file