公会推送消息修改

This commit is contained in:
wushaocheng
2022-11-09 20:23:42 +08:00
parent 867dad585c
commit e286d4dcd2
10 changed files with 166 additions and 4 deletions

View File

@@ -15,7 +15,10 @@ import com.yizhuan.erban.databinding.FragmentAssociationBinding
import com.yizhuan.erban.module_hall.hall.activity.ModuleClanActivity
import com.yizhuan.erban.ui.utils.RVDelegate
import com.yizhuan.xchat_android_core.association.ClanListInfo
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel
import com.yizhuan.xchat_android_core.utils.Logger
import com.yizhuan.xchat_android_core.utils.net.BeanObserver
import com.yizhuan.xchat_android_core.utils.net.RxHelper
import com.yizhuan.xchat_android_library.utils.ResUtil
@@ -44,6 +47,27 @@ class AssociationFragment : BaseViewBindingFragment<FragmentAssociationBinding>(
ModuleClanActivity.start(context, info.clanElderUid)
}
}
associationAdapter.setOnItemChildClickListener { adapter, view, position ->
val bean = associationAdapter.getItem(position)
bean?.let {
dialogManager.showProgressDialog(context)
HallModel.get().applyJoinClan(it.clanId.toLong())
.compose(RxHelper.bindFragment(this))
.subscribe(object : BeanObserver<String?>() {
override fun onErrorMsg(error: String) {
dialogManager.dismissDialog()
toast(error)
}
override fun onSuccess(s: String) {
dialogManager.dismissDialog()
it.applyBtnStatus = 2
associationAdapter.notifyItemChanged(position)
toast(s)
}
})
}
}
rvDelegate = RVDelegate.Builder<ClanListInfo>()
.setLayoutManager(LinearLayoutManager(context))
.setRecyclerView(binding.recyclerView)

View File

