神龙送财,逻辑修改,由开通接口触发

This commit is contained in:
18401019693 2024-03-20 10:02:14 +08:00
parent 859810f1f6
commit 4693954a72
10 changed files with 102 additions and 30 deletions

View File

@ -33,7 +33,7 @@ public class GuardGetGuardUserInfoModel extends BaseModel {
@SerializedName("level") @SerializedName("level")
private int level; private int level;
@SerializedName("endtime") @SerializedName("endtime")
private int endtime; private long endtime;
@SerializedName("user_language") @SerializedName("user_language")
private String userLanguage; private String userLanguage;
@SerializedName("live_language") @SerializedName("live_language")
@ -102,11 +102,11 @@ public class GuardGetGuardUserInfoModel extends BaseModel {
return this; return this;
} }
public int getEndtime() { public long getEndtime() {
return endtime; return endtime;
} }
public GuardGetGuardUserInfoModel setEndtime(int endtime) { public GuardGetGuardUserInfoModel setEndtime(long endtime) {
this.endtime = endtime; this.endtime = endtime;
return this; return this;
} }

View File

@ -117,7 +117,7 @@ public class GuardUpgradePopup extends CenterPopupView {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
LiveNetManager.get(getContext()) LiveNetManager.get(getContext())
.getRewards(new HttpCallback<CheckUpgradesModel>() { .guardGetRewards(mLiveUid,new HttpCallback<CheckUpgradesModel>() {
@Override @Override
public void onSuccess(CheckUpgradesModel data) { public void onSuccess(CheckUpgradesModel data) {
dismiss(); dismiss();

View File

@ -1190,5 +1190,5 @@ public interface PDLiveApi {
@GET("/api/public/?service=Guard.checkUpgrades") @GET("/api/public/?service=Guard.checkUpgrades")
Observable<ResponseModel<CheckUpgradesModel>> checkUpgrades(@Query("liveuid") String liveUid); Observable<ResponseModel<CheckUpgradesModel>> checkUpgrades(@Query("liveuid") String liveUid);
@GET("/api/public/?service=Guard.getRewards") @GET("/api/public/?service=Guard.getRewards")
Observable<ResponseModel<CheckUpgradesModel>> getRewards(@Query("type") String type); Observable<ResponseModel<CheckUpgradesModel>> guardGetRewards(@Query("type") String type,@Query("liveuid") String liveUid);
} }

View File

@ -3129,9 +3129,9 @@ public class LiveNetManager {
} }
public void getRewards(HttpCallback<CheckUpgradesModel> callback) { public void guardGetRewards( String liveUid,HttpCallback<CheckUpgradesModel> callback) {
API.get().pdLiveApi(mContext) API.get().pdLiveApi(mContext)
.getRewards("2") .guardGetRewards("2",liveUid)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<CheckUpgradesModel>>() { .subscribe(new Consumer<ResponseModel<CheckUpgradesModel>>() {

View File

@ -1,5 +1,8 @@
package com.yunbao.common.utils; package com.yunbao.common.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
/** /**
* 时间处理 * 时间处理
*/ */
@ -67,4 +70,16 @@ public class TimeUtils {
} }
return hour + minute + ":" + second; 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);
}
} }

View File

@ -23,8 +23,8 @@ android.enableJetifier=true
systemProp.http.proxyHost=127.0.0.1 systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1 systemProp.https.proxyHost=127.0.0.1
#systemProp.https.proxyPort=7890 systemProp.https.proxyPort=7890
#systemProp.http.proxyPort=7890 systemProp.http.proxyPort=7890
systemProp.https.proxyPort=10809 #systemProp.https.proxyPort=10809
systemProp.http.proxyPort=10809 #systemProp.http.proxyPort=10809
#android.enableR8.fullMode=true #android.enableR8.fullMode=true

View File

@ -333,6 +333,11 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
public void onSuccess(String data) { public void onSuccess(String data) {
ToastUtil.show(data); ToastUtil.show(data);
dismiss(); dismiss();
if (dataTipModel.getGuardType()==3){
new XPopup.Builder(mContext)
.asCustom(new DragonSendsMoneyPopup(mContext, mLiveUid))
.show();
}
} }
@Override @Override

View File

@ -27,6 +27,7 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.TimeUtils;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -57,6 +58,8 @@ public class LiveGuardDialog extends AbsDialogPopupWindow {
RoundedImageView guardIcon; RoundedImageView guardIcon;
SVGAImageView giftSvga; SVGAImageView giftSvga;
TextView btnGuardOpen; TextView btnGuardOpen;
TextView guard_hint;
TextView guard_time;
public LiveGuardDialog(@NonNull Context context, boolean isEmpty, String liveUid, String stream) { public LiveGuardDialog(@NonNull Context context, boolean isEmpty, String liveUid, String stream) {
super(context); super(context);
@ -83,6 +86,8 @@ public class LiveGuardDialog extends AbsDialogPopupWindow {
guardianTask = findViewById(R.id.guardian_task); guardianTask = findViewById(R.id.guardian_task);
myGraudGrade = findViewById(R.id.my_graud_grade); myGraudGrade = findViewById(R.id.my_graud_grade);
guardingTheAnchor = findViewById(R.id.guarding_the_anchor); 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 = findViewById(R.id.refreshView);
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
@ -175,10 +180,40 @@ public class LiveGuardDialog extends AbsDialogPopupWindow {
guardianTask.setVisibility(GONE); guardianTask.setVisibility(GONE);
myGraudGrade.setVisibility(GONE); myGraudGrade.setVisibility(GONE);
btnGuardOpen.setText(WordUtil.isNewZh() ? "開通守護" : "Open Guard"); btnGuardOpen.setText(WordUtil.isNewZh() ? "開通守護" : "Open Guard");
guard_hint.setText(WordUtil.getNewString(R.string.guardian_for_your_favorite_anchor));
} else { } else {
guardianTask.setVisibility(VISIBLE); guardianTask.setVisibility(VISIBLE);
myGraudGrade.setVisibility(VISIBLE); myGraudGrade.setVisibility(VISIBLE);
btnGuardOpen.setText(WordUtil.isNewZh() ? "續費守護" : "Renewal Guard"); 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")));
} }
} }

View File

@ -635,12 +635,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
liveReceiveGiftBean.setGiftId(liveReceiveGiftBean.getGiftName()); liveReceiveGiftBean.setGiftId(liveReceiveGiftBean.getGiftName());
mLiveGiftAnimPresenter.showGifGift(liveReceiveGiftBean); 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();
}
} }

View File

@ -193,29 +193,51 @@
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@drawable/background_live_guard3"> android:background="@drawable/background_live_guard3">
<TextView <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="18dp" android:layout_weight="1"
android:layout_marginEnd="20dp" android:orientation="vertical">
android:text="@string/guardian_for_your_favorite_anchor"
android:textColor="@color/white" <TextView
android:textSize="14sp" /> android:id="@+id/guard_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="18dp"
android:layout_marginEnd="20dp"
android:gravity="center"
android:text="@string/guardian_for_your_favorite_anchor"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:id="@+id/guard_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="18dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="20dp"
android:gravity="center"
android:text="@string/guardian_for_your_favorite_anchor"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
<TextView <TextView
android:id="@+id/btn_guard_open" android:id="@+id/btn_guard_open"
android:layout_width="124dp" android:layout_width="124dp"
android:layout_height="42dp" android:layout_height="42dp"
android:gravity="center"
android:textSize="16sp"
android:textColor="@color/white"
android:textStyle="bold"
android:layout_gravity="center_vertical|end" android:layout_gravity="center_vertical|end"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:background="@mipmap/btn_guard_open"
android:gravity="center"
android:text="續費守護" android:text="續費守護"
android:background="@mipmap/btn_guard_open" /> android:textColor="@color/white"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>