From 4693954a72283710911ac7061ba35ec9e6e65b5a Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 20 Mar 2024 10:02:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A5=9E=E9=BE=99=E9=80=81=E8=B4=A2=EF=BC=8C?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=EF=BC=8C=E7=94=B1=E5=BC=80?= =?UTF-8?q?=E9=80=9A=E6=8E=A5=E5=8F=A3=E8=A7=A6=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bean/GuardGetGuardUserInfoModel.java | 6 +-- .../common/dialog/GuardUpgradePopup.java | 2 +- .../com/yunbao/common/http/PDLiveApi.java | 2 +- .../common/http/live/LiveNetManager.java | 4 +- .../com/yunbao/common/utils/TimeUtils.java | 15 ++++++ gradle.properties | 8 ++-- .../live/dialog/LiveBuyGuardDialog.java | 5 ++ .../yunbao/live/dialog/LiveGuardDialog.java | 35 ++++++++++++++ .../yunbao/live/views/LiveRoomViewHolder.java | 7 +-- .../src/main/res/layout/dialog_live_guard.xml | 48 ++++++++++++++----- 10 files changed, 102 insertions(+), 30 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/bean/GuardGetGuardUserInfoModel.java b/common/src/main/java/com/yunbao/common/bean/GuardGetGuardUserInfoModel.java index d887b76f8..ce843ab70 100644 --- a/common/src/main/java/com/yunbao/common/bean/GuardGetGuardUserInfoModel.java +++ b/common/src/main/java/com/yunbao/common/bean/GuardGetGuardUserInfoModel.java @@ -33,7 +33,7 @@ public class GuardGetGuardUserInfoModel extends BaseModel { @SerializedName("level") private int level; @SerializedName("endtime") - private int endtime; + private long endtime; @SerializedName("user_language") private String userLanguage; @SerializedName("live_language") @@ -102,11 +102,11 @@ public class GuardGetGuardUserInfoModel extends BaseModel { return this; } - public int getEndtime() { + public long getEndtime() { return endtime; } - public GuardGetGuardUserInfoModel setEndtime(int endtime) { + public GuardGetGuardUserInfoModel setEndtime(long endtime) { this.endtime = endtime; return this; } diff --git a/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java b/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java index 3e850f441..07a486aa1 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java @@ -117,7 +117,7 @@ public class GuardUpgradePopup extends CenterPopupView { @Override public void onViewClicks() { LiveNetManager.get(getContext()) - .getRewards(new HttpCallback() { + .guardGetRewards(mLiveUid,new HttpCallback() { @Override public void onSuccess(CheckUpgradesModel data) { dismiss(); diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 3bcbe8e86..166786ecc 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1190,5 +1190,5 @@ public interface PDLiveApi { @GET("/api/public/?service=Guard.checkUpgrades") Observable> checkUpgrades(@Query("liveuid") String liveUid); @GET("/api/public/?service=Guard.getRewards") - Observable> getRewards(@Query("type") String type); + Observable> guardGetRewards(@Query("type") String type,@Query("liveuid") String liveUid); } 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 0725b71c6..4c7420f1e 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 @@ -3129,9 +3129,9 @@ public class LiveNetManager { } - public void getRewards(HttpCallback callback) { + public void guardGetRewards( String liveUid,HttpCallback callback) { API.get().pdLiveApi(mContext) - .getRewards("2") + .guardGetRewards("2",liveUid) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer>() { diff --git a/common/src/main/java/com/yunbao/common/utils/TimeUtils.java b/common/src/main/java/com/yunbao/common/utils/TimeUtils.java index ef038c26b..919c17168 100644 --- a/common/src/main/java/com/yunbao/common/utils/TimeUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/TimeUtils.java @@ -1,5 +1,8 @@ package com.yunbao.common.utils; +import java.text.SimpleDateFormat; +import java.util.Date; + /** * 时间处理 */ @@ -67,4 +70,16 @@ public class TimeUtils { } return hour + minute + ":" + second; } + + /** + * 时间戳转换成字符窜 + * @param milSecond + * @param pattern + * @return + */ + public static String getDateToString(long milSecond, String pattern) { + Date date = new Date(milSecond); + SimpleDateFormat format = new SimpleDateFormat(pattern); + return format.format(date); + } } diff --git a/gradle.properties b/gradle.properties index 35e9eefed..15d390c86 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,8 +23,8 @@ android.enableJetifier=true systemProp.http.proxyHost=127.0.0.1 systemProp.https.proxyHost=127.0.0.1 -#systemProp.https.proxyPort=7890 -#systemProp.http.proxyPort=7890 -systemProp.https.proxyPort=10809 -systemProp.http.proxyPort=10809 +systemProp.https.proxyPort=7890 +systemProp.http.proxyPort=7890 +#systemProp.https.proxyPort=10809 +#systemProp.http.proxyPort=10809 #android.enableR8.fullMode=true \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java index 5fbc3e027..91f47433b 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java @@ -333,6 +333,11 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow { public void onSuccess(String data) { ToastUtil.show(data); dismiss(); + if (dataTipModel.getGuardType()==3){ + new XPopup.Builder(mContext) + .asCustom(new DragonSendsMoneyPopup(mContext, mLiveUid)) + .show(); + } } @Override diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java index 903d95b09..1e7e465ec 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java @@ -27,6 +27,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.CommonIconUtil; +import com.yunbao.common.utils.TimeUtils; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -57,6 +58,8 @@ public class LiveGuardDialog extends AbsDialogPopupWindow { RoundedImageView guardIcon; SVGAImageView giftSvga; TextView btnGuardOpen; + TextView guard_hint; + TextView guard_time; public LiveGuardDialog(@NonNull Context context, boolean isEmpty, String liveUid, String stream) { super(context); @@ -83,6 +86,8 @@ public class LiveGuardDialog extends AbsDialogPopupWindow { guardianTask = findViewById(R.id.guardian_task); myGraudGrade = findViewById(R.id.my_graud_grade); guardingTheAnchor = findViewById(R.id.guarding_the_anchor); + guard_time = findViewById(R.id.guard_time); + guard_hint = findViewById(R.id.guard_hint); mRefreshView = findViewById(R.id.refreshView); mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); @@ -175,10 +180,40 @@ public class LiveGuardDialog extends AbsDialogPopupWindow { guardianTask.setVisibility(GONE); myGraudGrade.setVisibility(GONE); btnGuardOpen.setText(WordUtil.isNewZh() ? "開通守護" : "Open Guard"); + guard_hint.setText(WordUtil.getNewString(R.string.guardian_for_your_favorite_anchor)); } else { guardianTask.setVisibility(VISIBLE); myGraudGrade.setVisibility(VISIBLE); btnGuardOpen.setText(WordUtil.isNewZh() ? "續費守護" : "Renewal Guard"); + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append(WordUtil.isNewZh() ? "您是當前主播的" : "You are the current anchor's ") + .append("【"); + switch (data.getGuardType()) { + case 1: + stringBuffer.append(WordUtil.isNewZh() ? "星之守護" : "Star Guardian") + .append("】"); + guard_hint.setText(stringBuffer.toString()); + break; + case 2: + stringBuffer.append(WordUtil.isNewZh() ? "王之守護" : "King Guardian") + .append("】"); + guard_hint.setText(stringBuffer.toString()); + break; + case 3: + stringBuffer.append(WordUtil.isNewZh() ? "神之守護" : "God Guardian") + .append("】"); + guard_hint.setText(stringBuffer.toString()); + break; + default: + guard_hint.setText(WordUtil.getNewString(R.string.guardian_for_your_favorite_anchor)); + break; + } + } + if (data.getEndtime() == 0) { + guard_time.setVisibility(GONE); + } else { + + guard_time.setText(String.format(WordUtil.getNewString(R.string.guardiandate), TimeUtils.getDateToString(data.getEndtime()*1000, "yyyy-MM-dd"))); } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 96b34ecd3..c38e78a66 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -635,12 +635,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis liveReceiveGiftBean.setGiftId(liveReceiveGiftBean.getGiftName()); mLiveGiftAnimPresenter.showGifGift(liveReceiveGiftBean); - if (TextUtils.equals(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()), liveReceiveGiftBean.getUid()) - && TextUtils.equals(liveReceiveGiftBean.getGuard_type(), "3")) { - new XPopup.Builder(mContext) - .asCustom(new DragonSendsMoneyPopup(mContext, mLiveUid)) - .show(); - } + } diff --git a/live/src/main/res/layout/dialog_live_guard.xml b/live/src/main/res/layout/dialog_live_guard.xml index 90f34ff6b..a858e9fdd 100644 --- a/live/src/main/res/layout/dialog_live_guard.xml +++ b/live/src/main/res/layout/dialog_live_guard.xml @@ -193,29 +193,51 @@ android:layout_gravity="bottom" android:background="@drawable/background_live_guard3"> - + android:layout_weight="1" + android:orientation="vertical"> + + + + + + + android:textColor="@color/white" + android:textSize="15sp" + android:textStyle="bold" /> \ No newline at end of file