1.萌新打招呼防双击 2.公会首页改版,去掉厅群聊

This commit is contained in:
oujunhui
2020-10-12 16:49:03 +08:00
parent fdd39fcc10
commit aa2fe08191
24 changed files with 1291 additions and 282 deletions

View File

@@ -20,6 +20,7 @@ import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.databinding.FragmentMeBinding;
import com.yizhuan.erban.decoration.view.MyDecorationActivity;
import com.yizhuan.erban.home.activity.CollectionRoomActivity;
import com.yizhuan.erban.module_hall.HallDataManager;
import com.yizhuan.xchat_android_core.home.bean.HomeTagInfo;
import com.yizhuan.erban.home.presenter.MainFragmentPresenter;
import com.yizhuan.erban.home.view.IMainFragmentView;
@@ -161,13 +162,13 @@ public class MeFragment extends BaseMvpFragment<IMainFragmentView, MainFragmentP
onMarketVerifyUpdateEvent(null);
//模厅
// HallDataManager.get().registerHallExist(this, hallExist -> {
// if (hallExist != null && hallExist) {
// mBinding.llModuleHall.setVisibility(View.VISIBLE);
// return;
// }
// mBinding.llModuleHall.setVisibility(View.GONE);
// });
HallDataManager.get().registerHallExist(this, hallExist -> {
if (hallExist != null && hallExist) {
mBinding.llModuleHall.setVisibility(View.VISIBLE);
return;
}
mBinding.llModuleHall.setVisibility(View.GONE);
});
// HallDataManager.get().registerName(this, name -> mBinding.tvModuleHall.setText(name));
if (TuTuGuideHelper.isNeedHiGuide(TuTuGuideHelper.KEY_GUIDE_ME_TAB)) {
@@ -182,7 +183,6 @@ public class MeFragment extends BaseMvpFragment<IMainFragmentView, MainFragmentP
}
});
}
}
private void onGetRelationShipEvent(RelationShipEvent event) {

View File

@@ -1,10 +1,8 @@
package com.yizhuan.erban.ui.search;
import android.content.Context;
import androidx.appcompat.widget.AppCompatImageView;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -19,17 +17,11 @@ import com.yizhuan.erban.ui.user.UserInfoActivity;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.widget.NobleAvatarView;
import com.yizhuan.erban.utils.RegexUtil;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.home.bean.HomeRoom;
import com.yizhuan.xchat_android_core.level.UserLevelVo;
import com.yizhuan.xchat_android_core.noble.NobleUtil;
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import com.yizhuan.xchat_android_core.user.UserModel;
import java.util.List;
/**
* @author chenran
* @date 2017/10/3
@@ -37,19 +29,26 @@ import java.util.List;
public class SearchAdapter extends BaseQuickAdapter<SearchRoomInfo,SearchAdapter.ViewHolder> {
private Context context;
private int mType;
private int searchType;
private int fromType;
public SearchAdapter(Context context, int type) {
public SearchAdapter(Context context, int searchType,int fromType) {
super(R.layout.list_item_search);
this.context = context;
this.mType = type;
this.searchType = searchType;
this.fromType = fromType;
}
public void setType(int type) {
this.fromType = type;
}
@Override
protected void convert(ViewHolder holder, SearchRoomInfo item) {
holder.ivLive.setVisibility(View.GONE);
holder.tvOnlineNum.setVisibility(View.GONE);
if (mType == SearchDetailFragment.TYPE_SEARCH_USER){
if (searchType == SearchDetailFragment.TYPE_SEARCH_USER){
holder.userName.setText(item.getNick() != null ? item.getNick().replaceAll(RegexUtil.getNotPrintableStringReg(), "?"):"");
holder.ivLive.setVisibility(item.getRoomUid() == 0?View.GONE:View.VISIBLE);
holder.container.setOnClickListener(v -> {
@@ -65,14 +64,25 @@ public class SearchAdapter extends BaseQuickAdapter<SearchRoomInfo,SearchAdapter
});
}
if (fromType == AbstractSelectFriendAction.TYPE_MODULE_HALL) {
//模厅搜索
holder.stvOp.setVisibility(View.VISIBLE);
holder.stvOp.setText("邀请");
holder.addOnClickListener(R.id.stv_op);
if (!UserModel.get().isMyseft(item.getUid())) {
holder.stvOp.setVisibility(View.VISIBLE);
} else {
holder.stvOp.setVisibility(View.GONE);
}
} else {
holder.stvOp.setVisibility(View.GONE);
}
holder.mNobleAvatarView.setSize(40, 58, 15);
holder.mNobleAvatarView.setData(item.getAvatar(), item.nobleUsers);
holder.erbanNo.setText(context.getString(R.string.me_user_id, item.getErbanNo()));
if (item.getGender() == 1) {
holder.mIvSex.setVisibility(View.VISIBLE);
holder.mIvSex.setImageResource(R.drawable.ic_gender_male);
@@ -83,12 +93,10 @@ public class SearchAdapter extends BaseQuickAdapter<SearchRoomInfo,SearchAdapter
holder.mIvSex.setVisibility(View.GONE);
}
holder.addOnClickListener(R.id.tv_send);
}
static class ViewHolder extends BaseViewHolder {
TextView userName;
TextView tvSend;
TextView roomTitle;
TextView erbanNo;
TextView tvOnlineNum;
@@ -96,20 +104,19 @@ public class SearchAdapter extends BaseQuickAdapter<SearchRoomInfo,SearchAdapter
RelativeLayout container;
private NobleAvatarView mNobleAvatarView;
private ImageView mIvSex;
private SuperTextView stvOp;
public ViewHolder(View itemView) {
super(itemView);
userName = itemView.findViewById(R.id.user_name);
roomTitle = itemView.findViewById(R.id.room_title);
tvSend = itemView.findViewById(R.id.tv_send);
erbanNo = itemView.findViewById(R.id.erban_no);
container = itemView.findViewById(R.id.container);
mNobleAvatarView = itemView.findViewById(R.id.noble_avatar_view);
mIvSex = itemView.findViewById(R.id.sex);
ivLive = itemView.findViewById(R.id.iv_living);
tvOnlineNum = itemView.findViewById(R.id.tv_online_num);
stvOp = itemView.findViewById(R.id.stv_op);
}
}
}

View File

@@ -1,21 +1,46 @@
package com.yizhuan.erban.ui.search;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.MainActivity;
import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.widget.MessageView;
import com.yizhuan.erban.base.BaseMvpFragment;
import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
import com.yizhuan.erban.friend.view.SelectFriendActivity;
import com.yizhuan.erban.module_hall.HallDataManager;
import com.yizhuan.erban.module_hall.hall.activity.HallSearchActivity;
import com.yizhuan.erban.ui.search.presenter.SearchPresenter;
import com.yizhuan.erban.ui.search.view.ISearchView;
import com.yizhuan.xchat_android_core.bean.RoomHistoryInfo;
import com.yizhuan.xchat_android_core.community.dynamic.DynamicModel;
import com.yizhuan.xchat_android_core.community.im.DynamicImMsg;
import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
import com.yizhuan.xchat_android_library.utils.JavaUtil;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.List;
import io.reactivex.android.schedulers.AndroidSchedulers;
@CreatePresenter(SearchPresenter.class)
public class SearchDetailFragment extends BaseMvpFragment<ISearchView, SearchPresenter> implements ISearchView {
@@ -24,6 +49,7 @@ public class SearchDetailFragment extends BaseMvpFragment<ISearchView, SearchPre
private RecyclerView recyclerView;
private SearchAdapter searchAdapter;
private int mType;
private int fromType;
public static SearchDetailFragment newInstance(int type) {
Bundle args = new Bundle();
@@ -33,6 +59,15 @@ public class SearchDetailFragment extends BaseMvpFragment<ISearchView, SearchPre
return fragment;
}
public static SearchDetailFragment newInstance(int type,int fromType) {
Bundle args = new Bundle();
args.putInt("type", type);
args.putInt("fromType",fromType);
SearchDetailFragment fragment = new SearchDetailFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -59,16 +94,64 @@ public class SearchDetailFragment extends BaseMvpFragment<ISearchView, SearchPre
public void initiate() {
if (getArguments() != null) {
mType = getArguments().getInt("type");
fromType = getArguments().getInt("fromType");
}
initData();
}
private void initData(){
recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
searchAdapter = new SearchAdapter(mContext, mType);
searchAdapter = new SearchAdapter(mContext, mType,fromType);
searchAdapter.setType(fromType);
searchAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
SearchRoomInfo item = (SearchRoomInfo) adapter.getData().get(position);
showSureDialog(item.getUid() + "",item.getAvatar(), item.getNick());
}
});
recyclerView.setAdapter(searchAdapter);
}
public void showSureDialog(String targetId, String avatar, String nick) {
if (fromType == AbstractSelectFriendAction.TYPE_MODULE_HALL) {
if (nick == null) {
nick = "";
}
long targetUid = JavaUtil.str2long(targetId);
MessageView.SpannableBuilder text = new MessageView.SpannableBuilder(null);
text.append("确认邀请")
.append(nick, new ForegroundColorSpan(getResources().getColor(R.color.appColor)))
.append("加入")
.append(HallDataManager.get().getHallName(),
new ForegroundColorSpan(getResources().getColor(R.color.appColor)))
.append("吗?");
getDialogManager().showOkCancelDialog(text.build(), new DialogManager.OkCancelDialogListener() {
@Override
public void onCancel() {
}
@Override
public void onOk() {
HallModel.get().inviteMember(targetUid)
.compose(RxHelper.bindActivity((HallSearchActivity) getActivity()))
.subscribe(new BeanObserver<String>() {
@Override
public void onErrorMsg(String error) {
toast(error);
}
@Override
public void onSuccess(String s) {
toast(s);
}
});
}
});
}
}
public void search(String str,int type){
getMvpPresenter().searchRooms(str,type);
}

View File

@@ -0,0 +1,278 @@
package com.yizhuan.erban.ui.search;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R;
import com.yizhuan.erban.base.BaseMvpActivity;
import com.yizhuan.erban.common.ViewPagerAdapter;
import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
import com.yizhuan.erban.friend.view.SelectFriendActivity;
import com.yizhuan.erban.home.adapter.ContactsIndicatorAdapter;
import com.yizhuan.erban.ui.search.presenter.SearchPresenter;
import com.yizhuan.erban.ui.search.view.ISearchView;
import com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator;
import com.yizhuan.erban.ui.widget.magicindicator.ViewPagerHelper;
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator;
import com.yizhuan.xchat_android_core.bean.RoomHistoryInfo;
import com.yizhuan.xchat_android_core.community.dynamic.DynamicModel;
import com.yizhuan.xchat_android_core.community.im.DynamicImMsg;
import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
import com.yizhuan.xchat_android_library.utils.ImeUtil;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.android.schedulers.AndroidSchedulers;
/**
* 搜索界面
*
* @author chenran
* @date 2017/10/3
* <p>
* jack 修改于 2018/5/2
*/
@CreatePresenter(SearchPresenter.class)
public class SearchHallActivity extends BaseMvpActivity<ISearchView, SearchPresenter> implements ISearchView, View.OnClickListener, ContactsIndicatorAdapter.OnItemSelectListener {
private static final String SHOW_HISTORY = "show_history";
public static final int CODE_REQUEST_TO_SEARCH = 200;
protected EditText searchEdit;
private ImageView ivBack;
private TextView tvSearch;
private ImageView ivClearText;
private MagicIndicator indicator;
private ViewPager viewPager;
private LinearLayout llSearchDetail;
protected int type = AbstractSelectFriendAction.TYPE_NORMAL;
private int secondOperator = -1;
private SearchDetailFragment userFrg ;
public static void start(Context context) {
Intent intent = new Intent(context, SearchActivity.class);
intent.putExtra(SHOW_HISTORY, true);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search_hall);
initView();
initSearchDetail();
}
private void initView() {
type = getIntent().getIntExtra(AbstractSelectFriendAction.KEY_TYPE, AbstractSelectFriendAction.TYPE_NORMAL);
secondOperator = getIntent().getIntExtra(SelectFriendActivity.KEY_SECOND_OPERATOR,-1);
switch (type) {
}
searchEdit = findViewById(R.id.search_edit);
searchEdit.addTextChangedListener(textWatcher);
searchEdit.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
searchEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH || (event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
toSearch();
return true;
}
return false;
}
});
ivBack = findViewById(R.id.iv_back);
ivBack.setOnClickListener(this);
tvSearch = findViewById(R.id.tv_search);
tvSearch.setOnClickListener(this);
ivClearText = findViewById(R.id.iv_clear_text);
ivClearText.setOnClickListener(this);
ivClearText.setVisibility(View.GONE);
llSearchDetail = findViewById(R.id.ll_search_detail);
indicator = findViewById(R.id.indicator);
viewPager = findViewById(R.id.viewpager);
}
private void initSearchDetail(){
// llSearchDetail.setVisibility(View.GONE);
List<String> mTabInfoList = new ArrayList<>();
mTabInfoList.add(getString(R.string.search_room_tab));
mTabInfoList.add(getString(R.string.search_user_tab));
List<Fragment> mTabs = new ArrayList<>();
userFrg = SearchDetailFragment.newInstance(SearchDetailFragment.TYPE_SEARCH_USER,AbstractSelectFriendAction.TYPE_MODULE_HALL);
mTabs.add(userFrg);
ContactsIndicatorAdapter topMagicIndicatorAdapter = new ContactsIndicatorAdapter(this, mTabInfoList,0);
topMagicIndicatorAdapter.setOnItemSelectListener(this);
CommonNavigator commonNavigator = new CommonNavigator(this);
commonNavigator.setAdjustMode(true);
commonNavigator.setAdapter(topMagicIndicatorAdapter);
indicator.setNavigator(commonNavigator);
// must after setNavigator
LinearLayout titleContainer = commonNavigator.getTitleContainer();
titleContainer.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), mTabs,null));
ViewPagerHelper.bind(indicator, viewPager);
}
@Override
public void onItemSelect(int position) {
viewPager.setCurrentItem(position);
}
private TextWatcher textWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (s.length()<=0) {
ivClearText.setVisibility(View.GONE);
showHistory();
} else {
ivClearText.setVisibility(View.VISIBLE);
}
}
};
@Override
public void update(List<SearchRoomInfo> homeRooms) {
}
@Override
public void showToast(String msg) {
toast(msg);
}
@Override
public void getInRoomRecordSuccess(List<RoomHistoryInfo> list) {
if (list != null && list.size() > 0) {
}
}
@Override
public void getInRoomRecordFail(String error) {
}
@Override
public void deleteInRoomRecordSuccess() {
}
@Override
public void deleteInRoomRecordFail(String error) {
toast(error);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_back:
goBack();
break;
case R.id.tv_search:
toSearch();
break;
case R.id.iv_clear_text:
searchEdit.setText("");
showHistory();
break;
}
}
private void goBack() {
finish();
}
private void toSearch() {
String str = searchEdit.getText().toString();
if (TextUtils.isEmpty(str)) {
SingleToastUtil.showToastShort("请输入搜索内容!");
showHistory();
return;
}
ImeUtil.hideIME(this, tvSearch);
starSearch(str);
}
private void starSearch(String str){
if (userFrg == null){
initSearchDetail();
}
userFrg.search(str,SearchDetailFragment.TYPE_SEARCH_USER);
llSearchDetail.setVisibility(View.VISIBLE);
}
private void clearSearch(){
llSearchDetail.setVisibility(View.GONE);
if (userFrg == null){return;}
userFrg.clear();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
private void showHistory() {
// hideStatus();
clearSearch();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
goBack();
}
return true;
}
}

