From 18970c22cf76e444f71acd550f8364addc4d2c9d Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Fri, 22 Sep 2023 13:38:34 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E9=A4=98=E9=A1=8D=E4=B8=8D=E8=B6=B3?= =?UTF-8?q?=E6=99=82=E5=BD=88=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utils/JavascriptInterfaceUtils.java | 16 ++++++++++ .../yunbao/live/activity/LiveActivity.java | 31 ++++++++++++++----- .../dialog/LiveNewGuardBuyDialogFragment.java | 20 +++++++++++- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java index fe911bd3b..ddb52f8c9 100644 --- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java @@ -4,6 +4,7 @@ import static com.yunbao.common.CommonAppConfig.isGetNewWrap; import static com.yunbao.common.utils.RouteUtil.PATH_COIN; import android.app.Activity; +import android.app.Dialog; import android.os.Handler; import android.os.Looper; import android.view.View; @@ -643,4 +644,19 @@ public class JavascriptInterfaceUtils { Bus.get().post(new JavascriptInterfaceEvent() .setMethod("androidCancelAnchorAttention")); } + @JavascriptInterface + public void androidLnsufficientBalanceClick(String msg){ + DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + dialog.dismiss(); + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }); + } } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index 64ece985f..2fd05cf34 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -1,5 +1,7 @@ package com.yunbao.live.activity; +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; + import android.app.Dialog; import android.content.ClipData; import android.content.ClipboardManager; @@ -15,6 +17,7 @@ import android.widget.TextView; import androidx.fragment.app.DialogFragment; +import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; @@ -36,6 +39,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.KeyBoardHeightChangeListener; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.KeyBoardHeightUtil2; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ProcessImageUtil; @@ -898,7 +902,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL @Override public void onClick(View v) { String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=task&a=index&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&tabIndex=1"; - WebViewActivity.forward(mContext, url,true); + WebViewActivity.forward(mContext, url, true); dialog.dismiss(); } }); @@ -924,7 +928,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL if (!mIsAnchor) { UserBean u = CommonAppConfig.getInstance().getUserBean(); if (u != null && u.getLevel() < mDanMuLevel) { - ToastUtil.show(String.format(mContext.getString(R.string.live_level_danmu_limit), mDanMuLevel+"")); + ToastUtil.show(String.format(mContext.getString(R.string.live_level_danmu_limit), mDanMuLevel + "")); return; } } @@ -945,7 +949,20 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL onCoinChanged(coin); } String[] data = new String[]{obj.getString("barragetoken")}; - SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents,obj.getIntValue("level_fans")); + SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents, obj.getIntValue("level_fans")); + } else if (code==1001) { + DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + dialog.dismiss(); + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }); } else { ToastUtil.show(msg); } @@ -961,7 +978,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL if (!mIsAnchor) { UserBean u = CommonAppConfig.getInstance().getUserBean(); if (u != null && u.getLevel() < mChatLevel) { - ToastUtil.show(String.format(mContext.getString(R.string.live_level_chat_limit), mChatLevel+"")); + ToastUtil.show(String.format(mContext.getString(R.string.live_level_chat_limit), mChatLevel + "")); return; } } @@ -1275,9 +1292,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL } else { bundle.putString(Constants.URL, CommonAppConfig.HOST + "/h5/live/fansClub.html" + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + uid); } - bundle.putString("liveUid",mLiveUid); - bundle.putString("anchorName",mAncherName); - bundle.putString("mStream",mStream); + bundle.putString("liveUid", mLiveUid); + bundle.putString("anchorName", mAncherName); + bundle.putString("mStream", mStream); fragment.setArguments(bundle); fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment"); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java index 33da1cc69..6c9e9a5aa 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java @@ -1,5 +1,7 @@ package com.yunbao.live.dialog; +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; + import android.app.Dialog; import android.os.Bundle; import android.text.Html; @@ -19,6 +21,7 @@ import androidx.annotation.Nullable; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.makeramen.roundedimageview.RoundedImageView; @@ -34,6 +37,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; @@ -462,7 +466,7 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements private void buy() { DialogUitl.showSimpleDialog(mContext, - String.format(mContext.getString(R.string.guard_buy_tip_3), mTargetBuyBean.getCoin(), mCoinName, mTargetBuyBean.getShopName(getContext())), + String.format(mContext.getString(R.string.guard_buy_tip_3), mTargetBuyBean.getCoin()+"", mCoinName, mTargetBuyBean.getShopName(getContext())), new DialogUitl.SimpleCallback() { @Override @@ -499,6 +503,20 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements } ((LiveActivity) mContext).sendBuyGuardMessage2(votes, guardNum, guardType, ancherName, liveuid); dismiss(); + }else if(code==1002){ + DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + dialog.dismiss(); + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }); + return; } ToastUtil.show(msg); }