Skip to content

Commit

Permalink
UI with SDK v1.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
yadavmangesh committed Jul 22, 2019
1 parent 110a26b commit d32741e
Show file tree
Hide file tree
Showing 32 changed files with 661 additions and 54 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
//cometchat sdk
implementation 'com.cometchat:pro-android-chat-sdk:1.7.2'
implementation 'com.cometchat:pro-android-chat-sdk:1.8.3'

implementation'com.facebook.shimmer:shimmer:0.3.0'
implementation 'com.android.support:recyclerview-selection:28.0.0'
implementation'com.facebook.shimmer:shimmer:0.4.0'

}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
<activity android:name=".Activity.VideoViewActivity" />
<activity android:name=".Activity.IncomingCallActivity" />
<activity android:name=".Activity.CallActivity" />
<activity android:name=".Activity.SelectUserActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
import java.util.HashMap;


public class CometChatActivity extends AppCompatActivity implements
ScrollHelper, CometChatActivityContract.CometChatActivityView,test {
public class CometChatActivity extends AppCompatActivity implements ScrollHelper, CometChatActivityContract.CometChatActivityView {

private ViewPager mViewPager; //view pager

Expand Down Expand Up @@ -271,20 +270,7 @@ public void setFab(boolean isExtended) {
fabIconAnimator.setExtended(isExtended);
}



@Override
public void x(String string) {

}
}

interface test{
/**
*
* This methods take no parameter
* @param string
*/
void x(String string);
}


Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.inscripts.cometchatpulse.demo.Activity;

import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
Expand All @@ -16,6 +17,7 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextUtils;
Expand Down Expand Up @@ -156,6 +158,10 @@ public class GroupChatActivity extends AppCompatActivity implements GroupChatAct

private boolean isEditMessage;

private MenuItem searchItem;

private SearchView searchView;

@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.AppTheme);
Expand Down Expand Up @@ -456,6 +462,41 @@ protected void onStop() {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.group_chat_menu, menu);


searchItem=menu.findItem(R.id.app_bar_search);

SearchManager searchManager=((SearchManager)getSystemService(Context.SEARCH_SERVICE));

if (searchItem!=null){

searchView=((SearchView)searchItem.getActionView());

searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}

@Override
public boolean onQueryTextChange(String s) {
groupChatPresenter.searchMessage(s,groupId);
return false;
}
});

searchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override
public boolean onClose() {
groupChatPresenter.fetchPreviousMessage(groupId,30);
return false;
}
});
}

if (searchView!=null){
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
}
return super.onCreateOptionsMenu(menu);
}

Expand Down Expand Up @@ -710,6 +751,13 @@ public void setEditedMessage(BaseMessage baseMessage) {
}
}

@Override
public void setFilterList(List<BaseMessage> list) {
if (groupMessageAdapter!=null){
groupMessageAdapter.setFilteredList(list);
}
}


@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.inscripts.cometchatpulse.demo.Activity;

import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
Expand All @@ -14,6 +15,8 @@
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.cometchat.pro.constants.CometChatConstants;
import com.inscripts.cometchatpulse.demo.R;
import com.inscripts.cometchatpulse.demo.Adapter.ViewPagerAdapter;
import com.inscripts.cometchatpulse.demo.Contracts.GroupDetailActivityContract;
Expand Down Expand Up @@ -52,8 +55,12 @@ public class GroupDetailActivity extends AppCompatActivity implements View.OnCli

private TextView tvGroupDescription;

private TextView tvAddMembers;

private ViewPagerAdapter adapter;