View File

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_back"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_gravity="center|start"
android:background="@color/transparent"
android:scaleType="centerInside"
android:src="@drawable/arrow_left" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="32dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="15dp"
android:layout_weight="1.0"
android:background="@drawable/bg_search_edit"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/search_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:src="@mipmap/ic_search_main" />
<EditText
android:id="@+id/search_edit"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:background="@null"
android:hint="@string/search_hint"
android:inputType="text"
android:maxLength="20"
android:maxLines="1"
android:text=""
android:textColor="@color/color_common_text_content"
android:textColorHint="@color/color_999999"
android:textCursorDrawable="@null"
android:textSize="14sp" />
<ImageView
android:id="@+id/iv_clear_text"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:layout_marginStart="4dp"
android:layout_marginEnd="8dp"
android:src="@mipmap/ic_text_clear" />
</LinearLayout>
<TextView
android:id="@+id/tv_search"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center"
android:paddingEnd="16dp"
android:text="@string/search"
android:textColor="@color/color_333333"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_search_detail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_FAFAFA"
android:visibility="gone"
android:orientation="vertical">
<com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="48dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:visibility="gone"
android:background="@color/white" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white" />
</LinearLayout>
<com.yizhuan.erban.common.widget.StatusLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</androidx.recyclerview.widget.RecyclerView>
</com.yizhuan.erban.common.widget.StatusLayout>
</LinearLayout>

