新增家族游客模式

This commit is contained in:
huangjian
2020-12-04 16:35:17 +08:00
parent 13487729c0
commit 42d765ee50
3 changed files with 74 additions and 34 deletions

View File

@@ -366,7 +366,13 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
} else {
mBinding.llClan.setVisibility(View.GONE);
}
mBinding.llModuleHall.setOnClickListener(v -> {
if (hallInfo != null && hallInfo.getHallId() != 0 && hallInfo.getHallId() == HallDataManager.get().getHallId()) {
ModuleHallActivity.start(context);
} else {
ModuleHallActivity.start(context, userId);
}
});
});
}

View File

@@ -20,6 +20,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.netease.nim.uikit.StatusBarUtil;
import com.netease.nim.uikit.support.glide.GlideApp;
import com.orhanobut.logger.Logger;
import com.yizhuan.erban.R;
@@ -134,12 +135,20 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
private final int pageSize = 20;
private boolean isLoading;
private long lastClickTime;
private final static String KEY_OTHER_UID = "key_other_uid";
private boolean isSelf;
private long uid;
public static void start(Context context, long uid) {
Intent intent = new Intent(context, ModuleHallActivity.class);
intent.putExtra(KEY_OTHER_UID, uid);
context.startActivity(intent);
}
public static void start(Context context) {
StatisticManager.Instance().onEvent(BasicConfig.INSTANCE.getAppContext(),
StatisticsProtocol.Event.MY_HALL_CLICK, "我的厅入口", null);
Intent intent = new Intent(context, ModuleHallActivity.class);
context.startActivity(intent);
start(context, AuthModel.get().getCurrentUid());
}
@Override
@@ -147,7 +156,8 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_module_hall);
ButterKnife.bind(this);
uid = getIntent().getLongExtra(KEY_OTHER_UID, AuthModel.get().getCurrentUid());
isSelf = uid == AuthModel.get().getCurrentUid();
recyclerView.setLayoutManager(new LinearLayoutManager(this));
mSrlGroup.setOnRefreshListener(() -> {
@@ -159,9 +169,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
});
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) {
mGroupMemberListAdapter.setOnItemChildClickListener((adapter, view, position) -> {
List<MemberInfo> memberInfoList = mGroupMemberListAdapter.getData();
if (memberInfoList.size() > 0) {
MemberInfo memberInfo = memberInfoList.get(position);
@@ -175,18 +183,19 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
UIHelper.showUserInfoAct(ModuleHallActivity.this, memberInfo.getUid());
}
}
}
});
mGroupMemberListAdapter.setOnLoadMoreListener(this::loadMembers, recyclerView);
recyclerView.setAdapter(mGroupMemberListAdapter);
setTvCount(0);
if (isSelf) {
getMvpPresenter().getHallAuths();
getMvpPresenter().getHallMenusByUid(AuthModel.get().getCurrentUid());
getMvpPresenter().getHallMenusByUid(uid);
}
EventBus.getDefault().register(this);
nsvHall.setNestedScrollingEnabled(false);
initClanAndHall();
setMoreOption(HallDataManager.get().isManager());
setMoreOption(HallDataManager.get().isManager() && isSelf);
}
@@ -202,13 +211,15 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
}
});
HallModel.get().getUserHallAndClan(AuthModel.get().getCurrentUid())
HallModel.get().getUserHallAndClan(uid)
.compose(bindToLifecycle())
.subscribe(clanAndHallInfo -> {
if (isSelf) {
HallDataManager.get().updateHallInfo(clanAndHallInfo);
//如果用户只是族长而且不是会长,隐藏设置
setSettingOption(HallDataManager.get().isClanElder() &&
HallDataManager.get().getRoleType() != RoleType.OWNER);
}
//如果用户只是族长而且不是会长,隐藏设置,游客也需要隐藏
setSettingOption((HallDataManager.get().isClanElder() &&
HallDataManager.get().getRoleType() != RoleType.OWNER) || !isSelf);
clanInfo = clanAndHallInfo.getClan();
String bgUrl = "";
HallInfo hallInfo = clanAndHallInfo.getHall();
@@ -399,7 +410,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
@SuppressLint("CheckResult")
private void loadMembers() {
isLoading = true;
HallModel.get().getClanAllMembers(AuthModel.get().getCurrentUid(), page, pageSize)
HallModel.get().getClanAllMembers(uid, page, pageSize)
.compose(RxHelper.bindActivity(this))
.subscribe((listMemberInfo, throwable) -> {
mSrlGroup.setRefreshing(false);
@@ -650,4 +661,16 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
super.onResume();
onReloadDate();
}
@Override
protected boolean needSteepStateBar() {
return true;
}
@Override
protected void setStatusBar() {
super.setStatusBar();
StatusBarUtil.transparencyBar(this);
StatusBarUtil.StatusBarLightMode(this);
}
}

View File

@@ -19,18 +19,19 @@
<FrameLayout
android:id="@+id/fl_top_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="750:497"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_avatar_bg"
android:layout_width="match_parent"
android:layout_height="228dp"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<View
android:layout_width="match_parent"
android:layout_height="228dp"
android:layout_height="match_parent"
android:background="@mipmap/bg_userinfo_photo_cover" />
</FrameLayout>
@@ -39,7 +40,7 @@
android:id="@+id/cl_clan"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize"
android:layout_marginTop="80dp"
android:orientation="horizontal"
android:visibility="visible"
app:layout_constraintEnd_toStartOf="@id/cl_hall"
@@ -129,7 +130,7 @@
android:id="@+id/cl_hall"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize"
android:layout_marginTop="80dp"
android:orientation="horizontal"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
@@ -214,6 +215,13 @@
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="cl_clan,cl_hall" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_option"
android:layout_width="match_parent"
@@ -221,7 +229,8 @@
android:layout_marginTop="@dimen/dp_30"
android:paddingStart="10dp"
android:paddingEnd="10dp"
app:layout_constraintBottom_toBottomOf="@id/fl_top_bg"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/barrier"
tools:itemCount="1"
tools:listitem="@layout/item_tab_small" />
@@ -239,6 +248,7 @@
android:paddingBottom="17dp"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/rv_option"
app:layout_goneMarginTop="30dp"
tools:visibility="visible">
<TextView
@@ -331,7 +341,8 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/tb_hall"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:visibility="visible"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
@@ -339,7 +350,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_height="50dp"
android:paddingLeft="15dp"
android:paddingRight="15dp">