家族和公会主页代码整理
This commit is contained in:
@@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
@@ -16,31 +15,22 @@ import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
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.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.erban.databinding.ActivityModuleClanBinding;
|
||||
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.hall.adapter.HallListAdapter;
|
||||
import com.yizhuan.erban.module_hall.hall.presenter.ModuleHallPresenter;
|
||||
import com.yizhuan.erban.module_hall.hall.view.IModuleHallView;
|
||||
import com.yizhuan.erban.module_hall.hall.view.dialog.HallMenuDialog;
|
||||
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate;
|
||||
import com.yizhuan.erban.ui.widget.ButtonItem;
|
||||
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.ClanInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.HallInfo;
|
||||
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.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
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.ListUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
@@ -52,12 +42,9 @@ import java.util.List;
|
||||
/**
|
||||
* 模厅界面
|
||||
*/
|
||||
@CreatePresenter(ModuleHallPresenter.class)
|
||||
public class ModuleClanActivity extends BaseMvpActivity<IModuleHallView, ModuleHallPresenter>
|
||||
implements IModuleHallView, View.OnClickListener {
|
||||
public class ModuleClanActivity extends BaseActivity implements View.OnClickListener {
|
||||
|
||||
private GroupMemberListAdapter mGroupMemberListAdapter;
|
||||
private List<AuthInfo> mAuthInfoList;
|
||||
|
||||
private HallListAdapter hallListAdapter;
|
||||
private RVDelegate<HallInfo> rvDelegate;
|
||||
@@ -67,7 +54,6 @@ public class ModuleClanActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
private int page = 100;
|
||||
private final int pageSize = 20;
|
||||
private boolean isLoading;
|
||||
private long lastClickTime;
|
||||
private final static String KEY_OTHER_UID = "key_other_uid";
|
||||
private boolean isSelfClan;
|
||||
private long otherUid;
|
||||
@@ -92,8 +78,6 @@ public class ModuleClanActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
binding = ActivityModuleClanBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
binding.ivHallMemberSearch.setOnClickListener(this);
|
||||
binding.ivHallMemberMore.setOnClickListener(this);
|
||||
binding.ivBack.setOnClickListener(this);
|
||||
binding.tvHallAdmin.setOnClickListener(this);
|
||||
binding.tvHallIncome.setOnClickListener(this);
|
||||
@@ -112,33 +96,18 @@ public class ModuleClanActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
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(ModuleClanActivity.this, memberInfo.getUid());
|
||||
}
|
||||
UIHelper.showUserInfoAct(ModuleClanActivity.this, memberInfo.getUid());
|
||||
}
|
||||
});
|
||||
mGroupMemberListAdapter.setOnLoadMoreListener(() -> loadMembers(false), binding.recyclerView);
|
||||
|
||||
binding.recyclerView.setAdapter(mGroupMemberListAdapter);
|
||||
setTvCount(0);
|
||||
if (isSelfClan) {
|
||||
getMvpPresenter().getHallAuths();
|
||||
if (HallDataManager.get().isClanElder()) {
|
||||
binding.llOption.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
binding.ivHallMemberSearch.setVisibility(View.GONE);
|
||||
if (isSelfClan && HallDataManager.get().isClanElder()) {
|
||||
binding.llOption.setVisibility(View.VISIBLE);
|
||||
}
|
||||
EventBus.getDefault().register(this);
|
||||
binding.nsvHall.setNestedScrollingEnabled(false);
|
||||
initClanAndHall();
|
||||
setMoreOption(HallDataManager.get().isManager() && isSelfClan);
|
||||
}
|
||||
|
||||
|
||||
@@ -207,19 +176,6 @@ public class ModuleClanActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
private void setMoreOption(boolean hasOption) {
|
||||
if (hasOption) {
|
||||
binding.ivHallMemberMore.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.ivHallMemberMore.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReloadDate() {
|
||||
@@ -227,31 +183,6 @@ public class ModuleClanActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
loadMembers(true);
|
||||
}
|
||||
|
||||
private long mTargetUid;
|
||||
|
||||
private void showRemoveDialog(long targetUid, int targetRoleType, String targetNick) {
|
||||
mTargetUid = targetUid;
|
||||
SpannableString spannableString = getMvpPresenter().getRemoveTips(this, targetRoleType, targetNick);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void loadMembers(boolean refresh) {
|
||||
page = refresh ? 1 : (page + 1);
|
||||
@@ -298,98 +229,13 @@ public class ModuleClanActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
|
||||
}
|
||||
|
||||
private int mCount;
|
||||
|
||||
private void setTvCount(int count) {
|
||||
mCount = count;
|
||||
binding.tvCount.setText("公会成员(" + mCount + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hallMenusByUidSuccess(List<OptionInfo> optionInfoList) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hallMenusByUidFail(String message) {
|
||||
}
|
||||
|
||||
@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);
|
||||
binding.tvCount.setText("公会成员(" + count + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.iv_hall_member_search:
|
||||
MemberSearchActivity.start(ModuleClanActivity.this);
|
||||
break;
|
||||
case R.id.iv_hall_member_more:
|
||||
//防双击
|
||||
long currTime = System.currentTimeMillis();
|
||||
if (currTime - lastClickTime < 1000) {
|
||||
return;
|
||||
}
|
||||
lastClickTime = currTime;
|
||||
moreOption(mAuthInfoList);
|
||||
break;
|
||||
case R.id.iv_back:
|
||||
finish();
|
||||
break;
|
||||
@@ -403,75 +249,6 @@ public class ModuleClanActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
}
|
||||
}
|
||||
|
||||
private void moreOption(List<AuthInfo> authInfoList) {
|
||||
if (authInfoList != null && authInfoList.size() > 0) {
|
||||
|
||||
List<ButtonItem> list_adapter = new ArrayList<>();
|
||||
for (AuthInfo authInfo : authInfoList) {
|
||||
if (authInfo.getCode().equals(AuthInfo.AUTH_APPLY_HALL_EXIT)) {
|
||||
continue;
|
||||
}
|
||||
if (authInfo.isOwnAuth()) {
|
||||
ButtonItem item = new ButtonItem(authInfo.getName(), () -> {
|
||||
jumpCode(authInfo.getCode());
|
||||
});
|
||||
list_adapter.add(item);
|
||||
}
|
||||
}
|
||||
getDialogManager().showCommonPopupDialog(list_adapter, "取消");
|
||||
|
||||
} else {
|
||||
toast("未分配权限");
|
||||
}
|
||||
}
|
||||
|
||||
private void jumpCode(String code) {
|
||||
switch (code) {
|
||||
case AuthInfo.AUTH_APPLY_HALL_EXIT:
|
||||
showExitDialog();
|
||||
break;
|
||||
|
||||
case AuthInfo.AUTH_MEMBER_JOIN_MANAGER:
|
||||
HallSearchActivity.start(context, AbstractSelectFriendAction.TYPE_MODULE_HALL);
|
||||
break;
|
||||
|
||||
case AuthInfo.AUTH_MEMBER_EXIT_MANAGER:
|
||||
RemoveMemberListActivity.start(ModuleClanActivity.this);
|
||||
break;
|
||||
|
||||
case AuthInfo.AUTH_HALL_MANAGER_SET:
|
||||
AdminListActivity.start(ModuleClanActivity.this);
|
||||
break;
|
||||
|
||||
case AuthInfo.AUTH_HALL_NAME_SET:
|
||||
HallNameSettingActivity.start(ModuleClanActivity.this);
|
||||
break;
|
||||
case AuthInfo.AUTH_HALL_CLAN_INCOME:
|
||||
if (clanInfo != null) {
|
||||
ClanIncomeActivity.start(this, clanInfo.getId());
|
||||
}
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -488,4 +265,11 @@ public class ModuleClanActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
super.setStatusBar();
|
||||
StatusBarUtil.transparencyBar(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,16 +6,9 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
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 androidx.core.widget.NestedScrollView;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
@@ -24,15 +17,14 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.UIHelper;
|
||||
import com.yizhuan.erban.base.BaseMvpActivity;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.databinding.ActivityModuleHallBinding;
|
||||
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.hall.adapter.OptionAdapter;
|
||||
import com.yizhuan.erban.module_hall.hall.presenter.ModuleHallPresenter;
|
||||
import com.yizhuan.erban.module_hall.hall.view.IModuleHallView;
|
||||
import com.yizhuan.erban.module_hall.hall.view.dialog.HallMenuDialog;
|
||||
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.erban.ui.widget.ButtonItem;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
|
||||
@@ -40,7 +32,6 @@ import com.yizhuan.xchat_android_core.module_hall.hall.bean.AuthInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.ClanInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.HallInfo;
|
||||
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.hall.bean.RoleType;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
@@ -53,48 +44,13 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
|
||||
/**
|
||||
* 模厅界面
|
||||
*/
|
||||
@CreatePresenter(ModuleHallPresenter.class)
|
||||
public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleHallPresenter>
|
||||
implements IModuleHallView {
|
||||
|
||||
@BindView(R.id.rv_option)
|
||||
RecyclerView mRvOption;
|
||||
@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.iv_hall_avatar)
|
||||
ImageView ivAvatar;
|
||||
@BindView(R.id.cl_hall)
|
||||
View clHall;
|
||||
@BindView(R.id.nsv_hall)
|
||||
NestedScrollView nsvHall;
|
||||
@BindView(R.id.tv_owner_clan)
|
||||
TextView tvOwnerClan;
|
||||
@BindView(R.id.iv_avatar_bg)
|
||||
ImageView ivAvatarBg;
|
||||
|
||||
private OptionAdapter mOptionAdapter;
|
||||
implements IModuleHallView, View.OnClickListener {
|
||||
|
||||
private GroupMemberListAdapter mGroupMemberListAdapter;
|
||||
private List<AuthInfo> mAuthInfoList;
|
||||
@@ -111,6 +67,8 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
private long ownerUid;
|
||||
private long otherUid;
|
||||
|
||||
private ActivityModuleHallBinding binding;
|
||||
|
||||
public static void start(Context context, long hallId, long ownerUid,long otherUid) {
|
||||
Intent intent = new Intent(context, ModuleHallActivity.class);
|
||||
intent.putExtra(KEY_HALL_ID, hallId);
|
||||
@@ -128,21 +86,25 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_module_hall);
|
||||
ButterKnife.bind(this);
|
||||
binding = ActivityModuleHallBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
binding.ivHallMemberSearch.setOnClickListener(this);
|
||||
binding.ivHallMemberMore.setOnClickListener(this);
|
||||
binding.ivBack.setOnClickListener(this);
|
||||
binding.ivSetting.setOnClickListener(this);
|
||||
hallId = getIntent().getLongExtra(KEY_HALL_ID, HallModel.get().getHallId());
|
||||
ownerUid = getIntent().getLongExtra(KEY_OWNER_UID, AuthModel.get().getCurrentUid());
|
||||
otherUid = getIntent().getLongExtra(KEY_OTHER_UID, AuthModel.get().getCurrentUid());
|
||||
isSelfHall = hallId == HallModel.get().getHallId();
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
mSrlGroup.setOnRefreshListener(() -> {
|
||||
binding.srlGroup.setOnRefreshListener(() -> {
|
||||
if (isLoading) {
|
||||
return;
|
||||
}
|
||||
loadMembers(true);
|
||||
});
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
mGroupMemberListAdapter = new GroupMemberListAdapter(this, null);
|
||||
mGroupMemberListAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
List<MemberInfo> memberInfoList = mGroupMemberListAdapter.getData();
|
||||
@@ -159,17 +121,16 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
}
|
||||
}
|
||||
});
|
||||
mGroupMemberListAdapter.setOnLoadMoreListener(() -> loadMembers(false), recyclerView);
|
||||
recyclerView.setAdapter(mGroupMemberListAdapter);
|
||||
mGroupMemberListAdapter.setOnLoadMoreListener(() -> loadMembers(false), binding.recyclerView);
|
||||
binding.recyclerView.setAdapter(mGroupMemberListAdapter);
|
||||
setTvCount(0);
|
||||
if (HallDataManager.get().isManager() && isSelfHall) {
|
||||
getMvpPresenter().getHallAuths();
|
||||
getMvpPresenter().getHallMenusByUid(AuthModel.get().getCurrentUid());
|
||||
} else {
|
||||
ivHallMemberSearch.setVisibility(View.GONE);
|
||||
binding.ivHallMemberSearch.setVisibility(View.GONE);
|
||||
}
|
||||
EventBus.getDefault().register(this);
|
||||
nsvHall.setNestedScrollingEnabled(false);
|
||||
binding.nsvHall.setNestedScrollingEnabled(false);
|
||||
initClanAndHall();
|
||||
setMoreOption(HallDataManager.get().isManager() && isSelfHall);
|
||||
}
|
||||
@@ -179,7 +140,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
//没有家族才更新顶部公会名,有的话重新加载公会列表
|
||||
HallDataManager.get().registerName(this, hallName -> {
|
||||
if (TextUtils.isEmpty(hallName)) return;
|
||||
tvTitle.setText(hallName);
|
||||
binding.tvTitle.setText(hallName);
|
||||
});
|
||||
|
||||
HallModel.get().getUserHallAndClan(ownerUid)
|
||||
@@ -187,28 +148,28 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
.subscribe(clanAndHallInfo -> {
|
||||
HallInfo hallInfo = clanAndHallInfo.getHall();
|
||||
ClanInfo clanInfo = clanAndHallInfo.getClan();
|
||||
if (clanInfo != null && clanInfo.getId() != 0) {
|
||||
tvOwnerClan.setVisibility(View.VISIBLE);
|
||||
tvOwnerClan.setOnClickListener(v -> ModuleClanActivity.start(context,otherUid));
|
||||
}
|
||||
/* if (clanInfo != null && clanInfo.getId() != 0) {
|
||||
binding.tvOwnerClan.setVisibility(View.VISIBLE);
|
||||
binding.tvOwnerClan.setOnClickListener(v -> ModuleClanActivity.start(context,otherUid));
|
||||
}*/
|
||||
setSettingOption(HallDataManager.get().getRoleType() != RoleType.OWNER || !isSelfHall);
|
||||
if (hallInfo != null && hallInfo.getHallId() != 0) {
|
||||
clHall.setVisibility(View.VISIBLE);
|
||||
clHall.setOnClickListener(v -> UserInfoActivity.Companion.start(context, hallInfo.getOwnerUid()));
|
||||
tvHallId.setText("公会ID:" + hallInfo.getHallId() + "");
|
||||
tvTitle.setText(hallInfo.getHallName());
|
||||
binding.clHall.setVisibility(View.VISIBLE);
|
||||
binding.clHall.setOnClickListener(v -> UserInfoActivity.Companion.start(context, hallInfo.getOwnerUid()));
|
||||
binding.tvHallId.setText("公会ID:" + hallInfo.getHallId() + "");
|
||||
binding.tvTitle.setText(hallInfo.getHallName());
|
||||
|
||||
GlideApp.with(ivAvatar.getContext())
|
||||
GlideApp.with(binding.ivHallAvatar.getContext())
|
||||
.load(hallInfo.getOwnerAvatar())
|
||||
.placeholder(R.drawable.default_avatar)
|
||||
.into(ivAvatar);
|
||||
.into(binding.ivHallAvatar);
|
||||
|
||||
GlideApp.with(ivAvatarBg.getContext())
|
||||
GlideApp.with(binding.ivAvatarBg.getContext())
|
||||
.load(hallInfo.getOwnerAvatar())
|
||||
.placeholder(R.drawable.default_avatar)
|
||||
.into(ivAvatarBg);
|
||||
.into(binding.ivAvatarBg);
|
||||
} else {
|
||||
clHall.setVisibility(View.GONE);
|
||||
binding.clHall.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -227,68 +188,20 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
*/
|
||||
private void setSettingOption(boolean gone) {
|
||||
if (gone) {
|
||||
ivSetting.setVisibility(View.GONE);
|
||||
binding.ivSetting.setVisibility(View.GONE);
|
||||
} else {
|
||||
ivSetting.setVisibility(View.VISIBLE);
|
||||
binding.ivSetting.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void setMoreOption(boolean hasOption) {
|
||||
if (hasOption) {
|
||||
ivHallMemberMore.setVisibility(View.VISIBLE);
|
||||
binding.ivHallMemberMore.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
ivHallMemberMore.setVisibility(View.GONE);
|
||||
binding.ivHallMemberMore.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void setTabOption(List<OptionInfo> tabList) {
|
||||
|
||||
if (tabList == null || tabList.size() == 0) {
|
||||
mRvOption.setVisibility(View.GONE);
|
||||
} else {
|
||||
mRvOption.setVisibility(View.VISIBLE);
|
||||
if (tabList.size() <= 2) {
|
||||
mRvOption.setLayoutManager(new GridLayoutManager(this, 2));
|
||||
} else {
|
||||
mRvOption.setLayoutManager(new GridLayoutManager(this, 3));
|
||||
}
|
||||
|
||||
mOptionAdapter = new OptionAdapter(this, tabList);
|
||||
mRvOption.setAdapter(mOptionAdapter);
|
||||
mOptionAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
List<OptionInfo> optionInfoList = mOptionAdapter.getData();
|
||||
OptionInfo optionInfo = optionInfoList.get(position);
|
||||
|
||||
// code --> url --> 原生
|
||||
if (OptionInfo.OPTION_LOOK_HALL_INCOME.equals(optionInfo.getCode())) {
|
||||
if (!TextUtils.isEmpty(optionInfo.getUrl())) {
|
||||
CommonWebViewActivity.start(ModuleHallActivity.this, optionInfo.getUrl());
|
||||
} else {
|
||||
IncomeStatisticsActivity.start(ModuleHallActivity.this);
|
||||
}
|
||||
} else if (OptionInfo.OPTION_HALL_BUILD.equals(optionInfo.getCode())) {
|
||||
Log.i("option", "do nothing");
|
||||
} else if (OptionInfo.OPTION_ADD_HALL_MEMBER_WITH_PWD.equals(optionInfo.getCode())) {
|
||||
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_HALL_ADDMEMBERS_CLICK,
|
||||
"添加成员-面板");
|
||||
HallSearchActivity.start(context, AbstractSelectFriendAction.TYPE_MODULE_HALL);
|
||||
|
||||
} else if (OptionInfo.OPTION_HALL_OWNER_ROOM_SERIAL.equals(optionInfo.getCode())) {
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_HALL_HALLINCOME_CLICK,
|
||||
"厅收入统计");
|
||||
String url = optionInfo.getUrl();
|
||||
if (!TextUtils.isEmpty(url))
|
||||
CommonWebViewActivity.start(ModuleHallActivity.this, optionInfo.getUrl());
|
||||
} else {
|
||||
toast("请更新到最新版本");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onReloadDate() {
|
||||
super.onReloadDate();
|
||||
@@ -327,7 +240,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
HallModel.get().getAllMembers(hallId, page, pageSize)
|
||||
.compose(RxHelper.bindActivity(this))
|
||||
.subscribe((listMemberInfo, throwable) -> {
|
||||
mSrlGroup.setRefreshing(false);
|
||||
binding.srlGroup.setRefreshing(false);
|
||||
isLoading = false;
|
||||
if (throwable != null) {
|
||||
Logger.i("模厅成员加载失败...");
|
||||
@@ -370,18 +283,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
|
||||
private void setTvCount(int count) {
|
||||
mCount = count;
|
||||
tvCount.setText("成员列表(" + mCount + "人)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hallMenusByUidSuccess(List<OptionInfo> optionInfoList) {
|
||||
setTabOption(optionInfoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hallMenusByUidFail(String message) {
|
||||
toast(message);
|
||||
setTabOption(null);
|
||||
binding.tvCount.setText("成员列表(" + mCount + "人)");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -445,8 +347,8 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
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) {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.iv_hall_member_search:
|
||||
MemberSearchActivity.start(ModuleHallActivity.this);
|
||||
@@ -499,7 +401,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
List<AuthInfo> authInfoList = new ArrayList<>();
|
||||
AuthInfo authInfo = new AuthInfo();
|
||||
authInfo.setCode("hall_name_set");
|
||||
authInfo.setName("设置公会名");
|
||||
authInfo.setName("设置房间名");
|
||||
authInfo.setStatus(1);
|
||||
authInfoList.add(authInfo);
|
||||
|
||||
@@ -513,7 +415,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
List<AuthInfo> authInfoList = new ArrayList<>();
|
||||
AuthInfo authInfo = new AuthInfo();
|
||||
authInfo.setCode(AuthInfo.AUTH_APPLY_HALL_EXIT);
|
||||
authInfo.setName("退出公会");
|
||||
authInfo.setName("退出房间");
|
||||
authInfo.setStatus(1);
|
||||
authInfoList.add(authInfo);
|
||||
|
||||
|
@@ -29,30 +29,6 @@ import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class ModuleHallPresenter extends BaseMvpPresenter<IModuleHallView>{
|
||||
|
||||
public void getHallMenusByUid(long uid) {
|
||||
HallModel.get().getHallMenusByUid(uid)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new SingleObserver<List<OptionInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<OptionInfo> optionInfoList) {
|
||||
getMvpView().hallMenusByUidSuccess(optionInfoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
if (getMvpView() == null) {
|
||||
return;
|
||||
}
|
||||
getMvpView().hallMenusByUidFail(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 成员列表
|
||||
*/
|
||||
|
@@ -13,9 +13,6 @@ import java.util.List;
|
||||
|
||||
public interface IModuleHallView extends IMvpBaseView{
|
||||
|
||||
void hallMenusByUidSuccess(List<OptionInfo> optionInfoList);
|
||||
void hallMenusByUidFail(String message);
|
||||
|
||||
//成员列表
|
||||
void getHallAuthsSuccess(List<AuthInfo> authInfoList);
|
||||
void getHallAuthsFail(String message);
|
||||
|
@@ -209,22 +209,6 @@
|
||||
android:textColor="@color/text_normal_c6c6e9"
|
||||
android:textSize="15dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_hall_member_search"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_hall_member_search" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_hall_member_more"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_hall_member_more"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
@@ -143,6 +143,7 @@
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:scaleType="center"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_hall_member_search" />
|
||||
|
||||
<ImageView
|
||||
|
Reference in New Issue
Block a user