View File

@@ -538,6 +538,7 @@
<LinearLayout
android:id="@+id/ll_module_hall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
@@ -547,23 +548,6 @@
android:orientation="vertical"
android:gravity="center_vertical">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#F5F5F5" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#F5F5F5" />
<LinearLayout
android:id="@+id/me_item_union"
android:layout_width="match_parent"

View File

@@ -106,8 +106,27 @@
android:paddingEnd="@dimen/dp_5"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
tools:visibility="gone"
tools:text="177" />
<com.coorchice.library.SuperTextView
android:id="@+id/stv_op"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:textColor="@color/white"
android:textSize="@dimen/sp_12"
android:visibility="gone"
android:paddingStart="@dimen/dp_16"
android:paddingEnd="@dimen/dp_16"
android:paddingTop="@dimen/dp_4"
android:paddingBottom="@dimen/dp_4"
android:text="邀请"
android:background="@drawable/bg_common_confirm_normal_22r"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
tools:visibility="visible" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"

View File

@@ -34,6 +34,10 @@ public class HallDataManager {
private HallInfo hallInfo;
/**模厅名字*/
private MutableLiveData<String> liveHallName;
/**公会ID*/
private MutableLiveData<Long> liveHallID;
/**厅主ID*/
private MutableLiveData<Long> liveOwnerUid;
/**是否具有模厅*/
private MutableLiveData<Boolean> liveHallExist;
/**
@@ -49,7 +53,9 @@ public class HallDataManager {
EventBus.getDefault().register(this);
liveHallName = new MutableLiveData<>();
liveHallExist = new MutableLiveData<>();
liveHallID = new MutableLiveData<>();
liveHallName.setValue("");
liveHallID.setValue(0L);
liveHallExist.setValue(false);
}
@@ -102,6 +108,7 @@ public class HallDataManager {
public void onLogout(LogoutEvent event) {
hallInfo = null;
liveHallName.setValue("");
liveHallID.setValue(0L);
liveHallExist.setValue(false);
}
@@ -113,6 +120,10 @@ public class HallDataManager {
liveHallName.observe(owner, observer);
}
public void registerHallID(LifecycleOwner owner, Observer<Long> observer) {
liveHallID.observe(owner, observer);
}
public void registerHallExist(LifecycleOwner owner, Observer<Boolean> observer) {
liveHallExist.observe(owner, observer);
}
@@ -126,6 +137,7 @@ public class HallDataManager {
hallInfo = info;
liveHallName.setValue(hallInfo.getHallName());
liveHallExist.setValue(hallInfo.getHallId() > 0);
liveHallID.setValue(hallInfo.getHallId());
});
}

View File

@@ -11,6 +11,7 @@ import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
import com.yizhuan.erban.module_hall.HallDataManager;
import com.yizhuan.erban.ui.search.SearchActivity;
import com.yizhuan.erban.ui.search.SearchHallActivity;
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
@@ -21,7 +22,7 @@ import com.yizhuan.xchat_android_library.utils.JavaUtil;
* Created by lvzebiao on 2019/1/8.
*/
public class HallSearchActivity extends SearchActivity{
public class HallSearchActivity extends SearchHallActivity {
public static void start(Context context, int type) {
Intent intent = new Intent(context, HallSearchActivity.class);
@@ -35,44 +36,4 @@ public class HallSearchActivity extends SearchActivity{
searchEdit.setHint("搜索昵称/66星球ID");
}
@Override
public void showSureDialog(String targetId, String avatar, String nick) {
super.showSureDialog(targetId, avatar, nick);
if (type == AbstractSelectFriendAction.TYPE_MODULE_HALL) {
if (nick == null) {
nick = "";
}
long targetUid = JavaUtil.str2long(targetId);
MessageView.SpannableBuilder text = new MessageView.SpannableBuilder(null);
text.append("确认邀请")
.append(nick, new ForegroundColorSpan(getResources().getColor(R.color.appColor)))
.append("加入")
.append(HallDataManager.get().getHallName(),
new ForegroundColorSpan(getResources().getColor(R.color.appColor)))
.append("吗?");
getDialogManager().showOkCancelDialog(text.build(), new DialogManager.OkCancelDialogListener() {
@Override
public void onCancel() {
}
@Override
public void onOk() {
HallModel.get().inviteMember(targetUid)
.compose(RxHelper.bindActivity(HallSearchActivity.this))
.subscribe(new BeanObserver<String>() {
@Override
public void onErrorMsg(String error) {
toast(error);
}
@Override
public void onSuccess(String s) {
toast(s);
}
});
}
});
}
}
}

View File

@@ -8,6 +8,7 @@ import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.yizhuan.erban.R;
@@ -50,8 +51,6 @@ public class MemberSearchActivity extends BaseMvpActivity<IMemberSearchView, Mem
ButterKnife.bind(this);
initTitleBar("");
recyclerView.setLayoutManager(new LinearLayoutManager(this));
mGroupMemberListAdapter = new GroupMemberListAdapter(this, null);
mGroupMemberListAdapter.setmType(GroupMemberListAdapter.TYPE_SEARCH);
@@ -68,7 +67,7 @@ public class MemberSearchActivity extends BaseMvpActivity<IMemberSearchView, Mem
recyclerView.setAdapter(mGroupMemberListAdapter);
}
@OnClick({R.id.tv_search})
@OnClick({R.id.tv_search,R.id.iv_back})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.tv_search:
@@ -76,6 +75,9 @@ public class MemberSearchActivity extends BaseMvpActivity<IMemberSearchView, Mem
if (!TextUtils.isEmpty(key))
getMvpPresenter().queryMembers(key);
break;
case R.id.iv_back:
finish();
break;
}
}

