新增家族游客模式

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 { } else {
mBinding.llClan.setVisibility(View.GONE); 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 androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.netease.nim.uikit.StatusBarUtil;
import com.netease.nim.uikit.support.glide.GlideApp; import com.netease.nim.uikit.support.glide.GlideApp;
import com.orhanobut.logger.Logger; import com.orhanobut.logger.Logger;
import com.yizhuan.erban.R; import com.yizhuan.erban.R;
@@ -134,12 +135,20 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
private final int pageSize = 20; private final int pageSize = 20;
private boolean isLoading; private boolean isLoading;
private long lastClickTime; 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) { public static void start(Context context) {
StatisticManager.Instance().onEvent(BasicConfig.INSTANCE.getAppContext(), StatisticManager.Instance().onEvent(BasicConfig.INSTANCE.getAppContext(),
StatisticsProtocol.Event.MY_HALL_CLICK, "我的厅入口", null); StatisticsProtocol.Event.MY_HALL_CLICK, "我的厅入口", null);
Intent intent = new Intent(context, ModuleHallActivity.class); start(context, AuthModel.get().getCurrentUid());
context.startActivity(intent);
} }
@Override @Override
@@ -147,7 +156,8 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_module_hall); setContentView(R.layout.activity_module_hall);
ButterKnife.bind(this); ButterKnife.bind(this);
uid = getIntent().getLongExtra(KEY_OTHER_UID, AuthModel.get().getCurrentUid());
isSelf = uid == AuthModel.get().getCurrentUid();
recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setLayoutManager(new LinearLayoutManager(this));
mSrlGroup.setOnRefreshListener(() -> { mSrlGroup.setOnRefreshListener(() -> {
@@ -159,9 +169,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
}); });
recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setLayoutManager(new LinearLayoutManager(this));
mGroupMemberListAdapter = new GroupMemberListAdapter(this, null); mGroupMemberListAdapter = new GroupMemberListAdapter(this, null);
mGroupMemberListAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() { mGroupMemberListAdapter.setOnItemChildClickListener((adapter, view, position) -> {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
List<MemberInfo> memberInfoList = mGroupMemberListAdapter.getData(); List<MemberInfo> memberInfoList = mGroupMemberListAdapter.getData();
if (memberInfoList.size() > 0) { if (memberInfoList.size() > 0) {
MemberInfo memberInfo = memberInfoList.get(position); MemberInfo memberInfo = memberInfoList.get(position);
@@ -175,18 +183,19 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
UIHelper.showUserInfoAct(ModuleHallActivity.this, memberInfo.getUid()); UIHelper.showUserInfoAct(ModuleHallActivity.this, memberInfo.getUid());
} }
} }
}
}); });
mGroupMemberListAdapter.setOnLoadMoreListener(this::loadMembers, recyclerView); mGroupMemberListAdapter.setOnLoadMoreListener(this::loadMembers, recyclerView);
recyclerView.setAdapter(mGroupMemberListAdapter); recyclerView.setAdapter(mGroupMemberListAdapter);
setTvCount(0); setTvCount(0);
if (isSelf) {
getMvpPresenter().getHallAuths(); getMvpPresenter().getHallAuths();
getMvpPresenter().getHallMenusByUid(AuthModel.get().getCurrentUid()); getMvpPresenter().getHallMenusByUid(uid);
}
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
nsvHall.setNestedScrollingEnabled(false); nsvHall.setNestedScrollingEnabled(false);
initClanAndHall(); 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()) .compose(bindToLifecycle())
.subscribe(clanAndHallInfo -> { .subscribe(clanAndHallInfo -> {
if (isSelf) {
HallDataManager.get().updateHallInfo(clanAndHallInfo); 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(); clanInfo = clanAndHallInfo.getClan();
String bgUrl = ""; String bgUrl = "";
HallInfo hallInfo = clanAndHallInfo.getHall(); HallInfo hallInfo = clanAndHallInfo.getHall();
@@ -399,7 +410,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private void loadMembers() { private void loadMembers() {
isLoading = true; isLoading = true;
HallModel.get().getClanAllMembers(AuthModel.get().getCurrentUid(), page, pageSize) HallModel.get().getClanAllMembers(uid, page, pageSize)
.compose(RxHelper.bindActivity(this)) .compose(RxHelper.bindActivity(this))
.subscribe((listMemberInfo, throwable) -> { .subscribe((listMemberInfo, throwable) -> {
mSrlGroup.setRefreshing(false); mSrlGroup.setRefreshing(false);
@@ -650,4 +661,16 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
super.onResume(); super.onResume();
onReloadDate(); 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 <FrameLayout
android:id="@+id/fl_top_bg" android:id="@+id/fl_top_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
app:layout_constraintDimensionRatio="750:497"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:id="@+id/iv_avatar_bg" android:id="@+id/iv_avatar_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="228dp" android:layout_height="match_parent"
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="228dp" android:layout_height="match_parent"
android:background="@mipmap/bg_userinfo_photo_cover" /> android:background="@mipmap/bg_userinfo_photo_cover" />
</FrameLayout> </FrameLayout>
@@ -39,7 +40,7 @@
android:id="@+id/cl_clan" android:id="@+id/cl_clan"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize" android:layout_marginTop="80dp"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="visible" android:visibility="visible"
app:layout_constraintEnd_toStartOf="@id/cl_hall" app:layout_constraintEnd_toStartOf="@id/cl_hall"
@@ -129,7 +130,7 @@
android:id="@+id/cl_hall" android:id="@+id/cl_hall"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize" android:layout_marginTop="80dp"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="visible" android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@@ -214,6 +215,13 @@
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </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 <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_option" android:id="@+id/rv_option"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -221,7 +229,8 @@
android:layout_marginTop="@dimen/dp_30" android:layout_marginTop="@dimen/dp_30"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingEnd="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:itemCount="1"
tools:listitem="@layout/item_tab_small" /> tools:listitem="@layout/item_tab_small" />
@@ -239,6 +248,7 @@
android:paddingBottom="17dp" android:paddingBottom="17dp"
android:visibility="gone" android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/rv_option" app:layout_constraintTop_toBottomOf="@id/rv_option"
app:layout_goneMarginTop="30dp"
tools:visibility="visible"> tools:visibility="visible">
<TextView <TextView
@@ -331,7 +341,8 @@
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/tb_hall" android:id="@+id/tb_hall"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="50dp"
android:layout_marginTop="20dp"
android:visibility="visible" android:visibility="visible"
app:contentInsetStart="0dp" app:contentInsetStart="0dp"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
@@ -339,7 +350,7 @@
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="50dp"
android:paddingLeft="15dp" android:paddingLeft="15dp"
android:paddingRight="15dp"> android:paddingRight="15dp">