diff --git a/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java b/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java index a1807d009..4db488c31 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java @@ -19,7 +19,7 @@ public class GuardBuyTipsDialog { * @param content 购买类型名称 * @param simpleCallback */ - public static void showBuyOrRenewDialog(Context context, String coin, String content, DialogUitl.SimpleCallback simpleCallback) { + public static void showBuyOrRenewDialog(Context context, String coin, String content, boolean isOpen,DialogUitl.SimpleCallback simpleCallback) { if (context instanceof Activity) { if (((Activity) context).isDestroyed() || ((Activity) context).isFinishing()) { return; @@ -30,14 +30,26 @@ public class GuardBuyTipsDialog { dialog.setContentView(R.layout.dialog_guard_buy_tips); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); - if (!TextUtils.isEmpty(coin)) { - TextView contentTextView = dialog.findViewById(R.id.content); - contentTextView.setText(context.getString(R.string.guard_buy_tips_1, coin)); - } - if (!TextUtils.isEmpty(content)) { - TextView buyTypeTextView = dialog.findViewById(R.id.buyType); - buyTypeTextView.setText("【"+content+"】"); + if (!isOpen){ + if (!TextUtils.isEmpty(coin)) { + TextView contentTextView = dialog.findViewById(R.id.content); + contentTextView.setText(context.getString(R.string.guard_buy_tips_1, coin)); + } + if (!TextUtils.isEmpty(content)) { + TextView buyTypeTextView = dialog.findViewById(R.id.buyType); + buyTypeTextView.setText("【"+content+"】"); + } + }else { + if (!TextUtils.isEmpty(coin)) { + TextView contentTextView = dialog.findViewById(R.id.content); + contentTextView.setText(context.getString(R.string.guard_buy_tips_2, coin)); + } + if (!TextUtils.isEmpty(content)) { + TextView buyTypeTextView = dialog.findViewById(R.id.buyType); + buyTypeTextView.setText("【"+content+"】"); + } } + dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { 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 815a791fc..3bcbe8e86 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1175,7 +1175,7 @@ public interface PDLiveApi { Observable> getGuardOpenInfo(@Query("liveuid") String liveUid); @GET("/api/public/?service=Guard.openGuard") - Observable> openGuard(@Query("liveuid") String liveUid, @Query("guard_type") String guardType, @Query("price_key") String priceKey); + Observable> openGuard(@Query("liveuid") String liveUid, @Query("guard_type") String guardType, @Query("price_key") String priceKey, @Query("stream") String stream); @GET("/api/public/?service=Guard.sendMoneyLong") Observable> sendMoneyLong(@Query("liveuid") String liveUid, @Query("gold_num") String goldNum); 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 8dbd0d705..0725b71c6 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 @@ -2984,9 +2984,9 @@ public class LiveNetManager { } - public void openGuard(String liveUid, String guardType, String priceKey, HttpCallback callback) { + public void openGuard(String liveUid, String guardType, String priceKey, String stream, HttpCallback callback) { API.get().pdLiveApi(mContext) - .openGuard(liveUid, guardType, priceKey) + .openGuard(liveUid, guardType, priceKey, stream) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer>() { @@ -3007,7 +3007,8 @@ public class LiveNetManager { }).isDisposed(); } - public void sendMoneyLongList(String liveUid,HttpCallback> callback) { + + public void sendMoneyLongList(String liveUid, HttpCallback> callback) { API.get().pdLiveApi(mContext) .sendMoneyLongList(liveUid) .subscribeOn(Schedulers.io()) @@ -3030,6 +3031,7 @@ public class LiveNetManager { }).isDisposed(); } + public void sendMoneyLong(String liveUid, String goldNum, HttpCallback callback) { API.get().pdLiveApi(mContext) .sendMoneyLong(liveUid, goldNum) @@ -3103,7 +3105,7 @@ public class LiveNetManager { } - public void checkUpgrades( String liveUid,HttpCallback callback) { + public void checkUpgrades(String liveUid, HttpCallback callback) { API.get().pdLiveApi(mContext) .checkUpgrades(liveUid) .subscribeOn(Schedulers.io()) diff --git a/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_god_zh.png b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_god_zh.png new file mode 100644 index 000000000..7fefefadf Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_god_zh.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_king_en.png b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_king_en.png new file mode 100644 index 000000000..e0aeae48b Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_king_en.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_king_zh.png b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_king_zh.png new file mode 100644 index 000000000..599dda1bd Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_king_zh.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_sgod_en.png b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_sgod_en.png new file mode 100644 index 000000000..412072201 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_sgod_en.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_star_en.png b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_star_en.png new file mode 100644 index 000000000..d11c3a70c Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_star_en.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_star_zh.png b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_star_zh.png new file mode 100644 index 000000000..61c5ae5cb Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/background_all_server_notify_star_zh.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/btn_god_guard_onlookers.png b/common/src/main/res/mipmap-xxhdpi/btn_god_guard_onlookers.png new file mode 100644 index 000000000..51ee8b65b Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/btn_god_guard_onlookers.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/btn_king_guard_onlookers.png b/common/src/main/res/mipmap-xxhdpi/btn_king_guard_onlookers.png new file mode 100644 index 000000000..bfadf52b9 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/btn_king_guard_onlookers.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/btn_star_guard_onlookers.png b/common/src/main/res/mipmap-xxhdpi/btn_star_guard_onlookers.png new file mode 100644 index 000000000..213e48346 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/btn_star_guard_onlookers.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 8cd4aac34..3051d2ce9 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1491,6 +1491,7 @@ Limited ride And limited avatar frame Expired "Now renew and enjoy guardian privileges again " Renewal Guardian + You will spend %s diamonds to renew the anchor Participate Send benefits diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index aa2432aa9..d2bdc0c99 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1490,6 +1490,7 @@ 天到期 保留守護等級 重享守護特權 續費守護 + 您將花費%s鑽石為主播續費 點擊參加 發放福利 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 263d3e343..9acdd7ccf 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1489,6 +1489,7 @@ 天到期 保留守護等級 重享守護特權 續費守護 + 您將花費%s鑽石為主播續費 點擊參加 發放福利 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index b9e367a1d..935980bae 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1486,6 +1486,7 @@ 天到期 保留守護等級 重享守護特權 續費守護 + 您將花費%s鑽石為主播續費 點擊參加 發放福利 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index efa60f439..fdc70c15f 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1495,6 +1495,7 @@ Limited ride And limited avatar frame Expired Renewal Guardian You will spend %s diamonds for the anchor + You will spend %s diamonds to renew the anchor Participate Send benefits diff --git a/config.gradle b/config.gradle index dbfa07aa8..f20f2246d 100644 --- a/config.gradle +++ b/config.gradle @@ -21,10 +21,10 @@ ext { baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", // true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包 3 samsung包 - isGooglePlay : 1, + isGooglePlay : 0, //是否上报异常日志 isUploadLog : true, //是否打包成插件包模式 - isPluginModel : true, + isPluginModel : false, ] } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index abe9f9d9f..215514dcd 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -1275,7 +1275,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL Log.e("getGuardList", list.toString()); if (list.isEmpty()) { // openNewBuyGuardWindow(true); - new LiveGuardDialog(mContext, true,mLiveUid).showDialog(); + new LiveGuardDialog(mContext, true,mLiveUid,mStream).showDialog(); } else { // LiveNewGuardDialogFragment fragment = new LiveNewGuardDialogFragment(); // fragment.setList(list); @@ -1286,7 +1286,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL // bundle.putBoolean("showBuyView", !showBuyView); // fragment.setArguments(bundle); // fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment"); - new LiveGuardDialog(mContext, false,mLiveUid).showDialog(); + new LiveGuardDialog(mContext, false,mLiveUid,mStream).showDialog(); } } }); 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 a4ee471ef..cbc273cfc 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -111,6 +111,7 @@ import com.yunbao.live.adapter.VerticalPagerAdapter; import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.bean.LiveGuardInfo; +import com.yunbao.live.bean.NewAllServerNotifyGuardEvent; import com.yunbao.live.dialog.DragonExpirePopup; import com.yunbao.live.dialog.LiveFansFragment; import com.yunbao.live.dialog.LiveGameDialogFragment; @@ -1925,7 +1926,7 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void run() { new XPopup.Builder(mContext) - .asCustom(new DragonExpirePopup(mContext, mLiveUid, maturityDateRemindModel)) + .asCustom(new DragonExpirePopup(mContext, mLiveUid, maturityDateRemindModel,mStream)) .show(); } }, 3000); @@ -1943,6 +1944,13 @@ public class LiveAudienceActivity extends LiveActivity { } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onNewAllServerNotifyGuardEvent(NewAllServerNotifyGuardEvent event) { + if (manager != null) { + manager.buyGuardNew(event); + } + } + @Subscribe(threadMode = ThreadMode.MAIN) public void onSendMoneyLongEndEvent(SendMoneyLongEndEvent sendMoneyLongModel) { Log.e("DateRemindModel", sendMoneyLongModel.toString()); diff --git a/live/src/main/java/com/yunbao/live/bean/NewAllServerNotifyGuardEvent.java b/live/src/main/java/com/yunbao/live/bean/NewAllServerNotifyGuardEvent.java new file mode 100644 index 000000000..74e5de3da --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/NewAllServerNotifyGuardEvent.java @@ -0,0 +1,120 @@ +package com.yunbao.live.bean; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.bean.BaseModel; + +public class NewAllServerNotifyGuardEvent extends BaseModel { + /** + * { + * "_method_": "AllServerNotify", + * "action": "90", + * "guard_type": "1", // 守护类型 + * "uid": "98888", // 用户ID + * "uname": "周末暴打小朋友", // 用户昵称 + * "avatar": "https://downs.yaoulive.com/mannine.png", // 用户头像链接 + * "liveuid": "98889", // 主播ID + * "msg_cn": "周末暴打小朋友在接化发直播間開通【星之守護】", + * "msg_en": "周末暴打小朋友opened 【星之守護】 in 接化发 live broadcast room" + * } + */ + + @SerializedName("_method_") + private String method; + @SerializedName("action") + private String action; + @SerializedName("guard_type") + private String guardType; + @SerializedName("uid") + private String uid; + @SerializedName("uname") + private String uname; + @SerializedName("avatar") + private String avatar; + @SerializedName("liveuid") + private String liveuid; + @SerializedName("msg_cn") + private String msgCn; + @SerializedName("msg_en") + private String msgEn; + + public String getMethod() { + return method; + } + + public NewAllServerNotifyGuardEvent setMethod(String method) { + this.method = method; + return this; + } + + public String getAction() { + return action; + } + + public NewAllServerNotifyGuardEvent setAction(String action) { + this.action = action; + return this; + } + + public String getGuardType() { + return guardType; + } + + public NewAllServerNotifyGuardEvent setGuardType(String guardType) { + this.guardType = guardType; + return this; + } + + public String getUid() { + return uid; + } + + public NewAllServerNotifyGuardEvent setUid(String uid) { + this.uid = uid; + return this; + } + + public String getUname() { + return uname; + } + + public NewAllServerNotifyGuardEvent setUname(String uname) { + this.uname = uname; + return this; + } + + public String getAvatar() { + return avatar; + } + + public NewAllServerNotifyGuardEvent setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public String getLiveuid() { + return liveuid; + } + + public NewAllServerNotifyGuardEvent setLiveuid(String liveuid) { + this.liveuid = liveuid; + return this; + } + + public String getMsgCn() { + return msgCn; + } + + public NewAllServerNotifyGuardEvent setMsgCn(String msgCn) { + this.msgCn = msgCn; + return this; + } + + public String getMsgEn() { + return msgEn; + } + + public NewAllServerNotifyGuardEvent setMsgEn(String msgEn) { + this.msgEn = msgEn; + return this; + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/DragonExpirePopup.java b/live/src/main/java/com/yunbao/live/dialog/DragonExpirePopup.java index d6884a4ff..83fabba3e 100644 --- a/live/src/main/java/com/yunbao/live/dialog/DragonExpirePopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/DragonExpirePopup.java @@ -17,6 +17,7 @@ import com.yunbao.live.R; public class DragonExpirePopup extends CenterPopupView { FragmentActivity activity; String mLiveUid; + String mStream; RoundedImageView liveAvatar; RoundedImageView userAvatar; @@ -28,11 +29,12 @@ public class DragonExpirePopup extends CenterPopupView { TextView dueInGuard2; GuardMaturityDateRemindModel maturityDateRemindModel; - public DragonExpirePopup(@NonNull Context context, String liveUid, GuardMaturityDateRemindModel maturityDateRemindModel) { + public DragonExpirePopup(@NonNull Context context, String liveUid, GuardMaturityDateRemindModel maturityDateRemindModel, String stream) { super(context); activity = (FragmentActivity) context; mLiveUid = liveUid; this.maturityDateRemindModel = maturityDateRemindModel; + mStream = stream; } // 返回自定义弹窗的布局 @@ -105,7 +107,7 @@ public class DragonExpirePopup extends CenterPopupView { @Override public void onViewClicks() { dismiss(); - new LiveBuyGuardDialog(activity, mLiveUid).showDialog(); + new LiveBuyGuardDialog(activity, mLiveUid,mStream).showDialog(); } }); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java index fa9258781..5fbc3e027 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java @@ -65,6 +65,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow { ImageView guardArrow; TextView guardMonth; String mLiveUid; + String mStream; List guardDataTipModels; List price = new ArrayList<>(); TextView discountPrice, discount; @@ -74,10 +75,11 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow { List guardPrivilegeStrings = new ArrayList<>(); GuardDataTipModel dataTipModel; - public LiveBuyGuardDialog(@NonNull Context context, String liveUid) { + public LiveBuyGuardDialog(@NonNull Context context, String liveUid, String stream) { super(context); activity = (FragmentActivity) context; mLiveUid = liveUid; + mStream = stream; } @Override @@ -310,10 +312,11 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow { break; } + GuardBuyTipsDialog .showBuyOrRenewDialog(mContext, discountPrice.getText().toString(), - dataTipModel.getGuardName(), new DialogUitl.SimpleCallback2() { + dataTipModel.getGuardName(), dataTipModel.isOpen(),new DialogUitl.SimpleCallback2() { @Override public void onCancelClick() { dismiss(); @@ -325,7 +328,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow { LiveNetManager.get(activity) .openGuard(mLiveUid, String.valueOf(dataTipModel.getGuardType()), - String.valueOf(guardPriceModel.getPriceKey()), new HttpCallback() { + String.valueOf(guardPriceModel.getPriceKey()), mStream, new HttpCallback() { @Override public void onSuccess(String data) { ToastUtil.show(data); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java index e016b0776..903d95b09 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java @@ -49,6 +49,7 @@ public class LiveGuardDialog extends AbsDialogPopupWindow { CommonRefreshView mRefreshView; String mLiveUid; + String mStream; List guardUserModels = new ArrayList<>(); TextView userNickname, weekContribution, guardLevel; @@ -57,11 +58,12 @@ public class LiveGuardDialog extends AbsDialogPopupWindow { SVGAImageView giftSvga; TextView btnGuardOpen; - public LiveGuardDialog(@NonNull Context context, boolean isEmpty, String liveUid) { + public LiveGuardDialog(@NonNull Context context, boolean isEmpty, String liveUid, String stream) { super(context); activity = (FragmentActivity) context; this.isEmpty = isEmpty; mLiveUid = liveUid; + mStream = stream; } @Override @@ -86,7 +88,7 @@ public class LiveGuardDialog extends AbsDialogPopupWindow { mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); newGuardAdapter = new NewGuardAdapter(mContext); mRefreshView.setRecyclerViewAdapter(newGuardAdapter); - mRefreshView.setEmptyLayoutId(R.layout.view_no_data_admin_room); + mRefreshView.setEmptyLayoutId(R.layout.view_no_data_admin_room2); userNickname = findViewById(R.id.user_nickname); weekContribution = findViewById(R.id.week_contribution); guardLevel = findViewById(R.id.guard_level); @@ -155,7 +157,7 @@ public class LiveGuardDialog extends AbsDialogPopupWindow { public void onViewClicks() { MobclickAgent.onEvent(mContext, "guardian_renew_btn", "守护席开通守护/续费守护按钮点击次数及人数"); dismiss(); - new LiveBuyGuardDialog(mContext, mLiveUid).showDialog(); + new LiveBuyGuardDialog(mContext, mLiveUid, mStream).showDialog(); } }); //神龙送财 diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index cadfb3330..8eaa36cf4 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -5,6 +5,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; +import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.CountDownTimer; import android.os.Handler; @@ -39,10 +40,12 @@ import com.yunbao.common.HtmlConfig; import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.event.AllServerNotifyEvent; +import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; @@ -54,14 +57,14 @@ import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LiveReceiveGiftBean; +import com.yunbao.live.bean.NewAllServerNotifyGuardEvent; import com.yunbao.live.custom.FrameImageView; import com.yunbao.live.event.LiveAudienceEvent; -import com.yunbao.common.event.LiveRoomChangeEvent; -import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.live.utils.AllMsgTextRender; import com.yunbao.live.utils.LiveIconUtil; import com.yunbao.live.views.LiveGiftLuckTopViewHolder; @@ -123,7 +126,9 @@ public class LiveGiftAnimPresenter { private ObjectAnimator mGifGiftTipShowAnimatorAllServer; private ObjectAnimator mGifGiftTipHideAnimatorAllServer; private ObjectAnimator mGifGiftTipShowAnimatorBuyGuard; + private ObjectAnimator mGifGiftTipShowAnimatorBuyGuardNew; private ObjectAnimator mGifGiftTipHideAnimatorBuyGuard; + private ObjectAnimator mGifGiftTipHideAnimatorBuyGuardNew; private ObjectAnimator mGifGiftTipShowAnimatorBuyZuoji; private ObjectAnimator mGifGiftTipHideAnimatorBuyZuoji; @@ -160,7 +165,8 @@ public class LiveGiftAnimPresenter { private static final int WHAT_BUY_LIANG_NAME_2 = -12; private static final int WHAT_BUY_VIP_1 = -13; private static final int WHAT_BUY_VIP_2 = -14; - + private static final int WHAT_BUY_GUARD_NEW_1 = -15; + private static final int WHAT_BUY_GUARD_NEW_2 = -16; private boolean mShowGif; private boolean mShowBuyGuard; private boolean mShowAllServer; @@ -227,6 +233,7 @@ public class LiveGiftAnimPresenter { superNotice = v.findViewById(R.id.super_notice); bgAllServer = v.findViewById(R.id.bg_all_server); mIvLookBuyGuard = v.findViewById(R.id.iv_look_buy_guard); + mIvLookBuyGuardNew = v.findViewById(R.id.iv_look_buy_guard_new); svgaImageViewCallback(); @@ -235,7 +242,10 @@ public class LiveGiftAnimPresenter { mGifGiftTip = (TextView) v.findViewById(R.id.gif_gift_tip); mGifGiftTipAllServer = (TextView) v.findViewById(R.id.gif_gift_tip_all_server); mGifGiftTipGroupBuyGuard = v.findViewById(R.id.gif_gift_tip_group_buy_guard); + mGifGiftTipGroupBuyGuardNew = v.findViewById(R.id.gif_gift_tip_group_buy_guard_new); + guardAllServerNotifyBg = v.findViewById(R.id.guard_all_server_notify_bg); mGifGiftTipBuyGuard = (TextView) v.findViewById(R.id.gif_gift_tip_buy_guard); + mGifGiftTipBuyGuardNew = (TextView) v.findViewById(R.id.gif_gift_tip_buy_guard_new); mGifGiftTipGroupBuyZuoji = v.findViewById(R.id.gif_gift_tip_group_buy_zuoji); mGifGiftTipBuyZuoji = (TextView) v.findViewById(R.id.gif_gift_tip_buy_zuoji); @@ -253,14 +263,14 @@ public class LiveGiftAnimPresenter { mIvLookBuyZuojiClick(); mIvLookBuyLiangNameClick(); mIvLookBuyVipClick(); - + onmIvLookBuyGuardNew(); setGitTipAnimator1(); setGitTipAnimatorAllServer(); setGitTipAnimatorBuyGuard(); setGitTipAnimatorBuyZuoji(); setGitTipAnimatorBuyLiangName(); setGitTipAnimatorBuyVip(); - + setGitTipAnimatorBuyGuardNew(); mSendString = "送了"; mLiveGiftViewHolders = new LiveGiftViewHolder[2]; @@ -374,7 +384,7 @@ public class LiveGiftAnimPresenter { mGifGiftTipGroupBuyZuoji.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - WebViewActivity.forward(mContext, HtmlConfig.SHOP + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"),true); + WebViewActivity.forward(mContext, HtmlConfig.SHOP + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"), true); } }); } @@ -383,7 +393,7 @@ public class LiveGiftAnimPresenter { mGifGiftTipGroupBuyLiangName.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - WebViewActivity.forward(mContext, HtmlConfig.SHOP + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"),true); + WebViewActivity.forward(mContext, HtmlConfig.SHOP + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"), true); } }); } @@ -404,7 +414,7 @@ public class LiveGiftAnimPresenter { String uid = mTempGifGiftBean.getUid(); String userId = CommonAppConfig.getInstance().getUid(); if (userId.equals(uid)) { - ToastUtil.show(WordUtil.isNewZh()?"已在当前直播间":"Already in the current studio"); + ToastUtil.show(WordUtil.isNewZh() ? "已在当前直播间" : "Already in the current studio"); return; } } @@ -507,6 +517,38 @@ public class LiveGiftAnimPresenter { }); } + private void setGitTipAnimatorBuyGuardNew() { + mDp500 = DpUtil.dp2px(500); + mGifGiftTipShowAnimatorBuyGuardNew = ObjectAnimator.ofFloat(mGifGiftTipGroupBuyGuardNew, "translationX", mDp500, 0); + mGifGiftTipShowAnimatorBuyGuardNew.setDuration(2000); + mGifGiftTipShowAnimatorBuyGuardNew.setInterpolator(new LinearInterpolator()); + mGifGiftTipShowAnimatorBuyGuardNew.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (mHandler != null) { + mHandler.sendEmptyMessageDelayed(WHAT_BUY_GUARD_NEW_1, 5000); + } + } + }); + mDp10 = DpUtil.dp2px(10); + mGifGiftTipHideAnimatorBuyGuardNew = ObjectAnimator.ofFloat(mGifGiftTipGroupBuyGuardNew, "translationX", 0); + mGifGiftTipHideAnimatorBuyGuardNew.setDuration(3000); + mGifGiftTipHideAnimatorBuyGuardNew.setInterpolator(new AccelerateDecelerateInterpolator()); + mGifGiftTipHideAnimatorBuyGuardNew.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + mGifGiftTipGroupBuyGuardNew.setAlpha(1 - animation.getAnimatedFraction()); + } + }); + mGifGiftTipHideAnimatorBuyGuardNew.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + if (mHandler != null) { + mHandler.sendEmptyMessageDelayed(WHAT_BUY_GUARD_NEW_2, 100); + } + } + }); + } private void setGitTipAnimatorBuyZuoji() { mDp500 = DpUtil.dp2px(500); @@ -721,6 +763,9 @@ public class LiveGiftAnimPresenter { } else if (msg.what == WHAT_BUY_GUARD_1) { mGifGiftTipHideAnimatorBuyGuard.setFloatValues(0, -mDp10 - mGifGiftTipGroupBuyGuard.getWidth()); mGifGiftTipHideAnimatorBuyGuard.start(); + } else if (msg.what == WHAT_BUY_GUARD_NEW_1) { + mGifGiftTipHideAnimatorBuyGuardNew.setFloatValues(0, -mDp10 - mGifGiftTipGroupBuyGuardNew.getWidth()); + mGifGiftTipHideAnimatorBuyGuardNew.start(); } else if (msg.what == WHAT_BUY_GUARD_2) { mShowAllServer = false; heightOffsetArr[index4Guard] = 0; @@ -728,6 +773,13 @@ public class LiveGiftAnimPresenter { if (bean != null) { chooseInto(bean); } + } else if (msg.what == WHAT_BUY_GUARD_NEW_2) { + mShowAllServer = false; + heightOffsetArr[index4Guard] = 0; + LiveReceiveGiftBean bean = mGifAll.poll(); + if (bean != null) { + chooseInto(bean); + } } else if (msg.what == WHAT_BUY_ZUOJI_1) { mGifGiftTipHideAnimatorBuyZuoji.setFloatValues(0, -mDp10 - mGifGiftTipGroupBuyZuoji.getWidth()); mGifGiftTipHideAnimatorBuyZuoji.start(); @@ -785,6 +837,8 @@ public class LiveGiftAnimPresenter { showBuyVipGiftAnim(bean); } else if (action == 71) { showSystAnim(bean); + } else if (action == 90) { + showBuyGuardGiftAnimNew(notifyGuardEvent); } } @@ -970,6 +1024,87 @@ public class LiveGiftAnimPresenter { } } + View mGifGiftTipGroupBuyGuardNew; + LinearLayout guardAllServerNotifyBg; + TextView mGifGiftTipBuyGuardNew; + View mIvLookBuyGuardNew; + NewAllServerNotifyGuardEvent notifyGuardEvent; + + public void showBuyGuardGiftAnimNew(NewAllServerNotifyGuardEvent event) { + notifyGuardEvent = event; + if (mShowAllServer) { + if (mGifAll != null) { + LiveReceiveGiftBean bean = new LiveReceiveGiftBean(); + bean.setSendtype(90); + mGifAll.offer(bean); + } + } else { + mShowAllServer = true; + index4Guard = getFirstIndexOfValue(heightOffsetArr, 0); + if (index4Guard >= 0) { + heightOffsetArr[index4Guard] = 1; + int y; + y = index4Guard * 60; + FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mGifGiftTipGroupBuyGuardNew.getLayoutParams(); + params.topMargin = DpUtil.dp2px(y); + mGifGiftTipGroupBuyGuardNew.setLayoutParams(params); + } + mGifGiftTipGroupBuyGuardNew.setAlpha(1f); + mGifGiftTipGroupBuyGuardNew.setVisibility(View.VISIBLE); + switch (event.getGuardType()) { + case "1": + guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? + R.mipmap.background_all_server_notify_star_zh : + R.mipmap.background_all_server_notify_star_en); + mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#072A93")); + mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_star_guard_onlookers); + break; + case "2": + guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? + R.mipmap.background_all_server_notify_king_zh : + R.mipmap.background_all_server_notify_king_en); + mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#BF0B0A")); + mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_king_guard_onlookers); + break; + case "3": + guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? + R.mipmap.background_all_server_notify_god_zh : + R.mipmap.background_all_server_notify_sgod_en); + mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#41057E")); + mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_god_guard_onlookers); + break; + + } + if (TextUtils.equals(mLiveUid, event.getLiveuid())) { + mIvLookBuyGuardNew.setVisibility(View.GONE); + } else { + mIvLookBuyGuardNew.setVisibility(View.VISIBLE); + } + mGifGiftTipShowAnimatorBuyGuardNew.start(); + + + mGifGiftTipBuyGuardNew.postDelayed(new Runnable() { + @Override + public void run() { + if (mGifGiftTipBuyGuardNew != null) { + mGifGiftTipBuyGuardNew.setSelected(true); + mGifGiftTipBuyGuardNew.setText(WordUtil.isNewZh() ? event.getMsgCn() : event.getMsgEn()); + } + } + }, 500); + + } + + } + + private void onmIvLookBuyGuardNew() { + ViewClicksAntiShake.clicksAntiShake(mIvLookBuyGuardNew, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + changeLiveRoom(); + } + }); + } //购买守护 全服通知 public void showBuyGuardGiftAnim(LiveReceiveGiftBean bean) { 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 a538671c3..9b599b029 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -66,6 +66,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.NewAllServerNotifyGuardEvent; import com.yunbao.live.bean.SendQuickGiftModel; import com.yunbao.live.event.LiveAnchorEvent; import com.yunbao.live.event.LiveAudienceEvent; @@ -439,6 +440,9 @@ public class SocketRyClient { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.BLIND_BOX) .setAllServerNotifyEvent(allServerNotifyEvent)); + } else if (action2 == 90) { + NewAllServerNotifyGuardEvent notifyGuardEvent = GsonUtils.fromJson(map.toString(), NewAllServerNotifyGuardEvent.class); + Bus.get().post(notifyGuardEvent); } break; case Constants.SOCKET_SEND_BARRAGE://发弹幕 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 0574d66c1..96b34ecd3 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -160,6 +160,7 @@ import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveWishlistBean; +import com.yunbao.live.bean.NewAllServerNotifyGuardEvent; import com.yunbao.live.bean.WishlistItemModel; import com.yunbao.live.custom.LiveLightView; import com.yunbao.live.custom.RightGradual; @@ -1596,6 +1597,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis dragonImmediateParticipation = (LinearLayout) findViewById(R.id.dragon_immediate_participation); dragonImmediateParticipationTime = (LinearLayout) findViewById(R.id.dragon_immediate_participation_time); participation_time = (TextView) findViewById(R.id.participation_time); + ViewClicksAntiShake.clicksAntiShake(dragonImmediateParticipation, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { @@ -1603,6 +1605,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis // new XPopup.Builder(mContext) // .asCustom(new GuardUpgradePopup(mContext, mLiveUid)) // .show(); +// ttttttype = ttttttype + 1; +// buyGuardNew(new NewAllServerNotifyGuardEvent() +// .setAction("90") +// .setGuardType(String.valueOf(ttttttype)) +// .setMsgCn("周末暴打小朋友在接化发直播間開通【星之守護】") +// .setMsgEn("周末暴打小朋友opened 【星之守護】 in 接化发 live broadcast room") +// .setLiveuid("98915")); } }); ViewClicksAntiShake.clicksAntiShake(dragonImmediateParticipationTime, new ViewClicksAntiShake.ViewClicksCallBack() { @@ -1617,6 +1626,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis // dragonImmediateParticipation.setVisibility(View.GONE); } + int ttttttype = 0; private LinearLayout dragonImmediateParticipation, dragonImmediateParticipationTime; private FrameLayout redPacket; private TextView redPacketCountdown, redSchedule, openRedPacket, participation_time; @@ -3918,6 +3928,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis setHotData(bean.getHot_num()); } + //新版购买守护 + public void buyGuardNew(NewAllServerNotifyGuardEvent event) { + if (mLiveGiftAnimPresenter == null) { + mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); + } + mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid, mStream); + mLiveGiftAnimPresenter.showBuyGuardGiftAnimNew(event); + + } + //全服通知 购买坐骑 public void showBuyZuojiMessage(LiveReceiveGiftBean bean) { if (mLiveGiftAnimPresenter == null) { 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 244f71efc..3af9c2c33 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -92,6 +92,7 @@ import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; +import com.yunbao.live.bean.NewAllServerNotifyGuardEvent; import com.yunbao.live.bean.OpenParametersModel; import com.yunbao.live.dialog.BlowkissDialog; import com.yunbao.live.dialog.NewUserDialog; @@ -1291,6 +1292,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } + public void buyGuardNew(NewAllServerNotifyGuardEvent event) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.buyGuardNew(event); + } + } + @Override public void onBuyZuoji(LiveReceiveGiftBean bean) { if (mLiveRoomViewHolder != null) { diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index cfde902a8..a55110ae9 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -1154,6 +1154,58 @@ + + + + + + + + + + + + + + + android:layout_alignParentEnd="true" + android:visibility="gone" /> + android:orientation="vertical" + android:visibility="gone"> + android:orientation="vertical" + android:visibility="gone"> + \ No newline at end of file