diff --git a/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java b/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java index 49c05a3de..a28783b02 100644 --- a/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java +++ b/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java @@ -19,6 +19,8 @@ public class RedPacketInfoModel extends BaseModel { private String redPacketMoney; @SerializedName("red_packet_quantity") private String redPacketQuantity; + @SerializedName("is_fans") + private String isFans; @SerializedName("conditions") private String conditions; @SerializedName("create_time") @@ -270,4 +272,12 @@ public class RedPacketInfoModel extends BaseModel { this.userGoldenBean = userGoldenBean; return this; } + + public boolean getIsFans() { + return isFans.equals("1"); + } + + public void setIsFans(String isFans) { + this.isFans = isFans; + } } 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 47049923e..c7adca890 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -766,18 +766,19 @@ public interface PDLiveApi { /** - * 获取盲盒礼物当前数据 + * 创建红包 */ @GET("/api/public/?service=Live.createRedPacket") Observable> createRedPacket( @Query("liveuid") String liveUid, + @Query("is_fans") int needFansGroup, @Query("red_packet_money") String redPacketMoney, @Query("red_packet_quantity") String redPacketQuantity, @Query("conditions") String conditions ); /** - * 获取盲盒礼物当前数据 + * 获取红包数据 */ @GET("/api/public/?service=Live.redPacketInfo") Observable> redPacketInfo( 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 b385a72fb..d63b8dcff 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 @@ -1631,10 +1631,11 @@ public class LiveNetManager { * @param redPacketMoney 红包金额 * @param redPacketQuantity 红包数量 * @param conditions 红包领取条件 0.无 1.关注主播 + * @param needFansGroup 是否需要加入粉丝团条件 */ - public void createRedPacket(String liveUid, String redPacketMoney, String redPacketQuantity, String conditions, HttpCallback callback) { + public void createRedPacket(String liveUid, String redPacketMoney, String redPacketQuantity, String conditions, boolean needFansGroup, HttpCallback callback) { API.get().pdLiveApi(mContext) - .createRedPacket(liveUid, redPacketMoney, redPacketQuantity, conditions) + .createRedPacket(liveUid, needFansGroup ? 1 : 0, redPacketMoney, redPacketQuantity, conditions) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer>() { @@ -1931,7 +1932,7 @@ public class LiveNetManager { public void giftDetail(String liveUid, String giftId, String toUid, HttpCallback callback) { API.get().pdLiveApi(mContext) - .giftDetail(liveUid, giftId,toUid) + .giftDetail(liveUid, giftId, toUid) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer>() { @@ -2171,7 +2172,7 @@ public class LiveNetManager { }).isDisposed(); } - public void getGiftNamingInfo(String giftId,HttpCallback callback) { + public void getGiftNamingInfo(String giftId, HttpCallback callback) { API.get().pdLiveApi(mContext) .getGiftNamingInfo(giftId) .subscribeOn(Schedulers.io()) @@ -2179,7 +2180,7 @@ public class LiveNetManager { .subscribe(new Consumer>() { @Override public void accept(ResponseModel liveGiftBeanResponseModel) throws Exception { - if (callback!=null){ + if (callback != null) { callback.onSuccess(liveGiftBeanResponseModel.getData().getInfo()); } } diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index 5d6436e27..fc726adaf 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1317,5 +1317,6 @@ Limited ride And limited avatar frame Anchor: Whether to use trial coupons Use diamonds + Join a fans club diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 1000878aa..f3721d6bd 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1313,4 +1313,5 @@ 主播: 是否使用試用劵 使用鑽石 + 加入粉絲團 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 3e87964b1..d3839869a 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1307,6 +1307,7 @@ 不再設置 去設置 重複添加禮物 + 加入粉絲團 當前連麥 連麥申請 主播: diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 41e348b63..7808238ad 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1313,5 +1313,6 @@ 連麥申請 主播: + 加入粉絲團 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index f22f221e0..a610a1f49 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1319,4 +1319,5 @@ Limited ride And limited avatar frame Apply for list Anchor: + Join a fans club diff --git a/gradle.properties b/gradle.properties index e850a38e3..3265ac671 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,6 +21,6 @@ android.enableJetifier=true systemProp.http.proxyHost=127.0.0.1 systemProp.https.proxyHost=127.0.0.1 -systemProp.https.proxyPort=10809 -systemProp.http.proxyPort=10809 +systemProp.https.proxyPort=7890 +systemProp.http.proxyPort=7890 #android.enableR8.fullMode=true \ No newline at end of file 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 6cd8716f5..6bcbfc0ad 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -763,6 +763,7 @@ public class LiveAudienceActivity extends LiveActivity { if (manager != null && !StringUtil.isEmpty(is_fans)) { if (is_fans.equals("-2")) { manager.setAttention(0); + mLiveRoomViewHolder.setFansGroup("0"); is_fans = "2"; } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveFansFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveFansFragment.java index 45a3c034a..d92669e1c 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveFansFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveFansFragment.java @@ -132,6 +132,7 @@ public class LiveFansFragment extends AbsDialogFragment { int num = LiveAudienceActivity.fansNum - 1; LiveRoomViewHolder.setFansNum(num); ToastUtil.show("退出成功"); + EventBus.getDefault().post("exitFansGroup"); dismiss(); } else if (TextUtils.equals(event.getMethod(), "sendFansCard")) { if (LiveRoomViewHolder.mBtnFollow != null && LiveRoomViewHolder.mBtnFollow.getVisibility() == View.VISIBLE) { diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java index 4367e195b..80e74106e 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java @@ -899,6 +899,7 @@ public class LiveGiftPopup extends AbsDialogFragment { MobclickAgent.onEvent(mContext, "gif_list_blind_box", "用户点开礼物列表盲盒"); iconArrow.setVisibility(View.GONE); showBlindProgress(liveGiftModel.getBlind_box_type()); + description.setTag(liveGiftModel.getBlind_box_type()); } else { blindBox.setVisibility(View.INVISIBLE); mCount = DEFAULT_COUNT; diff --git a/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java b/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java index 4dbd9a207..c08778b6b 100644 --- a/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java @@ -25,6 +25,7 @@ import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.TimeUtils; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.CircleProgress; import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -46,10 +47,13 @@ public class ReceiveRendPacketPopup extends CenterPopupView { private ImageView isAttention; private RedPacketInfoModel redPacketInfoModel; private boolean isSuperJackpot; + private boolean isFans = false; public ReceiveRendPacketPopup(@NonNull Context context, int time, String mLiveUid, String stream, String redPacketId, RedPacketInfoModel redPacketInfoModel, - boolean isSuperJackpot) { + boolean isSuperJackpot, + boolean isFans + ) { super(context); this.time = time; @@ -58,7 +62,7 @@ public class ReceiveRendPacketPopup extends CenterPopupView { this.redPacketId = redPacketId; this.redPacketInfoModel = redPacketInfoModel; this.isSuperJackpot = isSuperJackpot; - + this.isFans = isFans; } // 返回自定义弹窗的布局离开 @@ -95,6 +99,7 @@ public class ReceiveRendPacketPopup extends CenterPopupView { } userID = redPacketInfoModel.getUserId(); + } private Handler timeHandler = new Handler(); @@ -102,7 +107,7 @@ public class ReceiveRendPacketPopup extends CenterPopupView { private Runnable timeRunnable = new Runnable() { @Override public void run() { - if (time > 0) { + if (time > 1) { circleProgress.setCurrent(time--); timeHandler.postDelayed(timeRunnable, 1000); String countdown = TimeUtils.getTime(time); @@ -149,6 +154,11 @@ public class ReceiveRendPacketPopup extends CenterPopupView { redPacketTimeLayout.setVisibility(GONE); redPacketOpen.setVisibility(VISIBLE); } + ViewClicksAntiShake.clicksAntiShake(redPacketTimeLayout, () -> { + if (!isFans && redPacketInfoModel.getIsFans()) { + ToastUtil.show(getContext().getString(R.string.live_rad_pack_join_fans_group_click_tip)); + } + }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.red_packet_open), () -> { if (isSuperJackpot) { @@ -179,6 +189,10 @@ public class ReceiveRendPacketPopup extends CenterPopupView { } }); } else { + if (!isFans && redPacketInfoModel.getIsFans()) { + ToastUtil.show(getContext().getString(R.string.live_rad_pack_join_fans_group_click_tip)); + return; + } if (TextUtils.equals(redPacketInfoModel.getConditions(), "1") && LiveAudienceActivity.isattention == 0) { LiveRoomViewHolder.follow(); } diff --git a/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java b/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java index 54412f364..153709be1 100644 --- a/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java @@ -25,7 +25,7 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; public class SendRendPacketPopup extends CenterPopupView { - private Button thereIsNo, followingAnchor; + private Button thereIsNo, followingAnchor, joinFansGroup; private TextView redEnvelopeRill, totalConsumptionOfDrill; private TextView rill, total; private FrameLayout redPacketIllustrate; @@ -59,6 +59,7 @@ public class SendRendPacketPopup extends CenterPopupView { redPacketIllustrate = findViewById(R.id.red_packet_illustrate); illustrateClose = findViewById(R.id.illustrate_close); iconInstructions = findViewById(R.id.icon_instructions); + joinFansGroup = findViewById(R.id.fans_group); rill = findViewById(R.id.rill); total = findViewById(R.id.total); selectText(thereIsNo, true); @@ -66,13 +67,21 @@ public class SendRendPacketPopup extends CenterPopupView { ViewClicksAntiShake.clicksAntiShake(thereIsNo, () -> { selectText(thereIsNo, true); selectText(followingAnchor, false); + selectText(joinFansGroup, false); conditions = "0"; }); ViewClicksAntiShake.clicksAntiShake(followingAnchor, () -> { selectText(thereIsNo, false); + selectText(joinFansGroup, false); selectText(followingAnchor, true); conditions = "1"; }); + ViewClicksAntiShake.clicksAntiShake(joinFansGroup, () -> { + selectText(thereIsNo, false); + selectText(joinFansGroup, true); + selectText(followingAnchor, false); + conditions = "0"; + }); redEnvelopeRill.setText(String.format(getContext().getString(R.string.red_envelope_rill), "0")); totalConsumptionOfDrill.setText(String.format(getContext().getString(R.string.total_consumption_of_drill), "0")); rill.addTextChangedListener(new TextWatcher() { @@ -205,7 +214,9 @@ public class SendRendPacketPopup extends CenterPopupView { .createRedPacket(mLiveID, rillNumber, number, - conditions, new HttpCallback() { + conditions, + joinFansGroup.getTag() != null && (boolean) joinFansGroup.getTag(), + new HttpCallback() { @Override public void onSuccess(String data) { @@ -223,10 +234,10 @@ public class SendRendPacketPopup extends CenterPopupView { } }); - if(WordUtil.isNewZh()){ - ((ImageView)findViewById(R.id.red_packet_info_img)).setImageResource(R.mipmap.bg_red_packet_info_zh); - }else{ - ((ImageView)findViewById(R.id.red_packet_info_img)).setImageResource(R.mipmap.bg_red_packet_info_en); + if (WordUtil.isNewZh()) { + ((ImageView) findViewById(R.id.red_packet_info_img)).setImageResource(R.mipmap.bg_red_packet_info_zh); + } else { + ((ImageView) findViewById(R.id.red_packet_info_img)).setImageResource(R.mipmap.bg_red_packet_info_en); } } @@ -234,8 +245,10 @@ public class SendRendPacketPopup extends CenterPopupView { textView.setSelected(select); if (select) { textView.setTextColor(Color.parseColor("#E12801")); + textView.setTag(true); } else { textView.setTextColor(Color.parseColor("#FDD04A")); + textView.setTag(false); } } 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 5f27221f3..4664a66aa 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -378,6 +378,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow; private String mAnchorName;//主播名字 private boolean isHinde = false; + private boolean isFans = false; @Subscribe(threadMode = ThreadMode.MAIN) public void onUpdata(String str) { @@ -460,6 +461,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } else if ("checkNewLetter".equals(str)) { checkNewLetter(); + }else if("exitFansGroup".equals(str)){ + setFansGroup("0"); } } @@ -1418,9 +1421,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void run() { if (redTimeCountdown > 1) { - redTimeCountdown = redTimeCountdown - 1; timeHandler.postDelayed(timeRunnable, 1000); redPacketCountdown.setText(String.format(mContext.getString(R.string.red_packet_countdown), TimeUtils.getTime(redTimeCountdown))); + redTimeCountdown = redTimeCountdown - 1; } else { redTimeCountdown = 0; timeHandler.removeCallbacks(timeRunnable); @@ -1526,7 +1529,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (TextUtils.equals(data.getReceiveStatus(), "0")) { redTimeCountdown = redTimeCountdown - 1; new XPopup.Builder(mContext) - .asCustom(new ReceiveRendPacketPopup(mContext, redTimeCountdown, mLiveUid, mStream, redPacketModel.getRedPacketId(), data, false)) + .asCustom(new ReceiveRendPacketPopup(mContext, redTimeCountdown, mLiveUid, mStream, redPacketModel.getRedPacketId(), data, false, isFans)) .show(); } else if (TextUtils.equals(data.getReceiveStatus(), "1")) { new XPopup.Builder(mContext) @@ -1563,7 +1566,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void setRedPacketInfoModel(RedPacketInfoModel redPacket) { new XPopup.Builder(mContext) - .asCustom(new ReceiveRendPacketPopup(mContext, 0, mLiveUid, mStream, redPacket.getRedPacketId(), redPacket, true)) + .asCustom(new ReceiveRendPacketPopup(mContext, 0, mLiveUid, mStream, redPacket.getRedPacketId(), redPacket, true, isFans)) .show(); } @@ -3520,8 +3523,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis ((LiveAudienceActivity) mContext).openFansMedalOkWindow(); } - if (!isAncher && bean.getGiftName().equals("粉絲牌")) { + if (!isAncher && bean.getGiftName().equals("粉絲牌") && bean.getUid().equals(CommonAppConfig.getInstance().getUid())) { LiveAudienceActivity.is_fans = "1"; + setFansGroup("1"); } Log.i("tvss", bean.getDrpk_status() + "是" + mLiveUid + "vsss" + bean.getRoomnum()); if (mLiveGiftAnimPresenter == null) { @@ -3998,6 +4002,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis .setUname("0"));//setUname==by } + public void setFansGroup(String isFans) { + this.isFans = isFans.equals("1"); + } + private static class LiveRoomHandler extends Handler { 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 e60696c6b..9e0461569 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -525,6 +525,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.updateTopBanner(); mLiveRoomViewHolder.setVoteData(data.getEnterRoomInfo().getVoteModel()); mLiveRoomViewHolder.updateFansMessageRed(); + mLiveRoomViewHolder.setFansGroup(data.getEnterRoomInfo().getIsFans()); isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention()); if (isattention == 0) { @@ -679,6 +680,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel)); } } + AppManager.runDebugCode(()->{ + liveHandler.postDelayed(loadTimeoutRunnableGone, 1_000); + }); liveHandler.postDelayed(loadTimeoutRunnableGone, 15_000); if (TextUtils.equals(data.getEnterRoomInfo().getIsconnection(), "1")) { //通知心愿单位置换地方 diff --git a/live/src/main/res/layout/view_red_packet_luck_user.xml b/live/src/main/res/layout/view_red_packet_luck_user.xml index 78759e372..12ccd5791 100644 --- a/live/src/main/res/layout/view_red_packet_luck_user.xml +++ b/live/src/main/res/layout/view_red_packet_luck_user.xml @@ -11,8 +11,9 @@ android:id="@+id/gift_name" android:layout_width="0dp" android:layout_height="wrap_content" - android:text="dadsad" + android:text="中文测试中文测试" android:layout_weight="1" + android:maxEms="9" android:textColor="@color/white" android:textSize="16sp" /> diff --git a/live/src/main/res/layout/view_red_packet_user_list.xml b/live/src/main/res/layout/view_red_packet_user_list.xml index 3437d2037..bd92dfaf2 100644 --- a/live/src/main/res/layout/view_red_packet_user_list.xml +++ b/live/src/main/res/layout/view_red_packet_user_list.xml @@ -33,7 +33,7 @@ diff --git a/live/src/main/res/layout/view_send_red_packet.xml b/live/src/main/res/layout/view_send_red_packet.xml index b2165b243..857692e35 100644 --- a/live/src/main/res/layout/view_send_red_packet.xml +++ b/live/src/main/res/layout/view_send_red_packet.xml @@ -148,7 +148,7 @@ @@ -161,19 +161,37 @@ android:text="@string/there_is_no" android:textColor="#FDD04A" android:textSize="13sp" /> - -