[Modify]修改免费礼物逻辑
This commit is contained in:
@@ -14,6 +14,7 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.databinding.DialogRoomFreeGiftBinding;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftFreeInfo;
|
||||
import com.yizhuan.xchat_android_library.utils.TimeUtils;
|
||||
|
||||
/**
|
||||
* 房间免费礼物弹窗
|
||||
@@ -49,7 +50,7 @@ public class RoomFreeGiftDialog extends BottomSheetDialog implements View.OnClic
|
||||
params.dimAmount = 0f;
|
||||
getWindow().setAttributes(params);
|
||||
|
||||
binding.tvTop.setText(context.getString(R.string.dialog_free_gift_top, (int) giftFreeInfo.getFirstSecond()));
|
||||
binding.tvTop.setText(context.getString(R.string.dialog_free_gift_top, TimeUtils.secondsToTime(giftFreeInfo.getFirstSecond())));
|
||||
binding.tvBottom.setText(String.format(context.getString(R.string.dialog_free_gift_bottom_text), giftFreeInfo.getGiftName(), giftFreeInfo.getMaxStage()));
|
||||
ImageLoadUtilsV2.loadImage(binding.ivGiftIcon, giftFreeInfo.getGiftUrl());
|
||||
}
|
||||
|
@@ -120,7 +120,7 @@ public class GiftInfoVm extends BaseItem<GiftInfo> {
|
||||
}
|
||||
|
||||
public void updateFreeGiftCount() {
|
||||
int progress = data.getFreeGiftProgress();
|
||||
long progress = data.getFreeGiftProgress();
|
||||
String countDown = TimeUtils.timeConversion(progress);
|
||||
if (progress == 0) {
|
||||
this.countDownText.set("");
|
||||
|
@@ -1473,7 +1473,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
public void onReceiveFreeGift(UpdateKnapFreeGiftEvent event){
|
||||
if (giftIndicator.getCurrrentType() == GiftIndicator.TYPE_KNAP) {
|
||||
int giftId = event.getGiftId();
|
||||
int progress = event.getProgress();
|
||||
long progress = event.getProgress();
|
||||
if (ListUtils.isListEmpty(pagerList)) {
|
||||
return;
|
||||
}
|
||||
|
@@ -5011,8 +5011,8 @@
|
||||
<string name="times_reward_get">倍獎勵,獲得</string>
|
||||
<string name="diamond_point">鉆石!</string>
|
||||
<string name="free_gift">免費禮物</string>
|
||||
<string name="dialog_free_gift_top">今天觀看直播滿%d分鐘啦,送你一個禮物</string>
|
||||
<string name="dialog_free_gift_bottom_text">每天觀看直播達到特別時長,即可獲得一個%s,每日上限%d個,禮物當日生效</string>
|
||||
<string name="dialog_free_gift_top">今天觀看直播滿%s啦,送你一個禮物</string>
|
||||
<string name="dialog_free_gift_bottom_text">每天觀看直播達到特定時長,即可獲得一個%s,每日上限%d個,禮物當日生效</string>
|
||||
<string name="dialog_free_gift_know">我知道啦</string>
|
||||
|
||||
</resources>
|
@@ -650,8 +650,7 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
countDownTimer = new CountDownTimer(giftFreeInfo.getCurStageSecond() * 1000, 1000) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
Logger.info(TAG, String.valueOf(millisUntilFinished / 1000));
|
||||
EventBus.getDefault().post(new UpdateKnapFreeGiftEvent(giftId, (int) (millisUntilFinished / 1000)));
|
||||
EventBus.getDefault().post(new UpdateKnapFreeGiftEvent(giftId, millisUntilFinished / 1000));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -97,13 +97,13 @@ public class GiftInfo implements Serializable {
|
||||
private boolean drawGift;
|
||||
|
||||
//免费礼物倒计时进度
|
||||
private int mFreeGiftProgress = 0;
|
||||
private long mFreeGiftProgress = 0;
|
||||
|
||||
public int getFreeGiftProgress() {
|
||||
public long getFreeGiftProgress() {
|
||||
return mFreeGiftProgress;
|
||||
}
|
||||
|
||||
public void setFreeGiftProgress(int freeGiftProgress) {
|
||||
public void setFreeGiftProgress(long freeGiftProgress) {
|
||||
mFreeGiftProgress = freeGiftProgress;
|
||||
}
|
||||
|
||||
|
@@ -13,6 +13,6 @@ public class UpdateKnapFreeGiftEvent {
|
||||
|
||||
private int giftId;
|
||||
|
||||
private int progress;
|
||||
private long progress;
|
||||
|
||||
}
|
||||
|
@@ -83,6 +83,8 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VOICE_BOTTLE_SUB_tO_MATCHING;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_ATTACK;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_RESULT;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.ROOM_FREE_GIFT;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.ROOM_FREE_GIFT_REST;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -93,6 +95,7 @@ import com.yizhuan.xchat_android_core.bean.attachmsg.RoomQueueMsgAttachment;
|
||||
import com.yizhuan.xchat_android_core.community.attachment.DynamicSysAttachment;
|
||||
import com.yizhuan.xchat_android_core.community.attachment.UnReadCountAttachment;
|
||||
import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment;
|
||||
import com.yizhuan.xchat_android_core.gift.GiftModel;
|
||||
import com.yizhuan.xchat_android_core.im.custom.AttachManager;
|
||||
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionFourAttachment;
|
||||
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionOneAttachment;
|
||||
@@ -617,6 +620,11 @@ public class CustomAttachParser implements MsgAttachmentParser {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ROOM_FREE_GIFT:
|
||||
if (second == ROOM_FREE_GIFT_REST) {
|
||||
GiftModel.get().getFreeGift().subscribe();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LogUtils.e(ResUtil.getString(R.string.custom_bean_customattachparser_01) + first + " second=" + second);
|
||||
break;
|
||||
|
@@ -423,6 +423,10 @@ public class CustomAttachment implements MsgAttachment {
|
||||
public static final int CUSTOM_MSG_LUCKY_SEA_GIFT_ROOM_NOTIFY = 950; // 深海奇缘礼物房间飘屏通知
|
||||
public static final int CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_NOTIFY = 951;// 深海奇缘礼物全服飘屏通知
|
||||
|
||||
//免费礼物倒计时重置推送
|
||||
public static final int ROOM_FREE_GIFT = 96;
|
||||
public static final int ROOM_FREE_GIFT_REST = 960;
|
||||
|
||||
/**
|
||||
* 自定义消息附件的类型,根据该字段区分不同的自定义消息
|
||||
*/
|
||||
|
@@ -380,11 +380,11 @@ public class TimeUtils {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static String timeConversion(int time) {
|
||||
int hour = 0;
|
||||
int minutes = 0;
|
||||
int sencond = 0;
|
||||
int temp = time % 3600;
|
||||
public static String timeConversion(long time) {
|
||||
long hour = 0;
|
||||
long minutes = 0;
|
||||
long sencond = 0;
|
||||
long temp = time % 3600;
|
||||
if (time > 3600) {
|
||||
hour = time / 3600;
|
||||
if (temp != 0) {
|
||||
@@ -406,6 +406,19 @@ public class TimeUtils {
|
||||
return (hour<10?("0"+hour):hour) + ":" + (minutes<10?("0"+minutes):minutes) + ":" + (sencond<10?("0"+sencond):sencond);
|
||||
}
|
||||
|
||||
public static String secondsToTime(long seconds){
|
||||
long h=seconds/3600; //小时
|
||||
long m=(seconds%3600)/60; //分钟
|
||||
long s=(seconds%3600)%60; //秒
|
||||
if(h>0){
|
||||
return h+"小時"+m+"分鐘"+s+"秒";
|
||||
}
|
||||
if(m>0){
|
||||
return m+"分鐘"+s+"秒";
|
||||
}
|
||||
return s+"秒";
|
||||
}
|
||||
|
||||
public static String getChineseMonth(Context context, long millis) {
|
||||
int month = getMonth(millis);
|
||||
String[] monthStrs = context.getResources().getStringArray(R.array.time_month_strs);
|
||||
|
Reference in New Issue
Block a user