[Modify]加入房间功能实现
This commit is contained in:
@@ -475,14 +475,14 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
//設置透明度
|
||||
rollPagerView.setAnimationDurtion(500)
|
||||
bannerAdapter.notifyDataSetChanged()
|
||||
bannerAdapter.setRoomActClickListener(RoomActClickListener { url ->
|
||||
bannerAdapter.setRoomActClickListener { url ->
|
||||
StatisticManager.Instance()
|
||||
.onEvent(
|
||||
StatisticsProtocol.EVENT_ROOM_PROMOTE_CLICK,
|
||||
ResUtil.getString(R.string.avroom_fragment_baseroomfragment_03)
|
||||
)
|
||||
DialogWebViewActivity.start(mContext, url)
|
||||
})
|
||||
}
|
||||
|
||||
// 模擬指示器在viewpager底部效果
|
||||
val viewPager = rollPagerView.viewPager
|
||||
|
@@ -146,15 +146,15 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
|
||||
updatePkScoreBoard();
|
||||
initRoomPkOrder(AvRoomDataManager.get().showPkBeginTime, AvRoomDataManager.get().pkBeginTime);
|
||||
getMvpPresenter().getBannerList();
|
||||
if (!GoldBoxHelper.needIntegrateBoxEntrance()) {
|
||||
UserModel.get().getCurrentUserInfo()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(userInfo -> {
|
||||
if (userInfo.isFirstCharge()) {
|
||||
gameBinding.ivFirstChargeEnter.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
// if (!GoldBoxHelper.needIntegrateBoxEntrance()) {
|
||||
// UserModel.get().getCurrentUserInfo()
|
||||
// .compose(bindToLifecycle())
|
||||
// .subscribe(userInfo -> {
|
||||
// if (userInfo.isFirstCharge()) {
|
||||
// gameBinding.ivFirstChargeEnter.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
@@ -303,8 +303,8 @@ public class HomePartyPresenter extends BaseRoomPresenter<IHomePartyView> {
|
||||
mAvRoomModel.getRoomBanner()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(bannerInfos -> {
|
||||
final boolean firstCharge = UserUtils.getUserInfo().isFirstCharge();
|
||||
if (GoldBoxHelper.needIntegrateBoxEntrance()) {
|
||||
final boolean firstCharge = UserUtils.getUserInfo().isFirstCharge();
|
||||
if (firstCharge) {
|
||||
BannerInfo bannerInfo = new BannerInfo();
|
||||
bannerInfo.setFirstCharge(true);
|
||||
@@ -328,6 +328,11 @@ public class HomePartyPresenter extends BaseRoomPresenter<IHomePartyView> {
|
||||
getMvpView().onShowBanner(bannerInfos);
|
||||
}, throwable -> getMvpView().onShowBanner(bannerInfos));
|
||||
} else {
|
||||
if (firstCharge) {
|
||||
BannerInfo bannerInfo = new BannerInfo();
|
||||
bannerInfo.setFirstCharge(true);
|
||||
bannerInfos.add(0, bannerInfo);
|
||||
}
|
||||
getMvpView().onShowBanner(bannerInfos);
|
||||
}
|
||||
});
|
||||
|
@@ -8,6 +8,7 @@ import android.text.SpannableString;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
@@ -24,6 +25,7 @@ import com.yizhuan.erban.module_hall.HallDataManager;
|
||||
import com.yizhuan.erban.module_hall.hall.adapter.GroupMemberListAdapter;
|
||||
import com.yizhuan.erban.module_hall.hall.presenter.ModuleHallPresenter;
|
||||
import com.yizhuan.erban.module_hall.hall.view.IModuleHallView;
|
||||
import com.yizhuan.erban.module_hall.team.activity.HallTeamMessageActivity;
|
||||
import com.yizhuan.erban.ui.user.activity.UserInfoActivity;
|
||||
import com.yizhuan.erban.ui.widget.ButtonItem;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
@@ -31,10 +33,12 @@ 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.JoinRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.MemberInfo;
|
||||
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;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
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.ResUtil;
|
||||
@@ -74,6 +78,8 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
private long mTargetUid;
|
||||
private int mCount;
|
||||
|
||||
private JoinRoomInfo joinRoomInfo;
|
||||
|
||||
public static void start(Context context, long hallId, long ownerUid) {
|
||||
Intent intent = new Intent(context, ModuleHallActivity.class);
|
||||
intent.putExtra(KEY_HALL_ID, hallId);
|
||||
@@ -132,15 +138,82 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
setTvCount(0);
|
||||
EventBus.getDefault().register(this);
|
||||
binding.nsvHall.setNestedScrollingEnabled(false);
|
||||
|
||||
binding.tvJoinRoom.setOnClickListener(view -> {
|
||||
if(joinRoomInfo != null) {
|
||||
if (joinRoomInfo.getHallBtnStatus() == 3) {
|
||||
HallTeamMessageActivity.start(this, String.valueOf(joinRoomInfo.getHallMessageUid()));
|
||||
} else if (joinRoomInfo.getHallBtnStatus() == 1) {
|
||||
getDialogManager().showProgressDialog(context);
|
||||
HallModel.get().applyJoinHall(hallId)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new BeanObserver<String>() {
|
||||
@Override
|
||||
public void onErrorMsg(String error) {
|
||||
getDialogManager().dismissDialog();
|
||||
toast(error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
getDialogManager().dismissDialog();
|
||||
joinRoomInfo.setHallBtnStatus(2);
|
||||
binding.tvJoinRoom.setCompoundDrawablePadding(0);
|
||||
binding.tvJoinRoom.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
|
||||
binding.tvJoinRoom.setTextColor(ContextCompat.getColor(ModuleHallActivity.this, R.color.color_6D6B89));
|
||||
binding.tvJoinRoom.setBackgroundResource(R.drawable.bg_e6e6f0_15);
|
||||
binding.tvJoinRoom.setText(getString(R.string.delay_to_audit));
|
||||
toast(getString(R.string.apply_success_wait_to_join_room));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
initJoinRoom();
|
||||
initClanAndHall();
|
||||
loadMembers(true);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void initJoinRoom() {
|
||||
HallModel.get().getJoinRoom(hallId)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(joinRoomInfo -> {
|
||||
if (joinRoomInfo != null) {
|
||||
this.joinRoomInfo = joinRoomInfo;
|
||||
if (joinRoomInfo.getHallBtnStatus() == 0) {
|
||||
binding.tvJoinRoom.setVisibility(View.GONE);
|
||||
} else if (joinRoomInfo.getHallBtnStatus() == 1) {
|
||||
binding.tvJoinRoom.setVisibility(View.VISIBLE);
|
||||
binding.tvJoinRoom.setCompoundDrawablePadding(2);
|
||||
binding.tvJoinRoom.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(this, R.drawable.ic_hall_add), null, null, null);
|
||||
binding.tvJoinRoom.setTextColor(ContextCompat.getColor(this, R.color.color_white));
|
||||
binding.tvJoinRoom.setBackgroundResource(R.drawable.bg_common_confirm_15);
|
||||
binding.tvJoinRoom.setText(getString(R.string.join_room));
|
||||
} else if (joinRoomInfo.getHallBtnStatus() == 2) {
|
||||
binding.tvJoinRoom.setVisibility(View.VISIBLE);
|
||||
binding.tvJoinRoom.setCompoundDrawablePadding(0);
|
||||
binding.tvJoinRoom.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
|
||||
binding.tvJoinRoom.setTextColor(ContextCompat.getColor(this, R.color.color_6D6B89));
|
||||
binding.tvJoinRoom.setBackgroundResource(R.drawable.bg_e6e6f0_15);
|
||||
binding.tvJoinRoom.setText(getString(R.string.delay_to_audit));
|
||||
} else if (joinRoomInfo.getHallBtnStatus() == 3) {
|
||||
binding.tvJoinRoom.setVisibility(View.VISIBLE);
|
||||
binding.tvJoinRoom.setCompoundDrawablePadding(0);
|
||||
binding.tvJoinRoom.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
|
||||
binding.tvJoinRoom.setTextColor(ContextCompat.getColor(this, R.color.color_white));
|
||||
binding.tvJoinRoom.setBackgroundResource(R.drawable.bg_ffbc51_15);
|
||||
binding.tvJoinRoom.setText(getString(R.string.by_invitation));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint({"CheckResult", "SetTextI18n"})
|
||||
private void initClanAndHall() {
|
||||
HallModel.get().getUserHallAndClan(ownerUid)
|
||||
@@ -381,7 +454,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
if (authInfoList != null && authInfoList.size() > 0) {
|
||||
List<ButtonItem> list_adapter = new ArrayList<>();
|
||||
if (hallInfo != null) {
|
||||
if (HallDataManager.get().getRoleType() == RoleType.OWNER && isSelfHall && clanInfo != null && clanInfo.getElderUid() <=0) {
|
||||
if (HallDataManager.get().getRoleType() == RoleType.OWNER && isSelfHall && clanInfo != null && clanInfo.getElderUid() <= 0) {
|
||||
ButtonItem item = new ButtonItem(getString(R.string.join_clan), () -> {
|
||||
jumpCode(AuthInfo.AUTH_MEMBER_JOIN_CLAN);
|
||||
});
|
||||
|
@@ -190,6 +190,7 @@
|
||||
android:background="@drawable/bg_common_confirm_30"
|
||||
android:paddingStart="@dimen/dp_60"
|
||||
android:paddingEnd="@dimen/dp_60"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="@+id/ll_member_list"
|
||||
app:layout_constraintEnd_toEndOf="@+id/ll_member_list"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ll_member_list"/>
|
||||
|
@@ -12,6 +12,7 @@ import com.yizhuan.xchat_android_core.module_hall.hall.bean.ClanAndHallInfo;
|
||||
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.HallMenuByUidResult;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.JoinRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.ListMemberInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.OptionInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.OwnerHallInfo;
|
||||
@@ -353,6 +354,14 @@ public class HallModel extends BaseModel implements IHallModel {
|
||||
.compose(RxHelper.handleStringData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户加入房間
|
||||
*/
|
||||
@Override
|
||||
public Single<JoinRoomInfo> getJoinRoom(long hallId) {
|
||||
return api.getJoinRoom(hallId)
|
||||
.compose(RxHelper.handleCommon());
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
/**
|
||||
@@ -562,5 +571,11 @@ public class HallModel extends BaseModel implements IHallModel {
|
||||
@GET("/hall/superManager/listSuperManageInRoom")
|
||||
Single<ServiceResult<List<SuperAdminInfo>>> getRoomSuperAdminList(@Query("roomUid") long roomUid);
|
||||
|
||||
/**
|
||||
* 获取用户加入房間
|
||||
*/
|
||||
@GET("/hall/getApplyBtnStatus")
|
||||
Single<ServiceResult<JoinRoomInfo>> getJoinRoom(@Query("hallId") long hallId);
|
||||
|
||||
}
|
||||
}
|
@@ -5,6 +5,7 @@ import com.yizhuan.xchat_android_core.module_hall.hall.bean.ApplyResult;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.AuthInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.ClanAndHallInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.HallInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.JoinRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.ListMemberInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.OptionInfo;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.OwnerHallInfo;
|
||||
@@ -97,4 +98,7 @@ public interface IHallModel {
|
||||
Single<List<SuperAdminInfo>> getClanSuperAdminList(long clanId);
|
||||
|
||||
Single<String> removeSuperAdmin(long uid);
|
||||
|
||||
Single<JoinRoomInfo> getJoinRoom(long hallId);
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,7 @@
|
||||
package com.yizhuan.xchat_android_core.module_hall.hall.bean
|
||||
|
||||
data class JoinRoomInfo(
|
||||
val recordId: Long = 0,
|
||||
val hallMessageUid: Long = 0,
|
||||
var hallBtnStatus: Int = 0//0=不显示 1=可申请 2=待审核 3通过邀请
|
||||
)
|
Reference in New Issue
Block a user