diff --git a/app/src/main/java/com/mango/moshen/ui/gift/dialog/GiftInfoVm.java b/app/src/main/java/com/mango/moshen/ui/gift/dialog/GiftInfoVm.java index 18566925a..d15fbdce4 100644 --- a/app/src/main/java/com/mango/moshen/ui/gift/dialog/GiftInfoVm.java +++ b/app/src/main/java/com/mango/moshen/ui/gift/dialog/GiftInfoVm.java @@ -64,7 +64,7 @@ public class GiftInfoVm extends BaseItem { if (data.getConsumeType() == GiftInfo.CONSUME_TYPE_GOLD) { radishDrawable = null; radishDrawableSelected = null; - goldText.set(context.getResources().getString(R.string.how_much_gold, data.getGoldPrice())); + goldText.set(String.valueOf(data.getGoldPrice())); } else { radishDrawable = context.getResources().getDrawable(R.drawable.icon_radish_transparent); radishDrawableSelected = context.getResources().getDrawable(R.drawable.icon_radish_transparent_selected); diff --git a/app/src/main/java/com/mango/moshen/ui/widget/GiftAvatarAdapter.java b/app/src/main/java/com/mango/moshen/ui/widget/GiftAvatarAdapter.java index 3dc7fe0e3..130bc8918 100644 --- a/app/src/main/java/com/mango/moshen/ui/widget/GiftAvatarAdapter.java +++ b/app/src/main/java/com/mango/moshen/ui/widget/GiftAvatarAdapter.java @@ -4,6 +4,7 @@ import android.content.Context; import androidx.recyclerview.widget.RecyclerView; +import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -83,18 +84,15 @@ public class GiftAvatarAdapter extends RecyclerView.Adapter micMemberInfos; private View giftNumLayout; @@ -173,7 +172,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene private List> pagerList; private WalletInfo goldWalletInfo = PayModel.get().getCurrentWalletInfo(); private int itemType = ITEM_TYPE_GOLD; - private HorizontalScrollView hsvTabs; private View rlGifts; private View llTabs; private View llDrawGift; @@ -181,6 +179,12 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene private View ivDrawGiftRemoveLast; private View ivDrawGiftRemoveAll; private View ivDrawGiftClose; + private TextView tvTabSendGift; + private TextView tvTabInteraction; + private View llTabType; + private View lineTabType; + private RealtimeBlurView realtimeBlurView; + private RollPagerView pagerViewVip; private boolean isShowDrawGiftModel; @Nullable private DrawGiftHelper drawGiftHelper; @@ -319,8 +323,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene setCanceledOnTouchOutside(true); setContentView(R.layout.dialog_bottom_gift); compositeDisposable = new CompositeDisposable(); - mContentView = findViewById(R.id.ll_dialog_bottom_gift); - init(mContentView); + init(); FrameLayout bottomSheet = findViewById(R.id.design_bottom_sheet); if (bottomSheet != null) { BottomSheetBehavior.from(bottomSheet).setSkipCollapsed(false); @@ -357,43 +360,50 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene } @SuppressLint("CheckResult") - private void init(View root) { - root.findViewById(R.id.tv_recharge).setOnClickListener(this); - sendGiftButton = root.findViewById(R.id.btn_send); - layoutEmpty = root.findViewById(R.id.layout_empty); - layoutLoading = root.findViewById(R.id.layout_loading); - layoutLoadFiled = root.findViewById(R.id.layout_load_failed); - reloadView = root.findViewById(R.id.tv_reload); + private void init() { + findViewById(R.id.tv_recharge).setOnClickListener(this); + tvTabSendGift = findViewById(R.id.tv_tab_send_gift); + tvTabSendGift.setOnClickListener(this); + tvTabInteraction = findViewById(R.id.tv_tab_interaction); + tvTabInteraction.setOnClickListener(this); + realtimeBlurView = findViewById(R.id.realtime_blur_view); + pagerViewVip = findViewById(R.id.pager_view_vip); + llTabType = findViewById(R.id.ll_tab_type); + lineTabType = findViewById(R.id.line_tab_type); + sendGiftButton = findViewById(R.id.btn_send); + layoutEmpty = findViewById(R.id.layout_empty); + layoutLoading = findViewById(R.id.layout_loading); + layoutLoadFiled = findViewById(R.id.layout_load_failed); + reloadView = findViewById(R.id.tv_reload); reloadView.setOnClickListener(this); - loadingView = root.findViewById(R.id.iv_loading); - hsvTabs = root.findViewById(R.id.hsv_tabs); - rlGifts = root.findViewById(R.id.rl_gifts); - llTabs = root.findViewById(R.id.ll_tabs); - llDrawGift = root.findViewById(R.id.ll_draw_gift); - tvDrawGiftTips = root.findViewById(R.id.tv_draw_gift_tips); - ivDrawGiftRemoveLast = root.findViewById(R.id.iv_draw_gift_remove_last); - ivDrawGiftRemoveAll = root.findViewById(R.id.iv_draw_gift_remove_all); - ivDrawGiftClose = root.findViewById(R.id.iv_draw_gift_close); + loadingView = findViewById(R.id.iv_loading); + rlGifts = findViewById(R.id.rl_gifts); + llTabs = findViewById(R.id.ll_tabs); + llDrawGift = findViewById(R.id.ll_draw_gift); + tvDrawGiftTips = findViewById(R.id.tv_draw_gift_tips); + ivDrawGiftRemoveLast = findViewById(R.id.iv_draw_gift_remove_last); + ivDrawGiftRemoveAll = findViewById(R.id.iv_draw_gift_remove_all); + ivDrawGiftClose = findViewById(R.id.iv_draw_gift_close); ivDrawGiftClose.setOnClickListener(this); ivDrawGiftRemoveLast.setOnClickListener(this); ivDrawGiftRemoveAll.setOnClickListener(this); showLoadingView(); showLoadingAnimation(); sendGiftButton.setOnClickListener(this); - giftNumLayout = root.findViewById(R.id.gift_number_layout); + giftNumLayout = findViewById(R.id.gift_number_layout); giftNumLayout.setOnClickListener(this); List tabInfoList = new ArrayList<>(); tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NORMAL, "礼物", "礼物")); - tabInfoList.add(new GiftTab(GiftIndicator.TYPE_LUCKY, "幸运礼物", "幸运礼物")); + tabInfoList.add(new GiftTab(GiftIndicator.TYPE_LUCKY, "幸运", "幸运")); tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NOBLE, "贵族", "贵族")); - tabInfoList.add(new GiftTab(GiftIndicator.TYPE_WEEK, "周星礼物", "周星礼物")); + tabInfoList.add(new GiftTab(GiftIndicator.TYPE_WEEK, "周星", "周星")); tabInfoList.add(new GiftTab(GiftIndicator.TYPE_DRAW_GIFT, "涂鸦礼物", "涂鸦礼物")); tabInfoList.add(new GiftTab(GiftIndicator.TYPE_KNAP, "背包", "背包")); - giftIndicator = root.findViewById(R.id.gift_indicator); + giftIndicator = findViewById(R.id.gift_indicator); giftIndicator.initTab( tabInfoList, - context.getResources().getColor(R.color.color_999999), - context.getResources().getColor(R.color.color_ffbc51) + context.getResources().getColor(R.color.white), + context.getResources().getColor(R.color.color_5FCCE4) ); //noinspection ResultOfMethodCallIgnored giftIndicator.addClick() @@ -412,44 +422,41 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene } else { giftIndicator.hidePosition(GiftIndicator.TYPE_LUCKY); giftIndicator.hidePosition(GiftIndicator.TYPE_DRAW_GIFT); + llTabType.setVisibility(View.GONE); + lineTabType.setVisibility(View.GONE); + realtimeBlurView.setOverlayColor(Color.parseColor("#B3020023")); } - gridView = root.findViewById(R.id.gridView); - indicatorView = root.findViewById(R.id.indicator); + gridView = findViewById(R.id.gridView); + indicatorView = findViewById(R.id.indicator); indicatorView.setVisibility(View.INVISIBLE); - tvTextGold = root.findViewById(R.id.tv_text_gold); - tvRecharge = root.findViewById(R.id.tv_recharge); + tvTextGold = findViewById(R.id.tv_text_gold); + tvRecharge = findViewById(R.id.tv_recharge); + tvTextGold.setSelected(true); + ivAvatarCharm = findViewById(R.id.iv_avatar_charm); + ivAvatarLevel = findViewById(R.id.iv_avatar_level); + tvNickCharm = findViewById(R.id.tv_nick_charm); + tvNickLevel = findViewById(R.id.tv_nick_level); + llStarWeek = findViewById(R.id.ll_star_week); + ivWeekStarIn = findViewById(R.id.iv_week_star_in); + ivWeekStarIn.setOnClickListener(this); - ivAvatarCharm = root.findViewById(R.id.iv_avatar_charm); - ivAvatarLevel = root.findViewById(R.id.iv_avatar_level); - tvNickCharm = root.findViewById(R.id.tv_nick_charm); - tvNickLevel = root.findViewById(R.id.tv_nick_level); - llStarWeek = root.findViewById(R.id.ll_star_week); - llWeekIn = root.findViewById(R.id.ll_week_in); - llWeekIn.setOnClickListener(this); - - giftNumberText = root.findViewById(R.id.gift_number_text); - giftNumberOptions = root.findViewById(R.id.iv_gift_number_options); - avatarImage = root.findViewById(R.id.avatar); - nickText = root.findViewById(R.id.nick); - avatarList = root.findViewById(R.id.avatar_list); + giftNumberText = findViewById(R.id.gift_number_text); + giftNumberOptions = findViewById(R.id.iv_gift_number_options); + avatarImage = findViewById(R.id.avatar); + nickText = findViewById(R.id.nick); + avatarList = findViewById(R.id.avatar_list); LinearLayoutManager mLayoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false); avatarList.setLayoutManager(mLayoutManager); - avatarList.addItemDecoration(new VerticalDecoration(UIUtil.dip2px(context, 10), false, true)); - - ivOpenNoble = root.findViewById(R.id.iv_open_noble); - etSendMessage = root.findViewById(R.id.et_gift_message); - ivOpenNoble.setOnClickListener(this); - sendContainer = root.findViewById(R.id.send_container); + etSendMessage = findViewById(R.id.et_gift_message); + sendContainer = findViewById(R.id.send_container); layoutEmpty.setVisibility(View.GONE); - ivFirstRecharge = root.findViewById(R.id.iv_first_recharge); - tvLuckyBagIntro = root.findViewById(R.id.tv_lucky_bag_intro); - tvGiftValue = root.findViewById(R.id.tv_gift_value); - ivFirstRecharge.setOnClickListener(this); - tvLuckyBagIntro.setOnClickListener(this); + ivLuckyBagIntro = findViewById(R.id.iv_lucky_bag_intro); + flLuckyDesc = findViewById(R.id.fl_lucky_desc); + tvGiftValue = findViewById(R.id.tv_gift_value); + ivLuckyBagIntro.setOnClickListener(this); if (giftId == 0) { // 更新所有礼物 - giftIndicator.setPosition(GiftIndicator.TYPE_NORMAL); - updateGiftView(giftIndicator.getCurrrentType()); + showGiftTab(); } else { int indicatorType = GiftIndicator.TYPE_NORMAL; GiftInfo giftInfo = GiftModel.get().findGiftInfoById(giftId); @@ -469,11 +476,10 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene break; } } - giftIndicator.setPosition(indicatorType); - updateGiftView(giftIndicator.getCurrrentType(), giftInfo); + showGiftTab(indicatorType, giftInfo); } - View descLayout = root.findViewById(R.id.desc_layout); + View descLayout = findViewById(R.id.desc_layout); if (isInRoom && (userOnMic || uid == 0)) { avatarList.setVisibility(View.VISIBLE); @@ -510,16 +516,36 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene }); compositeDisposable.add(GiftModel.get().requestKnapGiftInfos().subscribe()); - if (isInRoom) { - UserModel.get().getCurrentUserInfo() - .compose(RxHelper.bindContext(context)) - .subscribe(userInfo -> { - if (userInfo.isFirstCharge()) { - ivFirstRecharge.setVisibility(View.VISIBLE); - } - }); - } + initVipPager(); + } + private void initVipPager() { + UserInfo userInfo = UserModel.get().getCacheLoginUserInfo(); + if (userInfo == null) return; + pagerViewVip.setAdapter(new StaticPagerAdapter() { + + @Override + public int getCount() { + return (isInRoom && userInfo.isFirstCharge()) ? 2 : 1; + } + + @Override + public View getView(ViewGroup container, int position) { + ImageView imageView = new ImageView(context); + imageView.setImageResource(position == 0 ? R.drawable.ic_vip_gift_dialog : R.drawable.ic_first_charge_gift_dialog_enter); + imageView.setOnClickListener(v -> { + if (position == 0) { + VipMainActivity.start(context); + StatisticManager.Instance() + .onEvent(StatisticsProtocol.EVENT_VIP_ENTRANCE_GIFT_CLICK, "贵族礼物面板入口点击事件"); + } else if (position == 1) { + FirstChargeDialog.start(context); + } + }); + return imageView; + } + }); + pagerViewVip.setPlayDelay(5000); } private void showLoadingAnimation() { @@ -590,7 +616,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene currentGiftInfoList = GiftModel.get().getKnapList(); } else if (position == GiftIndicator.TYPE_NOBLE) { currentGiftInfoList = nobleGiftInfos; - ivOpenNoble.setVisibility(View.VISIBLE); } else if (position == GiftIndicator.TYPE_NORMAL) { currentGiftInfoList = getNormalGiftInfos(); } else if (position == GiftIndicator.TYPE_LUCKY) { @@ -600,12 +625,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene } else if (position == GiftIndicator.TYPE_DRAW_GIFT) { currentGiftInfoList = getDrawGiftInfos(); } - // 有贵族礼物才显示贵族礼物的tab - if (ListUtils.isListEmpty(nobleGiftInfos)) { - giftIndicator.hidePosition(GiftIndicator.TYPE_NOBLE); - } else { - giftIndicator.showPosition(GiftIndicator.TYPE_NOBLE); - } //是否背包礼物 final boolean isKnap = (position == GiftIndicator.TYPE_KNAP); initEasyPop(isKnap); @@ -630,7 +649,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene if (currentGiftInfo.isSendMsg()) { etSendMessage.setVisibility(View.VISIBLE); } - pagerList = beanTransformVm(context, currentGiftInfoList, isKnap, position == GiftIndicator.TYPE_WEEK ? 4 : 8, selectGiftInfo); + pagerList = beanTransformVm(context, currentGiftInfoList, isKnap, 8, selectGiftInfo); setGridViewData(pagerList); if (isKnap) { tvGiftValue.setVisibility(View.VISIBLE); @@ -644,61 +663,46 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene updateWeekStarDesc(); isShowDrawGiftModel = false; updateDrawGift(); - giftIndicator.post(() -> { - if (position < GiftIndicator.TYPE_WEEK) { - hsvTabs.fullScroll(View.FOCUS_LEFT); - } else { - hsvTabs.fullScroll(View.FOCUS_RIGHT); - } - }); } private void updateLuckyBagIntro() { - if (currentGiftInfo == null || - (TextUtils.isEmpty(currentGiftInfo.getGiftExplainUrl()) && currentGiftInfo.getGiftType() != GiftType.GIFT_TYPE_LUCKY)) { - tvLuckyBagIntro.setVisibility(View.GONE); + if (currentGiftInfo == null || currentGiftInfo.getGiftType() != GiftType.GIFT_TYPE_LUCKY) { + flLuckyDesc.setVisibility(View.GONE); } else { - tvLuckyBagIntro.setVisibility(View.VISIBLE); + flLuckyDesc.setVisibility(View.VISIBLE); } } private void updateWeekStarDesc() { if (giftIndicator.getCurrrentType() == GiftIndicator.TYPE_WEEK) { - llWeekIn.setVisibility(View.VISIBLE); llStarWeek.setVisibility(View.VISIBLE); } else { - llWeekIn.setVisibility(View.GONE); llStarWeek.setVisibility(View.GONE); return; } - if (currentGiftInfo == null) { - llStarWeek.setVisibility(View.INVISIBLE); - return; - } - - SimpleUserInfo firstCharmRankUser = currentGiftInfo.getFirstCharmRankUser(); + SimpleUserInfo firstCharmRankUser = currentGiftInfo == null ? null : currentGiftInfo.getFirstCharmRankUser(); if (firstCharmRankUser != null) { ImageLoadUtils.loadImage(getContext(), firstCharmRankUser.getAvatar(), ivAvatarCharm); ivAvatarCharm.setOnClickListener(v -> { if (firstCharmRankUser.getUid() == 0) return; EventBus.getDefault().post(new ShowUserInfoDialogEvent(String.valueOf(firstCharmRankUser.getUid()))); }); - tvNickCharm.setText(StringExtensionKt.subAndReplaceDot(firstCharmRankUser.getNick(), 10)); + tvNickCharm.setText(StringExtensionKt.subAndReplaceDot(firstCharmRankUser.getNick(), 7)); } else { ivAvatarCharm.setOnClickListener(null); ivAvatarCharm.setImageResource(R.drawable.default_avatar); tvNickCharm.setText("虚位以待"); } - SimpleUserInfo firstLevelRankUser = currentGiftInfo.getFirstLevelRankUser(); + SimpleUserInfo firstLevelRankUser = currentGiftInfo == null ? null : currentGiftInfo.getFirstLevelRankUser(); if (firstLevelRankUser != null) { ImageLoadUtils.loadImage(getContext(), firstLevelRankUser.getAvatar(), ivAvatarLevel); ivAvatarLevel.setOnClickListener(v -> { if (firstLevelRankUser.getUid() == 0) return; EventBus.getDefault().post(new ShowUserInfoDialogEvent(String.valueOf(firstLevelRankUser.getUid()))); }); - tvNickLevel.setText(StringExtensionKt.subAndReplaceDot(firstLevelRankUser.getNick(), 10)); + tvNickLevel.setText(StringExtensionKt.subAndReplaceDot(firstLevelRankUser.getNick(), 7)); } else { ivAvatarLevel.setOnClickListener(null); ivAvatarLevel.setImageResource(R.drawable.default_avatar); @@ -741,6 +745,8 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene drawGiftHelper.setMaxDrawSize(MAX_DRAW_SIZE); rlGifts.setVisibility(View.GONE); llTabs.setVisibility(View.GONE); + llTabType.setVisibility(View.GONE); + lineTabType.setVisibility(View.GONE); giftNumLayout.setVisibility(View.GONE); llDrawGift.setVisibility(View.VISIBLE); drawGiftHelper.setDrawEnable(true); @@ -758,6 +764,8 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene } rlGifts.setVisibility(View.VISIBLE); llTabs.setVisibility(View.VISIBLE); + llTabType.setVisibility(View.VISIBLE); + lineTabType.setVisibility(View.VISIBLE); llDrawGift.setVisibility(View.GONE); drawGiftHelper.setDrawEnable(false); drawGiftHelper.resetDrawGiftView(); @@ -804,8 +812,8 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene diamond = String.valueOf((int) totalValue); } SpannableBuilder text = new SpannableBuilder() - .append("总价值: ", new ForegroundColorSpan(Color.parseColor("#7A797A"))) - .append(diamond + "钻石", new ForegroundColorSpan(Color.WHITE)); + .append("总价值: ", new ForegroundColorSpan(Color.parseColor("#BABBCD"))) + .append(diamond + "", new ForegroundColorSpan(Color.parseColor("#5FCCE4"))); tvGiftValue.setText(text.build()); } @@ -839,11 +847,9 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene layoutLoadFiled.setVisibility(View.GONE); layoutEmpty.setVisibility(View.GONE); etSendMessage.setVisibility(View.GONE); - tvLuckyBagIntro.setVisibility(View.GONE); tvGiftValue.setVisibility(View.GONE); - ivOpenNoble.setVisibility(View.GONE); - llWeekIn.setVisibility(View.GONE); llStarWeek.setVisibility(View.GONE); + flLuckyDesc.setVisibility(View.GONE); gridView.setVisibility(View.VISIBLE); indicatorView.setVisibility(View.VISIBLE); @@ -1034,7 +1040,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene public void onClick(View v) { switch (v.getId()) { case R.id.tv_recharge: - if (itemType == ITEM_TYPE_GOLD) { StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_GIFT_PANEL_TO_RECHARGE, "礼物面板_去充值:" + GIFT_DIALOG_FROM); @@ -1042,7 +1047,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene } else if (itemType == ITEM_TYPE_RADISH) { TaskCenterActivity.start(context, TaskCenterActivity.FromPage.GIFT); } - dismiss(); break; //送礼物 @@ -1211,29 +1215,15 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene case R.id.gift_number_layout: showEasyPopup(); break; - case R.id.iv_open_noble: - VipMainActivity.start(context); - StatisticManager.Instance() - .onEvent(StatisticsProtocol.EVENT_VIP_ENTRANCE_GIFT_CLICK, "贵族礼物面板入口点击事件"); - break; - - case R.id.iv_first_recharge: - FirstChargeDialog.start(context); - break; - - case R.id.tv_lucky_bag_intro: + case R.id.iv_lucky_bag_intro: if (currentGiftInfo == null) break; - if (currentGiftInfo.getGiftType() == GiftType.GIFT_TYPE_LUCKY) { - DialogWebViewActivity.start(context, UriProvider.getLuckyGiftRule(currentGiftInfo.getGiftId()), true); - } else { - DialogWebViewActivity.start(context, currentGiftInfo.getGiftExplainUrl(), true); - } + DialogWebViewActivity.start(context, UriProvider.getLuckyGiftRule(currentGiftInfo.getGiftId()), true); break; case R.id.tv_reload: reloadData(true); break; - case R.id.ll_week_in: + case R.id.iv_week_star_in: DialogWebViewActivity.start(context, UriProvider.getWeekStarUrl(), true); break; case R.id.iv_draw_gift_close: @@ -1250,11 +1240,51 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene case R.id.iv_draw_gift_remove_all: clearDrawGift(); break; + case R.id.tv_tab_send_gift: + showGiftTab(); + break; + case R.id.tv_tab_interaction: + showInteractionTab(); + break; default: break; } } + private void showGiftTab() { + showGiftTab(GiftIndicator.TYPE_NORMAL, null); + } + + private void showGiftTab(int position, @Nullable GiftInfo selectGiftInfo) { + if (tvTabSendGift.isSelected() && position == giftIndicator.getCurrrentType()) return; + tvTabSendGift.setSelected(true); + tvTabInteraction.setSelected(false); + + giftIndicator.hidePosition(GiftIndicator.TYPE_DRAW_GIFT); + giftIndicator.showPosition(GiftIndicator.TYPE_LUCKY); + giftIndicator.showPosition(GiftIndicator.TYPE_NOBLE); + giftIndicator.showPosition(GiftIndicator.TYPE_WEEK); + giftIndicator.showPosition(GiftIndicator.TYPE_NORMAL); + + giftIndicator.setPosition(position); + updateGiftView(giftIndicator.getCurrrentType(), selectGiftInfo); + } + + private void showInteractionTab() { + if (tvTabInteraction.isSelected()) return; + tvTabSendGift.setSelected(false); + tvTabInteraction.setSelected(true); + + giftIndicator.showPosition(GiftIndicator.TYPE_DRAW_GIFT); + giftIndicator.hidePosition(GiftIndicator.TYPE_LUCKY); + giftIndicator.hidePosition(GiftIndicator.TYPE_NOBLE); + giftIndicator.hidePosition(GiftIndicator.TYPE_WEEK); + giftIndicator.hidePosition(GiftIndicator.TYPE_NORMAL); + + giftIndicator.setPosition(GiftIndicator.TYPE_DRAW_GIFT); + updateGiftView(giftIndicator.getCurrrentType()); + } + private void onSendGiftSuccess(GiftInfo giftInfo) { if (sendGiftButton == null) return; sendGiftButton.setText("赠送"); @@ -1371,9 +1401,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene @Subscribe(threadMode = ThreadMode.MAIN) public void onFirstRechargeEvent(FirstChargeEvent event) { - if (ivFirstRecharge != null) { - ivFirstRecharge.setVisibility(View.GONE); - } + initVipPager(); } @Subscribe(threadMode = ThreadMode.MAIN) diff --git a/app/src/main/java/com/mango/moshen/ui/widget/magicindicator/GiftIndicator.java b/app/src/main/java/com/mango/moshen/ui/widget/magicindicator/GiftIndicator.java index 7e1f96d05..9f7ea8909 100644 --- a/app/src/main/java/com/mango/moshen/ui/widget/magicindicator/GiftIndicator.java +++ b/app/src/main/java/com/mango/moshen/ui/widget/magicindicator/GiftIndicator.java @@ -1,7 +1,9 @@ package com.mango.moshen.ui.widget.magicindicator; import android.content.Context; + import androidx.annotation.Nullable; + import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; @@ -28,40 +30,49 @@ import lombok.Getter; */ public class GiftIndicator extends LinearLayout { - /**普通礼物*/ + /** + * 普通礼物 + */ public static final int TYPE_NORMAL = 0; - /**星球礼物*/ + /** + * 星球礼物 + */ public static final int TYPE_LUCKY = 1; - /**贵族礼物*/ + /** + * 贵族礼物 + */ public static final int TYPE_NOBLE = 2; - /**周星礼物*/ + /** + * 周星礼物 + */ public static final int TYPE_WEEK = 3; - /**涂鸦礼物*/ + /** + * 涂鸦礼物 + */ public static final int TYPE_DRAW_GIFT = 4; - /**背包礼物*/ + /** + * 背包礼物 + */ public static final int TYPE_KNAP = 5; private Map map = new HashMap<>(); + private List tabList = new ArrayList<>(); + @Getter + private int currrentType = TYPE_NORMAL; + private int mFalseColor; + private int mTrueColor; public GiftIndicator(Context context, @Nullable AttributeSet attrs) { super(context, attrs); setOrientation(LinearLayout.HORIZONTAL); } - private List tabList = new ArrayList<>(); - - @Getter - private int currrentType = TYPE_NORMAL; - - private int mFalseColor; - private int mTrueColor; - public void initTab(List list, int falseColor, int trueColor) { for (int i = 0; i < list.size(); i++) { GiftTab tab = list.get(i); @@ -72,6 +83,9 @@ public class GiftIndicator extends LinearLayout { TextView tvTitle = view.findViewById(R.id.tv_title); tvTitle.setText(tab.getUnSelectedTitle()); } + LinearLayout.LayoutParams params = new LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT); + params.weight = 1f; + addView(new View(getContext()), list.size() - 1, params); tabList = list; mFalseColor = falseColor; mTrueColor = trueColor; diff --git a/app/src/main/java/com/mango/moshen/ui/widget/rollviewpager/RollPagerView.java b/app/src/main/java/com/mango/moshen/ui/widget/rollviewpager/RollPagerView.java index 0b128e809..013fbeb6a 100644 --- a/app/src/main/java/com/mango/moshen/ui/widget/rollviewpager/RollPagerView.java +++ b/app/src/main/java/com/mango/moshen/ui/widget/rollviewpager/RollPagerView.java @@ -124,7 +124,6 @@ public class RollPagerView extends RelativeLayout implements OnPageChangeListene mViewPager.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); addView(mViewPager); type.recycle(); - initHint(new ColorPointHintView(getContext(), Color.parseColor("#E3AC42"), Color.parseColor("#88ffffff"))); //手势处理 mGestureDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() { @Override diff --git a/app/src/main/java/com/mango/moshen/ui/widget/rollviewpager/adapter/StaticPagerAdapter.java b/app/src/main/java/com/mango/moshen/ui/widget/rollviewpager/adapter/StaticPagerAdapter.java index cf5235338..73afacc98 100644 --- a/app/src/main/java/com/mango/moshen/ui/widget/rollviewpager/adapter/StaticPagerAdapter.java +++ b/app/src/main/java/com/mango/moshen/ui/widget/rollviewpager/adapter/StaticPagerAdapter.java @@ -13,58 +13,57 @@ import java.util.ArrayList; /** * 静态存储的Adapter。概念参照{@link FragmentStatePagerAdapter} * view添加进去就不管了,View长在,内存不再。 - *

