1.我的公会页面 会长族长权限判断
2.家族成员列表UI优化 3.新增公会成员列表页面
This commit is contained in:
@@ -1001,6 +1001,9 @@
|
||||
<activity
|
||||
android:name=".module_hall.hall.activity.ClanIncomeActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".module_hall.hall.activity.HallMemberListActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".module_hall.hall.activity.HallNameSettingActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
@@ -311,7 +311,7 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
|
||||
@SuppressLint({"CheckResult", "SetTextI18n"})
|
||||
private void initClanAndHall() {
|
||||
HallModel.get().getUserHallAndClan(AuthModel.get().getCurrentUid())
|
||||
HallModel.get().getUserHallAndClan(userId)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(clanAndHallInfo -> {
|
||||
HallInfo hallInfo = clanAndHallInfo.getHall();
|
||||
|
@@ -0,0 +1,113 @@
|
||||
package com.yizhuan.erban.module_hall.hall.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.erban.base.BaseMvpActivity;
|
||||
import com.yizhuan.erban.base.TitleBar;
|
||||
import com.yizhuan.erban.common.EmptyViewHelper;
|
||||
import com.yizhuan.erban.module_hall.hall.adapter.GroupMemberListAdapter;
|
||||
import com.yizhuan.erban.module_hall.hall.adapter.HallListAdapter;
|
||||
import com.yizhuan.erban.module_hall.hall.presenter.AdminListPresenter;
|
||||
import com.yizhuan.erban.module_hall.hall.view.IAdminListView;
|
||||
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.HallInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.ListMemberInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.MemberInfo;
|
||||
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
@CreatePresenter(AdminListPresenter.class)
|
||||
public class HallMemberListActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.refresh_layout)
|
||||
SwipeRefreshLayout refreshLayout;
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.tv_hall_member_num)
|
||||
TextView tvHallMemberNum;
|
||||
|
||||
private GroupMemberListAdapter mGroupMemberListAdapter;
|
||||
|
||||
private RVDelegate<MemberInfo> rvDelegate;
|
||||
|
||||
private static final String KEY_HALL_NAME = "hallName";
|
||||
private static final String KEY_HALL_ID = "hallId";
|
||||
|
||||
private String hallName;
|
||||
private long hallId;
|
||||
|
||||
private int page = 1;
|
||||
private final int pageSize = 20;
|
||||
|
||||
|
||||
public static void start(Context context, String hallName, long hallId) {
|
||||
Intent intent = new Intent(context, HallMemberListActivity.class);
|
||||
intent.putExtra(KEY_HALL_NAME, hallName);
|
||||
intent.putExtra(KEY_HALL_ID, hallId);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_hall_member_list);
|
||||
ButterKnife.bind(this);
|
||||
hallName = getIntent().getStringExtra(KEY_HALL_NAME);
|
||||
hallId = getIntent().getLongExtra(KEY_HALL_ID, 0);
|
||||
initTitleBar(hallName);
|
||||
rvDelegate = new RVDelegate.Builder<MemberInfo>()
|
||||
.setAdapter(mGroupMemberListAdapter = new GroupMemberListAdapter(this, null))
|
||||
.setLayoutManager(new LinearLayoutManager(this))
|
||||
.setPageSize(pageSize)
|
||||
.setEmptyView(EmptyViewHelper.createEmptyView(context, "暂无成员"))
|
||||
.setRefreshLayout(refreshLayout)
|
||||
.setRecyclerView(recyclerView)
|
||||
.build();
|
||||
mGroupMemberListAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
MemberInfo memberInfo = mGroupMemberListAdapter.getItem(position);
|
||||
if (memberInfo != null) {
|
||||
UserInfoActivity.Companion.start(context, memberInfo.getUid());
|
||||
}
|
||||
});
|
||||
mGroupMemberListAdapter.setOnLoadMoreListener(() -> loadData(false), recyclerView);
|
||||
refreshLayout.setOnRefreshListener(() -> loadData(true));
|
||||
loadData(true);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void loadData(boolean refresh) {
|
||||
if (refresh) {
|
||||
page = 1;
|
||||
} else {
|
||||
page++;
|
||||
}
|
||||
HallModel.get().getAllMembers(hallId, page, pageSize)
|
||||
.compose(bindToLifecycle())
|
||||
.doOnError(e -> rvDelegate.loadErr(refresh))
|
||||
.subscribe(listMemberInfo -> {
|
||||
tvHallMemberNum.setText(String.valueOf(listMemberInfo.getCount()));
|
||||
rvDelegate.loadData(listMemberInfo.getMembers(), refresh);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@@ -150,8 +150,6 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
setContentView(R.layout.activity_module_hall);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
initTitle();
|
||||
|
||||
mRvOption.addItemDecoration(new SpacingDecoration(
|
||||
Utils.dip2px(this, 15),
|
||||
Utils.dip2px(this, 15),
|
||||
@@ -208,6 +206,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
HallModel.get().getUserHallAndClan(AuthModel.get().getCurrentUid())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(clanAndHallInfo -> {
|
||||
ivSetting.setVisibility(View.VISIBLE);
|
||||
String bgUrl = "";
|
||||
HallInfo hallInfo = clanAndHallInfo.getHall();
|
||||
if (hallInfo != null && hallInfo.getHallId() != 0) {
|
||||
@@ -223,6 +222,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
.load(hallInfo.getOwnerAvatar())
|
||||
.placeholder(R.drawable.default_avatar)
|
||||
.into(ivAvatar);
|
||||
initTitle();
|
||||
} else {
|
||||
clHall.setVisibility(View.GONE);
|
||||
}
|
||||
@@ -264,6 +264,12 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
.setPageSize(20)
|
||||
.setRecyclerView(rvHall)
|
||||
.build();
|
||||
hallListAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
HallInfo hallInfo = hallListAdapter.getItem(position);
|
||||
if (hallInfo != null) {
|
||||
HallMemberListActivity.start(context, hallInfo.getHallName(), hallInfo.getHallId());
|
||||
}
|
||||
});
|
||||
}
|
||||
llHallList.setVisibility(View.VISIBLE);
|
||||
tvClanMemberCount.setText("公会列表(" + hallInfos.size() + ")");
|
||||
@@ -278,11 +284,6 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
}
|
||||
|
||||
private void initTitle() {
|
||||
HallDataManager.get().registerName(this, name -> {
|
||||
if (!TextUtils.isEmpty(name)) {
|
||||
tvTitle.setText(name);
|
||||
}
|
||||
});
|
||||
isHallOwner = HallDataManager.get().getRole() == 1;
|
||||
isHallAdmin = HallDataManager.get().getRole() == 2;
|
||||
setSearchOption(isHallOwner, isHallAdmin);
|
||||
|
@@ -11,8 +11,12 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.module_hall.HallDataManager;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.utils.RegexUtil;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.level.UserLevelVo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.MemberInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.RoleType;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -32,6 +36,8 @@ public class GroupMemberListAdapter extends BaseQuickAdapter<MemberInfo, BaseVie
|
||||
private Context context;
|
||||
private int mType = 0;
|
||||
|
||||
private boolean isClanOwner;
|
||||
|
||||
public GroupMemberListAdapter(Context context, List<MemberInfo> homeRoomList) {
|
||||
super(R.layout.item_member);
|
||||
this.context = context;
|
||||
@@ -46,7 +52,15 @@ public class GroupMemberListAdapter extends BaseQuickAdapter<MemberInfo, BaseVie
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder holder, MemberInfo item) {
|
||||
protected void convert(@NotNull BaseViewHolder holder, MemberInfo item) {
|
||||
boolean isClanLeader = item.getRoleType() == RoleType.CLAN_OWNER || item.getRoleType() == RoleType.CLAN_HALL_OWNER;
|
||||
|
||||
//族长都是在第一个的,后面的不会有问题的,就是这样的
|
||||
if (holder.getLayoutPosition() == 0 && isClanLeader) {
|
||||
isClanOwner = item.getUid() == AuthModel.get().getCurrentUid();
|
||||
}
|
||||
holder.setGone(R.id.tv_in_hall_name, isClanOwner && !TextUtils.isEmpty(item.getHallName()))
|
||||
.setText(R.id.tv_in_hall_name, item.getHallName());
|
||||
String nick = item.getNick() != null ? item.getNick().replaceAll(RegexUtil.getNotPrintableStringReg(), "?") : "";
|
||||
|
||||
if (!TextUtils.isEmpty(nick) && nick.length() > 8)
|
||||
@@ -56,14 +70,18 @@ public class GroupMemberListAdapter extends BaseQuickAdapter<MemberInfo, BaseVie
|
||||
ImageView avatar = holder.getView(R.id.iv_avatar);
|
||||
ImageLoadUtils.loadAvatar(mContext, item.getAvatar(), avatar, true);
|
||||
|
||||
if (item.getRoleType() == 1) {
|
||||
if (item.getRoleType() == RoleType.OWNER) {
|
||||
holder.setVisible(R.id.iv_type, true);
|
||||
holder.setImageResource(R.id.iv_type, R.drawable.ic_hall_owner);
|
||||
|
||||
} else if (item.getRoleType() == 2) {
|
||||
holder.setImageResource(R.id.iv_type, R.drawable.bg_hall_owner);
|
||||
} else if (item.getRoleType() == RoleType.ADMIN) {
|
||||
holder.setVisible(R.id.iv_type, true);
|
||||
holder.setImageResource(R.id.iv_type, R.drawable.label_hall_manager);
|
||||
|
||||
holder.setImageResource(R.id.iv_type, R.drawable.bg_hall_manager);
|
||||
} else if (item.getRoleType() == RoleType.CLAN_OWNER) {
|
||||
holder.setVisible(R.id.iv_type, true);
|
||||
holder.setImageResource(R.id.iv_type, R.drawable.bg_clan_owner);
|
||||
} else if (item.getRoleType() == RoleType.CLAN_HALL_OWNER) {
|
||||
holder.setVisible(R.id.iv_type, true);
|
||||
holder.setImageResource(R.id.iv_type, R.drawable.bg_clan_and_hall_owner);
|
||||
} else
|
||||
holder.setVisible(R.id.iv_type, false);
|
||||
|
||||
@@ -110,22 +128,20 @@ public class GroupMemberListAdapter extends BaseQuickAdapter<MemberInfo, BaseVie
|
||||
|
||||
else if (mType == TYPE_SEARCH) {
|
||||
holder.addOnClickListener(R.id.container);
|
||||
setRemove(holder,false);
|
||||
setRemove(holder, false);
|
||||
setNext(holder, false);
|
||||
setCheck(holder, false, false);
|
||||
|
||||
} else {
|
||||
holder.addOnClickListener(R.id.container);
|
||||
setRemove(holder,false);
|
||||
setRemove(holder, false);
|
||||
setNext(holder, false);
|
||||
setCheck(holder, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param isRemove
|
||||
* true 当前页展示移除按钮
|
||||
* @param isRemove true 当前页展示移除按钮
|
||||
*/
|
||||
private void setRemove(BaseViewHolder holder, boolean isRemove) {
|
||||
holder.setVisible(R.id.iv_remove, isRemove);
|
||||
@@ -135,9 +151,7 @@ public class GroupMemberListAdapter extends BaseQuickAdapter<MemberInfo, BaseVie
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param isNext
|
||||
* true 当前页展示 箭头按钮
|
||||
* @param isNext true 当前页展示 箭头按钮
|
||||
*/
|
||||
private void setNext(BaseViewHolder holder, boolean isNext) {
|
||||
holder.setVisible(R.id.iv_arrow, isNext);
|
||||
@@ -146,11 +160,8 @@ public class GroupMemberListAdapter extends BaseQuickAdapter<MemberInfo, BaseVie
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param isCheck
|
||||
* true 当前页展示是否选中按钮
|
||||
* @param isChecked
|
||||
* true 选中,false 未选中
|
||||
* @param isCheck true 当前页展示是否选中按钮
|
||||
* @param isChecked true 选中,false 未选中
|
||||
*/
|
||||
private void setCheck(BaseViewHolder holder, boolean isCheck, boolean isChecked) {
|
||||
holder.setVisible(R.id.iv_check, isCheck);
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,68 @@
|
||||
<?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"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<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>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:background="@color/color_f5f5f5"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:text="总人数:"
|
||||
android:textColor="#ff999999"
|
||||
android:textSize="11sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hall_member_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="#7154EE"
|
||||
android:textSize="11sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=" 人"
|
||||
android:textColor="#ff999999"
|
||||
android:textSize="11sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<com.yizhuan.erban.common.widget.StatusLayout
|
||||
android:id="@+id/status_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</com.yizhuan.erban.common.widget.StatusLayout>
|
||||
|
||||
</LinearLayout>
|
@@ -295,7 +295,8 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:padding="@dimen/dp_5"
|
||||
android:src="@drawable/ic_hall_member_search" />
|
||||
android:src="@drawable/ic_hall_member_search"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_hall_member_more"
|
||||
@@ -304,7 +305,8 @@
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:padding="@dimen/dp_5"
|
||||
android:src="@drawable/ic_hall_member_more" />
|
||||
android:src="@drawable/ic_hall_member_more"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -370,7 +372,8 @@
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/ic_setting" />
|
||||
android:src="@drawable/ic_setting"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_edit"
|
||||
|
@@ -8,24 +8,23 @@
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_avatar"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp">
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_centerInParent="true"
|
||||
tools:src="@drawable/default_user_head" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/ic_hall_owner"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -174,6 +173,21 @@
|
||||
android:src="@drawable/ic_hall_member_unchecked"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_in_hall_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/ll_name"
|
||||
android:layout_alignParentEnd="true"
|
||||
tools:text="所属公所属公会昵称会昵称"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:maxWidth="80dp"
|
||||
android:lines="1"
|
||||
android:ellipsize="end"
|
||||
android:textColor="#ff999999"
|
||||
android:textSize="13sp"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1px"
|
||||
@@ -182,4 +196,5 @@
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/color_F5F5F5" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
@@ -8,7 +8,9 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class HallInfo {
|
||||
|
||||
private long hallId;
|
||||
|
||||
private String hallName;
|
||||
/**
|
||||
* 厅角色 {@link RoleType}
|
||||
|
@@ -23,4 +23,6 @@ public class MemberInfo extends SimpleUserInfo implements Serializable {
|
||||
/**是否是选中*/
|
||||
private boolean select;
|
||||
|
||||
private String hallName;
|
||||
|
||||
}
|
||||
|
@@ -12,4 +12,8 @@ public interface RoleType {
|
||||
int ADMIN = 2;
|
||||
/**普通成员*/
|
||||
int NORMAL = 3;
|
||||
/**族长*/
|
||||
int CLAN_OWNER = 4;
|
||||
/**族长,会长*/
|
||||
int CLAN_HALL_OWNER = 5;
|
||||
}
|
||||
|
Reference in New Issue
Block a user