diff --git a/common/src/main/java/com/yunbao/common/event/QuickGiftingEvent.java b/common/src/main/java/com/yunbao/common/event/QuickGiftingEvent.java index a01219060..8253aa1a6 100644 --- a/common/src/main/java/com/yunbao/common/event/QuickGiftingEvent.java +++ b/common/src/main/java/com/yunbao/common/event/QuickGiftingEvent.java @@ -6,6 +6,37 @@ 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; 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/JavascriptInterfaceUtils.java b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java index 62fc018f7..b951378e9 100644 --- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java @@ -2,6 +2,7 @@ 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; @@ -25,6 +26,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 +126,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 +149,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 +261,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 +303,7 @@ public class JavascriptInterfaceUtils { } }); } + @JavascriptInterface public void androidMethodLookToLive(String liveId) { Bus.get().post(new JavascriptInterfaceEvent() @@ -598,6 +602,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 +660,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() { 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-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/config.gradle b/config.gradle index 3c4631a75..8bd78b4b7 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式、 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", // 测试 -// serverHost : " https://ceshi.yaoulive.com", + serverHost : " https://ceshi.yaoulive.com", 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 d1931ad57..7b2d00bfb 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1774,13 +1774,25 @@ public class LiveAudienceActivity extends LiveActivity { @Subscribe(threadMode = ThreadMode.MAIN) public void onQuickGiftingEvent(QuickGiftingEvent event) { if (manager != null) { - - - if (event.isShow()) { - manager.onQuickGifting2(true); + 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.onQuickGifting(event.getIndex(), event.getSvgaName()); + manager.setHotNum(event.getHotNum()); } + + } } diff --git a/live/src/main/java/com/yunbao/live/bean/SendQuickGiftModel.java b/live/src/main/java/com/yunbao/live/bean/SendQuickGiftModel.java index 2317872e0..a3add8eaf 100644 --- a/live/src/main/java/com/yunbao/live/bean/SendQuickGiftModel.java +++ b/live/src/main/java/com/yunbao/live/bean/SendQuickGiftModel.java @@ -11,6 +11,17 @@ public class SendQuickGiftModel extends BaseModel { 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; 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 385713a19..c3c0b0763 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; @@ -767,10 +768,11 @@ public class SocketRyClient { SendQuickGiftModel sendQuickGiftModel = GsonUtils.fromJson(map.toString(), SendQuickGiftModel.class); StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(sendQuickGiftModel.getUserNicename()) - .append(WordUtil.isNewZh()?"送出了":"sent") + .append(WordUtil.isNewZh() ? "送出了" : "sent") .append(sendQuickGiftModel.getQuickGiftNumber()) - .append(WordUtil.isNewZh()?"個小PD":"small pandas"); + .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 7645a0b10..e2b652461 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -28,6 +28,7 @@ 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; @@ -279,6 +280,45 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { 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"); + } + }); + 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) { @@ -293,6 +333,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { 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", "连点"); } } @@ -322,11 +363,22 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { } 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) { 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 1947c5d98..9a135da2f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -387,6 +387,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis 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) { @@ -711,8 +712,19 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis 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); + } + IMLoginManager.get(mContext).setQuickGiftIfFirst(); } } + 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); @@ -1553,8 +1565,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis 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); + } private FrameLayout redPacket; @@ -2531,11 +2545,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 + ""))); } } } @@ -2555,12 +2569,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)); + } /** * 更新心愿单进度 * 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 1888cb042..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; @@ -235,6 +236,22 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } + 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; @@ -846,8 +863,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLivePlayViewHolder.release(); } if (mLiveRoomViewHolder != null) { - mLiveRoomViewHolder.removeFromParent(); mLiveRoomViewHolder.clearData(); + mLiveRoomViewHolder.removeFromParent(); mLiveRoomViewHolder.countDownTimerTrickery = null; } diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index 098475017..2309da2b0 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -506,6 +506,7 @@ android:textColor="#FFB403" android:textSize="8sp" android:textStyle="bold" /> + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 1c67d8d0b..ce7507d06 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -2509,6 +2509,7 @@ android:layout_width="match_parent" android:layout_height="384dp" android:layout_alignParentBottom="true" /> + + +