private String scope;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -66,7 +73,7 @@ protected void onCreate(Bundle savedInstanceState) {

private void initViewComponent() {
Toolbar toolbar = findViewById(R.id.toolbar);
//

setSupportActionBar(toolbar);
getSupportActionBar().setTitle("");
getSupportActionBar().setElevation(10);
Expand All @@ -81,6 +88,9 @@ private void initViewComponent() {
collapsingToolbar.setExpandedTitleGravity(Gravity.START | Gravity.BOTTOM);

tvGroupDescription = findViewById(R.id.tv_group_description);
tvAddMembers=findViewById(R.id.addMember);
tvAddMembers.setVisibility(View.GONE);
tvAddMembers.setOnClickListener(this);
tvGroupDescription.setTypeface(FontUtils.robotoRegular);

tvGroupDescriptionLabel = findViewById(R.id.group_description_labal);
Expand Down Expand Up @@ -120,9 +130,23 @@ protected void onDestroy() {
groupDetailPresenter.detach();
}

@Override
protected void onResume() {
super.onResume();
}

@Override
public void onClick(View view) {

switch (view.getId()){

case R.id.addMember:
Intent addMemberIntent=new Intent(this,SelectUserActivity.class);
addMemberIntent.putExtra(StringContract.IntentStrings.INTENT_GROUP_ID,groupId);
addMemberIntent.putExtra(StringContract.IntentStrings.INTENT_SCOPE,scope);
startActivity(addMemberIntent);
break;
}
}

@Override
Expand Down Expand Up @@ -158,6 +182,16 @@ public void setOwnerDetail(User user) {
ownerUid = user.getUid();
}

@Override
public void setUserScope(String scope) {
this.scope=scope;
if (scope.equals(CometChatConstants.SCOPE_ADMIN)||scope.equals(CometChatConstants.SCOPE_MODERATOR)) {
tvAddMembers.setVisibility(View.VISIBLE);
}
else {
tvAddMembers.setVisibility(View.GONE);
}
}

@Override
public void setGroupOwnerName(String owner) {
Expand Down Expand Up @@ -189,4 +223,4 @@ public void setGroupDescription(String description) {
tvGroupDescription.setText(description);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.inscripts.cometchatpulse.demo.Activity;

import android.annotation.TargetApi;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
Expand All @@ -15,6 +17,7 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextUtils;
Expand All @@ -34,6 +37,7 @@
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.cometchat.pro.constants.CometChatConstants;
import com.cometchat.pro.core.CometChat;
import com.cometchat.pro.models.BaseMessage;
import com.cometchat.pro.models.MediaMessage;
import com.cometchat.pro.models.MessageReceipt;
Expand Down Expand Up @@ -139,7 +143,7 @@ public class OneToOneChatActivity extends AppCompatActivity implements OneToOneA

private BaseMessage baseMessage;

private RelativeLayout rlMain;
private static RelativeLayout rlMain;

private static RelativeLayout rlReplyContainer;

Expand All @@ -161,6 +165,10 @@ public class OneToOneChatActivity extends AppCompatActivity implements OneToOneA

private boolean isEditMessage;

private MenuItem searchItem;

private SearchView searchView;


@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -177,10 +185,12 @@ protected void onCreate(Bundle savedInstanceState) {

private void initViewComponent() {


ivAttchament = findViewById(R.id.iv_attchment);
ivAttchament.setOnClickListener(this);
sendButton = findViewById(R.id.buttonSendMessage);
sendButton.setOnClickListener(this);

recordMicButton = findViewById(R.id.record_button);
recordAudioLayout = findViewById(R.id.record_audio_view);
tvBanner=findViewById(R.id.tvBlock);
Expand Down Expand Up @@ -240,6 +250,7 @@ private void initViewComponent() {

viewAniamtion = AnimationUtils.loadAnimation(this, R.anim.animate);
goneAnimation = AnimationUtils.loadAnimation(this, R.anim.gone_animation);

oneToOnePresenter.setContext(this);
oneToOnePresenter.getOwnerDetail();
oneToOnePresenter.handleIntent(getIntent());
Expand Down Expand Up @@ -394,6 +405,42 @@ protected void onDestroy() {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.one_to_one_chat_menu, menu);


searchItem=menu.findItem(R.id.app_bar_search);

SearchManager searchManager=((SearchManager)getSystemService(Context.SEARCH_SERVICE));

if (searchItem!=null){

searchView=((SearchView)searchItem.getActionView());

searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}

@Override
public boolean onQueryTextChange(String s) {
oneToOnePresenter.searchMessage(s,contactUid);
return false;
}
});

searchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override
public boolean onClose() {
oneToOnePresenter.fetchPreviousMessage(contactUid,30);
return false;
}
});
}

if (searchView!=null){
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
}

return super.onCreateOptionsMenu(menu);
}

Expand Down Expand Up @@ -954,6 +1001,13 @@ public void setEditedMessage(BaseMessage baseMessage) {
}
}

@Override
public void setFilterList(List<BaseMessage> list) {
if (oneToOneAdapter!=null){
oneToOneAdapter.setFilterList(list);
}
}

@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {

Expand Down
Loading

0 comments on commit d32741e

Please sign in to comment.