@@ -23,6 +23,7 @@ import com.yizhuan.xchat_android_library.utils.ResUtil
class AssociationActivity : BaseViewBindingActivity<ActivityAssociationBinding>() {
companion object {
@JvmStatic
fun start(context: Context) {
val intent = Intent(context, AssociationActivity::class.java)
context.startActivity(intent)

View File

@@ -4949,5 +4949,6 @@
<string name="clan_day"></string>
<string name="clan_week"></string>
<string name="clan_month"></string>
<string name="join_clan">加入公會</string>
</resources>

View File

@@ -19,6 +19,7 @@ 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.home.activity.AssociationActivity;
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;
@@ -28,6 +29,7 @@ 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.RoleType;
@@ -66,6 +68,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
@Nullable
private HallInfo hallInfo;
private ClanInfo clanInfo;
private ActivityModuleHallBinding binding;
private long mTargetUid;
@@ -143,6 +146,7 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
.compose(bindToLifecycle())
.subscribe(clanAndHallInfo -> {
HallInfo hallInfo = clanAndHallInfo.getHall();
clanInfo = clanAndHallInfo.getClan();
setManegeOption((HallDataManager.get().isManager() && isSelfHall) || clanAndHallInfo.isManageHall());
//高管是没有修改公会名称权限的,只有房主和超管才有
setSettingOption((HallDataManager.get().getRoleType() == RoleType.OWNER && isSelfHall) || clanAndHallInfo.isManageHall());
@@ -372,6 +376,14 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
private void moreOption(List<AuthInfo> authInfoList) {
if (authInfoList != null && authInfoList.size() > 0) {
List<ButtonItem> list_adapter = new ArrayList<>();
if (hallInfo != null) {
if (hallInfo.getRoleType() == 1 && clanInfo != null && clanInfo.getElderUid() > 0) {
ButtonItem item = new ButtonItem(getString(R.string.join_clan), () -> {
jumpCode(AuthInfo.AUTH_MEMBER_JOIN_CLAN);
});
list_adapter.add(item);
}
}
for (AuthInfo authInfo : authInfoList) {
if (authInfo.getCode().equals(AuthInfo.AUTH_APPLY_HALL_EXIT)) {
continue;
@@ -392,6 +404,10 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
private void jumpCode(String code) {
switch (code) {
case AuthInfo.AUTH_MEMBER_JOIN_CLAN:
AssociationActivity.start(this);
break;
case AuthInfo.AUTH_APPLY_HALL_EXIT:
showExitDialog();
break;

View File

@@ -34,6 +34,7 @@ import com.yizhuan.xchat_android_core.module_hall.im.HallImMsgInfo;
import com.yizhuan.xchat_android_core.module_hall.im.bean.HallMsgComponent;
import com.yizhuan.xchat_android_core.module_hall.im.bean.HallMsgLayout;
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
import com.yizhuan.xchat_android_library.utils.ResUtil;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import org.greenrobot.eventbus.EventBus;
@@ -56,6 +57,8 @@ public class ClanMsgViewHolder extends MsgViewHolderBase{
private TextView tvContent;
private View llOpLayout;
private SuperTextView stvReject;
private View llResultLayout;
private TextView tvResult;
public ClanMsgViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
@@ -74,6 +77,8 @@ public class ClanMsgViewHolder extends MsgViewHolderBase{
llOpLayout = findViewById(R.id.ll_op_layout);
tvContent = findViewById(R.id.tv_content);
clContainer = findViewById(R.id.cl_container);
llResultLayout = findViewById(R.id.ll_result_layout);
tvResult = findViewById(R.id.tv_result);
}
@Override
@@ -111,11 +116,12 @@ public class ClanMsgViewHolder extends MsgViewHolderBase{
stvReject.setVisibility(View.VISIBLE);
int second = attachment.getSecond();
if (second == CustomAttachment.CUSTOM_MSG_SUB_CLANAPPLY) { //申请加入
llOpLayout.setVisibility(View.VISIBLE);
handleClick(info, second);
setMsgTypeView(info, second);
} else if (second == CustomAttachment.CUSTOM_MSG_SUB_CLANNORMAL) {//其它文本通知
llResultLayout.setVisibility(View.GONE);
llOpLayout.setVisibility(View.GONE);
} else {
llResultLayout.setVisibility(View.GONE);
llOpLayout.setVisibility(View.GONE);
}
@@ -237,12 +243,22 @@ public class ClanMsgViewHolder extends MsgViewHolderBase{
}
private void setMsgTypeView(ClanImMsgInfo info, int second) {
llResultLayout.setVisibility(View.VISIBLE);
llOpLayout.setVisibility(View.GONE);
if (info.getType() == ClanImMsgInfo.MSG_TYPE_HAS_AGREE) {//已同意
tvResult.setText(ResUtil.getString(R.string.im_msgholder_hallmsgviewholder_01));
tvResult.setTextColor(Color.parseColor("#09BB07"));
} else if (info.getType() == ClanImMsgInfo.MSG_TYPE_HAS_REJECT) {//已拒绝
tvResult.setText(ResUtil.getString(R.string.im_msgholder_hallmsgviewholder_02));
tvResult.setTextColor(Color.parseColor("#FF3852"));
} else if (info.getType() == ClanImMsgInfo.MSG_TYPE_OUT_OF_DATE) {//已过期
tvResult.setText(ResUtil.getString(R.string.im_msgholder_hallmsgviewholder_03));
tvResult.setTextColor(Color.parseColor("#333333"));
} else if (info.getType() == ClanImMsgInfo.MSG_TYPE_HAS_HANDLE) {//已处理
tvResult.setText(ResUtil.getString(R.string.im_msgholder_hallmsgviewholder_04));
tvResult.setTextColor(Color.parseColor("#333333"));
} else {
llResultLayout.setVisibility(View.GONE);
llOpLayout.setVisibility(View.VISIBLE);
handleClick(info, second);
}

View File

@@ -7,9 +7,51 @@
android:gravity="bottom"
android:orientation="vertical">
<include
<LinearLayout
android:id="@+id/toolbar"
layout="@layout/timepicker_toolbar" />
android:orientation="horizontal"
android:background="@color/timepicker_toolbar_bg"
android:paddingTop="@dimen/dp_20"
android:paddingStart="@dimen/dp_5"
android:paddingEnd="@dimen/dp_5"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_cancel"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/timepicker_sel_text_item"
android:gravity="center"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:text="@string/picker_cancel"
android:textColor="@color/color_FFFFFF"
android:textSize="16sp"/>
<TextView
android:id="@+id/tv_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:gravity="center"
android:text="@string/picker_title"
android:textColor="@android:color/white"
android:textSize="16sp"/>
<TextView
android:id="@+id/tv_sure"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/timepicker_sel_text_item"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/picker_sure"
android:textColor="@android:color/white"
android:textSize="16sp"/>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:paddingTop="@dimen/dp_20"

View File

@@ -82,4 +82,33 @@
</LinearLayout>
<LinearLayout
android:id="@+id/ll_result_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_space">
<View
android:layout_marginStart="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_10"
android:background="@color/line_353548"
android:layout_width="match_parent"
android:layout_height="1px" />
<TextView
android:id="@+id/tv_result"
tools:text="@string/layout_layout_hall_msg_view_holder_03"
android:textSize="@dimen/sp_12"
android:textColor="@color/color_333333"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="40dp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -110,6 +110,23 @@ public class HallModel extends BaseModel implements IHallModel {
});
}
/**
* 申请加入公会
*/
@Override
public Single<String> applyJoinClan(long clanId) {
return api.applyClan(AuthModel.get().getCurrentUid(), clanId)
.compose(RxHelper.handleSchedulers())
.compose(RxHelper.handleException())
.flatMap(result -> {
if (result.isSuccess()) {
return Single.just(ResUtil.getString(R.string.module_hall_hall_hallmodel_02));
}
return Single.error(new Throwable(RxHelper.getValidMessage(result)));
});
}
/**
* 模厅审核
*/
@@ -346,6 +363,14 @@ public class HallModel extends BaseModel implements IHallModel {
Single<ServiceResult<Void>> applyHall(@Field("uid") long uid,
@Field("hallId") long hallId);
/**
* 申请加入公会
*/
@FormUrlEncoded
@POST("/clan/apply")
Single<ServiceResult<Void>> applyClan(@Field("uid") long uid,
@Field("clanId") long clanId);
/**
* 模厅审核
*

View File

@@ -30,6 +30,11 @@ public interface IHallModel {
*/
Single<String> applyJoinHall(long hallId);
/**
* 申请加入公会
*/
Single<String> applyJoinClan(long clanId);
/**
* 模厅审核
*/

View File

@@ -8,6 +8,8 @@ import lombok.Data;
@Data
public class AuthInfo implements Serializable {
/**加入公会*/
public final static String AUTH_MEMBER_JOIN_CLAN = "member_join_clan";
/**添加成员,同意成员加入*/
public final static String AUTH_MEMBER_JOIN_MANAGER = "member_join_manager";
/**移除成员,同意成员退出*/
@@ -29,6 +31,7 @@ public class AuthInfo implements Serializable {
/**表示能够处理的权限,为了兼容版本问题,过滤新版可能出现的新权限*/
public static List<String> canHandleAuth() {
List<String> list = new ArrayList<>();
list.add(AUTH_MEMBER_JOIN_CLAN);
list.add(AUTH_MEMBER_JOIN_MANAGER);
list.add(AUTH_MEMBER_EXIT_MANAGER);
list.add(AUTH_HALL_MANAGER_SET);