diff --git a/app/src/main/java/com/yizhuan/erban/avroom/activity/RoomSettingActivity.java b/app/src/main/java/com/yizhuan/erban/avroom/activity/RoomSettingActivity.java index 1b8cfc19d..fb7537814 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/activity/RoomSettingActivity.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/activity/RoomSettingActivity.java @@ -9,15 +9,15 @@ import android.text.TextUtils; import android.view.View; import android.widget.CompoundButton; import android.widget.RelativeLayout; -import android.widget.TextView; +import androidx.annotation.Nullable; import androidx.databinding.DataBindingUtil; -import com.donkingliang.labels.LabelsView; import com.netease.nim.uikit.StatusBarUtil; import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder; import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage; import com.yizhuan.erban.R; +import com.yizhuan.erban.avroom.dialog.SelectLabelDialog; import com.yizhuan.erban.avroom.presenter.RoomSettingPresenter; import com.yizhuan.erban.avroom.view.IRoomSettingView; import com.yizhuan.erban.avroom.widget.EditRoomTitleDialog; @@ -39,6 +39,7 @@ import com.yizhuan.xchat_android_core.manager.RoomEvent; import com.yizhuan.xchat_android_core.room.bean.RoomInfo; import com.yizhuan.xchat_android_core.room.bean.RoomMessageViewNoticeInfo; import com.yizhuan.xchat_android_core.room.bean.RoomSettingTabInfo; +import com.yizhuan.xchat_android_core.room.bean.SingleRoomSortInfo; import com.yizhuan.xchat_android_core.room.giftvalue.GiftValueModel; import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg; import com.yizhuan.xchat_android_core.room.model.AvRoomModel; @@ -49,6 +50,7 @@ import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol; import com.yizhuan.xchat_android_core.utils.net.BeanObserver; import com.yizhuan.xchat_android_library.base.factory.CreatePresenter; import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack; +import com.yizhuan.xchat_android_library.utils.CommonUtils; import com.yizhuan.xchat_android_library.utils.JavaUtil; import com.yizhuan.xchat_android_library.utils.ListUtils; import com.yizhuan.xchat_android_library.utils.codec.DESUtils; @@ -60,6 +62,7 @@ import org.greenrobot.eventbus.ThreadMode; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import io.reactivex.SingleObserver; import io.reactivex.android.schedulers.AndroidSchedulers; @@ -71,21 +74,24 @@ import io.reactivex.disposables.Disposable; */ @CreatePresenter(RoomSettingPresenter.class) public class RoomSettingActivity extends BaseMvpActivity - implements LabelsView.OnLabelClickListener, View.OnClickListener, IRoomSettingView { + implements View.OnClickListener, IRoomSettingView { - private LabelsView labelsView; - private List labels; - private String selectLabel; private RelativeLayout managerLayout; private RelativeLayout blackLayout; private RelativeLayout mRoomBgLayout; - private RoomInfo roomInfo; - private View selectLabelView; - + private String selectLabel; private RoomSettingTabInfo mSelectTabInfo; - private List mTabInfoList; + private List tabInfoList; + + @Nullable + private Long singleRoomSortId; + @Nullable + private String singleRoomSortName; + @Nullable + private List sortInfoList; + private ActivityRoomSettingBinding binding; public static void start(Context context) { @@ -121,6 +127,9 @@ public class RoomSettingActivity extends BaseMvpActivity IMNetEaseManager.get().closeOpenScreen( data.getRoomId(), data)) @@ -538,35 +529,64 @@ public class RoomSettingActivity extends BaseMvpActivity tabInfoList) { - mTabInfoList = tabInfoList; + this.tabInfoList = tabInfoList; + getDialogManager().dismissDialog(); if (ListUtils.isListEmpty(tabInfoList)) { toast("房间标签为空"); return; } - labels = new ArrayList<>(); + List labels = new ArrayList<>(); for (RoomSettingTabInfo tabInfo : tabInfoList) { labels.add(tabInfo.getName()); } - labelsView.setLabels((ArrayList) labels); - if (roomInfo != null && !TextUtils.isEmpty(roomInfo.getRoomTag())) { - if (labels.contains(roomInfo.getRoomTag())) { - labelsView.setSelects(labels.indexOf(roomInfo.getRoomTag())); + new SelectLabelDialog(this, "房间标签", labels, roomInfo.getRoomTag(), (label, data, position) -> { + mSelectTabInfo = tabInfoList.get(position); + selectLabel = (String) data; + }, v -> { + //选择的是同一个则不处理 + if (TextUtils.isEmpty(selectLabel) || selectLabel.equals(roomInfo.getRoomTag())) { + return; } - } + save(null, null, selectLabel); + }).show(); } - @Override public void onResultRequestTagAllFail(String error) { + getDialogManager().dismissDialog(); toast(error); } @Override - public void updateRoomInfoSuccess(RoomInfo roomInfo) { + public void onResultRequestSingleRoomSortSuccess(List tabInfoList) { + sortInfoList = tabInfoList; + getDialogManager().dismissDialog(); + if (ListUtils.isListEmpty(tabInfoList)) { + toast("房间分类为空"); + return; + } + List labels = new ArrayList<>(); + for (SingleRoomSortInfo tabInfo : tabInfoList) { + labels.add(tabInfo.getSortName()); + } + new SelectLabelDialog(this, "房间分类", labels, roomInfo.getRoomTag(), (label, data, position) -> { + singleRoomSortId = tabInfoList.get(position).getId(); + singleRoomSortName = (String) data; + }, v -> { + //选择的是同一个则不处理 + if (TextUtils.isEmpty(singleRoomSortName) || Objects.equals(singleRoomSortName, roomInfo.getSortName())) { + return; + } + save(null, null, roomInfo.getRoomTag()); + }).show(); + } + @Override + public void onResultRequestSingleRoomSortFail(String error) { + getDialogManager().dismissDialog(); + toast(error); } @Override @@ -606,12 +626,6 @@ public class RoomSettingActivity extends BaseMvpActivity, + private val selectLabel: String?, + private val onLabelClickListener: LabelsView.OnLabelClickListener, + private val onSaveClickListener: View.OnClickListener +) : + BaseBindingDialog(context, R.style.dialog), + View.OnClickListener { + override fun init() { + binding.click = this + binding.tvTitle.text = title + binding.labelsView.setOnLabelClickListener(onLabelClickListener) + binding.labelsView.setLabels(labels) + if (labels.contains(selectLabel)) { + binding.labelsView.setSelects(labels.indexOf(selectLabel)) + } + } + + override fun onClick(v: View) { + when (v.id) { + R.id.tv_confirm -> { + onSaveClickListener.onClick(v) + dismiss() + } + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/yizhuan/erban/avroom/presenter/RoomSettingPresenter.java b/app/src/main/java/com/yizhuan/erban/avroom/presenter/RoomSettingPresenter.java index a4ee9ddf1..82952d900 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/presenter/RoomSettingPresenter.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/presenter/RoomSettingPresenter.java @@ -62,6 +62,20 @@ public class RoomSettingPresenter extends BaseMvpPresenter { }); } + @SuppressLint("CheckResult") + public void requestSingleRoomSort() { + model.requestSingleRoomSort() + .subscribe((date, throwable) -> { + IRoomSettingView roomSettingView = getMvpView(); + if (roomSettingView == null) return; + if (throwable != null) { + roomSettingView.onResultRequestSingleRoomSortFail(throwable.getMessage()); + } else { + roomSettingView.onResultRequestSingleRoomSortSuccess(date); + } + }); + } + public void requestRoomInfo(long uid) { model.requestRoomInfoFromService(uid + "", new CallBack() { @Override @@ -194,9 +208,9 @@ public class RoomSettingPresenter extends BaseMvpPresenter { } if (AvRoomDataManager.get().isRoomOwner()) { model.updateRoomPureModeForOwner(roomInfo.getTitle(), roomInfo.getRoomDesc(), - roomInfo.getIntroduction(), roomInfo.getRoomPwd(), roomInfo.getRoomTag(), - roomInfo.getTagId(), roomInfo.isHasAnimationEffect(), - roomInfo.getAudioQuality(), roomInfo.getLimitType(), isPureMode) + roomInfo.getIntroduction(), roomInfo.getRoomPwd(), roomInfo.getRoomTag(), + roomInfo.getTagId(), roomInfo.isHasAnimationEffect(), + roomInfo.getAudioQuality(), roomInfo.getLimitType(), isPureMode) .compose(bindToLifecycle()) .subscribe((roomInfo1, throwable) -> { if (throwable == null) { @@ -207,8 +221,8 @@ public class RoomSettingPresenter extends BaseMvpPresenter { }); } else if (AvRoomDataManager.get().isRoomAdmin()) { model.updateRoomPureMode(roomInfo.getUid(), roomInfo.getTitle(), roomInfo.getRoomDesc(), - roomInfo.getIntroduction(), roomInfo.getRoomPwd(), roomInfo.getRoomTag(), roomInfo.getTagId(), - roomInfo.isHasAnimationEffect(), roomInfo.getAudioQuality(), isPureMode) + roomInfo.getIntroduction(), roomInfo.getRoomPwd(), roomInfo.getRoomTag(), roomInfo.getTagId(), + roomInfo.isHasAnimationEffect(), roomInfo.getAudioQuality(), isPureMode) .compose(bindToLifecycle()) .subscribe((roomInfo1, throwable) -> { if (throwable == null) { diff --git a/app/src/main/java/com/yizhuan/erban/avroom/view/IRoomSettingView.java b/app/src/main/java/com/yizhuan/erban/avroom/view/IRoomSettingView.java index 8710de340..8233297c9 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/view/IRoomSettingView.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/view/IRoomSettingView.java @@ -2,6 +2,7 @@ package com.yizhuan.erban.avroom.view; import com.yizhuan.xchat_android_core.room.bean.RoomInfo; import com.yizhuan.xchat_android_core.room.bean.RoomSettingTabInfo; +import com.yizhuan.xchat_android_core.room.bean.SingleRoomSortInfo; import com.yizhuan.xchat_android_library.base.IMvpBaseView; import java.util.List; @@ -18,12 +19,12 @@ public interface IRoomSettingView extends IMvpBaseView { void onResultRequestTagAllFail(String error); - void updateRoomInfoSuccess(RoomInfo roomInfo); + void onResultRequestSingleRoomSortSuccess(List tabInfoList); + + void onResultRequestSingleRoomSortFail(String error); void reQuestRoomInfo(RoomInfo roomInfo); - void updateRoomInfoFail(String error); - void onSuccessToFinish(); void onFailToToast(String error); diff --git a/app/src/main/res/color/color_selectorffa936_false_666.xml b/app/src/main/res/color/color_selectorffa936_false_666.xml new file mode 100644 index 000000000..a91bd5a63 --- /dev/null +++ b/app/src/main/res/color/color_selectorffa936_false_666.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/bg_label.xml b/app/src/main/res/drawable/bg_label.xml index 886248098..c70589d3d 100644 --- a/app/src/main/res/drawable/bg_label.xml +++ b/app/src/main/res/drawable/bg_label.xml @@ -4,14 +4,15 @@ - + + - + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_room_setting.xml b/app/src/main/res/layout/activity_room_setting.xml index 3fc185a32..2e532a17e 100644 --- a/app/src/main/res/layout/activity_room_setting.xml +++ b/app/src/main/res/layout/activity_room_setting.xml @@ -10,66 +10,118 @@ type="android.view.View.OnClickListener" /> - + android:background="@color/bg_normal_1c1b22" + android:orientation="vertical"> - - + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/dp_30" /> - + + + android:orientation="vertical"> - + + + + + + + + + + + + + + + + + + - - - - - - - - - + android:layout_height="@dimen/dp_44" + android:drawableEnd="@drawable/arrow_right" + android:gravity="center_vertical" + android:onClick="@{click}" + android:paddingStart="@dimen/dp_15" + android:paddingEnd="@dimen/dp_15" + android:textColor="@color/text_title_white" + android:textSize="@dimen/sp_15" + tools:text="123456" /> - + - + - - + - + android:layout_centerVertical="true" + android:layout_marginLeft="15dp" + android:text="房间分类" + android:textColor="@color/text_title_white" + android:textSize="@dimen/sp_15" /> - + - + - + - - + - + - + - + - - + - + - - + - + + + + + + + + + + + + + + + + + + + + + + + + android:text="高品质音效" + android:textColor="@color/text_title_white" /> - + + - + - - + - + android:text="房间礼物特效" + android:textColor="@color/text_title_white" + android:textSize="@dimen/sp_15" /> - + + - + - - + - + - + + - - + - + + + android:text="@string/text_room_queuing_micro_mode" + android:textColor="@color/text_title_white" + android:textSize="@dimen/sp_15" /> - + + - + - - + - + android:layout_marginTop="@dimen/dp_13" + android:text="@string/text_room_pure_mode" + android:textColor="@color/text_title_white" + android:textSize="@dimen/dp_15" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:ignore="SpUsage" /> - - - - - - - - - - + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="@+id/tv_room_pure_mode" + app:layout_constraintTop_toBottomOf="@+id/tv_room_pure_mode" + tools:ignore="SpUsage" + tools:visibility="gone" /> - + + - - + + android:background="@color/line_353548" /> + android:minHeight="@dimen/dp_45"> + - - - - - - - - - - - - - - - - - - - - - - + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_select_label.xml b/app/src/main/res/layout/dialog_select_label.xml new file mode 100644 index 000000000..b2f2a95d0 --- /dev/null +++ b/app/src/main/res/layout/dialog_select_label.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_layout_room_lable.xml b/app/src/main/res/layout/include_layout_room_lable.xml deleted file mode 100644 index fe78e6250..000000000 --- a/app/src/main/res/layout/include_layout_room_lable.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 031e2d382..19a65c838 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -123,7 +123,7 @@ @android:color/transparent @android:color/transparent true - 0.8 + 0.5