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()); }