View File

@@ -8,17 +8,26 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.SpannableString;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.netease.nim.uikit.support.glide.GlideApp;
import com.orhanobut.logger.Logger;
import com.yizhuan.erban.R;
import com.yizhuan.erban.UIHelper;
import com.yizhuan.erban.base.BaseMvpActivity;
import com.yizhuan.erban.base.TitleBar;
import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
import com.yizhuan.erban.module_hall.HallDataManager;
import com.yizhuan.erban.module_hall.hall.adapter.GroupMemberListAdapter;
import com.yizhuan.erban.module_hall.secretcode.PwdCodeMgr;
import com.yizhuan.erban.module_hall.team.activity.CreateHallTeamActivity;
@@ -37,8 +46,10 @@ import com.yizhuan.erban.ui.widget.marqueeview.Utils;
import com.yizhuan.erban.ui.widget.recyclerview.decoration.SpacingDecoration;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
import com.yizhuan.xchat_android_core.module_hall.hall.bean.AuthInfo;
import com.yizhuan.xchat_android_core.module_hall.hall.bean.MemberInfo;
import com.yizhuan.xchat_android_core.module_hall.hall.bean.OptionInfo;
import com.yizhuan.xchat_android_core.module_hall.team.HTeamModel;
import com.yizhuan.xchat_android_core.module_hall.hall.bean.HTeamInfo;
@@ -71,16 +82,55 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
@BindView(R.id.rv_option)
RecyclerView mRvOption;
@BindView(R.id.tv_create_group)
TextView tvCreateGroup;
@BindView(R.id.srl_group)
SwipeRefreshLayout mSrlGroup;
@BindView(R.id.recycler_view)
RecyclerView recyclerView;
@BindView(R.id.tv_count)
TextView tvCount;
@BindView(R.id.iv_hall_member_more)
ImageView ivHallMemberMore;
@BindView(R.id.iv_hall_member_search)
ImageView ivHallMemberSearch;
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.iv_setting)
ImageView ivSetting;
@BindView(R.id.tv_hall_id)
TextView tvHallId;
@BindView(R.id.tv_owner_uid)
TextView tvOwnerUid;
@BindView(R.id.tv_owner_name)
TextView tvOwnerName;
@BindView(R.id.iv_avatar)
ImageView ivAvatar;
@BindView(R.id.iv_avatar_bg)
ImageView ivAvatarBg;
private OptionAdapter mOptionAdapter;
private GroupListAdapter mGroupListAdapter;
// private GroupListAdapter mGroupListAdapter;
private GroupMemberListAdapter mGroupMemberListAdapter;
private List<MemberInfo> listInfos = new ArrayList<>();
private List<AuthInfo> mAuthInfoList;
private int page = 1;
private int pageSize = 50;
private boolean isLoading, noMoreData;
private long lastClickTime;
public static void start(Context context) {
StatisticManager.Instance().onEvent(BasicConfig.INSTANCE.getAppContext(),
@@ -104,9 +154,56 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
recyclerView.setLayoutManager(new LinearLayoutManager(this));
setGroupList();
mSrlGroup.setOnRefreshListener(() -> {
if (isLoading) {
return;
}
page = 1;
loadMembers();
});
mSrlGroup.setOnRefreshListener(this::onRefreshHTeamList);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
mGroupMemberListAdapter = new GroupMemberListAdapter(this, null);
mGroupMemberListAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
List<MemberInfo> memberInfoList = mGroupMemberListAdapter.getData();
if (memberInfoList.size() > 0) {
MemberInfo memberInfo = memberInfoList.get(position);
int type = mGroupMemberListAdapter.getmType();
if (type == GroupMemberListAdapter.TYPE_REMOVE) {
if (view.getId() == R.id.iv_remove) {
showRemoveDialog(memberInfo.getUid(), memberInfo.getRoleType(), memberInfo.getNick());
}
} else {
UIHelper.showUserInfoAct(ModuleHallActivity.this, memberInfo.getUid());
}
}
}
});
recyclerView.setAdapter(mGroupMemberListAdapter);
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
if (isLoading || noMoreData) {
return;
}
LinearLayoutManager manager = (LinearLayoutManager) recyclerView.getLayoutManager();
int lastfirst = manager.findLastVisibleItemPosition();
int itemCount = mGroupMemberListAdapter.getItemCount();
if (lastfirst >= itemCount - 2) {
loadMembers();
}
}
}
});
setTvCount(0);
loadMembers();
getMvpPresenter().getHallAuths();
getMvpPresenter().getHallMenusByUid(AuthModel.get().getCurrentUid());
getMvpPresenter().getHallInfo();
@@ -122,20 +219,28 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
private void initTitle() {
HallDataManager.get().registerName(this, name -> {
if (!TextUtils.isEmpty(name)) {
initTitleBar(name);
tvTitle.setText(name);
}
});
mTitleBar.addAction(new TitleBar.ImageAction(R.drawable.lu_ic_member_list) {
@Override
public void performAction(View view) {
GroupMemberListActivity.start(ModuleHallActivity.this);
}
});
// HallDataManager.get().registerHallID(this, hallID -> {
// if (hallID >0) {
// tvHallId.setText("公会ID:"+hallID);
// }
// });
// mTitleBar.addAction(new TitleBar.ImageAction(R.drawable.lu_ic_member_list) {
// @Override
// public void performAction(View view) {
// GroupMemberListActivity.start(ModuleHallActivity.this);
// }
// });
boolean isHallOwner = HallDataManager.get().getRole() == 1;
setSettingOption(isHallOwner);
setCreateOption(isHallOwner);
}
/**
@@ -145,20 +250,18 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
*/
private void setSettingOption(boolean hasOption) {
if (hasOption) {
mTitleBar.addAction(new TitleBar.ImageAction(R.drawable.lu_ic_setting) {
@Override
public void performAction(View view) {
showMenuDialog(view);
}
}, 0);
// mTitleBar.addAction(new TitleBar.ImageAction(R.drawable.lu_ic_setting) {
// @Override
// public void performAction(View view) {
// showMenuDialog(view);
// }
// }, 0);
ivSetting.setVisibility(View.VISIBLE);
}else {
ivSetting.setVisibility(View.GONE);
}
}
private void setCreateOption(boolean hasOption) {
tvCreateGroup.setVisibility(hasOption ? View.VISIBLE : View.GONE);
tvCreateGroup.setEnabled(hasOption);
}
private void setTabOption(List<OptionInfo> tabList) {
if (tabList == null || tabList.size() == 0) {
@@ -194,13 +297,13 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_HALL_ADDMEMBERS_CLICK,
"添加成员-面板");
HallSearchActivity.start(context, AbstractSelectFriendAction.TYPE_MODULE_HALL);
//批量导入
if (!TextUtils.isEmpty(optionInfo.getUrl())) {
CommonWebViewActivity.start(context, optionInfo.getUrl());
} else {
PwdCodeMgr.showShareCodeDialog(context);
}
// if (!TextUtils.isEmpty(optionInfo.getUrl())) {
// CommonWebViewActivity.start(context, optionInfo.getUrl());
// } else {
// PwdCodeMgr.showShareCodeDialog(context);
// }
} else if (OptionInfo.OPTION_HALL_OWNER_ROOM_SERIAL.equals(optionInfo.getCode())) {
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_HALL_HALLINCOME_CLICK,
@@ -218,87 +321,94 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
}
}
private void setGroupList() {
mGroupListAdapter = new GroupListAdapter(R.layout.item_group_list);
recyclerView.setAdapter(mGroupListAdapter);
mGroupListAdapter.setOnItemClickListener((adapter, view, position) -> {
HTeamInfo hTeamInfo = mGroupListAdapter.getData().get(position);
if (hTeamInfo == null) {
return;
}
if (!hTeamInfo.isInChat()) {
return;
}
HallTeamMessageActivity.start(context, hTeamInfo.getTid());
});
mGroupListAdapter.setOnItemChildClickListener((adapter, view, position) -> {
HTeamInfo hTeamInfo = mGroupListAdapter.getData().get(position);
if (hTeamInfo == null) {
return;
}
if (hTeamInfo.isInChat()) {
return;
}
getDialogManager().showProgressDialog(context);
//不在厅群,先加入群,再打开群
HTeamModel.get().joinHteam(hTeamInfo.getChatId())
.compose(bindToLifecycle())
.doAfterTerminate(() -> getDialogManager().dismissDialog())
.subscribe(new BeanObserver<String>() {
@Override
public void onErrorMsg(String error) {
toast(error);
}
@Override
public void onSuccess(String s) {
HallTeamMessageActivity.start(context, hTeamInfo.getTid());
}
});
});
onRefreshHTeamList();
}
@Override
public void onReloadDate() {
super.onReloadDate();
showLoading();
onRefreshHTeamList();
page = 1;
loadMembers();
}
@SuppressLint("CheckResult")
private void onRefreshHTeamList() {
private long mTargetUid;
private void showRemoveDialog(long targetUid, int targetRoleType, String targetNick) {
mTargetUid = targetUid;
SpannableString spannableString = getMvpPresenter().getRemoveTips(this, targetRoleType, targetNick);
HTeamModel.get().getGroupChatList("")
getDialogManager().showOkCancelWithTitleDialog("提示", spannableString, "确定", "取消", new DialogManager.OkCancelDialogListener() {
@Override
public void onCancel() {
mTargetUid = -1;
statusNone();
}
@Override
public void onOk() {
getMvpPresenter().remove(targetUid);
}
});
}
private void statusNone() {
mGroupMemberListAdapter.setmType(GroupMemberListAdapter.TYPE_NONE);
mGroupMemberListAdapter.notifyDataSetChanged();
}
private void loadMembers() {
isLoading = true;
HallModel.get().getAllMembers(HallDataManager.get().getHallId(), page, pageSize)
.compose(RxHelper.bindActivity(this))
.doAfterTerminate(() -> mSrlGroup.setRefreshing(false))
.subscribe(list -> {
hideStatus();
if (list != null && list.size() > 0)
mGroupListAdapter.setNewData(list);
else
showNoData();
.subscribe((listMemberInfo, throwable) -> {
mSrlGroup.setRefreshing(false);
isLoading = false;
if (throwable != null) {
Logger.i("模厅成员加载失败...");
if (page == 1) {
showNetworkErr();
}
} else {
int count = listMemberInfo.getCount();
setTvCount(count);
List<MemberInfo> list = listMemberInfo.getMembers();
if (list == null) {
list = new ArrayList<>();
}
if (list.size() == 0) {
noMoreData = true;
if (page == 1) {
showNoData();
}
} else {
noMoreData = false;
hideStatus();
if (page == 1) {
mGroupMemberListAdapter.setNewData(list);
tvHallId.setText("公会ID:"+list.get(0).getHallId()+"");
tvOwnerUid.setText("66号:"+list.get(0).getErbanNo());
tvOwnerName.setText(list.get(0).getNick());
GlideApp.with(ivAvatar.getContext())
.load(list.get(0).getAvatar())
.placeholder(R.drawable.default_avatar)
.into(ivAvatar);
GlideApp.with(ivAvatarBg.getContext())
.load(list.get(0).getAvatar())
.placeholder(R.drawable.default_avatar)
.into(ivAvatarBg);
} else {
mGroupMemberListAdapter.addData(list);
}
page ++;
}
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onHteamListChangeEvent(HteamListChangeEvent event) {
onRefreshHTeamList();
}
@OnClick({R.id.tv_create_group})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.tv_create_group:
CreateHallTeamActivity.start(this);
break;
}
private int mCount;
private void setTvCount(int count) {
mCount = count;
tvCount.setText("成员列表(" + mCount + "人)");
}
@Override
@@ -312,6 +422,111 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
setTabOption(null);
}
@Override
public void getHallAuthsSuccess(List<AuthInfo> authInfoList) {
mAuthInfoList = authInfoList;
}
@Override
public void getHallAuthsFail(String message) {
}
@Override
public void quitSuccess(String message) {
toast(message);
}
@Override
public void quitFail(String message) {
toast(message);
}
@Override
public void getAllMembersSuccess(List<MemberInfo> memberInfoList) {
hideStatus();
mGroupMemberListAdapter.setNewData(memberInfoList);
}
@Override
public void getAllMembersFail(String message) {
hideStatus();
showNoData();
}
@Override
public void removeSuccess(String message) {
if (mTargetUid == -1)
return;
List<MemberInfo> memberInfoList = mGroupMemberListAdapter.getData();
if (memberInfoList.size() > 0) {
for (MemberInfo memberInfo : memberInfoList) {
if (memberInfo.getUid() == mTargetUid) {
memberInfoList.remove(memberInfo);
if (mCount > 0) {
mCount--;
setTvCount(mCount);
}
break;
}
}
}
statusNone();
mTargetUid = -1;
}
@Override
public void removeFail(String message) {
mTargetUid = -1;
toast(message);
}
@OnClick({R.id.iv_hall_member_search,R.id.iv_hall_member_more,R.id.iv_back,R.id.iv_setting})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_hall_member_search:
MemberSearchActivity.start(ModuleHallActivity.this);
break;
case R.id.iv_hall_member_more:
//防双击
long currTime = System.currentTimeMillis();
if (currTime - lastClickTime < 1000) {
return;
}
lastClickTime = currTime;
moreOption(view, mAuthInfoList);
break;
case R.id.iv_back:
finish();
break;
case R.id.iv_setting:
showMenuDialog(view);
break;
}
}
private void moreOption(View attachView, List<AuthInfo> authInfoList) {
if (authInfoList != null && authInfoList.size() > 0) {
HallMenuDialog dialog = new HallMenuDialog(this, attachView, authInfoList, true);
dialog.setOnMenuClickListener(new HallMenuDialog.OnMenuClickListener() {
@Override
public void callback(String code) {
jumpCode(code);
}
});
dialog.show();
} else {
toast("未分配权限");
}
}
private void showMenuDialog(View attachView) {
List<AuthInfo> authInfoList = new ArrayList<>();
AuthInfo authInfo = new AuthInfo();
@@ -328,11 +543,43 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
private void jumpCode(String code) {
switch (code) {
case AuthInfo.AUTH_HALL_NAME_SET:
HallNameSettingActivity.start(ModuleHallActivity.this);
case AuthInfo.AUTH_APPLY_HALL_EXIT:
showExitDialog();
break;
case AuthInfo.AUTH_MEMBER_JOIN_MANAGER:
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_HALL_ADDMEMBERS_CLICK,
"添加成员-成员列表");
PwdCodeMgr.showShareCodeDialog(context);
break;
case AuthInfo.AUTH_MEMBER_EXIT_MANAGER:
mGroupMemberListAdapter.setmType(GroupMemberListAdapter.TYPE_REMOVE);
mGroupMemberListAdapter.notifyDataSetChanged();
break;
case AuthInfo.AUTH_HALL_MANAGER_SET:
AdminListActivity.start(ModuleHallActivity.this);
break;
default:
Logger.e("本版本不能识别的权限");
break;
}
}
private void showExitDialog() {
CharSequence text = getMvpPresenter().getExitTips(this);
getDialogManager().showOkCancelDialog(text, new DialogManager.OkCancelDialogListener() {
@Override
public void onCancel() {
}
@Override
public void onOk() {
getMvpPresenter().quit();
}
});
}
}

View File

@@ -1,11 +1,23 @@
package com.yizhuan.erban.module_hall.hall.presenter;
import android.content.Context;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import androidx.core.content.ContextCompat;
import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.widget.MessageView;
import com.yizhuan.erban.base.BaseMvpPresenter;
import com.yizhuan.erban.module_hall.HallDataManager;
import com.yizhuan.erban.module_hall.hall.view.IModuleHallView;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.module_hall.hall.bean.AuthInfo;
import com.yizhuan.xchat_android_core.module_hall.hall.bean.OptionInfo;
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.SingleObserver;
@@ -44,4 +56,132 @@ public class ModuleHallPresenter extends BaseMvpPresenter<IModuleHallView>{
public void getHallInfo() {
HallDataManager.get().updateHallInfo();
}
/**
* 成员列表
*/
public void getHallAuths() {
HallModel.get().getHallAuths(AuthModel.get().getCurrentUid(),
HallDataManager.get().getRole())
.compose(bindToLifecycle())
.subscribe(new SingleObserver<List<AuthInfo>>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(List<AuthInfo> authInfos) {
//对权限处理下
List<AuthInfo> showList = new ArrayList<>();
List<String> canHandle = AuthInfo.canHandleAuth();
for(AuthInfo info : authInfos) {
if (info == null) {
continue;
}
if (canHandle.contains(info.getCode()) && info.isOwnAuth()) {
showList.add(info);
}
}
getMvpView().getHallAuthsSuccess(showList);
}
@Override
public void onError(Throwable e) {
if (getMvpView() == null)
return;
getMvpView().getHallAuthsFail(e.getMessage());
}
});
}
public void quit() {
HallModel.get().quit(AuthModel.get().getCurrentUid())
.compose(bindToLifecycle())
.subscribe(new SingleObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(String s) {
getMvpView().quitSuccess(s);
}
@Override
public void onError(Throwable e) {
getMvpView().quitFail(e.getMessage());
}
});
}
public void remove(long targetUid) {
HallModel.get().removeFromHall(targetUid)
.compose(bindToLifecycle())
.subscribe(new SingleObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(String s) {
getMvpView().removeSuccess(s);
}
@Override
public void onError(Throwable e) {
if (getMvpView() == null) {
return;
}
getMvpView().removeFail(e.getMessage());
}
});
}
public CharSequence getExitTips(Context context) {
MessageView.SpannableBuilder builder = new MessageView.SpannableBuilder(null);
builder.append("退出将解除关系并")
.append("退出群聊", new ForegroundColorSpan(
ContextCompat.getColor(context, R.color.appColor)))
.append(", 此操作")
.append("需要厅主审核", new ForegroundColorSpan(
ContextCompat.getColor(context, R.color.appColor)))
.append(", 你真的要退出吗?");
return builder.build();
}
public SpannableString getRemoveTips(Context context, int targetRoleType, String targetNick) {
String message;
if (targetRoleType == 2) {
message = targetNick + "为高管,移除将清除数据和权限并退出群聊,确认移除吗?";
} else if (targetRoleType == 3) {
message = "移除" + targetNick + "将清除数据并退出群聊,\n确认移除吗?";
} else {
message = "";
}
SpannableString spannableString = new SpannableString(message);
ForegroundColorSpan colorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_333333));
ForegroundColorSpan colorSpan1 = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.appColor));
if (targetRoleType == 2) {
spannableString.setSpan(colorSpan1, 0, targetNick.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
spannableString.setSpan(colorSpan, targetNick.length(), message.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} else if (targetRoleType == 3) {
spannableString.setSpan(colorSpan, 0, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
spannableString.setSpan(colorSpan1, 2, 2 + targetNick.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
spannableString.setSpan(colorSpan, 2 + targetNick.length(), message.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return spannableString;
}
}

View File

@@ -1,5 +1,7 @@
package com.yizhuan.erban.module_hall.hall.view;
import com.yizhuan.xchat_android_core.module_hall.hall.bean.AuthInfo;
import com.yizhuan.xchat_android_core.module_hall.hall.bean.MemberInfo;
import com.yizhuan.xchat_android_core.module_hall.hall.bean.OptionInfo;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
@@ -13,4 +15,17 @@ public interface IModuleHallView extends IMvpBaseView{
void hallMenusByUidSuccess(List<OptionInfo> optionInfoList);
void hallMenusByUidFail(String message);
//成员列表
void getHallAuthsSuccess(List<AuthInfo> authInfoList);
void getHallAuthsFail(String message);
void quitSuccess(String message);
void quitFail(String message);
void getAllMembersSuccess(List<MemberInfo> memberInfoList);
void getAllMembersFail(String message);
void removeSuccess(String message);
void removeFail(String message);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 826 B

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#f0f0f0" />
<solid android:color="#f4f4f4" />
<corners android:radius="19dp"/>

View File

@@ -5,23 +5,26 @@
android:orientation="vertical"
android:background="@color/white">
<com.yizhuan.erban.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</com.yizhuan.erban.base.TitleBar>
<RelativeLayout
android:id="@+id/rl_search"
android:layout_width="match_parent"
android:layout_height="35dp">
android:layout_height="35dp"
android:layout_marginTop="7dp">
<ImageView
android:id="@+id/iv_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/icon_arrow_left_black"
android:paddingStart="15dp"
android:paddingEnd="8dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="55dp"
android:layout_toEndOf="@id/iv_back"
android:layout_marginStart="@dimen/dp_10"
android:background="@drawable/bg_member_search_edit">
<ImageView
@@ -33,7 +36,7 @@
<EditText
android:id="@+id/et_search"
android:hint="搜索成员昵称/66星球ID"
android:hint="搜索用户昵称/66"
android:textSize="@dimen/sp_13"
android:textColor="@color/color_333333"
android:textColorHint="@color/color_999999"
@@ -49,7 +52,7 @@
android:id="@+id/tv_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/appColor"
android:textColor="#343434"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="15dp"

View File

@@ -4,90 +4,227 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context="com.yizhuan.erban.module_hall.hall.activity.ModuleHallActivity">
<com.yizhuan.erban.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</com.yizhuan.erban.base.TitleBar>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
>
<ImageView
android:id="@+id/iv_avatar_bg"
android:layout_width="match_parent"
android:layout_height="228dp"
android:scaleType="centerCrop"
/>
<View
android:layout_width="match_parent"
android:layout_height="228dp"
android:background="@mipmap/bg_userinfo_photo_cover"
/>
</FrameLayout>
<androidx.appcompat.widget.Toolbar
android:id="@+id/tb_hall"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:visibility="visible"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
app:layout_constraintTop_toTopOf="parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<ImageView
android:id="@+id/iv_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="@drawable/icon_user_back" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="@color/white"
android:textSize="18sp"
android:visibility="visible" />
<ImageView
android:id="@+id/iv_setting"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_setting" />
<TextView
android:id="@+id/tv_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:textColor="@color/color_999999"
android:visibility="gone"
android:textSize="@dimen/sp_13"
android:text="编辑"
/>
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
<!-- <com.yizhuan.erban.base.TitleBar-->
<!-- android:id="@+ide.hdodenhof:circleimageviewd/title_bar"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_constraintTop_toTopOf="parent">-->
<!-- </com.yizhuan.erban.base.TitleBar>-->
<com.yizhuan.erban.common.widget.CircleImageView
android:id="@+id/iv_avatar"
android:layout_width="75dp"
android:layout_height="75dp"
app:layout_constraintTop_toBottomOf="@id/tb_hall"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_20"
android:src="@drawable/nim_avatar_default"
app:civ_border_color="@color/black"
app:civ_border_width="5dp"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@id/iv_avatar"
app:layout_constraintTop_toTopOf="@id/iv_avatar"
android:orientation="vertical"
android:layout_marginStart="@dimen/dp_20"
app:layout_constraintBottom_toBottomOf="@id/iv_avatar"
>
<TextView
android:id="@+id/tv_owner_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="我是会长"
android:textColor="@color/white"
android:textSize="@dimen/sp_18"
/>
<TextView
android:id="@+id/tv_owner_uid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="66号:3979655"
android:textSize="@dimen/sp_11"
android:textColor="@color/white"
android:layout_marginTop="@dimen/dp_6"
/>
<TextView
android:id="@+id/tv_hall_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="公会ID:123456"
android:textSize="@dimen/sp_11"
android:textColor="@color/white"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_option"
app:layout_constraintTop_toBottomOf="@id/title_bar"
app:layout_constraintTop_toBottomOf="@id/iv_avatar"
android:layout_marginTop="@dimen/dp_30"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View
android:id="@+id/v_divider_one"
<LinearLayout
android:id="@+id/ll_member_list"
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="@color/color_F8F8F8"
app:layout_constraintTop_toBottomOf="@id/rv_option" />
android:layout_height="wrap_content"
android:background="@drawable/bg_corner_shadow_12"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_13"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/rv_option"
<RelativeLayout
android:id="@+id/rl_group_title"
app:layout_constraintTop_toBottomOf="@id/v_divider_one"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_333333"
android:textSize="18dp"
android:textStyle="bold"
android:text="@string/lu_label_group_chat" />
<TextView
android:id="@+id/tv_create_group"
android:text="@string/lu_label_group_create"
android:textColor="@color/appColor"
android:textSize="14dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<View
android:id="@+id/v_divider"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
app:layout_constraintTop_toBottomOf="@id/rl_group_title"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/color_F8F8F8" />
<com.yizhuan.erban.common.widget.StatusLayout
android:id="@+id/status_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/v_divider"
app:layout_constraintBottom_toBottomOf="parent"
>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/srl_group"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/tv_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/color_333333"
android:textSize="15dp"
android:text="总人数:0人"
android:paddingStart="14dp"
android:paddingEnd="14dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_weight="1"
android:layout_marginEnd="@dimen/dp_10"
/>
<ImageView
android:id="@+id/iv_hall_member_search"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/ic_hall_member_search"
android:padding="@dimen/dp_5"
android:layout_gravity="end"
/>
<ImageView
android:id="@+id/iv_hall_member_more"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/dp_5"
android:src="@drawable/ic_hall_member_more"
android:layout_gravity="end"
android:layout_marginEnd="@dimen/dp_10"
/>
</LinearLayout>
<com.yizhuan.erban.common.widget.StatusLayout
android:id="@+id/status_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/srl_group"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content">
</androidx.recyclerview.widget.RecyclerView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</com.yizhuan.erban.common.widget.StatusLayout>
</com.yizhuan.erban.common.widget.StatusLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -37,6 +37,7 @@
android:layout_height="wrap_content"
android:layout_toStartOf="@id/tv_send"
android:layout_toEndOf="@id/rl_avatar"
android:gravity="center"
android:orientation="horizontal">
<TextView
@@ -50,8 +51,8 @@
<ImageView
android:id="@+id/sex"
android:layout_width="17dp"
android:layout_height="17dp"
android:layout_width="wrap_content"
android:layout_height="14dp"
android:layout_marginStart="3dp"
android:src="@drawable/ic_gender_female" />
@@ -66,20 +67,22 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_user_level"
android:layout_width="41dp"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="3dp"
android:layout_marginEnd="2dp"
android:visibility="gone"
tools:visibility="visible"
tools:src="@mipmap/ic_user_level" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_user_charm_level"
android:layout_width="41dp"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginStart="3dp"
android:layout_marginEnd="2dp"
android:visibility="gone"
tools:visibility="visible"
tools:src="@mipmap/ic_user_level" />
</LinearLayout>
@@ -118,8 +121,8 @@
android:id="@+id/erban_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_999999"
android:textSize="12sp"
android:textColor="#9A9A9A"
android:textSize="13sp"
tools:text="ID:8888" />
</LinearLayout>

View File

@@ -26,6 +26,7 @@ import butterknife.OnClick;
public class RoomNewbieMessageActivity extends BaseActivity implements View.OnClickListener {
private boolean mIsInRoom;
private long lastClickTime;
public static void start(Context context,int uid,boolean isInRoom) {
Intent starter = new Intent(context, RoomNewbieMessageActivity.class);
starter.putExtra("uid",uid);
@@ -92,6 +93,12 @@ public class RoomNewbieMessageActivity extends BaseActivity implements View.OnCl
break;
case R.id.tv_send:
//防双击
long currTime = System.currentTimeMillis();
if (currTime - lastClickTime < 1000) {
return;
}
lastClickTime = currTime;
EventBus.getDefault().post(new SendHelloEvent());
break;
default:

View File

@@ -3,18 +3,14 @@ package com.yizhuan.xchat_android_core.room.giftvalue.helper;
import android.annotation.SuppressLint;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.util.LongSparseArray;
import android.util.SparseArray;
import com.huawei.multimedia.audiokit.utils.LogUtils;
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
import com.orhanobut.logger.Logger;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomGiftValueAttachment;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
@@ -27,16 +23,12 @@ import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
import com.yizhuan.xchat_android_library.utils.JavaUtil;
import com.yizhuan.xchat_android_library.utils.ListUtils;
import com.yizhuan.xchat_android_library.utils.LogUtil;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;

View File

@@ -21,5 +21,5 @@ with_jenkins=false
#\u6253\u652F\u6301x86\u7684\u6A21\u62DF\u5668\u5305\u4F7F\u7528
ndk_abi_filters=arm
version_name=1.4.0
version_code=140
version_name=1.4.1
version_code=141