diff --git a/common/src/main/java/com/yunbao/common/bean/CoolConfig.java b/common/src/main/java/com/yunbao/common/bean/CoolConfig.java new file mode 100644 index 000000000..b4d5aa04f --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/CoolConfig.java @@ -0,0 +1,24 @@ +package com.yunbao.common.bean; + +public class CoolConfig extends BaseModel { + private int rate; + private String ticketCount="0" ; + + public String getTicketCount() { + return ticketCount; + } + + public CoolConfig setTicketCount(String ticketCount) { + this.ticketCount = ticketCount; + return this; + } + + public int getRate() { + return rate; + } + + public CoolConfig setRate(int rate) { + this.rate = rate; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java b/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java index 35d6b7295..049be7908 100644 --- a/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java +++ b/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java @@ -39,6 +39,28 @@ public class EnterRoomNewModel extends BaseModel { private String sudGameRoomName; @SerializedName("sud_gameDate") private SudGameDateModel sudGameDateModel; + @SerializedName("quick_gift_remaining_quantity") + private int quickGiftRemainingQuantity;//剩余的小PD礼物数量 + @SerializedName("if_viewing_duration_complete") + private int ifViewingDurationComplete;//通过观看时间获取小PD礼物的次数 + + public int getQuickGiftRemainingQuantity() { + return quickGiftRemainingQuantity; + } + + public EnterRoomNewModel setQuickGiftRemainingQuantity(int quickGiftRemainingQuantity) { + this.quickGiftRemainingQuantity = quickGiftRemainingQuantity; + return this; + } + + public int getIfViewingDurationComplete() { + return ifViewingDurationComplete; + } + + public EnterRoomNewModel setIfViewingDurationComplete(int ifViewingDurationComplete) { + this.ifViewingDurationComplete = ifViewingDurationComplete; + return this; + } public SudGameDateModel getSudGameDateModel() { return sudGameDateModel; diff --git a/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java b/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java index 1bde53fb4..c011a5a67 100644 --- a/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java +++ b/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java @@ -204,7 +204,7 @@ public class IMLoginModel extends BaseModel { @SerializedName("votes") private String votes; @SerializedName("yuanbao") - private double yuanbao; + private String yuanbao; @SerializedName("list") private List> list; @SerializedName("slide") @@ -825,11 +825,11 @@ public class IMLoginModel extends BaseModel { return this; } - public double getYuanbao() { + public String getYuanbao() { return yuanbao; } - public IMLoginModel setYuanbao(double yuanbao) { + public IMLoginModel setYuanbao(String yuanbao) { this.yuanbao = yuanbao; return this; } diff --git a/common/src/main/java/com/yunbao/common/bean/NativeCallbackModel.java b/common/src/main/java/com/yunbao/common/bean/NativeCallbackModel.java new file mode 100644 index 000000000..742409245 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/NativeCallbackModel.java @@ -0,0 +1,14 @@ +package com.yunbao.common.bean; + +public class NativeCallbackModel extends BaseModel{ + private String uid ; + + public String getUid() { + return uid; + } + + public NativeCallbackModel setUid(String uid) { + this.uid = uid; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/QuickGiftSendGiftModel.java b/common/src/main/java/com/yunbao/common/bean/QuickGiftSendGiftModel.java new file mode 100644 index 000000000..493c83b2a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/QuickGiftSendGiftModel.java @@ -0,0 +1,39 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class QuickGiftSendGiftModel extends BaseModel { + @SerializedName("quick_gift_remaining_quantity") + private int quickGiftRemainingQuantity;//剩余的小PD礼物数量 + @SerializedName("if_viewing_duration_complete") + private int ifViewingDurationComplete;//通过观看时间获取小PD礼物的次数 + @SerializedName("if_hidden_egg") + private int ifHiddenEgg = 1;//1.未解锁 2.已解锁过奖励 3.当前请求解锁了奖励 + + public int getIfHiddenEgg() { + return ifHiddenEgg; + } + + public QuickGiftSendGiftModel setIfHiddenEgg(int ifHiddenEgg) { + this.ifHiddenEgg = ifHiddenEgg; + return this; + } + + public int getQuickGiftRemainingQuantity() { + return quickGiftRemainingQuantity; + } + + public QuickGiftSendGiftModel setQuickGiftRemainingQuantity(int quickGiftRemainingQuantity) { + this.quickGiftRemainingQuantity = quickGiftRemainingQuantity; + return this; + } + + public int getIfViewingDurationComplete() { + return ifViewingDurationComplete; + } + + public QuickGiftSendGiftModel setIfViewingDurationComplete(int ifViewingDurationComplete) { + this.ifViewingDurationComplete = ifViewingDurationComplete; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/CinemaTicketPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/CinemaTicketPopupWindow.java new file mode 100644 index 000000000..010bf189a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/CinemaTicketPopupWindow.java @@ -0,0 +1,101 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.bean.CoolConfig; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +import java.math.BigDecimal; + +public class CinemaTicketPopupWindow extends CenterPopupView { + private CoolConfig mCoolConfig; + private TextView cinemaTicket, ticketsPlusMinus, quantityNeed; + private int ticket = 1; + private CinemaTicketPopupWindowCallBack mCinemaTicketPopupWindowCallBack; + + public CinemaTicketPopupWindow(@NonNull Context context, CoolConfig coolConfig, CinemaTicketPopupWindowCallBack cinemaTicketPopupWindowCallBack) { + super(context); + mCoolConfig = coolConfig; + mCinemaTicketPopupWindowCallBack = cinemaTicketPopupWindowCallBack; + } + + @Override + protected int getImplLayoutId() { + return R.layout.cinema_ticket_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + + cinemaTicket = findViewById(R.id.cinema_ticket); + ticketsPlusMinus = findViewById(R.id.tickets_plus_minus); + quantityNeed = findViewById(R.id.quantity_need); + cinemaTicket.setText(new BigDecimal(ticket).add(new BigDecimal(mCoolConfig.getTicketCount())).toString()); + ticketsPlusMinus.setText(String.valueOf(ticket)); + quantityNeed.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).toString()); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.cinema_ticket_close), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); + findViewById(R.id.sub).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + if (ticket > 1) { + ticket = ticket - 1; + + cinemaTicket.setText(new BigDecimal(ticket).add(new BigDecimal(mCoolConfig.getTicketCount())).toString()); + ticketsPlusMinus.setText(String.valueOf(ticket)); + quantityNeed.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).toString()); + } + } + }); + findViewById(R.id.add).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + ticket = ticket + 1; + cinemaTicket.setText(new BigDecimal(ticket).add(new BigDecimal(mCoolConfig.getTicketCount())).toString()); + ticketsPlusMinus.setText(String.valueOf(ticket)); + quantityNeed.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).toString()); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.cinema_ticket_exchange), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + LiveNetManager.get(getContext()) + .buyTicket(String.valueOf(ticket), new HttpCallback() { + @Override + public void onSuccess(String data) { + + + if (mCinemaTicketPopupWindowCallBack != null) { + mCinemaTicketPopupWindowCallBack.onCallBack(data); + } + dialog.dismiss(); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + }); + } + + public interface CinemaTicketPopupWindowCallBack { + void onCallBack(String data); + } +} diff --git a/common/src/main/java/com/yunbao/common/event/JavascriptInterfaceEvent.java b/common/src/main/java/com/yunbao/common/event/JavascriptInterfaceEvent.java index 474e127e4..8b1beba89 100644 --- a/common/src/main/java/com/yunbao/common/event/JavascriptInterfaceEvent.java +++ b/common/src/main/java/com/yunbao/common/event/JavascriptInterfaceEvent.java @@ -1,6 +1,7 @@ package com.yunbao.common.event; import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.CoolConfig; import com.yunbao.common.bean.VideoBean; import java.util.ArrayList; @@ -23,6 +24,16 @@ public class JavascriptInterfaceEvent extends BaseModel { private String data; private String name; private String image; + private CoolConfig coolConfig; + + public CoolConfig getCoolConfig() { + return coolConfig; + } + + public JavascriptInterfaceEvent setCoolConfig(CoolConfig coolConfig) { + this.coolConfig = coolConfig; + return this; + } public String getName() { return name; diff --git a/common/src/main/java/com/yunbao/common/event/QuickGiftingEvent.java b/common/src/main/java/com/yunbao/common/event/QuickGiftingEvent.java new file mode 100644 index 000000000..8253aa1a6 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/QuickGiftingEvent.java @@ -0,0 +1,67 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class QuickGiftingEvent extends BaseModel { + private int index; + private String svgaName; + private boolean show =false; + private boolean reminder = false; + + private String giftRemainingQuantity; + private String hotNum; + + public String getHotNum() { + return hotNum; + } + + public QuickGiftingEvent setHotNum(String hotNum) { + this.hotNum = hotNum; + return this; + } + + public String getGiftRemainingQuantity() { + return giftRemainingQuantity; + } + + public QuickGiftingEvent setGiftRemainingQuantity(String giftRemainingQuantity) { + this.giftRemainingQuantity = giftRemainingQuantity; + return this; + } + + public boolean isReminder() { + return reminder; + } + + public QuickGiftingEvent setReminder(boolean reminder) { + this.reminder = reminder; + return this; + } + + public boolean isShow() { + return show; + } + + public QuickGiftingEvent setShow(boolean show) { + this.show = show; + return this; + } + + public int getIndex() { + return index; + } + + public QuickGiftingEvent setIndex(int index) { + this.index = index; + return this; + } + + public String getSvgaName() { + return svgaName; + } + + public QuickGiftingEvent setSvgaName(String svgaName) { + this.svgaName = svgaName; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/SlideEvent.java b/common/src/main/java/com/yunbao/common/event/SlideEvent.java new file mode 100644 index 000000000..482dff588 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/SlideEvent.java @@ -0,0 +1,15 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class SlideEvent extends BaseModel { + private boolean isSlide; + + public boolean isSlide() { + return isSlide; + } + public SlideEvent setSlide(boolean slide) { + isSlide = slide; + return this; + } +} 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 b8298861e..b0f7ca437 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -9,6 +9,7 @@ import com.yunbao.common.bean.BlindBoxInfoModel; import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.CheckRemainingBalance; import com.yunbao.common.bean.ContributeModel; +import com.yunbao.common.bean.CoolConfig; import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.DiscountsModel; @@ -46,6 +47,7 @@ import com.yunbao.common.bean.OpenAdModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.PrankGiftBean; import com.yunbao.common.bean.PrankHttpTurntableBean; +import com.yunbao.common.bean.QuickGiftSendGiftModel; import com.yunbao.common.bean.RandomPkUserBean; import com.yunbao.common.bean.RankPkInfoBean; import com.yunbao.common.bean.RedPacketDetailsBean; @@ -1061,9 +1063,32 @@ public interface PDLiveApi { @GET("/api/public/?service=Sudgameserver.deductMoney") Observable> deductMoney( @Query("room_id") String roomId + ); + @GET("/api/public/?service=Sudgameserver.checkCurrency") Observable> checkCurrency( ); + + @GET("/api/public/?service=Quickgift.sendGift") + Observable> quickGiftSendGift( + @Query("quick_gift_number") String quickGiftNumber, + @Query("liveuid") String liveUid, + @Query("stream") String stream + ); + + @GET("/api/public/?service=Quickgift.viewingDurationGetGift") + Observable> viewingDurationGetGift( + @Query("liveuid") String liveUid + ); + + @GET("/api/public/?service=cool.config") + Observable> getCoolConfig(); + + @FormUrlEncoded + @POST("/api/public/?service=cool.buy_ticket") + Observable> buyTicket( + @Field("quantity") String quantity + ); } 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 7627a1f77..5716e4c33 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 @@ -11,6 +11,7 @@ import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.BlindBoxInfoModel; import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.CheckRemainingBalance; +import com.yunbao.common.bean.CoolConfig; import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.DiscountsModel; @@ -44,6 +45,7 @@ import com.yunbao.common.bean.OpenAdModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.PrankGiftBean; import com.yunbao.common.bean.PrankHttpTurntableBean; +import com.yunbao.common.bean.QuickGiftSendGiftModel; import com.yunbao.common.bean.RandomPkUserBean; import com.yunbao.common.bean.RankPkInfoBean; import com.yunbao.common.bean.RedPacketDetailsBean; @@ -2317,21 +2319,21 @@ public class LiveNetManager { } public void deductMoney(String roomId) { - API.get().pdLiveApi(mContext) - .deductMoney(roomId) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new Consumer>() { - @Override - public void accept(ResponseModel objectResponseModel) throws Exception { - - } - }, new Consumer() { - @Override - public void accept(Throwable throwable) throws Exception { - - } - }).isDisposed(); +// API.get().pdLiveApi(mContext) +// .deductMoney(roomId) +// .subscribeOn(Schedulers.io()) +// .observeOn(AndroidSchedulers.mainThread()) +// .subscribe(new Consumer>() { +// @Override +// public void accept(ResponseModel objectResponseModel) throws Exception { +// +// } +// }, new Consumer() { +// @Override +// public void accept(Throwable throwable) throws Exception { +// +// } +// }).isDisposed(); } public void checkCurrency(HttpCallback callback) { @@ -2384,6 +2386,102 @@ public class LiveNetManager { }).isDisposed(); } + public void viewingDurationGetGift(String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .viewingDurationGetGift(liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel quickGiftSendGiftModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(quickGiftSendGiftModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void getCoolConfig(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getCoolConfig() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel coolConfigResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(coolConfigResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + + } + + public void buyTicket(String quantity, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .buyTicket(quantity) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel objectResponseModel) throws Exception { + if (callback != null) { + if (objectResponseModel.getData().getCode() == 200) { + callback.onSuccess("1"); + } else if (objectResponseModel.getData().getCode() == 500) { + callback.onSuccess("2"); + } else { + callback.onError(objectResponseModel.getData().getMsg()); + } + + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void quickGiftSendGift(String quickGiftNumber, String liveUid, String stream, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .quickGiftSendGift(quickGiftNumber, liveUid, stream) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel quickGiftSendGiftModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(quickGiftSendGiftModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + public void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid, String currencyType, int page, HttpCallback> callback) { API.get().pdLiveApi(mContext) .getRoomList(sudGameId, threshold, roomHolderType, liveUid, currencyType, page) 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 bab23995e..90e1fbda8 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -60,6 +60,13 @@ public class IMLoginManager extends BaseCacheManager { public boolean getRedPoint() { return !TextUtils.isEmpty(getString("RedPoint")) && !TextUtils.equals(getString("RedPoint"), "1"); } + public void setQuickGiftIfFirst() { + put("quick_gift_if_first", "1"); + } + + public boolean getQuickGiftIfFirst() { + return TextUtils.isEmpty(getString("quick_gift_if_first")) || !TextUtils.equals(getString("quick_gift_if_first"), "1"); + } public void setSudGameMin() { put("SudGameMin", "0"); diff --git a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfacePlayLetUtils.java b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfacePlayLetUtils.java new file mode 100644 index 000000000..fed640833 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfacePlayLetUtils.java @@ -0,0 +1,54 @@ +package com.yunbao.common.utils; + +import android.app.Activity; +import android.util.Log; +import android.webkit.JavascriptInterface; +import android.webkit.WebView; + +import com.momo.mcamera.util.JsonUtil; +import com.yunbao.common.bean.CoolConfig; +import com.yunbao.common.event.JavascriptInterfaceEvent; + +public class JavascriptInterfacePlayLetUtils { + private Activity mContext; + private WebView mWebView; + private static JavascriptInterfacePlayLetUtils sInstance; + + public static JavascriptInterfacePlayLetUtils getInstance() { + + synchronized (JavascriptInterfacePlayLetUtils.class) { + + sInstance = new JavascriptInterfacePlayLetUtils(); + + return sInstance; + } + } + + public JavascriptInterfacePlayLetUtils setmContext(Activity mContext, WebView mWebView) { + this.mContext = mContext; + this.mWebView = mWebView; +// webView.evaluateJavascript("javascript:nativeCallback('" + params + "')", new ValueCallback() { +// @Override +// public void onReceiveValue(String value) { +// } +// }); + return this; + } + + @JavascriptInterface + public void postEvent(String name, String data) { + Log.e("TAG", "postEvent name==" + name); + Log.e("TAG", "postEvent data==" + data); + } + + @JavascriptInterface + public void postWeakBalance(String data) { + CoolConfig coolConfig = new JsonUtil().fromJson(data, CoolConfig.class); + Log.e("TAG", "postWeakBalance data==" + data); + Bus.get().post(new JavascriptInterfaceEvent() + .setCoolConfig(coolConfig) + .setMethod("postWeakBalance")); + + + } +} 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 62fc018f7..8918e70e0 100644 --- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java @@ -2,11 +2,13 @@ package com.yunbao.common.utils; import static com.yunbao.common.CommonAppConfig.isGetNewWrap; import static com.yunbao.common.utils.RouteUtil.PATH_COIN; +import static com.yunbao.common.utils.RouteUtil.PATH_REWARD; import android.app.Activity; import android.app.Dialog; import android.os.Handler; import android.os.Looper; +import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.webkit.JavascriptInterface; @@ -25,6 +27,7 @@ import com.yunbao.common.bean.VideoBean; import com.yunbao.common.bean.VideoListBean; import com.yunbao.common.event.JavascriptInterfaceEvent; import com.yunbao.common.event.LiveRoomChangeEvent; +import com.yunbao.common.event.QuickGiftingEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.LiveHttpUtil; @@ -124,10 +127,10 @@ public class JavascriptInterfaceUtils { url = CommonAppConfig.HOST + url; if (url.contains("?")) { url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); } else { url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); } if (LiveZhuangBana) { RouteUtil.forwardLiveZhuangBanActivity(url, false); @@ -147,10 +150,10 @@ public class JavascriptInterfaceUtils { url = CommonAppConfig.HOST + url; if (url.contains("?")) { url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); } else { url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); } if (LiveZhuangBana) { RouteUtil.forwardLiveZhuangBanActivity(url, title); @@ -259,11 +262,12 @@ public class JavascriptInterfaceUtils { /** * 跳转直播并打开礼物栏选中礼物 + * * @param liveId 直播间id * @param giftId 礼物id */ @JavascriptInterface - public void androidMethodLookToLiveGift(String liveId,String giftId){ + public void androidMethodLookToLiveGift(String liveId, String giftId) { LiveHttpUtil.getLiveInfo(liveId, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -300,6 +304,7 @@ public class JavascriptInterfaceUtils { } }); } + @JavascriptInterface public void androidMethodLookToLive(String liveId) { Bus.get().post(new JavascriptInterfaceEvent() @@ -598,6 +603,18 @@ public class JavascriptInterfaceUtils { .setMethod("clickLogOffAccount")); } + @JavascriptInterface + public void androidClickToTaskPage() { + ARouter.getInstance().build(PATH_REWARD).withString("url", + CommonAppConfig.HOST + "/index.php?g=Appapi&m=task&a=index" + "&uid=" + CommonAppConfig.getInstance().getUid() + + "&token=" + CommonAppConfig.getInstance().getToken() + "&tabIndex=1"+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0")).navigation(); + } + + @JavascriptInterface + public void androidQuickGiftRemainingQuantity(int giftRemainingQuantity) { + Bus.get().post(new QuickGiftingEvent().setGiftRemainingQuantity(String.valueOf(giftRemainingQuantity))); + } + @JavascriptInterface public void androidFansGroupBuy(String id) { Bus.get().post(new JavascriptInterfaceEvent() @@ -644,8 +661,9 @@ public class JavascriptInterfaceUtils { Bus.get().post(new JavascriptInterfaceEvent() .setMethod("androidCancelAnchorAttention")); } + @JavascriptInterface - public void androidLnsufficientBalanceClick(String msg){ + public void androidLnsufficientBalanceClick(String msg) { DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() { @Override public void onCancelClick() { @@ -659,4 +677,5 @@ public class JavascriptInterfaceUtils { } }); } + } diff --git a/common/src/main/java/com/yunbao/common/views/weight/CircleProgress2.java b/common/src/main/java/com/yunbao/common/views/weight/CircleProgress2.java new file mode 100644 index 000000000..7efdb89c5 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/weight/CircleProgress2.java @@ -0,0 +1,73 @@ +package com.yunbao.common.views.weight; + + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.RectF; +import android.util.AttributeSet; +import android.view.View; + +public class CircleProgress2 extends View { + private Paint mPaint; + private RectF mRectF; + private int mCurrent = 10, mMax = 100; + //圆弧(也可以说是圆环)的宽度 + private float mArcWidth =7; + //控件的宽度 + private float mWidth; + + public CircleProgress2(Context context) { + this(context, null); + } + + public CircleProgress2(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public CircleProgress2(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + mPaint = new Paint(); + mPaint.setAntiAlias(true); + mRectF = new RectF(); + } + + public void setCurrent(int mCurrent) { + this.mCurrent = mCurrent; + invalidate(); + } + + public void setMax(int mMax) { + this.mMax = mMax; + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + //getMeasuredWidth获取的是view的原始大小,也就是xml中配置或者代码中设置的大小 + //getWidth获取的是view最终显示的大小,这个大小不一定等于原始大小 + mWidth = getMeasuredWidth(); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + mPaint.setStyle(Paint.Style.STROKE); + //设置圆弧的宽度(圆环的宽度) + mPaint.setStrokeWidth(mArcWidth); + mPaint.setColor(Color.TRANSPARENT); + //大圆的半径 + float bigCircleRadius = mWidth / 2; + //小圆的半径 + float smallCircleRadius = bigCircleRadius; + //绘制小圆 + canvas.drawCircle(bigCircleRadius, bigCircleRadius, smallCircleRadius, mPaint); + mPaint.setColor(Color.parseColor("#FEC51B")); + mRectF.set(mArcWidth, mArcWidth, mWidth - mArcWidth, mWidth - mArcWidth); + //绘制圆弧 + canvas.drawArc(mRectF, -90, mCurrent * 360 / mMax, false, mPaint); + setBackgroundColor(Color.TRANSPARENT); + } + +} diff --git a/common/src/main/res/drawable/backgroud_panda_time.xml b/common/src/main/res/drawable/backgroud_panda_time.xml new file mode 100644 index 000000000..399a3cc0c --- /dev/null +++ b/common/src/main/res/drawable/backgroud_panda_time.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/background_cinema_ticket_hint.xml b/common/src/main/res/drawable/background_cinema_ticket_hint.xml new file mode 100644 index 000000000..bf1eaf96a --- /dev/null +++ b/common/src/main/res/drawable/background_cinema_ticket_hint.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/common/src/main/res/layout/cinema_ticket_popup.xml b/common/src/main/res/layout/cinema_ticket_popup.xml new file mode 100644 index 000000000..58778fa45 --- /dev/null +++ b/common/src/main/res/layout/cinema_ticket_popup.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-b+en+us/background_quick_gift_reminder.png b/common/src/main/res/mipmap-b+en+us/background_quick_gift_reminder.png new file mode 100644 index 000000000..f49f0f4bb Binary files /dev/null and b/common/src/main/res/mipmap-b+en+us/background_quick_gift_reminder.png differ diff --git a/common/src/main/res/mipmap-b+en+us/backgroundn_cinema_ticket_exchange.png b/common/src/main/res/mipmap-b+en+us/backgroundn_cinema_ticket_exchange.png new file mode 100644 index 000000000..da90a6622 Binary files /dev/null and b/common/src/main/res/mipmap-b+en+us/backgroundn_cinema_ticket_exchange.png differ diff --git a/common/src/main/res/mipmap-b+en+us/icon_cinema_ticket_title.png b/common/src/main/res/mipmap-b+en+us/icon_cinema_ticket_title.png new file mode 100644 index 000000000..6520c65c5 Binary files /dev/null and b/common/src/main/res/mipmap-b+en+us/icon_cinema_ticket_title.png differ diff --git a/common/src/main/res/mipmap-hdpi/icon_pd_pao.png b/common/src/main/res/mipmap-hdpi/icon_pd_pao.png new file mode 100644 index 000000000..47ee6f10b Binary files /dev/null and b/common/src/main/res/mipmap-hdpi/icon_pd_pao.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/background_quick_gift_reminder.png b/common/src/main/res/mipmap-xxhdpi/background_quick_gift_reminder.png new file mode 100644 index 000000000..40a338914 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/background_quick_gift_reminder.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_combo.png b/common/src/main/res/mipmap-xxhdpi/icon_combo.png new file mode 100644 index 000000000..3ce65fe8c Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_combo.png differ diff --git a/common/src/main/res/mipmap-xxxhdpi/backgroud_tickets_plus_minus.png b/common/src/main/res/mipmap-xxxhdpi/backgroud_tickets_plus_minus.png new file mode 100644 index 000000000..8bcf9b285 Binary files /dev/null and b/common/src/main/res/mipmap-xxxhdpi/backgroud_tickets_plus_minus.png differ diff --git a/common/src/main/res/mipmap-xxxhdpi/background_cinema_ticket.png b/common/src/main/res/mipmap-xxxhdpi/background_cinema_ticket.png new file mode 100644 index 000000000..c2fa2bf91 Binary files /dev/null and b/common/src/main/res/mipmap-xxxhdpi/background_cinema_ticket.png differ diff --git a/common/src/main/res/mipmap-xxxhdpi/backgroundn_cinema_ticket_exchange.png b/common/src/main/res/mipmap-xxxhdpi/backgroundn_cinema_ticket_exchange.png new file mode 100644 index 000000000..110da07a0 Binary files /dev/null and b/common/src/main/res/mipmap-xxxhdpi/backgroundn_cinema_ticket_exchange.png differ diff --git a/common/src/main/res/mipmap-xxxhdpi/icon_cinema_ticket.png b/common/src/main/res/mipmap-xxxhdpi/icon_cinema_ticket.png new file mode 100644 index 000000000..bcb7554da Binary files /dev/null and b/common/src/main/res/mipmap-xxxhdpi/icon_cinema_ticket.png differ diff --git a/common/src/main/res/mipmap-xxxhdpi/icon_cinema_ticket_close.png b/common/src/main/res/mipmap-xxxhdpi/icon_cinema_ticket_close.png new file mode 100644 index 000000000..f2f8c448d Binary files /dev/null and b/common/src/main/res/mipmap-xxxhdpi/icon_cinema_ticket_close.png differ diff --git a/common/src/main/res/mipmap-xxxhdpi/icon_cinema_ticket_title.png b/common/src/main/res/mipmap-xxxhdpi/icon_cinema_ticket_title.png new file mode 100644 index 000000000..c465bfc4d Binary files /dev/null and b/common/src/main/res/mipmap-xxxhdpi/icon_cinema_ticket_title.png differ diff --git a/common/src/main/res/mipmap-xxxhdpi/icon_collectibles2.png b/common/src/main/res/mipmap-xxxhdpi/icon_collectibles2.png new file mode 100644 index 000000000..977fe087d Binary files /dev/null and b/common/src/main/res/mipmap-xxxhdpi/icon_collectibles2.png differ diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index b8c6597cd..56358e6b1 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1386,5 +1386,12 @@ Limited ride And limited avatar frame 0-100 coins 100-500 coins Above 500 coins + combo X + Exchange quantity: + Need %s + Exchange&Usage Rules: + ·One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance; + ·One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie; + ·Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities. diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 9313068f9..1c9c00ff1 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1383,4 +1383,11 @@ 0-100星幣 100-500星幣 500以上星幣 + 連擊× + 兌換數量: + 需要 %s + 兌換&使用規則: + ·1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認; + ·1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片; + ·觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲 打擊。 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 4a2e232d9..99a35ce6f 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1382,4 +1382,11 @@ 0-100星幣 100-500星幣 500以上星幣 + 連擊× + 兌換數量: + 需要 %s + 兌換&使用規則: + ·1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認; + ·1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片; + ·觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲 打擊。 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index eed7b579e..9bcf8c8e3 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1382,5 +1382,12 @@ 0-100星幣 100-500星幣 500以上星幣 + 連擊× + 兌換數量: + 需要 %s + 兌換&使用規則: + ·1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認; + ·1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片; + ·觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 1d9a1b650..9b648b88d 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1389,4 +1389,11 @@ Limited ride And limited avatar frame 0-100 coins 100-500 coins Above 500 coins + combo X + Exchange quantity: + Need %s + Exchange&Usage Rules: + ·One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance; + ·One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie; + ·Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities. diff --git a/config.gradle b/config.gradle index 6a55ef543..9b4d6997d 100644 --- a/config.gradle +++ b/config.gradle @@ -5,7 +5,7 @@ ext { minSdkVersion : 21, targetSdkVersion : 33, versionCode : 458, - versionName : "6.6.2" + versionName : "6.6.3" ] manifestPlaceholders = [ //正式、 @@ -19,11 +19,13 @@ ext { baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnRB", baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", +// true表示谷歌支付 false + isGooglePlay : false, // true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包 isGooglePlay : 1, //是否上报异常日志 isUploadLog : true, //是否打包成插件包模式 - isPluginModel : false, + isPluginModel : true, ] } diff --git a/live/src/main/assets/littlepanda1.svga b/live/src/main/assets/littlepanda1.svga new file mode 100644 index 000000000..1903ebe28 Binary files /dev/null and b/live/src/main/assets/littlepanda1.svga differ diff --git a/live/src/main/assets/littlepanda10.svga b/live/src/main/assets/littlepanda10.svga new file mode 100644 index 000000000..39b52deeb Binary files /dev/null and b/live/src/main/assets/littlepanda10.svga differ diff --git a/live/src/main/assets/littlepanda11.svga b/live/src/main/assets/littlepanda11.svga new file mode 100644 index 000000000..86ff67d6f Binary files /dev/null and b/live/src/main/assets/littlepanda11.svga differ diff --git a/live/src/main/assets/littlepanda12.svga b/live/src/main/assets/littlepanda12.svga new file mode 100644 index 000000000..18f0e3eb5 Binary files /dev/null and b/live/src/main/assets/littlepanda12.svga differ diff --git a/live/src/main/assets/littlepanda13.svga b/live/src/main/assets/littlepanda13.svga new file mode 100644 index 000000000..c2a56376c Binary files /dev/null and b/live/src/main/assets/littlepanda13.svga differ diff --git a/live/src/main/assets/littlepanda14.svga b/live/src/main/assets/littlepanda14.svga new file mode 100644 index 000000000..0c0af324a Binary files /dev/null and b/live/src/main/assets/littlepanda14.svga differ diff --git a/live/src/main/assets/littlepanda15.svga b/live/src/main/assets/littlepanda15.svga new file mode 100644 index 000000000..4e0ac1b7d Binary files /dev/null and b/live/src/main/assets/littlepanda15.svga differ diff --git a/live/src/main/assets/littlepanda16.svga b/live/src/main/assets/littlepanda16.svga new file mode 100644 index 000000000..b4c0838ac Binary files /dev/null and b/live/src/main/assets/littlepanda16.svga differ diff --git a/live/src/main/assets/littlepanda17.svga b/live/src/main/assets/littlepanda17.svga new file mode 100644 index 000000000..72ceb9999 Binary files /dev/null and b/live/src/main/assets/littlepanda17.svga differ diff --git a/live/src/main/assets/littlepanda18.svga b/live/src/main/assets/littlepanda18.svga new file mode 100644 index 000000000..b4a561697 Binary files /dev/null and b/live/src/main/assets/littlepanda18.svga differ diff --git a/live/src/main/assets/littlepanda19.svga b/live/src/main/assets/littlepanda19.svga new file mode 100644 index 000000000..7f0fdd99e Binary files /dev/null and b/live/src/main/assets/littlepanda19.svga differ diff --git a/live/src/main/assets/littlepanda2.svga b/live/src/main/assets/littlepanda2.svga new file mode 100644 index 000000000..632bbb87f Binary files /dev/null and b/live/src/main/assets/littlepanda2.svga differ diff --git a/live/src/main/assets/littlepanda3.svga b/live/src/main/assets/littlepanda3.svga new file mode 100644 index 000000000..92b53d058 Binary files /dev/null and b/live/src/main/assets/littlepanda3.svga differ diff --git a/live/src/main/assets/littlepanda4.svga b/live/src/main/assets/littlepanda4.svga new file mode 100644 index 000000000..7b6ab0692 Binary files /dev/null and b/live/src/main/assets/littlepanda4.svga differ diff --git a/live/src/main/assets/littlepanda5.svga b/live/src/main/assets/littlepanda5.svga new file mode 100644 index 000000000..42293109f Binary files /dev/null and b/live/src/main/assets/littlepanda5.svga differ diff --git a/live/src/main/assets/littlepanda6.svga b/live/src/main/assets/littlepanda6.svga new file mode 100644 index 000000000..6d0311b04 Binary files /dev/null and b/live/src/main/assets/littlepanda6.svga differ diff --git a/live/src/main/assets/littlepanda7.svga b/live/src/main/assets/littlepanda7.svga new file mode 100644 index 000000000..f01bc2fc6 Binary files /dev/null and b/live/src/main/assets/littlepanda7.svga differ diff --git a/live/src/main/assets/littlepanda8.svga b/live/src/main/assets/littlepanda8.svga new file mode 100644 index 000000000..d6d150eb5 Binary files /dev/null and b/live/src/main/assets/littlepanda8.svga differ diff --git a/live/src/main/assets/littlepanda9.svga b/live/src/main/assets/littlepanda9.svga new file mode 100644 index 000000000..45cacbb11 Binary files /dev/null and b/live/src/main/assets/littlepanda9.svga differ diff --git a/live/src/main/assets/littlepanda_craft.svga b/live/src/main/assets/littlepanda_craft.svga new file mode 100644 index 000000000..a612ba08a Binary files /dev/null and b/live/src/main/assets/littlepanda_craft.svga differ diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 1770cfdd9..d7c139793 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -70,7 +70,9 @@ import com.yunbao.common.event.LiveOpenSudRoomEvent; import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent; import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent; +import com.yunbao.common.event.QuickGiftingEvent; import com.yunbao.common.event.ShowHideEvent; +import com.yunbao.common.event.SlideEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; @@ -1727,14 +1729,13 @@ public class LiveAudienceActivity extends LiveActivity { .dismissOnTouchOutside(false) .dismissOnBackPressed(false) .asCustom(liveSudGamePopupXPopup).show(); - }else { + } else { if (liveSudGamePopupXPopup != null) { liveSudGamePopupXPopup.dialog.show(); } } - break; case 1: @@ -1763,6 +1764,36 @@ public class LiveAudienceActivity extends LiveActivity { } } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onSlideEvent(SlideEvent event) { + verticalViewPager.setEnableScroll(event.isSlide()); + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onQuickGiftingEvent(QuickGiftingEvent event) { + if (manager != null) { + if (TextUtils.isEmpty(event.getHotNum())) { + if (TextUtils.isEmpty(event.getGiftRemainingQuantity())) { + if (event.isReminder()) { + manager.onQuickGifting3(); + } else { + if (event.isShow()) { + manager.onQuickGifting2(true); + } else { + manager.onQuickGifting(event.getIndex(), event.getSvgaName()); + } + } + } else { + manager.setGiftRemainingQuantity(event.getGiftRemainingQuantity()); + } + } else { + manager.setHotNum(event.getHotNum()); + } + + + } + } + @Subscribe(threadMode = ThreadMode.MAIN) public void onNewRoleCustomDrawerPopupEvent(NewRoleCustomDrawerPopupEvent event) { //是否关闭弹窗 diff --git a/live/src/main/java/com/yunbao/live/bean/SendQuickGiftModel.java b/live/src/main/java/com/yunbao/live/bean/SendQuickGiftModel.java new file mode 100644 index 000000000..a3add8eaf --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/SendQuickGiftModel.java @@ -0,0 +1,52 @@ +package com.yunbao.live.bean; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.bean.BaseModel; + +public class SendQuickGiftModel extends BaseModel { + + @SerializedName("_method_") + private String method; + @SerializedName("user_nicename") + private String userNicename; + @SerializedName("quick_gift_number") + private String quickGiftNumber; + @SerializedName("hot_num") + private String hotNum; + + public String getHotNum() { + return hotNum; + } + + public SendQuickGiftModel setHotNum(String hotNum) { + this.hotNum = hotNum; + return this; + } + + public String getMethod() { + return method; + } + + public SendQuickGiftModel setMethod(String method) { + this.method = method; + return this; + } + + public String getUserNicename() { + return userNicename; + } + + public SendQuickGiftModel setUserNicename(String userNicename) { + this.userNicename = userNicename; + return this; + } + + public String getQuickGiftNumber() { + return quickGiftNumber; + } + + public SendQuickGiftModel setQuickGiftNumber(String quickGiftNumber) { + this.quickGiftNumber = quickGiftNumber; + return this; + } +} diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index b3a5087cc..03b009666 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -38,6 +38,7 @@ import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.event.AllServerNotifyEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.GiftWallIlluminateEvent; +import com.yunbao.common.event.QuickGiftingEvent; import com.yunbao.common.event.SendBlindGiftEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; @@ -62,6 +63,7 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; +import com.yunbao.live.bean.SendQuickGiftModel; import com.yunbao.live.event.LiveAnchorEvent; import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.views.LiveEndViewHolder; @@ -762,6 +764,16 @@ public class SocketRyClient { .setAvatar(WordUtil.isNewZh() ? map.getString("sud_game_name") : map.getString("sud_game_name_en")) .setCreateSudRoomModel(GsonUtils.fromJson(map.toString(), SudGameDateModel.class))); break; + case "sendQuickGift": + SendQuickGiftModel sendQuickGiftModel = GsonUtils.fromJson(map.toString(), SendQuickGiftModel.class); + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append(sendQuickGiftModel.getUserNicename()) + .append(WordUtil.isNewZh() ? " 送出了 " : " sent ") + .append(sendQuickGiftModel.getQuickGiftNumber()) + .append(WordUtil.isNewZh() ? " 個小PD " : " small pandas "); + systemChatMessage2(stringBuffer.toString()); + Bus.get().post(new QuickGiftingEvent().setHotNum(sendQuickGiftModel.getHotNum())); + break; } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 90152b196..d2b6b7a6d 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -28,19 +28,24 @@ import com.lxj.xpopup.XPopup; import com.umeng.analytics.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; +import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.NewPeopleInfo; +import com.yunbao.common.bean.QuickGiftSendGiftModel; import com.yunbao.common.dialog.LiveNewRolePopup; import com.yunbao.common.event.MessageIMEvent; +import com.yunbao.common.event.QuickGiftingEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.API; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.CircleProgress2; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; @@ -58,7 +63,10 @@ import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; +import java.util.ArrayList; +import java.util.List; import java.util.Locale; +import java.util.Random; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; @@ -76,7 +84,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { private View v_msg_redpoint, stationHornBanner; private Activity context; private ViewFlipper viewFlipper; - private TextView goToRomm; + private TextView goToRomm, quick_gift_remaining_quantity, time_text; private int icon = 0; private String nobleName, nobleTtext; private ImageView giftImage, liveNewPeople; @@ -86,10 +94,13 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { private ImageView mRole;//特权 private ImageView mPlay;//玩 private ImageView mCheat;//整蛊 + private ImageView pd_pao, combo; + private CircleProgress2 circleProgress; public LiveAudienceViewHolder(Context context, ViewGroup parentView) { super(context, parentView); this.context = (Activity) context; + initLittlePanda(); } @@ -110,6 +121,8 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { findViewById(R.id.btn_zg).setOnClickListener(this); voiceButton = (LinearLayout) findViewById(R.id.voice_button); giftImage = (ImageView) findViewById(R.id.gift_image); + quick_gift_remaining_quantity = (TextView) findViewById(R.id.quick_gift_remaining_quantity); + time_text = (TextView) findViewById(R.id.time_text); liveNewPeople = (ImageView) findViewById(R.id.live_new_people); viewFlipper = (ViewFlipper) findViewById(R.id.viewflipper_banner); @@ -118,6 +131,10 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { mPlay = (ImageView) findViewById(R.id.live_play); stationHornBanner = findViewById(R.id.station_horn_banner); mNewPeopleRedDot = findViewById(R.id.live_new_people_red_dot); + pd_pao = (ImageView) findViewById(R.id.pd_pao); + combo = (ImageView) findViewById(R.id.combo); + circleProgress = (CircleProgress2) findViewById(R.id.circleProgress); + combo.setVisibility(View.GONE); liveNewPeople.setOnClickListener(this); mRole.setOnClickListener(this); mCheat.setOnClickListener(this); @@ -261,6 +278,249 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { return true; }); mProcessResultUtil = new ProcessResultUtil((FragmentActivity) mContext); + quick_gift_remaining_quantity.setVisibility(View.GONE); + time_text.setVisibility(View.GONE); + ViewClicksAntiShake.clicksAntiShake(time_text, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + StringBuffer urlString = new StringBuffer(); + urlString.append(CommonAppConfig.HOST) + .append("/h5/exchangeShop/index.html?uid=") + .append(userInfo.getId()) + .append("&token=") + .append(userInfo.getToken()).append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); + Bundle bundle1 = new Bundle(); + bundle1.putString("url", urlString.toString()); + LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); + liveHDDialogFragment.setArguments(bundle1); + liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + Bus.get().post(new QuickGiftingEvent().setReminder(true)); + } + }); + pd_pao.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View view) { + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + StringBuffer urlString = new StringBuffer(); + urlString.append(CommonAppConfig.HOST) + .append("/h5/exchangeShop/index.html?uid=") + .append(userInfo.getId()) + .append("&token=") + .append(userInfo.getToken()).append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); + Bundle bundle1 = new Bundle(); + bundle1.putString("url", urlString.toString()); + LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); + liveHDDialogFragment.setArguments(bundle1); + liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + Bus.get().post(new QuickGiftingEvent().setReminder(true)); + MobclickAgent.onEvent(mContext, "small_pd_gifts", "长按"); + return true; + } + }); + pd_pao.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (mQuickGiftRemainingQuantity > 0) { + quickGiftingIndex = 1; + combo.setVisibility(View.VISIBLE); + removeRunnable = true; + lianSongHandler.postDelayed(lianSongRunnable, 1000); + Random random = new Random(); + int randomNumber = random.nextInt(shortSvgas.size()); + String randomName = shortSvgas.get(randomNumber); + Bus.get().post(new QuickGiftingEvent().setIndex(quickGiftingIndex).setSvgaName(randomName)); + mQuickGiftRemainingQuantity = mQuickGiftRemainingQuantity - 1; + quick_gift_remaining_quantity.setText(String.valueOf(mQuickGiftRemainingQuantity)); + MobclickAgent.onEvent(mContext, "small_pd_gifts", "连点"); + } + + } + }); + combo.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (mQuickGiftRemainingQuantity > 0) { + quickGiftingIndex = quickGiftingIndex + 1; + removeRunnable = true; + lianSongHandler.postDelayed(lianSongRunnable, 1000); + Random random = new Random(); + if (quickGiftingIndex < 11) { + int randomNumber = random.nextInt(shortSvgas.size()); + String randomName = shortSvgas.get(randomNumber); + Bus.get().post(new QuickGiftingEvent().setIndex(quickGiftingIndex).setSvgaName(randomName)); + } else { + int randomNumber = random.nextInt(highSvgas.size()); + String randomName = highSvgas.get(randomNumber); + if (quickGiftingIndex >= 88) { + + Bus.get().post(new QuickGiftingEvent().setIndex(quickGiftingIndex).setSvgaName("littlepanda_craft.svga")); + } else { + Bus.get().post(new QuickGiftingEvent().setIndex(quickGiftingIndex).setSvgaName(randomName)); + } + + } + mQuickGiftRemainingQuantity = mQuickGiftRemainingQuantity - 1; + quick_gift_remaining_quantity.setText(String.valueOf(mQuickGiftRemainingQuantity)); + MobclickAgent.onEvent(mContext, "small_pd_gifts", "连点"+quickGiftingIndex); + } + } + }); + } + + public void setGiftRemainingQuantity(String giftRemainingQuantity) { + mQuickGiftRemainingQuantity = Integer.parseInt(giftRemainingQuantity); + if (mQuickGiftRemainingQuantity > 0) { + quick_gift_remaining_quantity.setVisibility(View.VISIBLE); + quick_gift_remaining_quantity.setText(String.valueOf(mQuickGiftRemainingQuantity)); + } else { + quick_gift_remaining_quantity.setVisibility(View.GONE); + } + } + + private int mQuickGiftRemainingQuantity = 0, mIfViewingDurationComplete; + + public void upDataQuickGift(int quickGiftRemainingQuantity, int ifViewingDurationComplete) { + mQuickGiftRemainingQuantity = quickGiftRemainingQuantity; + mIfViewingDurationComplete = ifViewingDurationComplete; + if (!(quickGiftContDown > 0 && quickGiftContDown < 120)) { + quickGiftContDown = 120; + circleProgress.setMax(120); + circleProgress.setCurrent(quickGiftContDown); + } + + if (quickGiftRemainingQuantity > 0) { + quick_gift_remaining_quantity.setVisibility(View.VISIBLE); + quick_gift_remaining_quantity.setText(String.valueOf(quickGiftRemainingQuantity)); + } else { + quick_gift_remaining_quantity.setVisibility(View.GONE); + } + if (quickGiftRemainingQuantity < 10 && ifViewingDurationComplete > 0) { + if (!(quickGiftContDown > 0 && quickGiftContDown < 120)) { + quickGiftHandler.postDelayed(quickGiftRunnable, 1000); + } + }else { + circleProgress.setCurrent(2); + } + } + + private int quickGiftContDown = 120; + private Handler quickGiftHandler = new Handler(); + private Runnable quickGiftRunnable = new Runnable() { + @Override + public void run() { + if (mQuickGiftRemainingQuantity == 0) { + time_text.setVisibility(View.VISIBLE); + quick_gift_remaining_quantity.setVisibility(View.GONE); + + } else { + time_text.setVisibility(View.GONE); + } + if (quickGiftContDown > 0) { + quickGiftContDown = quickGiftContDown - 1; + if (time_text.getVisibility() == View.VISIBLE) { + time_text.setText(String.valueOf(quickGiftContDown) + "s"); + } + circleProgress.setCurrent(quickGiftContDown); + quickGiftHandler.postDelayed(quickGiftRunnable, 1000); + } else { + quickGiftHandler.removeCallbacks(quickGiftRunnable); + LiveNetManager.get(mContext).viewingDurationGetGift(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(QuickGiftSendGiftModel data) { + + upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete()); + + + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + + } + }; + + public void resetView() { + pd_pao.setVisibility(View.VISIBLE); + combo.setVisibility(View.GONE); + lianSongHandler.removeCallbacks(lianSongRunnable); + lianSongHandler.removeCallbacks(lianSongRunnable); + quickGiftHandler.removeCallbacks(quickGiftRunnable); + } + + private boolean removeRunnable = false; + private int mLianCountDownCount;//连送倒计时的数字 + private Handler lianSongHandler = new Handler(); + private Runnable lianSongRunnable = new Runnable() { + @Override + public void run() { + if (removeRunnable) { + lianSongHandler.removeCallbacks(lianSongRunnable); + mLianCountDownCount = 5; + lianSongHandler.postDelayed(lianSongRunnable, 1000); + removeRunnable = false; + Log.e("QuickGiftingEvent", removeRunnable + " " + mLianCountDownCount); + } else { + mLianCountDownCount--; + if (mLianCountDownCount == 0) { + pd_pao.setVisibility(View.VISIBLE); + combo.setVisibility(View.GONE); + lianSongHandler.removeCallbacks(lianSongRunnable); + Bus.get().post(new QuickGiftingEvent().setShow(true)); + LiveNetManager.get(mContext).quickGiftSendGift(String.valueOf(quickGiftingIndex), mLiveUid, mStream, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(QuickGiftSendGiftModel data) { + upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete()); + if (data.getIfHiddenEgg() == 3) { + ToastUtil.show(WordUtil.isNewZh() ? "恭喜您解鎖隱藏彩蛋! 獎勵已發放!" : "Congratulations on unlocking the hidden easter egg! Rewards have been distributed!"); + } + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } else { + lianSongHandler.postDelayed(lianSongRunnable, 1000); + } + Log.e("QuickGiftingEvent", removeRunnable + " " + mLianCountDownCount); + } + + } + }; + private List highSvgas = new ArrayList<>(); + private List shortSvgas = new ArrayList<>(); + private int quickGiftingIndex = 1; + + private void initLittlePanda() { + highSvgas = new ArrayList<>(); + shortSvgas = new ArrayList<>(); + highSvgas.add("littlepanda1.svga"); + highSvgas.add("littlepanda2.svga"); + highSvgas.add("littlepanda3.svga"); + highSvgas.add("littlepanda4.svga"); + highSvgas.add("littlepanda5.svga"); + highSvgas.add("littlepanda6.svga"); + highSvgas.add("littlepanda7.svga"); + highSvgas.add("littlepanda8.svga"); + highSvgas.add("littlepanda9.svga"); + highSvgas.add("littlepanda10.svga"); + shortSvgas.add("littlepanda11.svga"); + shortSvgas.add("littlepanda12.svga"); + shortSvgas.add("littlepanda13.svga"); + shortSvgas.add("littlepanda14.svga"); + shortSvgas.add("littlepanda15.svga"); + shortSvgas.add("littlepanda16.svga"); + shortSvgas.add("littlepanda17.svga"); + shortSvgas.add("littlepanda18.svga"); + shortSvgas.add("littlepanda19.svga"); } private float downY = 0; @@ -528,6 +788,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { super.release(); EventBus.getDefault().unregister(this); removeCallbacks(); + resetView(); } /** diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index 0f8a687ac..126ec891c 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -198,7 +198,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { // ImgLoader.displayBlurLive(mContext, coverUrl, mCover, 400, 600); // // } - } + }// @Override public synchronized void setLiveBeanLandscape(int landscape) { @@ -206,7 +206,10 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { Log.i(TAG, "setLiveBeanLandscape: " + landscape + " isPk: " + isPk); this.landscape = landscape; this.videoLandscape = landscape; - mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL); + if (mPlayer != null) { + mPlayer.setViewResizeMode(landscape == VIDEO_VERTICAL); + } + if (landscape == 2) { Log.i(TAG, "还原9:16"); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); @@ -1111,19 +1114,19 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { int maxRate = 900; switch (IMLoginManager.get(mContext).getSelectClarity()) { case 0: - rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848; - minRate = 200; - maxRate = 900; + rcrtcVideoResolution = landscape == 1 ? RCRTCParamsType.RCRTCVideoResolution.parseVideoResolution(960, 720) : RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848; + minRate = landscape == 1 ? 900 : 200; + maxRate = landscape == 1 ? 700 : 900; break; case 1: - rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280; - minRate = 250; - maxRate = 2200; + rcrtcVideoResolution = landscape == 1 ? RCRTCParamsType.RCRTCVideoResolution.parseVideoResolution(960, 720) : RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280; + minRate = landscape == 1 ? 900 : 250; + maxRate = landscape == 1 ? 700 : 2200; break; case 2: - rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_1080_1920; - minRate = 400; - maxRate = 4000; + rcrtcVideoResolution = landscape == 1 ? RCRTCParamsType.RCRTCVideoResolution.parseVideoResolution(960, 720) : RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_1080_1920; + minRate = landscape == 1 ? 900 : 400; + maxRate = landscape == 1 ? 700 : 4000; break; } // 示例代码使用480x640分辨率演示 @@ -1146,6 +1149,15 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { ArrayList streams = new ArrayList<>(); // streams.add(RCRTCEngine.getInstance().getDefaultVideoStream()); streams.add(RCRTCEngine.getInstance().getDefaultAudioStream()); + if (landscape == 1) { + new Handler(Looper.getMainLooper()).post(new Runnable() { + @Override + public void run() { + setLiveBeanLandscape(1); + } + }); + + } // 开启摄像头 // RCRTCEngine.getInstance().getDefaultVideoStream().startCamera(null); // 开始切换为主播身份 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 edd4f5943..96c65ea14 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -56,6 +56,7 @@ import com.makeramen.roundedimageview.RoundedImageView; import com.ms.banner.Banner; import com.ms.banner.BannerConfig; import com.ms.banner.listener.OnBannerClickListener; +import com.opensource.svgaplayer.SVGACallback; import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; @@ -99,9 +100,9 @@ import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.event.AllServerNotifyEvent; import com.yunbao.common.event.AnchorInfoEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; -import com.yunbao.common.event.HideShowEvent; import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent; +import com.yunbao.common.event.SlideEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.API; import com.yunbao.common.http.CommonHttpConsts; @@ -131,7 +132,6 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.views.AbsViewHolder; -import com.yunbao.common.views.LiveSudGamePopup; import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.common.views.weight.FullServiceNotificationView; import com.yunbao.common.views.weight.NobleNoticeView; @@ -384,6 +384,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private String mAnchorName;//主播名字 private boolean isHinde = false; private boolean isFans = false; + private FrameLayout pa_pao_layout; + private LinearLayout combo_layout; + private TextView combo_number; + private View quick_gift_reminder ; @Subscribe(threadMode = ThreadMode.MAIN) public void onUpdata(String str) { @@ -703,6 +707,90 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } + HashMap svgaImageViewHashMap = new HashMap<>(); + + public void onQuickGifting2(boolean show) { + if (show) { + combo_layout.setVisibility(View.GONE); + if (IMLoginManager.get(mContext).getQuickGiftIfFirst()) { + quick_gift_reminder.setVisibility(View.VISIBLE); + } else { + quick_gift_reminder.setVisibility(View.GONE); + } + } + } + public void onQuickGifting3() { + IMLoginManager.get(mContext).setQuickGiftIfFirst(); + quick_gift_reminder.setVisibility(View.GONE); + + } + + public void onQuickGifting(int index, String svgaName) { + pa_pao_layout.setVisibility(View.VISIBLE); + combo_layout.setVisibility(View.VISIBLE); + combo_number.setText(String.valueOf(index)); + SVGAImageView svgaImageView = new SVGAImageView(mContext); + String tag = svgaName + System.currentTimeMillis(); + svgaImageViewHashMap.put(tag, svgaImageView); + + Bus.get().post(new SlideEvent().setSlide(!(svgaImageViewHashMap.size() > 0))); + svgaImageView.setLoops(1); + svgaImageView.setTag(tag); + pa_pao_layout.addView(svgaImageView); + Log.e("QuickGiftingEvent", "pa_pao_layout:getChildCount:" + pa_pao_layout.getChildCount()); + Log.e("QuickGiftingEvent", "index:" + index + " svgaName:" + svgaName); + svgaImageView.setCallback(new SVGACallback() { + @Override + public void onPause() { + + } + + @Override + public void onFinished() { + if (svgaImageViewHashMap.size() != 0) { + svgaImageView.clear(); + pa_pao_layout.removeView(svgaImageView); + Log.e("QuickGiftingEvent", "svgaImageView.getTag:" + svgaImageView.getTag()); + svgaImageViewHashMap.remove(svgaName); + Log.e("QuickGiftingEvent", "svgaImageViewHashMap:" + svgaImageViewHashMap.toString()); + Log.e("QuickGiftingEvent", "pa_pao_layout:getChildCount:" + pa_pao_layout.getChildCount()); + if (pa_pao_layout.getChildCount() == 0) { + pa_pao_layout.setVisibility(View.GONE); + + Bus.get().post(new SlideEvent().setSlide(true)); + } + } + + } + + @Override + public void onRepeat() { + + } + + @Override + public void onStep(int i, double v) { + + } + }); + + new SVGAParser(mContext).decodeFromAssets(svgaName, new SVGAParser.ParseCompletion() { + @Override + public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) { + SVGADrawable drawable = new SVGADrawable(svgaVideoEntity); + svgaImageView.setImageDrawable(drawable); + + svgaImageView.startAnimation(); + + } + + @Override + public void onError() { + + } + }, null); + } + /** * 获取下一秒钟的时间 */ @@ -1473,6 +1561,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis new LoadDian9TuUtil().loadDian9TuAssets2(mContext, wishListLayout2, "rectangle_new.png", 1); + pa_pao_layout = (FrameLayout) findViewById(R.id.pa_pao_layout); + combo_layout = (LinearLayout) findViewById(R.id.combo_layout); + combo_number = (TextView) findViewById(R.id.combo_number); + quick_gift_reminder = findViewById(R.id.quick_gift_reminder); + pa_pao_layout.setVisibility(View.GONE); + combo_layout.setVisibility(View.GONE); } @@ -1730,8 +1824,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 重置数据 */ public void resetView() { + svgaImageViewHashMap.clear(); + pa_pao_layout.removeAllViews(); timeHandler.removeCallbacks(timeRunnable); anchorTimeHandler.removeCallbacks(anchorTimeRunnable); + pa_pao_layout.setVisibility(View.GONE); + combo_layout.setVisibility(View.GONE); resetViewGone(); visibility = false; pkUidTmp = ""; @@ -2446,11 +2544,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * @param rank 小时榜 */ public void setHourRankData(long rank) { - if (mHourRank != null) { + if (mHotText != null) { if (rank == 0) { - mHourRank.setText(R.string.no_rank_data); + mHotText.setText(R.string.no_rank_data); } else { - mHourRank.setText(String.format(mContext.getString(R.string.hour_rank), formatBigNum.formatBigNum(rank + ""))); + mHotText.setText(String.format(mContext.getString(R.string.hour_rank), formatBigNum.formatBigNum(rank + ""))); } } } @@ -2470,12 +2568,14 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * @param hot 热度值 */ public void setHotData(String hot) { - if (mHotText != null && !TextUtils.isEmpty(hot)) { - mHotText.setText(hot); + if (mHourRank != null && !TextUtils.isEmpty(hot)) { + mHourRank.setText(hot); } } - + public void setHotNum(String hotNum) { + setHotData(formatBigNum.formatBigNum(hotNum)); + } /** * 更新心愿单进度 * @@ -3987,6 +4087,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void clearData() { + svgaImageViewHashMap.clear(); + pa_pao_layout.removeAllViews(); timeHandler.removeCallbacks(timeRunnable); anchorTimeHandler.removeCallbacks(anchorTimeRunnable); LiveHttpUtil.cancel(LiveHttpConsts.GET_USER_LIST); diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 5ba3690a5..703824e77 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -56,6 +56,7 @@ import com.yunbao.common.event.LiveFloatEvent; import com.yunbao.common.event.LiveGiftDialogEvent; import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent; +import com.yunbao.common.event.QuickGiftingEvent; import com.yunbao.common.event.SendBlindGiftEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; @@ -223,6 +224,34 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } + public void onQuickGifting(int index, String svgaName) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.onQuickGifting(index, svgaName); + } + } + + public void onQuickGifting2(boolean show) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.onQuickGifting2(show); + } + } + + public void onQuickGifting3() { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.onQuickGifting3(); + } + } + + public void setGiftRemainingQuantity(String giftRemainingQuantity) { + if (mLiveAudienceViewHolder!=null){ + mLiveAudienceViewHolder.setGiftRemainingQuantity(giftRemainingQuantity); + } + } + public void setHotNum(String hotNum) { + if (mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.setHotNum(hotNum); + } + } public PortraitLiveManager(Activity context, Intent intent) { this.mContext = context; this.mIntent = intent; @@ -386,6 +415,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } }); mLiveRoomViewHolder.resetView(); + mLiveAudienceViewHolder.resetView(); enterRoomModel.clear(); enterRoomLeaveHandler.removeCallbacks(enterRoomLeaveRunnable); mLiveRoomViewHolder.setAvatar(data.getAvatar()); @@ -726,6 +756,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.setSudName(WordUtil.isNewZh() ? data.getSudGameDateModel().getSudGameName() : data.getSudGameDateModel().getSud_game_name_en(), data.getSudGameDateModel()); } } + mLiveAudienceViewHolder.upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete()); } @@ -832,8 +863,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLivePlayViewHolder.release(); } if (mLiveRoomViewHolder != null) { - mLiveRoomViewHolder.removeFromParent(); mLiveRoomViewHolder.clearData(); + mLiveRoomViewHolder.removeFromParent(); mLiveRoomViewHolder.countDownTimerTrickery = null; } @@ -932,7 +963,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe * 申请连麦但是主播还未同意的状态 */ public void micIngTypeOne(LiveBean bean, int liveType, int liveTypeVal) { - DialogUitl.showSimpleDialog(mContext, null, WordUtil.isNewZh()?"您已申請,退出將取消語音連麥申請!":"You have applied, logout will cancel the voice connection application!", false, new DialogUitl.SimpleCallback3() { + DialogUitl.showSimpleDialog(mContext, null, WordUtil.isNewZh() ? "您已申請,退出將取消語音連麥申請!" : "You have applied, logout will cancel the voice connection application!", false, new DialogUitl.SimpleCallback3() { @Override public void onConfirmClick(Dialog dialog) { MicStatusManager.getInstance().clear(); diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index ca4ab61d2..2309da2b0 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -1,9 +1,9 @@ + android:src="@mipmap/icon_prank" + android:visibility="gone" /> + + + + + + + + + + + + + + android:background="@drawable/background_gift" /> - + app:layout_constraintTop_toTopOf="parent" /> + - - - - + diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 556ee4257..9a7a5a8cc 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -2484,13 +2484,13 @@ android:layout_height="40dp" android:layout_alignParentEnd="true" android:layout_alignParentBottom="true" - android:background="@drawable/background_live_sud_hint" - android:gravity="center" android:layout_marginStart="21dp" android:layout_marginEnd="42dp" + android:background="@drawable/background_live_sud_hint" + android:gravity="center" android:paddingStart="21dp" - android:visibility="gone" - android:paddingEnd="15dp"> + android:paddingEnd="15dp" + android:visibility="gone"> + android:textSize="14sp" /> + + + + + + + + + + diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java index 90e508f5c..d9c58e538 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java @@ -2,6 +2,8 @@ package com.yunbao.main.views; import static android.content.Context.CLIPBOARD_SERVICE; +import android.app.Activity; +import android.app.Dialog; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; @@ -28,25 +30,35 @@ import androidx.annotation.RequiresApi; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.lxj.xpopup.XPopup; +import com.momo.mcamera.util.JsonUtil; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.HtmlConfig; +import com.yunbao.common.bean.CoolConfig; import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.NativeCallbackModel; +import com.yunbao.common.dialog.CinemaTicketPopupWindow; import com.yunbao.common.event.JavascriptInterfaceEvent; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.common.http.live.LiveNetManager; 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.JavascriptInterfacePlayLetUtils; import com.yunbao.common.utils.JavascriptInterfaceUtils; import com.yunbao.common.utils.L; +import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.http.LiveHttpUtil; -import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.live.views.LoadingView; import com.yunbao.main.R; import com.yunbao.main.activity.MainActivity; +import com.yunbao.main.activity.MyWalletActivity; import com.yunbao.main.dialog.EncourageDialog; import com.yunbao.main.utils.BottomBarUtil; import com.yunbao.share.ui.SharePopDialog; @@ -89,11 +101,12 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl Bus.getOn(this); String url = HtmlConfig.ENCOURAGE + "?t=" + Math.random() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"); +// String url = "https://coolshi.feioou.com/testAndroid.html"; final LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView); mProgressBar = (ProgressBar) findViewById(R.id.progressbar); mWebView = new WebView(mContext); int aa = BottomBarUtil.getNavigationBarHeightIfRoom(mContext); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); params.topMargin = DpUtil.dp2px(1); mWebView.setLayoutParams(params); mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER); @@ -114,7 +127,9 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口 mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(nowMainActivity, mWebView), "androidObject"); - + //短剧 + mWebView.addJavascriptInterface(JavascriptInterfacePlayLetUtils.getInstance().setmContext(nowMainActivity, mWebView), "jsBridge"); + mWebView.getSettings().setSupportMultipleWindows(true); rootView.addView(mWebView); mWebView.setWebViewClient(new WebViewClient() { @@ -211,6 +226,26 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } mWebView.loadUrl(url); +// findViewById(R.id.native_callback).setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View view) { +// mWebView.post(new Runnable() { +// @Override +// public void run() { +// +// NativeCallbackModel model = new NativeCallbackModel(); +// model.setUid(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId())); +// String nativeJson = new JsonUtil().toJson(model); +// mWebView.evaluateJavascript("javascript:nativeCallback('" +nativeJson + "')", new ValueCallback() { +// @Override +// public void onReceiveValue(String value) { +// } +// }); +// +// } +// }); +// } +// }); } public void loadNewUrl() { @@ -357,7 +392,60 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl .setShareLink(CommonAppConfig.HOST + json.getString("link")) .setAnchorAvatar(json.getString("avatar")) .showDialog(); + } else if (TextUtils.equals(event.getMethod(), "postWeakBalance")) { + LiveNetManager.get(mContext). + getCoolConfig(new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(CoolConfig data) { + new XPopup.Builder(mContext) + .enableDrag(false) + .maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34)) + .asCustom(new CinemaTicketPopupWindow(mContext, data.setTicketCount(event.getCoolConfig().getTicketCount()), new CinemaTicketPopupWindow.CinemaTicketPopupWindowCallBack() { + @Override + public void onCallBack(String data) { + if (TextUtils.equals(data, "2")) { + DialogUitl.showSimpleDialog(mContext, mContext.getString(com.yunbao.live.R.string.live_coin_not_enough), false, + new DialogUitl.SimpleCallback2() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 1)); + } + + @Override + public void onCancelClick() { + + } + }); + } else if (TextUtils.equals(data, "1")) { + mWebView.post(new Runnable() { + @Override + public void run() { + + NativeCallbackModel model = new NativeCallbackModel(); + model.setUid(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId())); + String nativeJson = new JsonUtil().toJson(model); + mWebView.evaluateJavascript("javascript:nativeCallback('" + nativeJson + "')", new ValueCallback() { + @Override + public void onReceiveValue(String value) { + } + }); + + } + }); + } + + } + })).show(); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } } } + } diff --git a/main/src/main/res/layout/view_main_encourage.xml b/main/src/main/res/layout/view_main_encourage.xml index 387eb2bb5..d796f713a 100644 --- a/main/src/main/res/layout/view_main_encourage.xml +++ b/main/src/main/res/layout/view_main_encourage.xml @@ -8,6 +8,7 @@ android:id="@+id/rootView" android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_marginBottom="45dp" android:orientation="vertical" /> + + + + + + + \ No newline at end of file