Subclasses only need to implement {@link #getView(ViewGroup,int)} + *

Subclasses only need to implement {@link #getView(ViewGroup, int)} * and {@link #getCount()} to have a working adapter. - * */ public abstract class StaticPagerAdapter extends PagerAdapter { private ArrayList mViewList = new ArrayList<>(); - @Override - public boolean isViewFromObject(View arg0, Object arg1) { - return arg0==arg1; - } + @Override + public boolean isViewFromObject(View arg0, Object arg1) { + return arg0 == arg1; + } - @Override - public void destroyItem(ViewGroup container, int position, Object object) { + @Override + public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } - @Override - public void notifyDataSetChanged() { + @Override + public void notifyDataSetChanged() { mViewList.clear(); super.notifyDataSetChanged(); - } + } - @Override - public int getItemPosition(Object object) { - return POSITION_NONE; - } + @Override + public int getItemPosition(Object object) { + return POSITION_NONE; + } - @Override - public Object instantiateItem(ViewGroup container, int position) { - View itemView = findViewByPosition(container,position); + @Override + public Object instantiateItem(ViewGroup container, int position) { + View itemView = findViewByPosition(container, position); container.addView(itemView); - onBind(itemView,position); - return itemView; - } + onBind(itemView, position); + return itemView; + } - private View findViewByPosition(ViewGroup container,int position){ + private View findViewByPosition(ViewGroup container, int position) { for (View view : mViewList) { - if (((int)view.getTag()) == position&&view.getParent()==null){ + if (((int) view.getTag()) == position && view.getParent() == null) { return view; } } - View view = getView(container,position); + View view = getView(container, position); view.setTag(position); mViewList.add(view); return view; } - public void onBind(View view,int position){ + public void onBind(View view, int position) { } - public abstract View getView(ViewGroup container, int position); + public abstract View getView(ViewGroup container, int position); } diff --git a/app/src/main/res/color/color_selector_white_false_8a8cab.xml b/app/src/main/res/color/color_selector_white_false_8a8cab.xml new file mode 100644 index 000000000..4818a7539 --- /dev/null +++ b/app/src/main/res/color/color_selector_white_false_8a8cab.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/app/src/main/res/drawable-xhdpi/bg_gift_dialog_lucky_bag.png b/app/src/main/res/drawable-xhdpi/bg_gift_dialog_lucky_bag.png new file mode 100644 index 000000000..e7b854f7c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_gift_dialog_lucky_bag.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_gift_dialog_lucky_desc.png b/app/src/main/res/drawable-xhdpi/bg_gift_dialog_lucky_desc.png new file mode 100644 index 000000000..9382c9845 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_gift_dialog_lucky_desc.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_gift_dialog_lucky_rule.png b/app/src/main/res/drawable-xhdpi/bg_gift_dialog_lucky_rule.png new file mode 100644 index 000000000..fd60c4ca8 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_gift_dialog_lucky_rule.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_star_week.png b/app/src/main/res/drawable-xhdpi/bg_star_week.png new file mode 100644 index 000000000..7e2f64297 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_star_week.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_star_week_charm_avatar.png b/app/src/main/res/drawable-xhdpi/bg_star_week_charm_avatar.png new file mode 100644 index 000000000..1bd508891 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_star_week_charm_avatar.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_star_week_in.png b/app/src/main/res/drawable-xhdpi/bg_star_week_in.png new file mode 100644 index 000000000..23890c151 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_star_week_in.png differ diff --git a/app/src/main/res/drawable-xhdpi/bg_star_week_level_avatar.png b/app/src/main/res/drawable-xhdpi/bg_star_week_level_avatar.png new file mode 100644 index 000000000..9820f640e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_star_week_level_avatar.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_gift_dialog_diamond.png b/app/src/main/res/drawable-xhdpi/ic_gift_dialog_diamond.png new file mode 100644 index 000000000..e9096081c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_gift_dialog_diamond.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_vip_gift_dialog.png b/app/src/main/res/drawable-xhdpi/ic_vip_gift_dialog.png index 7a0d838c1..0a6f8d2c7 100644 Binary files a/app/src/main/res/drawable-xhdpi/ic_vip_gift_dialog.png and b/app/src/main/res/drawable-xhdpi/ic_vip_gift_dialog.png differ diff --git a/app/src/main/res/drawable-xhdpi/icon_gift_all_mic_false.png b/app/src/main/res/drawable-xhdpi/icon_gift_all_mic_false.png deleted file mode 100644 index 017c507d1..000000000 Binary files a/app/src/main/res/drawable-xhdpi/icon_gift_all_mic_false.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/icon_gift_all_mic_ture.png b/app/src/main/res/drawable-xhdpi/icon_gift_all_mic_ture.png index 97dde9f2a..e2696f365 100644 Binary files a/app/src/main/res/drawable-xhdpi/icon_gift_all_mic_ture.png and b/app/src/main/res/drawable-xhdpi/icon_gift_all_mic_ture.png differ diff --git a/app/src/main/res/drawable/bg_magic_dialog_button_send.xml b/app/src/main/res/drawable/bg_magic_dialog_button_send.xml index 7940f5685..6a7e82f05 100644 --- a/app/src/main/res/drawable/bg_magic_dialog_button_send.xml +++ b/app/src/main/res/drawable/bg_magic_dialog_button_send.xml @@ -2,8 +2,12 @@ - - + + diff --git a/app/src/main/res/drawable/shape_gift_item_select.xml b/app/src/main/res/drawable/shape_gift_item_select.xml index 3e9372fb7..c8e0e35fb 100644 --- a/app/src/main/res/drawable/shape_gift_item_select.xml +++ b/app/src/main/res/drawable/shape_gift_item_select.xml @@ -2,7 +2,6 @@ - - + android:color="@color/color_5FCCE4" /> + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_room_bg_send.xml b/app/src/main/res/drawable/shape_room_bg_send.xml index 19403da54..a9241df13 100644 --- a/app/src/main/res/drawable/shape_room_bg_send.xml +++ b/app/src/main/res/drawable/shape_room_bg_send.xml @@ -2,7 +2,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_bottom_gift.xml b/app/src/main/res/layout/dialog_bottom_gift.xml index d8179c482..b4c5a1874 100644 --- a/app/src/main/res/layout/dialog_bottom_gift.xml +++ b/app/src/main/res/layout/dialog_bottom_gift.xml @@ -1,518 +1,625 @@ - + android:layout_gravity="bottom"> - + app:layout_constraintBottom_toTopOf="@id/ll_dialog_bottom_gift" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent"> + + - - + android:textSize="12sp" /> + android:layout_gravity="end" + android:src="@drawable/bg_gift_dialog_lucky_rule" /> - + - - - - - + android:layout_marginStart="10dp" + android:layout_marginEnd="10dp" + android:layout_marginBottom="12dp" + android:background="@drawable/bg_star_week" + android:gravity="center" + android:visibility="gone" + app:layout_constraintBottom_toTopOf="@id/ll_dialog_bottom_gift" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent"> + android:orientation="horizontal"> - + - + + + + + + + android:orientation="vertical"> + + + + + + - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:id="@+id/ll_dialog_bottom_gift" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + tools:background="@drawable/bg_dialog_room_operation"> - + + + + + + + + + + + + + + + android:layout_marginStart="18dp" + android:layout_marginTop="10dp"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + android:src="@drawable/ic_knap_gift_empty" /> - + android:layout_marginTop="@dimen/dp_6" + android:gravity="center" + android:text="@string/text_gift_knapsack_empty" + android:textColor="@color/white_transparent_20" + android:textSize="@dimen/sp_12" + android:visibility="visible" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + +