[BugFix]修复寻爱bug

This commit is contained in:
wushaocheng
2023-03-28 18:18:53 +08:00
parent 955c9ef277
commit 4d5d44649c
13 changed files with 204 additions and 29 deletions

View File

@@ -738,7 +738,7 @@ class RoomEffectView @JvmOverloads constructor(
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
)
.append(
ResUtil.getString(R.string.avroom_widget_roomeffectview_09) + attachment.boxTypeStr + ResUtil.getString(
ResUtil.getString(R.string.treasure_in_find_love) + ResUtil.getString(
R.string.avroom_widget_roomeffectview_010
), ForegroundColorSpan(Color.WHITE)
)

View File

@@ -85,7 +85,11 @@ class UserInfoInfoFragment : BaseViewBindingFragment<FragmentUserinfoUserinfoBin
binding.tvMore.setOnClickListener {
binding.tvMore.visibility = View.GONE
binding.llRoom.visibility = View.VISIBLE
binding.llAssociation.visibility = View.VISIBLE
if (clanInfo != null && clanInfo.id > 0) {
binding.llAssociation.visibility = View.VISIBLE
} else {
binding.llAssociation.visibility = View.GONE
}
}
}

View File

@@ -32,12 +32,14 @@ import com.yizhuan.treasure_box.model.BoxModel;
import com.yizhuan.treasure_box.model.IBoxModel;
import com.yizhuan.xchat_android_core.DemoCache;
import com.yizhuan.xchat_android_core.exception.FailReasonException;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.manager.RoomEvent;
import com.yizhuan.xchat_android_core.pay.PayModel;
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
import com.yizhuan.xchat_android_core.utils.StringUtils;
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
import com.yizhuan.xchat_android_library.common.util.SoftKeyboardStateHelper;
import com.yizhuan.xchat_android_library.utils.FormatUtils;
import com.yizhuan.xchat_android_library.utils.ResUtil;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
@@ -111,16 +113,27 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
loadKeyInfo();
looperPrize();
looperHintPrize();
new SoftKeyboardStateHelper(mBinding.editNum).addSoftKeyboardStateListener(new SoftKeyboardStateHelper.SoftKeyboardStateListener() {
@Override
public void onSoftKeyboardOpened(int keyboardHeightInPx) {
}
@Override
public void onSoftKeyboardClosed() {
int num = StringUtils.toInt(mBinding.editNum.getText().toString(), 0);
if(num == 0){
mBinding.editNum.setText("1");
mBinding.editNum.setSelection(1);
}
}
});
}
@SuppressLint("CheckResult")
private void loadKeyInfo() {
BoxModel.get()
.getKeyInfo(boxType)
.compose(bindToLifecycle())
.subscribe(keyInfo -> {
sendMessageSwitchLevel = keyInfo.getSendMessageSwitchLevel();
});
sendMessageSwitchLevel = AvRoomDataManager.get().mFindLoveSwitchVo.getSendMsgLevel();
}
@Override
@@ -169,9 +182,9 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
mBinding.ivOpen.setEnabled(true);
if (throwable instanceof FailReasonException) {
FailReasonException failReasonException = (FailReasonException) throwable;
if(failReasonException.getCode() == BoxModel.ERROR_CODE_DIAMOND){
if (failReasonException.getCode() == BoxModel.ERROR_CODE_DIAMOND) {
TreasureBoxDialog.newInstance().show(this);
}else {
} else {
SingleToastUtil.showToast(throwable.getMessage());
}
} else {

View File

@@ -35,7 +35,7 @@ public class BoxRankingListAdapter extends BaseQuickAdapter<TreasureRankingInfo,
protected void convert(@NonNull BaseViewHolder baseViewHolder, final TreasureRankingInfo rankVosBeans) {
if (rankVosBeans == null) return;
baseViewHolder.setText(R.id.tv_userName, rankVosBeans.getNick()).setText(R.id.tv_amount, rankVosBeans.getAmount() + "");
baseViewHolder.setText(R.id.tv_userName, rankVosBeans.getNick()).setText(R.id.tv_amount, rankVosBeans.getDiamonds() + "");
ImageLoadKt.loadAvatar(baseViewHolder.getView(R.id.iv_avatar), rankVosBeans.getAvatar());
TextView tvPosition = baseViewHolder.getView(R.id.tv_position);
ImageView ivPosition = baseViewHolder.getView(R.id.iv_position);

View File

@@ -38,8 +38,8 @@ public class GoldBoxHelper {
}
if (myInfo != null && levelVo != null) {
//1.审核模式 2.全局隐藏 3. 用户等级小于后台配置等级 都需要隐藏开箱子
isHide = MarketVerifyModel.get().isMarketChecking() || !AvRoomDataManager.get().mBoxSwitchVo.isOpenBoxSwitch()
|| levelVo.getExperLevelSeq() < boxInfo.getOpenBoxSwitchLevelNo() || AvRoomDataManager.get().isOpenPureMode();
isHide = MarketVerifyModel.get().isMarketChecking() || !AvRoomDataManager.get().mFindLoveSwitchVo.isOpen()
|| levelVo.getExperLevelSeq() < AvRoomDataManager.get().mFindLoveSwitchVo.getOpenLevel() || AvRoomDataManager.get().isOpenPureMode();
}
return Single.just(isHide);
});

View File

@@ -49,10 +49,6 @@ public class BoxMoreDialog extends BaseBindingDialog<DialogBoxMoreBinding> {
DialogWebViewActivity.start(context, UriProvider.getBoxHelp(), false);
closeDialog();
});
binding.tvGetKey.setOnClickListener(v -> {
DialogWebViewActivity.start(context, UriProvider.getBoxKey());
closeDialog();
});
boolean canSwitch = sendMessageSwitchLevel != 0 && UserUtils.getExpLevel() >= sendMessageSwitchLevel;

View File

@@ -30,7 +30,7 @@ class TreasureBoxDialog : BaseDialog<DialogTreasureBoxBinding>() {
} else {
CommonWebViewActivity.start(
context, UriProvider.getOfficialPay(
10,
4,
getDeviceId(context)
)
)

View File

@@ -28,16 +28,6 @@
android:textColor="#ff333333"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_get_key"
android:layout_width="match_parent"
android:layout_height="43dp"
android:background="@drawable/bottom_line"
android:gravity="center_vertical"
android:text="@string/layout_dialog_box_more_02"
android:textColor="#ff333333"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_history"
android:layout_width="match_parent"

View File

@@ -29,6 +29,7 @@ import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
import com.yizhuan.xchat_android_core.room.bean.BoxSwitchVo;
import com.yizhuan.xchat_android_core.room.bean.FindLoveSwitchVo;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomModeType;
import com.yizhuan.xchat_android_core.room.bean.SimplePartyRoomInfo;
@@ -108,6 +109,7 @@ public final class AvRoomDataManager {
@Nullable
public RoomInfo mCurrentRoomInfo;
public BoxSwitchVo mBoxSwitchVo;
public FindLoveSwitchVo mFindLoveSwitchVo;
public EnterChatRoomResultData mEnterChatRoomResultData;
/**
* 房间创建者
@@ -266,6 +268,7 @@ public final class AvRoomDataManager {
//我们自己服务端信息
mCurrentRoomInfo = roomInfo;
mBoxSwitchVo = roomInfo.boxSwitchVo;
mFindLoveSwitchVo = roomInfo.findLoveDrawSwitchVo;
phrases = roomInfo.getSpeakTemplate();
nick = roomInfo.getNick();
gender = roomInfo.getGender();

View File

@@ -0,0 +1,76 @@
package com.yizhuan.xchat_android_core.room.bean;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.Serializable;
public class FindLoveSwitchVo implements Parcelable, Serializable {
private boolean open;
private int openLevel;
private int sendMsgLevel;
public boolean isOpen() {
return open;
}
public void setOpen(boolean open) {
this.open = open;
}
public int getOpenLevel() {
return openLevel;
}
public void setOpenLevel(int openLevel) {
this.openLevel = openLevel;
}
public int getSendMsgLevel() {
return sendMsgLevel;
}
public void setSendMsgLevel(int sendMsgLevel) {
this.sendMsgLevel = sendMsgLevel;
}
protected FindLoveSwitchVo(Parcel in) {
open = in.readByte() != 0;
openLevel = in.readInt();
sendMsgLevel = in.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeByte((byte) (open ? 1 : 0));
dest.writeInt(openLevel);
dest.writeInt(sendMsgLevel);
}
public static final Creator<FindLoveSwitchVo> CREATOR = new Creator<FindLoveSwitchVo>() {
@Override
public FindLoveSwitchVo createFromParcel(Parcel in) {
return new FindLoveSwitchVo(in);
}
@Override
public FindLoveSwitchVo[] newArray(int size) {
return new FindLoveSwitchVo[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public String toString() {
return "BoxInfo{" +
"open=" + open +
", openLevel=" + openLevel +
", sendMsgLevel='" + sendMsgLevel + '\'' +
'}';
}
}

View File

@@ -108,6 +108,8 @@ public class RoomInfo implements Parcelable,Serializable {
public BoxSwitchVo boxSwitchVo;
public FindLoveSwitchVo findLoveDrawSwitchVo;
private String singingMusicName;
// 限制类型
public static final String LOCK = "lock";//密码可进
@@ -178,6 +180,7 @@ public class RoomInfo implements Parcelable,Serializable {
isOpenKTV = in.readByte() != 0;
isOpenGame = in.readByte() != 0;
boxSwitchVo = in.readParcelable(BoxSwitchVo.class.getClassLoader());
findLoveDrawSwitchVo = in.readParcelable(FindLoveSwitchVo.class.getClassLoader());
singingMusicName = in.readString();
limitType = in.readString();
introduction = in.readString();
@@ -240,6 +243,7 @@ public class RoomInfo implements Parcelable,Serializable {
dest.writeByte((byte) (isOpenKTV ? 1 : 0));
dest.writeByte((byte) (isOpenGame ? 1 : 0));
dest.writeParcelable(boxSwitchVo, flags);
dest.writeParcelable(findLoveDrawSwitchVo, flags);
dest.writeString(singingMusicName);
dest.writeString(limitType);
dest.writeString(introduction);

View File

@@ -7,6 +7,6 @@ data class TreasureRankingInfo(
val erbanNo: Int = 0,
val nick: String = "",
val avatar: String = "",
val amount: Int = 0,
val diamonds: Int = 0,
val ranking: Int = 0
): Serializable

View File

@@ -0,0 +1,89 @@
package com.yizhuan.xchat_android_library.common.util;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewTreeObserver;
import java.util.LinkedList;
import java.util.List;
public class SoftKeyboardStateHelper implements ViewTreeObserver.OnGlobalLayoutListener {
public interface SoftKeyboardStateListener {
void onSoftKeyboardOpened(int keyboardHeightInPx);
void onSoftKeyboardClosed();
}
private final List<SoftKeyboardStateListener> listeners = new LinkedList<SoftKeyboardStateListener>();
private final View activityRootView;
private int lastSoftKeyboardHeightInPx;
private boolean isSoftKeyboardOpened;
public SoftKeyboardStateHelper(View activityRootView) {
this(activityRootView, false);
}
public SoftKeyboardStateHelper(View activityRootView, boolean isSoftKeyboardOpened) {
this.activityRootView = activityRootView;
this.isSoftKeyboardOpened = isSoftKeyboardOpened;
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(this);
}
@Override
public void onGlobalLayout() {
final Rect r = new Rect();
//r will be populated with the coordinates of your view that area still visible.
activityRootView.getWindowVisibleDisplayFrame(r);
final int heightDiff = activityRootView.getRootView().getHeight() - (r.bottom - r.top);
if (!isSoftKeyboardOpened && heightDiff > 100) { // if more than 100 pixels, its probably a keyboard...
isSoftKeyboardOpened = true;
notifyOnSoftKeyboardOpened(heightDiff);
} else if (isSoftKeyboardOpened && heightDiff < 100) {
isSoftKeyboardOpened = false;
notifyOnSoftKeyboardClosed();
}
}
public void setIsSoftKeyboardOpened(boolean isSoftKeyboardOpened) {
this.isSoftKeyboardOpened = isSoftKeyboardOpened;
}
public boolean isSoftKeyboardOpened() {
return isSoftKeyboardOpened;
}
/**
* Default value is zero (0)
* @return last saved keyboard height in px
*/
public int getLastSoftKeyboardHeightInPx() {
return lastSoftKeyboardHeightInPx;
}
public void addSoftKeyboardStateListener(SoftKeyboardStateListener listener) {
listeners.add(listener);
}
public void removeSoftKeyboardStateListener(SoftKeyboardStateListener listener) {
listeners.remove(listener);
}
private void notifyOnSoftKeyboardOpened(int keyboardHeightInPx) {
this.lastSoftKeyboardHeightInPx = keyboardHeightInPx;
for (SoftKeyboardStateListener listener : listeners) {
if (listener != null) {
listener.onSoftKeyboardOpened(keyboardHeightInPx);
}
}
}
private void notifyOnSoftKeyboardClosed() {
for (SoftKeyboardStateListener listener : listeners) {
if (listener != null) {
listener.onSoftKeyboardClosed();
}
}
}
}