From 9ae6fedd8dae7b653aeea9aac3fb93ca6b6db60f Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 30 Jul 2024 10:29:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E5=8F=8D?= =?UTF-8?q?=E9=A6=88=E5=86=85=E5=AE=B9=20=E6=96=B0=E5=A2=9E=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E9=9C=80=E6=B1=82=EF=BC=9Abanner=E7=82=B9=E8=BF=9B?= =?UTF-8?q?=E7=A4=BC=E7=89=A9=E5=A2=99=20=E6=96=B0=E5=A2=9E=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E9=9C=80=E6=B1=82=EF=BC=9A=E4=B8=BB=E6=92=AD=E4=B8=8B?= =?UTF-8?q?=E6=92=AD=E5=90=8E=E6=98=BE=E7=A4=BA=E8=BF=9D=E8=A7=84=E5=86=85?= =?UTF-8?q?=E5=AE=B9(=E6=9C=AA=E6=8E=A5=E5=85=A5=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=89=20=E5=90=88=E5=B9=B6=E6=BD=98=E5=A4=9A=E6=8B=89?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shayu/phonelive/AppContext.java | 3 + .../GiftWallGiftInfoListItemAdapter.java | 9 +- .../adapter/GiftWallMainTab1List2Adapter.java | 24 ++- .../adapter/GiftWallMainTab2ListAdapter.java | 11 +- .../GiftWallTab2GiftInfoListItemAdapter.java | 2 +- .../common/bean/GiftNamingInfoModel.java | 10 +- .../yunbao/common/bean/GiftWallInfoBean.java | 13 ++ .../bean/GiftWallMainTab2ClassicInfoBean.java | 20 +++ .../com/yunbao/common/bean/LiveGiftBean.java | 11 +- .../LiveGifWallAchieveWearTransformer.java | 38 ++--- .../dialog/GiftWallAchieveWearDialog.java | 54 +++--- .../yunbao/common/dialog/GiftWallDialog.java | 21 ++- .../common/dialog/GiftWallGiftInfoDialog.java | 28 +++- .../GiftWallMainTab2ClassicInfoDialog.java | 10 +- .../common/dialog/GiftWallRuleDialog.java | 2 +- .../dialog/GiftWallTab2List2Dialog.java | 5 +- .../fragment/GiftWallMainTab1Fragment.java | 9 +- .../fragment/GiftWallMainTab2Fragment.java | 24 ++- .../res/layout/dialog_gift_wall_gift_info.xml | 3 + .../dialog_gift_wall_tab2_classic_info.xml | 48 +++--- .../layout/item_gift_wall_man_tab1_list_1.xml | 2 +- .../layout/item_gift_wall_man_tab1_list_2.xml | 21 ++- common/src/main/res/values-zh/strings.xml | 5 + common/src/main/res/values/strings.xml | 5 + .../yunbao/live/activity/LiveActivity.java | 7 +- .../live/activity/LiveSwAnchorActivity.java | 1 + .../live/adapter/FreePkRecyclerAdapter.java | 156 +++++++++--------- .../com/yunbao/live/dialog/LiveGiftPopup.java | 9 +- .../presenter/LiveSwLinkMicPkPresenter.java | 3 - .../live/views/FrameGiftViewHolder.java | 3 +- .../yunbao/live/views/LiveEndViewHolder.java | 15 +- .../live/views/LivePushSwViewHolder.java | 7 + .../yunbao/live/views/LiveRoomViewHolder.java | 9 + live/src/main/res/layout/view_live_end.xml | 118 ++++++++++++- live/src/main/res/layout/view_live_gift.xml | 5 +- .../main/res/layout/view_live_gift_naming.xml | 137 --------------- .../yunbao/main/activity/EntryActivity.java | 44 ++++- .../main/views/MainHomeLiveViewHolder.java | 16 +- .../yunbao/main/views/MainHomeViewHolder.java | 4 +- main/src/main/res/layout/activity_entry.xml | 46 +++++- 40 files changed, 592 insertions(+), 366 deletions(-) delete mode 100644 live/src/main/res/layout/view_live_gift_naming.xml diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index b08d81f4a..5ceb3d531 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -5,6 +5,8 @@ import static com.yunbao.live.socket.SocketClient.mSocketHandler; import android.app.Activity; import android.app.ActivityManager; import android.content.Context; +import android.content.res.Configuration; +import android.content.res.Resources; import android.net.http.HttpResponseCache; import android.os.Build; import android.os.Bundle; @@ -25,6 +27,7 @@ import com.blankj.utilcode.util.Utils; import com.facebook.appevents.AppEventsLogger; import com.fm.openinstall.OpenInstall; import com.google.gson.Gson; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.LogUtils; import com.tencent.imsdk.v2.V2TIMGroupMemberInfo; import com.tencent.imsdk.v2.V2TIMManager; diff --git a/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java b/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java index 425fdc1c6..d49706220 100644 --- a/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java @@ -102,6 +102,11 @@ public class GiftWallGiftInfoListItemAdapter extends RecyclerView.Adapter999999){ + return "999999+"; + } + return giftHallSendNum+""; + } public void setGiftHallSendNum(int giftHallSendNum) { this.giftHallSendNum = giftHallSendNum; @@ -402,6 +419,9 @@ public class GiftWallMainTab2ClassicInfoBean extends BaseModel{ } public String getUserId() { + if(StringUtil.isEmpty(userId)){ + return "0"; + } return userId; } diff --git a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java index 4153dbb86..44c90cf46 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java @@ -4,6 +4,7 @@ import android.view.View; import com.alibaba.fastjson.annotation.JSONField; import com.google.gson.annotations.SerializedName; +import com.yunbao.common.utils.StringUtil; /** * Created by cxf on 2018/10/12. @@ -52,9 +53,9 @@ public class LiveGiftBean { @JSONField(name = "operate_url") private String operateUrl; - @JSONField(name = "naming_liveuid") + @JSONField(name = "naming_live_id") private String namingLiveuid; - @JSONField(name = "naming_uid") + @JSONField(name = "naming_user_id") private String namingUid; @JSONField(name = "naming_live_name") private String namingLiveName; @@ -168,6 +169,9 @@ public class LiveGiftBean { } public String getNamingUid() { + if(StringUtil.isEmpty(namingUid)){ + namingUid="0"; + } return namingUid; } @@ -310,6 +314,9 @@ public class LiveGiftBean { } public String getSwf() { + if(StringUtil.isEmpty(swf)){ + swf=""; + } return swf; } diff --git a/common/src/main/java/com/yunbao/common/custom/LiveGifWallAchieveWearTransformer.java b/common/src/main/java/com/yunbao/common/custom/LiveGifWallAchieveWearTransformer.java index 2e9d2cd1d..56032e07a 100644 --- a/common/src/main/java/com/yunbao/common/custom/LiveGifWallAchieveWearTransformer.java +++ b/common/src/main/java/com/yunbao/common/custom/LiveGifWallAchieveWearTransformer.java @@ -2,9 +2,12 @@ package com.yunbao.common.custom; import android.view.View; +import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.view.ViewCompat; +import androidx.viewpager.widget.ViewPager; import com.stx.xhb.androidx.transformers.BasePageTransformer; +import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.L; public class LiveGifWallAchieveWearTransformer extends BasePageTransformer { @@ -15,7 +18,7 @@ public class LiveGifWallAchieveWearTransformer extends BasePageTransformer { * github:https://github.com/xiaohaibin * describe: 适用于一屏显示多个模式 */ - private float mMinScale = 0.55f; + private float mMinScale = 0.85f; private float mMinAlpha = 1f; public LiveGifWallAchieveWearTransformer() { @@ -28,7 +31,7 @@ public class LiveGifWallAchieveWearTransformer extends BasePageTransformer { @Override public void handleInvisiblePage(View view, float position) { - ViewCompat.setAlpha(view, 0); + // ViewCompat.setAlpha(view, 0); } @Override @@ -36,19 +39,12 @@ public class LiveGifWallAchieveWearTransformer extends BasePageTransformer { float scale = Math.max(mMinScale, 1 + position); float vertMargin = view.getHeight() * (1 - scale) / 2; float horzMargin = view.getWidth() * (1 - scale) / 2; - L.eSw("l position:"+position); - L.eSw("l mMinScale:"+mMinScale); - L.eSw("l getHeight:"+view.getHeight()); - L.eSw("l getWidth:"+view.getWidth()); - L.eSw("l scale:"+scale); - L.eSw("l vertMargin:"+vertMargin); - L.eSw("l horzMargin:"+horzMargin); - L.eSw("l setTranslationX :"+(horzMargin - vertMargin / 2)); - L.eSw("l setAlpha :"+mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha)); - view.setTranslationX(horzMargin - vertMargin / 4); + view.setTranslationX(horzMargin - vertMargin / 2); view.setScaleX(scale); view.setScaleY( scale); - view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha)); + L.e("handleLeftPage scale:"+scale); + // view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha)); + view.setAlpha(1f); } @Override @@ -56,19 +52,13 @@ public class LiveGifWallAchieveWearTransformer extends BasePageTransformer { float scale = Math.max(mMinScale, 1 - position); float vertMargin = view.getHeight() * (1 - scale) / 2; float horzMargin = view.getWidth() * (1 - scale) / 2; - L.eSw("r position:"+position); - L.eSw("r mMinScale:"+mMinScale); - L.eSw("r getHeight:"+view.getHeight()); - L.eSw("r getWidth:"+view.getWidth()); - L.eSw("r scale:"+scale); - L.eSw("r vertMargin:"+vertMargin); - L.eSw("r horzMargin:"+horzMargin); - L.eSw("r setTranslationX :"+(horzMargin - vertMargin / 2)); - L.eSw("r setAlpha :"+mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha)); - view.setTranslationX( -horzMargin + vertMargin / 4); + view.setTranslationX( -horzMargin + vertMargin / 2); view.setScaleX( scale); + view.setScaleY( scale); - view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha)); + L.e("handleRightPage scale:"+scale); + // view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha)); + view.setAlpha(1f); } public void setMinAlpha(float minAlpha) { diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java index edc95fa09..7731165c5 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java @@ -10,12 +10,14 @@ import androidx.viewpager.widget.ViewPager; import com.lxj.xpopup.XPopup; import com.stx.xhb.androidx.XBanner; +import com.stx.xhb.androidx.transformers.BasePageTransformer; import com.stx.xhb.androidx.transformers.Transformer; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserMedalModel; +import com.yunbao.common.custom.LiveGifWallAchieveWearTransformer; import com.yunbao.common.custom.LiveGuardScalePageTransformer; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.base.HttpCallback; @@ -47,13 +49,20 @@ public class GiftWallAchieveWearDialog extends AbsDialogPopupWindow { String wearing = WordUtil.isNewZh() ? "已佩戴" : "worn"; private List achieveWearModels = new ArrayList<>(); private UserUseDressSuccess userUseDressSuccess; + private int useIndex = 0; - public GiftWallAchieveWearDialog(@NonNull Context context,String toUid,boolean isAnchor, List achieveWearModels,UserUseDressSuccess userUseDressSuccess) { + public GiftWallAchieveWearDialog(@NonNull Context context, String toUid, boolean isAnchor, List achieveWearModels, UserUseDressSuccess userUseDressSuccess) { super(context); this.toUid = toUid; this.isAnchor = isAnchor; this.achieveWearModels = achieveWearModels; this.userUseDressSuccess = userUseDressSuccess; + for (int i = 0; i < this.achieveWearModels.size(); i++) { + if ("1".equals(this.achieveWearModels.get(i).getUseStatus())) { + useIndex = i; + break; + } + } } public GiftWallAchieveWearDialog setFullWindows(boolean fullWindows) { @@ -102,30 +111,30 @@ public class GiftWallAchieveWearDialog extends AbsDialogPopupWindow { public void onClick(View view) { if (achieveWearModels.get(selectPosition).getUseStatus().equals("0") && achieveWearModels.get(selectPosition).getDressStatus().equals("2")) { LiveNetManager.get(mContext).userUseDress( - achieveWearModels.get(selectPosition).getUsersDressId(), new HttpCallback() { - @Override - public void onSuccess(HttpCallbackModel data) { - ToastUtil.show(data.getMsg()); - if (data.getCode() == 0) { - UserBean u = CommonAppConfig.getInstance().getUserBean(); - u.setMedal_no_display_src(achieveWearModels.get(selectPosition).getDisplaySrc()); - CommonAppConfig.getInstance().setUserBean(u); - if(userUseDressSuccess!=null){ - userUseDressSuccess.onSuccess(); + achieveWearModels.get(selectPosition).getUsersDressId(), new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + ToastUtil.show(data.getMsg()); + if (data.getCode() == 0) { + UserBean u = CommonAppConfig.getInstance().getUserBean(); + u.setMedal_no_display_src(achieveWearModels.get(selectPosition).getDisplaySrc()); + CommonAppConfig.getInstance().setUserBean(u); + if (userUseDressSuccess != null) { + userUseDressSuccess.onSuccess(); + } + dialog.dismiss(); + } } - dialog.dismiss(); - } - } - @Override - public void onError(String error) { + @Override + public void onError(String error) { - } - }); + } + }); } } }); - btnConfirm.setVisibility(CommonAppConfig.getInstance().getUid().equals(toUid)?View.VISIBLE:View.GONE); + btnConfirm.setVisibility(CommonAppConfig.getInstance().getUid().equals(toUid) ? View.VISIBLE : View.GONE); } @Override @@ -161,9 +170,9 @@ public class GiftWallAchieveWearDialog extends AbsDialogPopupWindow { setWearInfo(); xBanner.setBannerData(R.layout.dialog_gift_wall_achieve_wear_item, achieveWearModels); //xBanner.setCustomPageTransformer(new LiveGuardScalePageTransformer()); - //xBanner.setCustomPageTransformer(new LiveGifWallAchieveWearTransformer()); + xBanner.setCustomPageTransformer(new LiveGifWallAchieveWearTransformer()); xBanner.setIsClipChildrenMode(true); - xBanner.setPageTransformer(Transformer.Scale); + //xBanner.setCustomPageTransformer(BasePageTransformer.getPageTransformer(Transformer.Zoom)); xBanner.getViewPager().setOffscreenPageLimit(3); xBanner.loadImage(new XBanner.XBannerAdapter() { @Override @@ -192,9 +201,10 @@ public class GiftWallAchieveWearDialog extends AbsDialogPopupWindow { } }); + // xBanner.getViewPager().setCurrentItem(useIndex); //自动定位到已佩戴到的勋章 } - public interface UserUseDressSuccess { + public interface UserUseDressSuccess { void onSuccess(); } } diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java index 493fa136d..3b016f84d 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java @@ -1,5 +1,6 @@ package com.yunbao.common.dialog; +import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.graphics.Typeface; @@ -54,13 +55,14 @@ public class GiftWallDialog extends AbsDialogPopupWindow { String toUserId; String userName; boolean isAnchor; + boolean isTab2; public GiftWallDialog(@NonNull Context context, String toUserId, String userName, String anchorId, boolean isAnchor) { super(context); this.toUserId = toUserId; this.isAnchor = isAnchor; this.userName = userName; - this.anchorId=anchorId; + this.anchorId = anchorId; } public GiftWallDialog setFullWindows(boolean fullWindows) { @@ -68,6 +70,11 @@ public class GiftWallDialog extends AbsDialogPopupWindow { return this; } + public GiftWallDialog setTab2(boolean isTab2) { + this.isTab2 = isTab2; + return this; + } + @Override public void buildDialog(XPopup.Builder builder) { @@ -140,10 +147,15 @@ public class GiftWallDialog extends AbsDialogPopupWindow { mTvUserName.setTextColor(Color.parseColor("#6BCDFF")); } else { mTvUserName.setTextColor(Color.parseColor("#FFCF94")); + if (isTab2) { + ((GiftWallMainTab2Fragment) fragments.get(position)).setTab2(); + } } } }); - + if (isTab2) { + mViewPager.setCurrentItem(1); + } ViewClicksAntiShake.clicksAntiShake(mTvTab1, () -> { mIvBg.setImageResource(R.mipmap.bg_gift_wall_main_root); @@ -181,6 +193,9 @@ public class GiftWallDialog extends AbsDialogPopupWindow { new GiftWallRuleDialog(mContext).setFullWindows(isFullWindows).showDialog(); }); resetWindows(); + if (isTab2) { + mTvTab2.callOnClick(); + } } private void resetWindows() { @@ -208,4 +223,6 @@ public class GiftWallDialog extends AbsDialogPopupWindow { mIvBack.setLayoutParams(params); ViewClicksAntiShake.clicksAntiShake(mIvBack, this::dismiss); } + + } diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java index 823cbd416..6b554682f 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java @@ -66,6 +66,7 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { View tab_layout; View bottom_layout; View gift_schedule; + ImageView diamond_icon; GiftWallGiftInfoListItemAdapter adapter; RecyclerView recyclerView; @@ -143,6 +144,7 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { void initView() { mIvBg = findViewById(R.id.iv_root_bg); mIvBack = findViewById(R.id.iv_back); + diamond_icon = findViewById(R.id.diamond_icon); giftName = findViewById(R.id.gift_name); gift = findViewById(R.id.gift); diamond_text = findViewById(R.id.diamond_text); @@ -319,6 +321,11 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { gift_tv_progress.setText(String.format(Locale.getDefault(), "%s", giftBean.getGift_info().getGift_hall_send_num())); gift_progress.setMax(giftBean.getGift_info().getIlluminate_num()); gift_progress.setProgress(Integer.parseInt(giftBean.getGift_info().getGift_hall_send_num())); + if (giftBean.getGift_info().getSendtype() == 0) { + diamond_icon.setImageResource(R.mipmap.diamond); + } else { + diamond_icon.setImageResource(R.mipmap.gold_coin); + } if (giftBean.getGift_info().getIlluminate_status() == 1) { gift_btn.setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_top_btn_continue)); btn_lighten.setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_spinner_up)); @@ -329,6 +336,11 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { btn_lighten.setBackgroundResource(R.drawable.gift_wall_gift_info_un_lighten); } adapter.setGiftStatus(giftBean.getGift_info().getIlluminate_status()); + /** + * 如果对方是主播,要有点亮标记。 + * 如果对方是用户,不要有点亮标记 + * + */ if (isAnchor) { tab_layout.setVisibility(View.VISIBLE); bottom_layout.setVisibility(View.VISIBLE); @@ -337,18 +349,20 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { tab_layout.setVisibility(View.GONE); bottom_layout.setVisibility(View.GONE); tv_list_title.setVisibility(View.VISIBLE); - gift_progress.setVisibility(View.GONE); } } else { tab_layout.setVisibility(View.GONE); bottom_layout.setVisibility(View.GONE); tv_list_title.setVisibility(View.VISIBLE); - if (!toUserId.equals(IMLoginManager.get(mContext).getUserInfo().getId() + "")) { + gift_progress.setVisibility(View.GONE); + gift_schedule.setVisibility(View.GONE); + if (isTab2Enter || ((!toUserId.equals(IMLoginManager.get(mContext).getUserInfo().getId() + "")) && !isTab2Enter)) { gift_btn.setVisibility(View.GONE); - gift_schedule.setVisibility(View.GONE); - gift_progress.setVisibility(View.GONE); + } else { + System.out.println("---------------显示 " + toUserId + " " + IMLoginManager.get(mContext).getUserInfo().getId() + "|" + isTab2Enter); } } + if (!isLiveRoom || giftBean.getGift_info().getGift_status() == 0) { gift_btn.setEnabled(false); btn_one.setEnabled(false); @@ -373,15 +387,12 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { loadChampion(giftBean); } } - if (!isAnchor) { - gift_schedule.setVisibility(View.GONE); - gift_progress.setVisibility(View.GONE); - } initAnim(); } private void setTips(String tmp) { + btn_one_tips.setVisibility(View.VISIBLE); btn_one_tips.setText(String.format(Locale.getDefault(), "%s%s%s" , WordUtil.isNewZh() ? "需 " : "Need ", tmp, @@ -394,6 +405,7 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { if (giftBean.getData() != null && !giftBean.getData().isEmpty()) { tmp = giftBean.getData().get(0).getGift_hall_send_num() - giftBean.getGift_info().getUser_gift_hall_send_num() + 1; } + System.out.println("冠名数据 我发的 = " + mySend + " 检测的 = " + tmp + " 第一名id = " + giftBean.getData().get(0).getUser_id() + " 我的id = " + IMLoginManager.get(mContext).getUserInfo().getId()); if (mySend > tmp || giftBean.getData().get(0).getUser_id().equals(IMLoginManager.get(mContext).getUserInfo().getId() + "")) { btn_one.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_champion_get)); btn_one_tips.setVisibility(View.GONE); diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java index 7cf18387b..9c42cc9e8 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java @@ -115,13 +115,14 @@ public class GiftWallMainTab2ClassicInfoDialog extends AbsDialogPopupWindow { void initData(GiftWallMainTab2ClassicInfoBean data) { ImgLoader.display(mContext, data.getGiftInfo().getGiftIcon(), mIvGift); - if (data.getGiftInfo().getNamingLiveActiveRankHide() == 0 || data.getGiftInfo().getNamingUserId() == IMLoginManager.get(mContext).getUserInfo().getId()) { + if (data.getGiftInfo().getNamingLiveActiveRankHide() == 0 || data.getGiftInfo().getNamingLiveId() == IMLoginManager.get(mContext).getUserInfo().getId()) { ImgLoader.display(mContext, data.getGiftInfo().getNamingLiveAvatar(), user_avatar); + mTvUserName.setText(data.getGiftInfo().getNamingLiveNicename()); } else { user_avatar.setImageResource(R.mipmap.hide); + mTvUserName.setText(WordUtil.getNewString(R.string.mystery_man)); } gift_name.setText(WordUtil.isNewZh() ? data.getGiftInfo().getGiftName() : data.getGiftInfo().getGiftNameEn()); - mTvUserName.setText(data.getGiftInfo().getNamingLiveNicename()); star_value.setText(String.format(Locale.getDefault(), "%d", data.getGiftInfo().getGiftHallSendNum())); int max = data.getData().size() > 3 ? 3 : 0; if (max != 0) { @@ -151,6 +152,11 @@ public class GiftWallMainTab2ClassicInfoDialog extends AbsDialogPopupWindow { } void setTopData(GiftWallMainTab2ClassicInfoBean.GiftData data, ImageView avatar, TextView name, TextView value) { + if (data.getNaming_user_gift_hall_rank_hide() == 1 && Integer.parseInt(data.getUserId()) != IMLoginManager.get(mContext).getUserInfo().getId()) { + avatar.setImageResource(R.mipmap.hide); + name.setText(WordUtil.getNewString(R.string.mystery_man)); + return; + } ImgLoader.display(mContext, data.getAvatar(), avatar); name.setText(data.getUserName()); value.setText(String.format(Locale.getDefault(), "%d", data.getGiftHallSendNum())); diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallRuleDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallRuleDialog.java index 82df2670b..70d0897c2 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallRuleDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallRuleDialog.java @@ -91,7 +91,7 @@ public class GiftWallRuleDialog extends AbsDialogPopupWindow { } else { mIvBg.setScaleType(ImageView.ScaleType.FIT_XY); } - ImgLoader.displayDrawable(mContext, WordUtil.isNewZh() ? "https://downs.yaoulive.com/Group%201384.png" : "https://downs.yaoulive.com/Group%201381.png", -1, -1, new ImgLoader.DrawableCallback() { + ImgLoader.displayDrawable(mContext, WordUtil.isNewZh() ? "https://downs.yaoulive.com/%E4%B8%AD%E6%96%87%E8%A7%84%E5%88%99.png" : "https://downs.yaoulive.com/%E8%8B%B1%E6%96%87%E8%A7%84%E5%88%99.png", -1, -1, new ImgLoader.DrawableCallback() { @Override public void onLoadSuccess(Drawable drawable) { iv_rule.setImageDrawable(drawable); diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallTab2List2Dialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallTab2List2Dialog.java index cb04987b6..191d0f2ca 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallTab2List2Dialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallTab2List2Dialog.java @@ -11,6 +11,7 @@ import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.R; import com.yunbao.common.bean.GiftWallTab2Bean; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -57,14 +58,14 @@ public class GiftWallTab2List2Dialog extends AbsDialogCenterPopupWindow { giftName = findViewById(R.id.gift_name); ImgLoader.display(mContext, gift.getGiftIcon(), giftImage); - if (gift.getNamingLiveActiveRankHide() == 0) { + if (gift.getNamingLiveActiveRankHide() == 0 || gift.getNamingLiveId()== IMLoginManager.get(mContext).getUserInfo().getId()) { ImgLoader.display(mContext, gift.getNamingLiveAvatar(), user2Avatar); user2Name.setText(gift.getNamingLiveNicename()); } else { user2Avatar.setImageResource(R.mipmap.hide); user2Name.setText(WordUtil.getNewString(R.string.mystery_man)); } - if (gift.getNamingUserActiveRankHide() == 0) { + if (gift.getNamingUserActiveRankHide() == 0|| gift.getNamingUserId()== IMLoginManager.get(mContext).getUserInfo().getId()) { ImgLoader.display(mContext, gift.getNamingUserAvatar(), user1Avatar); user1Name.setText(gift.getNamingUserNicename()); } else { diff --git a/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab1Fragment.java b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab1Fragment.java index 4a6f130db..23581b91b 100644 --- a/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab1Fragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab1Fragment.java @@ -93,8 +93,13 @@ public class GiftWallMainTab1Fragment extends BaseFragment { @Override public void updateData() { super.updateData(); - list1Adapter.notifyDataSetChanged(); - list2Adapter.notifyDataSetChanged(); + if (list1Adapter != null) { + list1Adapter.notifyDataSetChanged(); + + } + if (list2Adapter != null) { + list2Adapter.notifyDataSetChanged(); + } } diff --git a/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab2Fragment.java b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab2Fragment.java index 881c94774..623b8aa57 100644 --- a/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab2Fragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab2Fragment.java @@ -53,6 +53,7 @@ public class GiftWallMainTab2Fragment extends BaseFragment { String anchorId; boolean isAnchor; private boolean isLiveRoom; + private boolean isTab2; public GiftWallMainTab2Fragment setToUserId(String toUserId) { this.toUserId = toUserId; @@ -151,11 +152,14 @@ public class GiftWallMainTab2Fragment extends BaseFragment { public Unit invoke(Integer fromIndex, List selectIndexList, Boolean select, Boolean fromUser) { //参考setOnSelectViewChange //只不过对象从view,变成了view在ViewGroup中的索引 - if (fromIndex == 0) { + if (isTab2 && fromIndex == -1) { + fromIndex = 1; + } else if (fromIndex == 0) { fromIndex = 1; } else { fromIndex = 0; } + setDslTabColor(fromIndex == 0 ? dslTab1 : dslTab2, fromIndex == 1 ? dslTab1 : dslTab2); type = (fromIndex + 1); list1Adapter.setNowRank(fromIndex == 0); @@ -179,7 +183,7 @@ public class GiftWallMainTab2Fragment extends BaseFragment { @Override public void onViewClicks() { spinnerImage.setRotation(180); - ((XPopup.Builder) spinner.getTag()).asCustom(new GiftWallMainTab1List2SpinnerDialog(getContext(),1, new OnItemClickListener() { + ((XPopup.Builder) spinner.getTag()).asCustom(new GiftWallMainTab1List2SpinnerDialog(getContext(), 1, new OnItemClickListener() { @Override public void onItemClick(Integer bean, int position) { if (bean > -1) { @@ -203,7 +207,11 @@ public class GiftWallMainTab2Fragment extends BaseFragment { } }); - initData(); + if (isTab2) { + tabLayout.onPageSelected(1); + } else { + initData(); + } } void setDslTabColor(TextView select, TextView unSelect) { @@ -216,9 +224,9 @@ public class GiftWallMainTab2Fragment extends BaseFragment { void initData() { list1Adapter.clear(); list2Adapter.clear(); - if(type==2){ + if (type == 2) { spinner.setVisibility(View.INVISIBLE); - }else { + } else { spinner.setVisibility(View.VISIBLE); } LiveNetManager.get(getContext()) @@ -254,7 +262,7 @@ public class GiftWallMainTab2Fragment extends BaseFragment { list1Adapter.setList(bean.getIlluminateData().getWeekStartData()); list2Adapter.setList(bean.getIlluminateData().getGiftData()); show_time.setText(String.format(Locale.getDefault(), "%s%s - %s", - WordUtil.getNewString(type==1?R.string.dialog_gift_wall_time_now:R.string.dialog_gift_wall_time_old), + WordUtil.getNewString(type == 1 ? R.string.dialog_gift_wall_time_now : R.string.dialog_gift_wall_time_old), bean.getGift_hall_start_date(), bean.getGift_hall_end_date())); } @@ -263,4 +271,8 @@ public class GiftWallMainTab2Fragment extends BaseFragment { protected void loadData() { } + + public void setTab2() { + isTab2 = true; + } } diff --git a/common/src/main/res/layout/dialog_gift_wall_gift_info.xml b/common/src/main/res/layout/dialog_gift_wall_gift_info.xml index c73f8a27a..7c2097297 100644 --- a/common/src/main/res/layout/dialog_gift_wall_gift_info.xml +++ b/common/src/main/res/layout/dialog_gift_wall_gift_info.xml @@ -122,6 +122,7 @@ android:layout_height="wrap_content"> diff --git a/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml b/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml index c74b45780..77c2f0d31 100644 --- a/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml +++ b/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml @@ -21,7 +21,6 @@ app:layout_constraintVertical_bias="0.0" /> - + app:layout_constraintTop_toBottomOf="@+id/user_avatar_container" + tools:text="TextView" /> + app:riv_oval="true" + tools:src="@mipmap/icon_avatar_placeholder" /> + app:layout_constraintStart_toStartOf="@+id/imageView17" + tools:text="TextView" /> + app:layout_constraintStart_toStartOf="@+id/user_name_2" + tools:text="TextView" /> @@ -293,12 +293,12 @@ android:id="@+id/user_avatar_1" android:layout_width="0dp" android:layout_height="0dp" - tools:src="@mipmap/icon_avatar_placeholder" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:riv_oval="true" /> + app:riv_oval="true" + tools:src="@mipmap/icon_avatar_placeholder" /> + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="@+id/imageView9" + tools:text="TextView" /> + app:layout_constraintStart_toStartOf="@+id/user_name_1" + tools:text="Mystery Man" /> @@ -384,12 +386,12 @@ android:id="@+id/user_avatar_3" android:layout_width="0dp" android:layout_height="0dp" - tools:src="@mipmap/icon_avatar_placeholder" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:riv_oval="true" /> + app:riv_oval="true" + tools:src="@mipmap/icon_avatar_placeholder" /> + app:layout_constraintStart_toStartOf="@+id/imageView16" + tools:text="TextView" /> + app:layout_constraintStart_toStartOf="@+id/user_name_3" + tools:text="TextView" /> @@ -472,6 +475,7 @@ + + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintStart_toStartOf="@+id/gift_soles" + tools:text="未點亮 00/000" /> 助力值 本期展館時間: 上期展館時間: + 您由於【%s】 違規被中斷直播 + 違規原因: + 處罰內容: + 處罰時間: + diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 2707570dd..380bd13bd 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1549,4 +1549,9 @@ Last hall time: *10% of the threshold will be charged as ticket + + You were interrupted from the live broadcast due to violation of [%s]. + Violation reasons: + Penalty content: + Penalty time: 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 a5f335d3e..c373be3c6 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -1729,7 +1729,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL protected void release() { EventBus.getDefault().unregister(this); LiveHttpUtil.cancel(LiveHttpConsts.SEND_DANMU); - LoadDian9TuUtil.clearBitmap(); if (mKeyBoardHeightUtil != null) { mKeyBoardHeightUtil.release(); } @@ -1778,6 +1777,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL Constants.isSend = "0"; } + private void claerBitmap(){ + LoadDian9TuUtil.clearBitmap(); + } + + /** * 显示个人资料弹窗 */ @@ -1835,6 +1839,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL @Override protected void onDestroy() { release(); + claerBitmap(); super.onDestroy(); } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java index d53127356..d23a91e4d 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java @@ -982,6 +982,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl } if (mLivePushViewHolder != null) { + mLivePushViewHolder.closeLive(); mLivePushViewHolder.release(); } if (mLiveLinkMicPresenter != null) { diff --git a/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java index 4e255eded..24633465c 100644 --- a/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java @@ -25,6 +25,7 @@ import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.AppManager; 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.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveSwAnchorActivity; @@ -129,85 +130,54 @@ public class FreePkRecyclerAdapter extends RefreshAdapter { mAvatar = itemView.findViewById(R.id.item_avatar); mPkStatus = itemView.findViewById(R.id.item_pk); mFollow = itemView.findViewById(R.id.item_follow); - mPkStatus.setOnClickListener(v -> { - RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag(); - if (bean.isPk()) { - ToastUtil.show(mContext.getString(R.string.free_pk_user_pking)); - return; - } - if (freePkNum == 0 && mDrPkNum == -1) { - ToastUtil.show(mContext.getString(R.string.free_pk_num_null)); - return; - } - //检查自己是不是在PK中 - LiveHttpUtil.livePkCheckLive(IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId() + "", "", "", new com.yunbao.common.http.HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - JSONObject obj = JSON.parseObject(info[0]); - if (obj != null) { - if(mDrPkNum!=-1){ - LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); - //非0认为未开通连麦权限 - if (code != 0) { - if (mDrPkNum <= 0) { - if (WordUtil.isNewZh()) { - ToastUtil.show("多人次數已用完"); - } else { - ToastUtil.show("Multiple times have been used up"); - } - return; - } - yaoqing.put(bean.getId(), bean.getId()); - if (yaoqing.size() < 5) { - if(mContext instanceof LiveSwAnchorActivity){ - ((LiveSwAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId()); - }else{ - ((LiveRyAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId()); - } - } else { - ToastUtil.show(WordUtil.isNewZh() ? "多人PK最大參與人數為4人" : "The maximum number of participants in a multiplayer PK is 4 people"); - } - if (freePkRecyclerListener != null) { - freePkRecyclerListener.onClose(); - } - - } else { - if (WordUtil.isNewZh()) { - ToastUtil.show("請先關閉語音連麥"); - } else { - ToastUtil.show("Please disable the voice connection first"); - } - } - } - }); - }else{ - if (TextUtils.equals(obj.getString("ispk"), "0")) {//自己不在PK,可以发起邀请 + ViewClicksAntiShake.clicksAntiShake(mPkStatus, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag(); + if (bean.isPk()) { + ToastUtil.show(mContext.getString(R.string.free_pk_user_pking)); + return; + } + if (freePkNum == 0 && mDrPkNum == -1) { + ToastUtil.show(mContext.getString(R.string.free_pk_num_null)); + return; + } + //检查自己是不是在PK中 + LiveHttpUtil.livePkCheckLive(IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId() + "", "", "", new com.yunbao.common.http.HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + JSONObject obj = JSON.parseObject(info[0]); + if (obj != null) { + if(mDrPkNum!=-1){ LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); //非0认为未开通连麦权限 if (code != 0) { - if (mDrPkNum == -1) { + if (mDrPkNum <= 0) { if (WordUtil.isNewZh()) { - ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功"); + ToastUtil.show("多人次數已用完"); } else { - ToastUtil.show("invite " + bean.getUserNiceName() + " successful"); - } - mOnItemClickListener.onItemClick(bean, -1); - if(mContext instanceof LiveSwAnchorActivity){ - ((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), - false); - }else{ - ((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), - ((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString() - ); + ToastUtil.show("Multiple times have been used up"); } + return; } + yaoqing.put(bean.getId(), bean.getId()); + if (yaoqing.size() < 5) { + if(mContext instanceof LiveSwAnchorActivity){ + ((LiveSwAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId()); + }else{ + ((LiveRyAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId()); + } + } else { + ToastUtil.show(WordUtil.isNewZh() ? "多人PK最大參與人數為4人" : "The maximum number of participants in a multiplayer PK is 4 people"); + } + if (freePkRecyclerListener != null) { + freePkRecyclerListener.onClose(); + } + } else { if (WordUtil.isNewZh()) { ToastUtil.show("請先關閉語音連麥"); @@ -218,19 +188,51 @@ public class FreePkRecyclerAdapter extends RefreshAdapter { } }); }else{ - if (WordUtil.isNewZh()) { - ToastUtil.show("請先關閉PK"); - } else { - ToastUtil.show("Please disable the PK"); + if (TextUtils.equals(obj.getString("ispk"), "0")) {//自己不在PK,可以发起邀请 + LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); + //非0认为未开通连麦权限 + if (code != 0) { + if (mDrPkNum == -1) { + if (WordUtil.isNewZh()) { + ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功"); + } else { + ToastUtil.show("invite " + bean.getUserNiceName() + " successful"); + } + mOnItemClickListener.onItemClick(bean, -1); + if(mContext instanceof LiveSwAnchorActivity){ + ((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), + false); + }else{ + ((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), + ((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString() + ); + } + } + } else { + if (WordUtil.isNewZh()) { + ToastUtil.show("請先關閉語音連麥"); + } else { + ToastUtil.show("Please disable the voice connection first"); + } + } + } + }); + }else{ + if (WordUtil.isNewZh()) { + ToastUtil.show("請先關閉PK"); + } else { + ToastUtil.show("Please disable the PK"); + } } } } } } - } - }); - - + }); + } }); mFollow.setOnClickListener(v -> { RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag(); 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 6401c14ef..2e82c7209 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java @@ -853,12 +853,14 @@ public class LiveGiftPopup extends AbsDialogFragment { .append(liveGiftModel.getNamingUserCoin()) .append(" "); } + String hideName=liveGiftModel.getNamingUid().equals(IMLoginManager.get(mContext).getUserInfo().getId()+"")?liveGiftModel.getNamingUserName():WordUtil.getNewString(R.string.mystery_man); + String hideLiveName=liveGiftModel.getNamingLiveuid().equals(IMLoginManager.get(mContext).getUserInfo().getId()+"")?liveGiftModel.getNamingLiveName():WordUtil.getNewString(R.string.mystery_man); namingNameText.append(mContext.getText(com.yunbao.live.R.string.title_anchor)) .append(liveGiftModel.getNamingLiveName()) .append(" ") .append(mContext.getText(com.yunbao.live.R.string.the_title_financier)) .append(" ") - .append(liveGiftModel.getNaming_user_gift_hall_rank_hide()==0?liveGiftModel.getNamingUserName():WordUtil.getNewString(R.string.mystery_man)); + .append(liveGiftModel.getNaming_user_gift_hall_rank_hide()==0?liveGiftModel.getNamingUserName():hideName); namingName.setText(namingNameText.toString()); } else { namingLayout.setVisibility(View.GONE); @@ -934,7 +936,6 @@ public class LiveGiftPopup extends AbsDialogFragment { !TextUtils.isEmpty(liveGiftModel.getNamingUid()) && !TextUtils.equals(liveGiftModel.getNamingLiveuid(), "0") && !TextUtils.equals(liveGiftModel.getNamingUid(), "0")) { - ToastUtil.show("显示"); namingLayout.setVisibility(View.VISIBLE); ImgLoader.display(mContext, liveGiftModel.getNamingLiveAvatar(), namingAvatar); StringBuffer namingNameText = new StringBuffer(); @@ -946,11 +947,13 @@ public class LiveGiftPopup extends AbsDialogFragment { namingNameText.append("Get title: ") .append(liveGiftModel.getNamingUserCoin()); } + String hideName=liveGiftModel.getNamingUid().equals(IMLoginManager.get(mContext).getUserInfo().getId()+"")?liveGiftModel.getNamingUserName():WordUtil.getNewString(R.string.mystery_man); + String hideLiveName=liveGiftModel.getNamingLiveuid().equals(IMLoginManager.get(mContext).getUserInfo().getId()+"")?liveGiftModel.getNamingLiveName():WordUtil.getNewString(R.string.mystery_man); namingNameText.append(mContext.getText(com.yunbao.live.R.string.title_anchor)) .append(liveGiftModel.getNamingLiveName()) .append(" ") .append(mContext.getText(com.yunbao.live.R.string.the_title_financier)) - .append(liveGiftModel.getNaming_user_gift_hall_rank_hide()==0?liveGiftModel.getNamingUserName():WordUtil.getNewString(R.string.mystery_man)); + .append(liveGiftModel.getNaming_user_gift_hall_rank_hide()==0?liveGiftModel.getNamingUserName():hideName); namingName.setText(namingNameText.toString()); } else { namingLayout.setVisibility(View.GONE); diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java index 7960a31ef..2c25aac46 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java @@ -767,7 +767,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V @Override public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { Log.e("tx", "aaa" + errorCode.toString()); - ToastUtil.show(errorCode.code + ":" + errorCode.msg); } }); @@ -801,7 +800,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V @Override public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { Log.e("tx", "aaa" + errorCode.toString()); - ToastUtil.show(errorCode.code + ":" + errorCode.msg); } }); } @@ -829,7 +827,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V @Override public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { Log.e("tx", "aaa" + errorCode.toString()); - ToastUtil.show(errorCode.code + ":" + errorCode.msg); } }); } diff --git a/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java b/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java index 731bf1d67..b17da4c1f 100644 --- a/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java @@ -21,6 +21,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.lxj.xpopup.XPopup; import com.makeramen.roundedimageview.RoundedImageView; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.event.LiveGiftDialogEvent; @@ -102,7 +103,7 @@ public class FrameGiftViewHolder extends RecyclerView.ViewHolder { giftName.setText(model.getName()); // } - if (model.getNaming_user_gift_hall_rank_hide() == 1) { + if (model.getNaming_user_gift_hall_rank_hide() == 1 && !model.getNamingUid().equals(IMLoginManager.get(mContext).getUserInfo().getId() + "")) { avatar.setImageResource(com.yunbao.common.R.mipmap.hide); naming_name.setText(WordUtil.getNewString(com.yunbao.common.R.string.mystery_man)); } else { diff --git a/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java index fd8598955..f7d8744b0 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java @@ -77,6 +77,8 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList private IMLoginModel model = null; private String live_id; private String leaveStream, leaveGroupId; + private TextView banContent, banReason, banTimer; + private View banLayout; public LiveEndViewHolder(Context context, ViewGroup parentView, String uid) { super(context, parentView); @@ -208,7 +210,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList @Override public void onError(String error) { - ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); + ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred"); } }); } @@ -258,6 +260,11 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList liveDurationAnchor = (TextView) findViewById(R.id.live_duration_anchor); liveVotes = (TextView) findViewById(R.id.live_votes); liveWatchNum = (TextView) findViewById(R.id.live_watch_num); + banContent = (TextView) findViewById(R.id.ban_content); + banReason = (TextView) findViewById(R.id.ban_reason); + banTimer = (TextView) findViewById(R.id.ban_timer); + banLayout=findViewById(R.id.banLayout); + findViewById(R.id.go_home_anchor) .setOnClickListener(new View.OnClickListener() { @Override @@ -366,7 +373,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList ((LiveAudienceActivity) mContext).exitLiveRoom(); } else if (mContext instanceof LiveSwAnchorActivity) { ((LiveSwAnchorActivity) mContext).superBackPressed(); - }else if(mContext instanceof LiveRyAnchorActivity){ + } else if (mContext instanceof LiveRyAnchorActivity) { ((LiveRyAnchorActivity) mContext).superBackPressed(); } Bus.get().post(new CloseEvent()); @@ -424,7 +431,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { @Override - public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) { + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) { if (liveBean == null) { return; } @@ -450,7 +457,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList ((LiveAudienceActivity) mContext).exitLiveRoom(); } else if (mContext instanceof LiveSwAnchorActivity) { ((LiveSwAnchorActivity) mContext).superBackPressed(); - }else if(mContext instanceof LiveRyAnchorActivity){ + } else if (mContext instanceof LiveRyAnchorActivity) { ((LiveRyAnchorActivity) mContext).superBackPressed(); } } diff --git a/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java index c3daf1d31..6f1ba0358 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushSwViewHolder.java @@ -667,6 +667,13 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX } } + public void closeLive(){ + if (swManager != null) { + swManager.exitChannelAll(); + } + } + + public interface onDrPkJoinSuccessListener{ void joinSuccess1(); void joinSuccess2(); 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 3744f8c74..926259113 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -4721,8 +4721,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mRefreshUserListCallback = null; mTimeChargeCallback = null; Contexts = null; + if(drawableBg!=null){ + drawableBg.clear(); + } drawableBg = null; + if(drawableTitleCn!=null){ + drawableTitleCn.clear(); + } drawableTitleCn = null; + if(drawableTitleEn!=null){ + drawableTitleEn.clear(); + } drawableTitleEn = null; } diff --git a/live/src/main/res/layout/view_live_end.xml b/live/src/main/res/layout/view_live_end.xml index 54df889f3..0c6491963 100644 --- a/live/src/main/res/layout/view_live_end.xml +++ b/live/src/main/res/layout/view_live_end.xml @@ -1,6 +1,7 @@ @@ -15,7 +16,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="#b3000000" - android:visibility="gone"> + android:visibility="gone" + tools:visibility="visible"> + + + + + + + + + + + + + + + + + + + + + + + + + + android:visibility="visible" + tools:visibility="gone"> + + diff --git a/live/src/main/res/layout/view_live_gift.xml b/live/src/main/res/layout/view_live_gift.xml index 781b414db..e22931f0e 100644 --- a/live/src/main/res/layout/view_live_gift.xml +++ b/live/src/main/res/layout/view_live_gift.xml @@ -120,13 +120,14 @@ android:layout_width="56dp" android:layout_height="15dp" android:layout_gravity="bottom" - android:visibility="gone" android:layout_marginStart="11dp" android:background="@drawable/background_naming_icon" android:gravity="center" android:text="@string/the_title_financier2" android:textColor="#DB7008" - android:textSize="10sp" /> + android:textSize="10sp" + android:visibility="gone" + tools:visibility="visible" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java index 12e3a93b9..4175e5785 100644 --- a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java @@ -14,6 +14,8 @@ import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.Signature; +import android.content.res.Configuration; +import android.content.res.Resources; import android.graphics.Paint; import android.media.MediaPlayer; import android.net.Uri; @@ -92,6 +94,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.main.R; import com.yunbao.main.dialog.LoginTipsDialog; import com.yunbao.main.http.MainHttpUtil; @@ -137,6 +140,20 @@ public class EntryActivity extends AppCompatActivity { private WebView webview; private WebSettings webSettings; + private View webViewLayout; + private View webBack; + + + @Override + public Resources getResources() { + Resources res = super.getResources(); + Configuration config = new Configuration(); + config.setToDefaults(); + config.locale = IMLoginManager.get(this).getLocaleLanguage(); + res.updateConfiguration(config, res.getDisplayMetrics()); + return res; + } + @Subscribe(threadMode = ThreadMode.MAIN) public void close(String str) { @@ -225,7 +242,9 @@ public class EntryActivity extends AppCompatActivity { btn_tip1.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); btn_tip1.getPaint().setAntiAlias(true); - webview = (WebView) findViewById(R.id.webview); + webview = findViewById(R.id.webview); + webViewLayout = findViewById(R.id.webview_container); + webBack = findViewById(R.id.btn_back1); initView(); btn_tip1.setOnClickListener(new View.OnClickListener() { @Override @@ -377,11 +396,22 @@ public class EntryActivity extends AppCompatActivity { } } }); + ViewClicksAntiShake.clicksAntiShake(webBack, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + webViewLayout.setVisibility(View.GONE); + } + }); } - private void verfiy(int loginType){ + private void verfiy(int loginType) { this.loginType = loginType; - webview.setVisibility(View.VISIBLE); + webViewLayout.setVisibility(View.VISIBLE); + // 开启js支持 + webSettings.setJavaScriptEnabled(true); + webview.addJavascriptInterface(new JsBridge(), "jsBridge"); +// 也可以加载本地html(webView.loadUrl("file:///android_asset/xxx.html")) + webview.loadUrl(CommonAppConfig.HOST + "/h5/live/TCaptcha.html" + "?isZh=" + (WordUtil.isNewZh() ? "1" : 0)); } private int loginType; // 1:facebook 2:google 3:twitter 4:Line @@ -429,7 +459,7 @@ public class EntryActivity extends AppCompatActivity { runOnUiThread(new Runnable() { @Override public void run() { - webview.setVisibility(View.GONE); + webViewLayout.setVisibility(View.GONE); //跳转 todo(); } @@ -451,11 +481,7 @@ public class EntryActivity extends AppCompatActivity { return true; } }); -// 开启js支持 - webSettings.setJavaScriptEnabled(true); - webview.addJavascriptInterface(new JsBridge(), "jsBridge"); -// 也可以加载本地html(webView.loadUrl("file:///android_asset/xxx.html")) - webview.loadUrl(CommonAppConfig.HOST + "/h5/live/TCaptcha.html" + "?isZh=" + (WordUtil.isNewZh() ? "1" : 0)); + } diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java index def2d4e70..81304ff53 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java @@ -29,6 +29,8 @@ import com.bumptech.glide.request.target.DrawableImageViewTarget; import com.bumptech.glide.request.target.Target; import com.ms.banner.Banner; import com.ms.banner.listener.OnBannerClickListener; +import com.yunbao.common.dialog.GiftWallDialog; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; @@ -211,7 +213,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement }); } else { pp = 0; - if(select==0){ + if (select == 0) { select = list.get(0).getId(); } MainHttpUtil.getClassLive(select, p, callback); @@ -409,8 +411,8 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement liveBean.setParams(gotoRoomKey); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { @Override - public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) { - RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw); + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal), isSw); } @Override @@ -467,6 +469,10 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement WebViewActivity.forward(mContext, link, true, false); } else if ("home_page_banner_battle".equals(link)) { RouteUtil.forwardBattlePass(); + } else if ("home_page_banner_giftwall".equals(link)) { + new GiftWallDialog(mContext, IMLoginManager.get(mContext).getUserInfo().getId() + "", + IMLoginManager.get(mContext).getUserInfo().getUserNicename(),null + , false).setFullWindows(true).setTab2(true).showDialog(); } else { gotoLive(link); } @@ -504,7 +510,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement } new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { @Override - public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) { + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) { if (LiveRoomViewHolder.mHandler != null) { LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); @@ -516,7 +522,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement } EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal))); } else { - RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw); + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk), isSw); } } diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java index e6723a38c..73405a834 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java @@ -69,8 +69,8 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { @Override public void run() { new GiftWallDialog(mContext, IMLoginManager.get(mContext).getUserInfo().getId() + "", - IMLoginManager.get(mContext).getUserInfo().getUserNicename(),null - , false).setFullWindows(true).showDialog(); + IMLoginManager.get(mContext).getUserInfo().getUserNicename(), null + , false).setFullWindows(true).setTab2(true).showDialog(); } }); return true; diff --git a/main/src/main/res/layout/activity_entry.xml b/main/src/main/res/layout/activity_entry.xml index a7f45aa2f..2680499be 100644 --- a/main/src/main/res/layout/activity_entry.xml +++ b/main/src/main/res/layout/activity_entry.xml @@ -1,5 +1,6 @@ - + android:visibility="gone" + tools:visibility="visible"> + + + + + + + + + \ No newline at end of file