From 8ae58e9c141b77c5b9e353584d4416fc34b62143 Mon Sep 17 00:00:00 2001
From: 18142669586 <1669783059@qq.com>
Date: Sat, 8 Apr 2023 17:27:26 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BF=83=E6=84=BF=E5=8D=95=E5=AE=A1=E6=A0=B8?=
=?UTF-8?q?=E5=92=8C=E8=B4=B5=E6=97=8F=E8=B4=AD=E4=B9=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/utils/JavascriptInterfaceUtils.java | 15 +++++++++++++++
common/src/main/res/values/strings.xml | 2 +-
.../com/yunbao/live/activity/LiveActivity.java | 17 +++++++++++++++++
.../yunbao/live/adapter/LiveChatAdapter.java | 3 ++-
.../live/dialog/LiveHDDialogFragment.java | 13 +++++++++++++
.../dialog/LiveNewGuardBuyDialogFragment.java | 8 +++++++-
6 files changed, 55 insertions(+), 3 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 9eb440bc7..6b30e98aa 100644
--- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java
+++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java
@@ -395,6 +395,21 @@ public class JavascriptInterfaceUtils {
}
+ //心愿单守護购买
+ @JavascriptInterface
+ public void BuyProtection(String by) {
+ Bus.get().post(new JavascriptInterfaceEvent()
+ .setMethod("BuyProtection").setData(by));
+ }
+
+ //心愿单贵族购买
+ @JavascriptInterface
+ public void BuyVIP(String by) {
+ Bus.get().post(new JavascriptInterfaceEvent()
+ .setMethod("BuyVIP").setData(by));
+ }
+
+
@JavascriptInterface
public String androidMethodLookLive(String uId, String liveId, String isLiving) {
//跳转个人主页
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index d7ef14ef8..dacb2cfc7 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -781,7 +781,7 @@
直接退出
用戶
- 你都不主動我們怎麼會有故事,跟主播Say Hi吧~
+ 阿萨飒飒飒飒飒飒萨达飒飒飒飒飒飒你都不主動我們怎麼會有故事,跟主播Say Hi吧~
+ 關注
進入活動
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 533e60088..793306502 100644
--- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java
@@ -1345,6 +1345,23 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
fragment.show(getSupportFragmentManager(), "LiveGuardBuyDialogFragment");
}
+ public void openNewBuyGuardWindow(String by) {
+ if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream) || mLiveGuardInfo == null) {
+ return;
+ }
+ LiveNewGuardBuyDialogFragment fragment = new LiveNewGuardBuyDialogFragment();
+ fragment.setLiveGuardInfo(mLiveGuardInfo);
+ Bundle bundle = new Bundle();
+ bundle.putString(Constants.COIN_NAME, mCoinName);
+ bundle.putString(Constants.LIVE_UID, mLiveUid);
+ bundle.putString(Constants.LIVE_ANCHER_NAME, mAncherName);
+ bundle.putString(Constants.STREAM, mStream);
+ bundle.putString(Constants.LIVE_ANCHER_ICON, mAncherIcon);
+ bundle.putString(Constants.USER_ICON, CommonAppConfig.getInstance().getUserBean().getAvatar());
+ bundle.putString("by", by);
+ fragment.setArguments(bundle);
+ fragment.show(getSupportFragmentManager(), "LiveGuardBuyDialogFragment");
+ }
/**
* 打开购买守护的弹窗
*/
diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java
index 350e4a28c..1fb171cc9 100644
--- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java
+++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java
@@ -29,6 +29,7 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
+import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
@@ -558,7 +559,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
public void scrollToBottom() {
if (mList.size() > 0) {
- mRecyclerView.smoothScrollToPosition(getItemCount() - 1);
+ mRecyclerView.smoothScrollToPosition(getItemCount());
}
mRecyclerViewScrolledDy = 0;
}
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java
index fe8dcf21a..8047fabd9 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java
@@ -21,6 +21,7 @@ import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;
import android.widget.TextView;
+import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -28,9 +29,11 @@ import androidx.fragment.app.FragmentManager;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
+import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.JsWishBean;
import com.yunbao.common.bean.LiveBean;
+import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.http.HttpCallback;
@@ -44,6 +47,7 @@ import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
+import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
@@ -357,6 +361,15 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
);
}
+ //守護
+ }else if(TextUtils.equals(event.getMethod(), "BuyProtection")){
+ ((LiveActivity) mContext).openNewBuyGuardWindow(event.getData());
+ }else if(TextUtils.equals(event.getMethod(), "BuyVIP")){
+ UserBean u = CommonAppConfig.getInstance().getUserBean();
+ String url = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname="
+ + u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&uid="
+ + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+"&active="+event.getData();
+ ZhuangBanActivity.forward(mContext, url, false);
}
}
}
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 473e34caa..f660a3645 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java
@@ -198,7 +198,11 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
mGuardRightAdapter.setList(mRightList);
buyItemsAdapter.notifyDataSetChanged();
- refreshList(1);
+ if(bundle.getString("by")!=null){
+ refreshList(Integer.parseInt(bundle.getString("by"))-1);
+ }else{
+ refreshList(1);
+ }
} else {
ToastUtil.show(msg);
@@ -275,6 +279,8 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
}
}
mGuardRightAdapter.notifyDataSetChanged();
+ buyItemsAdapter.changeItem(index);
+ buyItemsAdapter.notifyDataSetChanged();
// mBtnBuy.setEnabled(mCoinVal >= guardBuyBean.getCoin());
}