From 28571272858f209afc6683c68b31e09ff807a6fd Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Wed, 17 Jan 2024 16:21:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=88=98=E4=BB=A4=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=97=B4=E8=B7=9D=20=E4=BF=AE=E5=A4=8D=E3=80=90?= =?UTF-8?q?=E6=88=98=E4=BB=A4=E4=BD=99=E9=A2=9D=E4=B8=8D=E8=B6=B3=E6=9C=AA?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=85=85=E5=80=BC=E9=A1=B5=E9=9D=A2=E3=80=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E4=BF=AE=E5=A4=8D=E3=80=90=E6=88=98?= =?UTF-8?q?=E4=BB=A4=E5=BC=80=E9=80=9A=E7=AD=89=E7=BA=A7=E6=97=B6=E5=BC=B9?= =?UTF-8?q?=E6=A1=86=E9=87=91=E9=A2=9D=E5=81=B6=E5=B0=94=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98=E3=80=91=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=88=98=E4=BB=A4=E8=8E=B7=E5=8F=96=E9=87=91=E9=A2=9D=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E8=B0=83=E6=95=B4=E6=88=98=E4=BB=A4item=E5=90=8D?= =?UTF-8?q?=E5=AD=97=E6=98=BE=E7=A4=BA=E6=A8=A1=E5=BC=8F=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=88=98=E4=BB=A4=E8=B4=AD=E4=B9=B0=E7=BB=8F=E9=AA=8C?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialog/LiberalBattlePassPopupWindow.java | 1 + .../common/dialog/OrderLevelPopupWindow.java | 11 ++-- .../common/http/live/LiveNetManager.java | 4 +- .../yunbao/common/manager/IMLoginManager.java | 18 ++++++ config.gradle | 8 +-- .../main/activity/BattlePassActivity.java | 16 +++++ .../main/adapter/BattlePassRewardAdapter.java | 61 ++++++++++++++++++- .../fragment/BattlePassMissionFragment.java | 25 +++++++- .../fragment/BattlePassRewardFragment.java | 33 ++++++++++ .../main/res/layout/activity_battlepass.xml | 8 +-- .../item_battlepass_reward_type_top.xml | 17 +++--- 11 files changed, 174 insertions(+), 28 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java index d01dc42a7..fb0a87a5e 100644 --- a/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java @@ -77,6 +77,7 @@ public class LiberalBattlePassPopupWindow extends CenterPopupView { mPassCallback.onCallback(data.getData().getCode(), data.getData().getMsg()); } IMLoginManager.get(getContext()).upDataUserInfo(); + IMLoginManager.get(getContext()).updateUserCoin(); } @Override diff --git a/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java index e9d0ae11c..205ecac5f 100644 --- a/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java @@ -9,6 +9,7 @@ import androidx.annotation.NonNull; import com.lxj.xpopup.core.CenterPopupView; import com.yunbao.common.R; +import com.yunbao.common.bean.BattlePassUserInfoBean; import com.yunbao.common.http.ResponseModel; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; @@ -28,11 +29,12 @@ public class OrderLevelPopupWindow extends CenterPopupView { private ProgressBar progressBar; private OrderLevelCallback orderLevelCallback; private long maxExp; - - public OrderLevelPopupWindow(@NonNull Context context, + private BattlePassUserInfoBean userInfoBean; + public OrderLevelPopupWindow(@NonNull Context context, BattlePassUserInfoBean userInfoBean, int mCurrentExperience, int mTotalExperience, - String mCurrentLevel, String mBalance,long maxExp, OrderLevelCallback mOrderLevelCallback) { + String mCurrentLevel, String mBalance, long maxExp, OrderLevelCallback mOrderLevelCallback) { super(context); + this.userInfoBean = userInfoBean; currentExperience = mCurrentExperience; totalExperience = mTotalExperience; currentLevel = mCurrentLevel; @@ -59,7 +61,7 @@ public class OrderLevelPopupWindow extends CenterPopupView { orderLevel.setText(buyExp); progressBar.setMax(totalExperience); progressBar.setProgress(currentExperience); - expText.setText(String.format("%s/%s", currentExperience, totalExperience)); + expText.setText(String.format("%s/%s", userInfoBean.getBattlePassExp(), userInfoBean.getNextLevelExp())); current.setText(String.format("Lv%s", currentLevel)); balanceDiamond.setText(balance); findViewById(R.id.sub).setOnClickListener(new OnClickListener() { @@ -102,6 +104,7 @@ public class OrderLevelPopupWindow extends CenterPopupView { .buyingExperiencePoint(buyExp, new HttpCallback>() { @Override public void onSuccess(ResponseModel data) { + if (orderLevelCallback != null) { orderLevelCallback.onCallback(data.getData().getCode(), data.getMsg()); }dialog.dismiss(); diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 70354f0e5..9b4321c7a 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -2675,9 +2675,7 @@ public class LiveNetManager { .observeOn(AndroidSchedulers.mainThread()) .subscribe(responseModel -> { if (callback != null) { - if (callback != null) { - callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg())); - } + callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg())); } }, new Consumer() { @Override diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index 7920c8b1c..c0fd33ebb 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -8,6 +8,7 @@ import android.text.TextUtils; import androidx.annotation.NonNull; +import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.lzf.easyfloat.EasyFloat; import com.umeng.analytics.MobclickAgent; @@ -509,5 +510,22 @@ public class IMLoginManager extends BaseCacheManager { } }); } + public void updateUserCoin(){ + HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance") + .execute(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + JSONObject obj = JSONObject.parseObject(info[0]); + String golds = obj.getString("gold"); + String coins = obj.getString("coin"); + String yuanbaos = obj.getString("yuanbao"); + userInfo.setCoin(obj.getLong("coin")); + userInfo.setGold(obj.getLong("gold")); + userInfo.setYuanbao(yuanbaos); + } + } + }); + } } diff --git a/config.gradle b/config.gradle index 33a33ff33..26fb307cc 100644 --- a/config.gradle +++ b/config.gradle @@ -5,13 +5,13 @@ ext { minSdkVersion : 21, targetSdkVersion : 33, versionCode : 460, - versionName : "6.6.3" + versionName : "6.6.4" ] manifestPlaceholders = [ //正式、 -// serverHost : "https://napi.yaoulive.com", + serverHost : "https://napi.yaoulive.com", // 测试 - serverHost : " https://ceshi.yaoulive.com", + //serverHost : " https://ceshi.yaoulive.com", //百度语音识别 @@ -21,7 +21,7 @@ ext { baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", // true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包 3 samsung包 - isGooglePlay : 3, + isGooglePlay : 0, //是否上报异常日志 isUploadLog : true, //是否打包成插件包模式 diff --git a/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java b/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java index 8bc19b420..c6c5e3392 100644 --- a/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java @@ -1,5 +1,7 @@ package com.yunbao.main.activity; +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; + import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; @@ -15,6 +17,7 @@ import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; import com.alibaba.android.arouter.facade.annotation.Route; +import com.alibaba.android.arouter.launcher.ARouter; import com.lxj.xpopup.XPopup; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.BattlePassUserInfoBean; @@ -133,6 +136,19 @@ public class BattlePassActivity extends AbsActivity { new LiberalBattlePassPopupWindow.LiberalBattlePassCallback() { @Override public void onCallback(int code, String msg) { + if (code == 1001) { + new DialogUitl.Builder(mContext) + .setView(com.yunbao.live.R.layout.dialog_live_unfollow) + .setConfirmString(getString(com.yunbao.live.R.string.charge)) + .setContent(getString(com.yunbao.live.R.string.insufficient_balance)) + .setClickCallback(new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }).build().show(); + return; + } ToastUtil.show(msg); initData(); } diff --git a/main/src/main/java/com/yunbao/main/adapter/BattlePassRewardAdapter.java b/main/src/main/java/com/yunbao/main/adapter/BattlePassRewardAdapter.java index f411b65c6..1db688217 100644 --- a/main/src/main/java/com/yunbao/main/adapter/BattlePassRewardAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/BattlePassRewardAdapter.java @@ -1,6 +1,10 @@ package com.yunbao.main.adapter; +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; + import android.annotation.SuppressLint; +import android.app.Activity; +import android.app.Dialog; import android.content.Context; import android.view.LayoutInflater; import android.view.View; @@ -13,18 +17,26 @@ import androidx.annotation.NonNull; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.recyclerview.widget.RecyclerView; +import com.alibaba.android.arouter.launcher.ARouter; +import com.lxj.xpopup.XPopup; import com.yunbao.common.bean.BattlePassUserInfoBean; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.LiveBattlePassRewardsBean; +import com.yunbao.common.dialog.ActivateEliteBattleOrderPopupWindow; +import com.yunbao.common.dialog.LiberalBattlePassPopupWindow; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.DeviceUtils; +import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.main.R; +import com.yunbao.main.event.BattlePassTypeEvent; import java.util.ArrayList; import java.util.List; @@ -36,6 +48,7 @@ public class BattlePassRewardAdapter extends RecyclerView.Adapter> mList = new ArrayList<>(); private int userLevel; private BattlePassUserInfoBean userType; + private String quintessenceSpendMoney,enjoySpendMoney; private OnItemClickListener onItemClickListener; public void setList(List> mList) { @@ -74,6 +87,14 @@ public class BattlePassRewardAdapter extends RecyclerView.Adapter() { @Override public void onSuccess(HttpCallbackModel data) { - ToastUtil.show(WordUtil.getNewString(R.string.battlepass_reward_item_get)); + ToastUtil.show(data.getMsg()); if (onItemClickListener != null) { onItemClickListener.onItemClick(reward, reward.getId()); } @@ -275,7 +301,38 @@ public class BattlePassRewardAdapter extends RecyclerView.Adapter { diff --git a/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java b/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java index bfa6b0d28..6aea5d641 100644 --- a/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java @@ -1,6 +1,9 @@ package com.yunbao.main.fragment; +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; + import android.app.Activity; +import android.app.Dialog; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -8,6 +11,7 @@ import android.view.ViewGroup; import androidx.recyclerview.widget.RecyclerView; +import com.alibaba.android.arouter.launcher.ARouter; import com.lxj.xpopup.XPopup; import com.yunbao.common.bean.BattlePassTask; import com.yunbao.common.bean.BattlePassUserInfoBean; @@ -20,6 +24,7 @@ import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DeviceUtils; +import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; @@ -83,18 +88,32 @@ public class BattlePassMissionFragment extends BaseFragment { .enableDrag(false) .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) .asCustom(new OrderLevelPopupWindow(getContext(), - userInfoBean.getBattlePassExp() - userInfoBean.getLastLevelExp(), - userInfoBean.getNextLevelExp() - userInfoBean.getLastLevelExp(), + userInfoBean, + userInfoBean.getBattlePassExp()-userInfoBean.getLastLevelExp(), + userInfoBean.getNextLevelExp()-userInfoBean.getLastLevelExp(), String.valueOf(userInfoBean.getLevel()), String.valueOf(IMLoginManager.get(getContext()).getUserInfo().getCoin()), maxExp, new OrderLevelPopupWindow.OrderLevelCallback() { @Override public void onCallback(int code, String msg) { + if (code == 1001) { + new DialogUitl.Builder(getContext()) + .setView(com.yunbao.live.R.layout.dialog_live_unfollow) + .setConfirmString(getString(com.yunbao.live.R.string.charge)) + .setContent(getString(com.yunbao.live.R.string.insufficient_balance)) + .setClickCallback(new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }).build().show(); + return; + } ToastUtil.show(msg); Bus.get().post(new BattlePassTypeEvent(0)); + IMLoginManager.get(getContext()).updateUserCoin(); updateData(); - IMLoginManager.get(getContext()).upDataUserInfo(); } } ) diff --git a/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java b/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java index 099f6431f..389c7b1b7 100644 --- a/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java @@ -1,6 +1,9 @@ package com.yunbao.main.fragment; +import static com.yunbao.common.utils.RouteUtil.PATH_COIN; + import android.app.Activity; +import android.app.Dialog; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -10,6 +13,7 @@ import android.widget.ImageView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.alibaba.android.arouter.launcher.ARouter; import com.lxj.xpopup.XPopup; import com.yunbao.common.bean.BattlePassUserInfoBean; import com.yunbao.common.bean.LiveBattlePassRewardsBean; @@ -21,6 +25,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DeviceUtils; +import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; @@ -104,6 +109,19 @@ public class BattlePassRewardFragment extends BaseFragment { new LiberalBattlePassPopupWindow.LiberalBattlePassCallback() { @Override public void onCallback(int code, String msg) { + if (code == 1001) { + new DialogUitl.Builder(getContext()) + .setView(com.yunbao.live.R.layout.dialog_live_unfollow) + .setConfirmString(getString(com.yunbao.live.R.string.charge)) + .setContent(getString(com.yunbao.live.R.string.insufficient_balance)) + .setClickCallback(new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }).build().show(); + return; + } ToastUtil.show(msg); updateData(); Bus.get().post(new BattlePassTypeEvent(0)); @@ -127,6 +145,19 @@ public class BattlePassRewardFragment extends BaseFragment { new LiberalBattlePassPopupWindow.LiberalBattlePassCallback() { @Override public void onCallback(int code, String msg) { + if (code == 1001) { + new DialogUitl.Builder(getContext()) + .setView(com.yunbao.live.R.layout.dialog_live_unfollow) + .setConfirmString(getString(com.yunbao.live.R.string.charge)) + .setContent(getString(com.yunbao.live.R.string.insufficient_balance)) + .setClickCallback(new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }).build().show(); + return; + } ToastUtil.show(msg); updateData(); Bus.get().post(new BattlePassTypeEvent(0)); @@ -151,9 +182,11 @@ public class BattlePassRewardFragment extends BaseFragment { for (LiveBattlePassRewardsBean.BattlePassType passType : data.getLive_battle_pass_type()) { if (passType.getId() == 2) { quintessenceSpendMoney = String.valueOf(passType.getDiamond_value()); + adapter.setQuintessenceSpendMoney(quintessenceSpendMoney); } if (passType.getId() == 3) { enjoySpendMoney = String.valueOf(passType.getDiamond_value()); + adapter.setEnjoySpendMoney(enjoySpendMoney); } } diff --git a/main/src/main/res/layout/activity_battlepass.xml b/main/src/main/res/layout/activity_battlepass.xml index 98eb8812c..bf646eb73 100644 --- a/main/src/main/res/layout/activity_battlepass.xml +++ b/main/src/main/res/layout/activity_battlepass.xml @@ -85,13 +85,13 @@ layout="@layout/view_battlepass_user" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="32dp" /> + android:layout_marginTop="16dp" /> + android:layout_height="match_parent" + android:layout_marginTop="10dp" + android:background="@drawable/background_order_dialog" /> \ No newline at end of file diff --git a/main/src/main/res/layout/item_battlepass_reward_type_top.xml b/main/src/main/res/layout/item_battlepass_reward_type_top.xml index 7afc6a5af..10ddef773 100644 --- a/main/src/main/res/layout/item_battlepass_reward_type_top.xml +++ b/main/src/main/res/layout/item_battlepass_reward_type_top.xml @@ -122,13 +122,10 @@ android:layout_marginTop="8dp" android:text="甜蜜氣球\n&積分30" android:textColor="#0D21B2" - android:textSize="14sp" + android:textSize="12sp" android:textStyle="bold" - android:maxLines="2" - app:autoSizeMaxTextSize="14sp" - app:autoSizeMinTextSize="5sp" - app:autoSizeStepGranularity="1sp" - app:autoSizeTextType="uniform" + android:maxLines="1" + android:ellipsize="end" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/tab_1_bg" /> @@ -199,7 +196,9 @@ android:layout_marginTop="8dp" android:text="甜蜜氣球\n&積分30" android:textColor="#0D21B2" - android:textSize="14sp" + android:textSize="12sp" + android:maxLines="1" + android:ellipsize="end" android:textStyle="bold" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -263,12 +262,14 @@ app:layout_constraintTop_toTopOf="parent" />