From ff6fb98a8e6c5e40a2c40d0a2a482e76e1bf10df Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 6 Sep 2022 14:14:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=96=B0=E4=BA=BA?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E4=B8=8E=E6=95=B4=E8=9B=8A=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E7=9A=84=E9=97=AE=E9=A2=98=20fix:=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=96=B0=E4=BA=BA=E4=BB=BB=E5=8A=A1=E4=B8=8E=E6=95=B4?= =?UTF-8?q?=E8=9B=8A=E8=A2=AB=E9=81=AE=E6=8C=A1=E9=97=AE=E9=A2=98=20update?= =?UTF-8?q?:=E5=B0=86view=5Flive=5Faudience.xml=E7=9A=84banner=E8=BD=AC?= =?UTF-8?q?=E7=A7=BB=E8=87=B3view=5Flive=5Froom.lxml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/presenter/LiveLinkMicPresenter.java | 185 +------- .../live/views/Banner3CustomViewHolder.java | 58 +++ .../live/views/LiveAudienceViewHolder.java | 207 +-------- .../yunbao/live/views/LiveRoomViewHolder.java | 414 ++++++++++++++++-- .../live/views/PortraitLiveManager.java | 19 +- .../main/res/layout/view_live_audience.xml | 48 -- live/src/main/res/layout/view_live_room.xml | 67 ++- 7 files changed, 517 insertions(+), 481 deletions(-) create mode 100644 live/src/main/java/com/yunbao/live/views/Banner3CustomViewHolder.java diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java index 2c0eb34b0..2a8ac9a9d 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java @@ -1,9 +1,9 @@ package com.yunbao.live.presenter; import android.Manifest; +import android.annotation.SuppressLint; import android.app.Dialog; import android.content.Context; -import android.graphics.Outline; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.os.Handler; @@ -14,7 +14,6 @@ import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.ViewOutlineProvider; import android.widget.ImageView; import android.widget.PopupWindow; import android.widget.TextView; @@ -26,10 +25,6 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.facebook.appevents.AppEventsLogger; import com.google.firebase.analytics.FirebaseAnalytics; -import com.ms.banner.Banner; -import com.ms.banner.BannerConfig; -import com.ms.banner.holder.BannerViewHolder; -import com.ms.banner.listener.OnBannerClickListener; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.BannerBean; @@ -40,7 +35,6 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; -import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.ClickUtil; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.DialogUitl; @@ -111,12 +105,10 @@ public class LiveLinkMicPresenter implements View.OnClickListener { private View btnWishList; private View btnTurnTable; - private View btnEvent3; private View btn_onecz_event; private String eventUrl; // - public Banner mBanner3; private List mBannerList1 = new ArrayList<>(); private List mBannerList3 = new ArrayList<>(); @@ -130,45 +122,11 @@ public class LiveLinkMicPresenter implements View.OnClickListener { @Subscribe(threadMode = ThreadMode.MAIN) public void onUpdata(String str) { - if ("showBanner".equals(str)) { - showBanner3(); - } else if ("stop_svga_new_user_double".equals(str) && mBannerList3.size() > 2) { - - mBannerList3.get(2).setLink("1"); - mBanner3.update(mBannerList3); - if (mBannerList3.get(0).getLink().equals("1")) { - if (mBannerList3.get(1).getLink().equals("1")) { - if (mBannerList3.get(2).getLink().equals("1")) { - btnEvent3.setVisibility(View.GONE); - } - } - } - } else if ("stop_svga_new_user_follow".equals(str) && mBannerList3.size() > 1) { - mBannerList3.get(1).setLink("1"); - - mBanner3.update(mBannerList3); - if (mBannerList3.get(0).getLink().equals("1")) { - if (mBannerList3.get(1).getLink().equals("1")) { - if (mBannerList3.get(2).getLink().equals("1")) { - btnEvent3.setVisibility(View.GONE); - } - } - } - } else if ("stop_new_user_gif".equals(str) && mBannerList3.size() > 0) { - IMLoginManager.get(mContext).setNewUserGif(false); - mBannerList3.get(0).setLink("1"); - mBanner3.update(mBannerList3); - if (mBannerList3.get(0).getLink().equals("1")) { - if (mBannerList3.get(1).getLink().equals("1")) { - if (mBannerList3.get(2).getLink().equals("1")) { - btnEvent3.setVisibility(View.GONE); - } - } - } - } else if ("stop_svga_new_user_double1".equals(str)) { + if ("stop_svga_new_user_double1".equals(str)) { AdjustEvent adjustEvent1 = new AdjustEvent("80lzdi"); Adjust.trackEvent(adjustEvent1); CommonHttpUtil.setAdvertisingChannels("80lzdi", new HttpCallback() { + @SuppressLint("MissingPermission") @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { @@ -180,6 +138,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener { AdjustEvent adjustEvent2 = new AdjustEvent("6va52i"); Adjust.trackEvent(adjustEvent2); CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() { + @SuppressLint("MissingPermission") @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { @@ -193,6 +152,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener { AdjustEvent adjustEvent1 = new AdjustEvent("f084wh"); Adjust.trackEvent(adjustEvent1); CommonHttpUtil.setAdvertisingChannels("f084wh", new HttpCallback() { + @SuppressLint("MissingPermission") @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { @@ -204,6 +164,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener { AdjustEvent adjustEvent2 = new AdjustEvent("6va52i"); Adjust.trackEvent(adjustEvent2); CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() { + @SuppressLint("MissingPermission") @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { @@ -217,6 +178,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener { AdjustEvent adjustEvent1 = new AdjustEvent("aqqz70"); Adjust.trackEvent(adjustEvent1); CommonHttpUtil.setAdvertisingChannels("aqqz70", new HttpCallback() { + @SuppressLint("MissingPermission") @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { @@ -228,6 +190,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener { AdjustEvent adjustEvent2 = new AdjustEvent("6va52i"); Adjust.trackEvent(adjustEvent2); CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() { + @SuppressLint("MissingPermission") @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { @@ -263,49 +226,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener { toast.show(); } - class MyCustomViewHolder implements BannerViewHolder { - private TextView task, status; - private TextView task_name; - private ImageView indicator1, indicator2, indicator3; - - @Override - public View createView(Context context, int position, BannerBean data) { - View view = LayoutInflater.from(context).inflate(R.layout.banner_new_user, null); - task = (TextView) view.findViewById(R.id.task); - task_name = (TextView) view.findViewById(R.id.task_name); - status = (TextView) view.findViewById(R.id.status); - indicator1 = (ImageView) view.findViewById(R.id.indicator1); - indicator2 = (ImageView) view.findViewById(R.id.indicator2); - indicator3 = (ImageView) view.findViewById(R.id.indicator3); - if (data.getLink().equals("0")) { - status.setText(R.string.incomplete); - } else { - status.setText(R.string.complete); - } - if (position == 0) { - task.setText(R.string.task1); - task_name.setText(R.string.give_a_free_gift); - indicator1.setImageResource(R.drawable.bg_home_indicator_selected); - indicator2.setImageResource(R.drawable.bg_home_indicator_unselected); - indicator3.setImageResource(R.drawable.bg_home_indicator_unselected); - } else if (position == 1) { - task.setText(R.string.task2); - task_name.setText(R.string.follow_anchor); - indicator1.setImageResource(R.drawable.bg_home_indicator_unselected); - indicator2.setImageResource(R.drawable.bg_home_indicator_selected); - indicator3.setImageResource(R.drawable.bg_home_indicator_unselected); - } else if (position == 2) { - task.setText(R.string.task3); - task_name.setText(R.string.light_up_room); - indicator1.setImageResource(R.drawable.bg_home_indicator_unselected); - indicator2.setImageResource(R.drawable.bg_home_indicator_unselected); - indicator3.setImageResource(R.drawable.bg_home_indicator_selected); - } - - return view; - } - } public LiveLinkMicPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, int liveSdk, View root) { mContext = context; @@ -324,18 +245,8 @@ public class LiveLinkMicPresenter implements View.OnClickListener { btnWishList.setOnClickListener(this); btnTurnTable.setOnClickListener(this); - btnEvent3 = root.findViewById(R.id.btn_event3); - mBanner3 = (Banner) root.findViewById(R.id.banner3); - - - mBanner3.setOutlineProvider(new ViewOutlineProvider() { - @Override - public void getOutline(View view, Outline outline) { - outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10); - } - }); //周星 BannerBean bannerBean = new BannerBean(); bannerBean.setImageUrl("https://downs.yaoulive.com/img/BTN_WEEKSTAR%20%281%29.png"); @@ -343,58 +254,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener { mBannerList1.add(bannerBean); - LiveHttpUtil.getFrontTask(IMLoginManager.get(mContext).getUserInfo().getToken(), "" + IMLoginManager.get(mContext).getUserInfo().getId(), new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - JSONObject old_obj = JSON.parseObject(info[0]); - - JSONObject obj = old_obj.getJSONObject("task"); - if (obj != null) { - JSONObject obj1 = old_obj.getJSONObject("gift"); - JSONObject reward_one = old_obj.getJSONObject("reward_one"); - - gold = reward_one.getString("gold"); - experience = reward_one.getString("experience"); - - bean1.setSwf("111.svga"); - bean1.setChecked(false); - bean1.setIcon(obj1.getString("gifticon")); - bean1.setId(obj1.getIntValue("id")); - bean1.setName(obj1.getString("giftname")); - bean1.setTag("1"); - - if (IMLoginManager.get(mContext).isisNewUserOne() == false) { - if (obj.getString("sendgift").equals("0")) { - IMLoginManager.get(mContext).setNewUserGif(true); - EventBus.getDefault().post("svga_new_user_gif"); - } - } - BannerBean banner3Bean = new BannerBean(); - banner3Bean.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); - banner3Bean.setLink(obj.getString("sendgift")); - mBannerList3.add(banner3Bean); - - - BannerBean banner3Bean1 = new BannerBean(); - banner3Bean1.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); - banner3Bean1.setLink(obj.getString("attent")); - mBannerList3.add(banner3Bean1); - - BannerBean banner3Bean2 = new BannerBean(); - banner3Bean2.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); - banner3Bean2.setLink(obj.getString("illumine")); - mBannerList3.add(banner3Bean2); - - if (obj.getString("sendgift").equals("0") && IMLoginManager.get(context).isisNewUserOne() == false) { - showBanner3(); - } else if (obj.getString("attent").equals("0") && IMLoginManager.get(context).isisNewUserOne() == false) { - showBanner3(); - } else if (obj.getString("illumine").equals("0") && IMLoginManager.get(context).isisNewUserOne() == false) { - showBanner3(); - } - } - } - }); btn_onecz_event = root.findViewById(R.id.btn_onecz_event); @@ -768,34 +627,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener { } - private void showBanner3() { - btnEvent3.setVisibility(View.VISIBLE); - if (mBannerList3 == null || mBannerList3.size() == 0 || mBanner3 == null) { - return; - } - mBanner3.setAutoPlay(true) - .setPages(mBannerList3, new MyCustomViewHolder()) - .setDelayTime(3000) - .setBannerStyle(BannerConfig.NOT_INDICATOR) - .setOnBannerClickListener(new OnBannerClickListener() { - @Override - public void onBannerClick(List datas, int p) { - if (mBannerList3 != null) { - if (mBannerList3.get(p).getLink().equals("0")) { - if (p == 0) { - ((LiveAudienceActivity) mContext).openGiftWindow("" + bean1.getId(), "1"); - EventBus.getDefault().post("svga_new_user_gif"); - } else if (p == 1) { - EventBus.getDefault().post("svga_new_user_follow"); - } else if (p == 2) { - EventBus.getDefault().post("svga_new_user_double"); - } - } - } - } - }) - .start(); - } //获取活动 private void getEvent() { diff --git a/live/src/main/java/com/yunbao/live/views/Banner3CustomViewHolder.java b/live/src/main/java/com/yunbao/live/views/Banner3CustomViewHolder.java new file mode 100644 index 000000000..6a1f361de --- /dev/null +++ b/live/src/main/java/com/yunbao/live/views/Banner3CustomViewHolder.java @@ -0,0 +1,58 @@ +package com.yunbao.live.views; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import com.ms.banner.holder.BannerViewHolder; +import com.yunbao.common.bean.BannerBean; +import com.yunbao.live.R; + +/** + * 新人任务的ViewHolder + */ +public class Banner3CustomViewHolder implements BannerViewHolder { + + private TextView task, status; + private TextView task_name; + private ImageView indicator1, indicator2, indicator3; + + @Override + public View createView(Context context, int position, BannerBean data) { + View view = LayoutInflater.from(context).inflate(R.layout.banner_new_user, null); + task = (TextView) view.findViewById(R.id.task); + task_name = (TextView) view.findViewById(R.id.task_name); + status = (TextView) view.findViewById(R.id.status); + indicator1 = (ImageView) view.findViewById(R.id.indicator1); + indicator2 = (ImageView) view.findViewById(R.id.indicator2); + indicator3 = (ImageView) view.findViewById(R.id.indicator3); + if (data.getLink().equals("0")) { + status.setText(R.string.incomplete); + } else { + status.setText(R.string.complete); + } + if (position == 0) { + task.setText(R.string.task1); + task_name.setText(R.string.give_a_free_gift); + indicator1.setImageResource(R.drawable.bg_home_indicator_selected); + indicator2.setImageResource(R.drawable.bg_home_indicator_unselected); + indicator3.setImageResource(R.drawable.bg_home_indicator_unselected); + } else if (position == 1) { + task.setText(R.string.task2); + task_name.setText(R.string.follow_anchor); + indicator1.setImageResource(R.drawable.bg_home_indicator_unselected); + indicator2.setImageResource(R.drawable.bg_home_indicator_selected); + indicator3.setImageResource(R.drawable.bg_home_indicator_unselected); + } else if (position == 2) { + task.setText(R.string.task3); + task_name.setText(R.string.light_up_room); + indicator1.setImageResource(R.drawable.bg_home_indicator_unselected); + indicator2.setImageResource(R.drawable.bg_home_indicator_unselected); + indicator3.setImageResource(R.drawable.bg_home_indicator_selected); + } + + return view; + } +} \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 5bb6cac90..0b4bd417b 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -2,13 +2,11 @@ package com.yunbao.live.views; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.Dialog; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.os.Bundle; -import android.os.CountDownTimer; import android.os.Handler; import android.text.TextUtils; import android.util.DisplayMetrics; @@ -17,14 +15,11 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; -import android.widget.Button; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.ViewFlipper; -import com.alibaba.fastjson.JSONObject; import com.opensource.svgaplayer.SVGACallback; import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; @@ -52,7 +47,6 @@ import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveMicUserDialogFragment; import com.yunbao.live.dialog.LivePromotionDialogFragment; import com.yunbao.live.event.LiveAudienceEvent; -import com.yunbao.live.http.LiveHttpUtil; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -73,8 +67,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { private String mLiveUid; private String mStream; private String url; - private LinearLayout lt_trickery; - private TextView tv_trickery_time; private View v_msg_redpoint, stationHornBanner; private Activity context; private SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow, svga_station_horn; @@ -83,7 +75,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { private int icon = 0; private String nobleName, nobleTtext; private ImageView giftImage, liveNewPeople; - private String newPeopleUrl=null; + private String newPeopleUrl = null; public LiveAudienceViewHolder(Context context, ViewGroup parentView) { super(context, parentView); @@ -242,11 +234,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { }); findViewById(R.id.btn_more).setOnClickListener(this); - lt_trickery = (LinearLayout) findViewById(R.id.lt_trickery); - tv_trickery_time = (TextView) findViewById(R.id.tv_trickery_time); - lt_trickery.setOnClickListener(this); - - dialog = new Dialog(mContext, R.style.dialog); v_msg_redpoint = (View) findViewById(R.id.v_msg_redpoint); //获取系统未读消息 @@ -343,8 +330,8 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { public void removeCallbacks() { - handler .removeCallbacks(runnable); - handler .removeCallbacks(runnable1); + handler.removeCallbacks(runnable); + handler.removeCallbacks(runnable1); } public void setLiveInfo(String liveUid, String stream, String urls, int isattention) { @@ -368,7 +355,8 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { }, 10000);//3秒后执行Runnable中的run方法 getNewPeopleInfo(); } - public void getNewPeopleInfo(){ + + public void getNewPeopleInfo() { API.get().pdLiveApi(mContext) .getNewPeopleInfo() .subscribeOn(Schedulers.io()) @@ -377,9 +365,9 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { NewPeopleInfo peopleInfo = stringResponseModel.getData().getInfo(); if (peopleInfo.getIsShow()) { liveNewPeople.setVisibility(View.VISIBLE); - if (peopleInfo.getLink().startsWith("http")){ - newPeopleUrl=peopleInfo.getLink()+"?"; - }else { + if (peopleInfo.getLink().startsWith("http")) { + newPeopleUrl = peopleInfo.getLink() + "?"; + } else { newPeopleUrl = CommonAppConfig.HOST + "/" + peopleInfo.getLink(); } } @@ -404,15 +392,12 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { } else if (i == R.id.btn_gift) { openGiftWindow(); - //全屏 } else if (i == R.id.btn_more) { ((LiveActivity) mContext).openMoreWindow(); } else if (i == R.id.btn_zg) { openZGListWindow(); - } else if (i == R.id.lt_trickery) { - showTrickeryDialog(); - }else if (i==R.id.live_new_people){ + } else if (i == R.id.live_new_people) { openNewPeopleDialog(); } @@ -421,9 +406,9 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { /** * 打开新人特惠对话框 */ - private void openNewPeopleDialog(){ - Bundle bundle=new Bundle(); - String url= newPeopleUrl+"&g=Appapi&m=Turntable&a=tricky"; + private void openNewPeopleDialog() { + Bundle bundle = new Bundle(); + String url = newPeopleUrl + "&g=Appapi&m=Turntable&a=tricky"; url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; bundle.putString("url", url); @@ -448,174 +433,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); } - private Dialog dialog; - - private void showTrickeryDialog() { - dialog.setContentView(R.layout.dialog_trickery); - dialog.setCancelable(true); - dialog.setCanceledOnTouchOutside(true); - - TextView tv_trickster_initiator, tv_trickster_content, tv_trickery_number_zuanshi, tv_username, tv_anchorname, tv_trickster_name; - Button bt_trickster_confirm; - LinearLayout lt_trickster_salvation, lt_trickster_top, lt_trickster, lt_trickster_suc; - lt_trickster_top = (LinearLayout) dialog.findViewById(R.id.lt_trickster_top); - lt_trickster = (LinearLayout) dialog.findViewById(R.id.lt_trickster); - lt_trickster_suc = (LinearLayout) dialog.findViewById(R.id.lt_trickster_suc); - - tv_trickster_initiator = (TextView) dialog.findViewById(R.id.tv_trickster_initiator); - tv_trickster_content = (TextView) dialog.findViewById(R.id.tv_trickster_content); - - tv_trickery_number_zuanshi = (TextView) dialog.findViewById(R.id.tv_trickery_number_zuanshi); - - bt_trickster_confirm = (Button) dialog.findViewById(R.id.bt_trickster_confirm); - lt_trickster_salvation = (LinearLayout) dialog.findViewById(R.id.lt_trickster_salvation); - - tv_trickster_initiator.setText(name); - tv_trickster_content.setText(content); - tv_trickery_number_zuanshi.setText(mContext.getResources().getString(R.string.consume) + nums); - - tv_username = (TextView) dialog.findViewById(R.id.tv_username); - tv_anchorname = (TextView) dialog.findViewById(R.id.tv_anchorname); - tv_trickster_name = (TextView) dialog.findViewById(R.id.tv_trickster_name); - - if (openType == 0) { - lt_trickster_top.setBackground(mContext.getResources().getDrawable(R.mipmap.img_pop_zhengjou)); - lt_trickster_salvation.setVisibility(View.VISIBLE); - bt_trickster_confirm.setVisibility(View.GONE); - bt_trickster_confirm.setText(mContext.getResources().getString(R.string.confirm)); - lt_trickster.setVisibility(View.VISIBLE); - lt_trickster_suc.setVisibility(View.GONE); - } else if (openType == 1) { - lt_trickster_top.setBackground(mContext.getResources().getDrawable(R.mipmap.img_pop_ing)); - lt_trickster_salvation.setVisibility(View.GONE); - bt_trickster_confirm.setVisibility(View.VISIBLE); - lt_trickster.setVisibility(View.VISIBLE); - lt_trickster_suc.setVisibility(View.GONE); - } else if (openType == 2) { - lt_trickster_top.setBackground(mContext.getResources().getDrawable(R.mipmap.img_pop_chenggong)); - lt_trickster_salvation.setVisibility(View.GONE); - bt_trickster_confirm.setVisibility(View.VISIBLE); - bt_trickster_confirm.setText(mContext.getResources().getString(R.string.trickster_thanks)); - lt_trickster.setVisibility(View.GONE); - lt_trickster_suc.setVisibility(View.VISIBLE); - - tv_username.setText(userNmae); - tv_anchorname.setText(anchorName); - tv_trickster_name.setText(tricksterName); - } - bt_trickster_confirm.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - dialog.dismiss(); - } - }); - lt_trickster_salvation.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - hopeRankTurntable(); - } - }); - dialog.show(); - } - - private String nums = "0", prankid = "", content = "", name = ""; - private String userNmae = "", anchorName = "", tricksterName = ""; - - /** - * 打开或者关闭整蛊 - */ - public void closeAndOpenTrickery(String msgtype, int time, JSONObject jsonObject) { - nowTime = time; - tv_trickery_time.setText("" + nowTime); - openType = 0; - if ("1".equals(msgtype)) { - nums = jsonObject.getString("nums"); - prankid = jsonObject.getString("prankid"); - content = jsonObject.getString("content"); - name = jsonObject.getString("user_nicename"); - lt_trickery.setVisibility(View.VISIBLE); - lt_trickery.setBackground(mContext.getResources().getDrawable(R.mipmap.img_buoy)); - isClose = false; - starTimeloud(1, time); - } else { - userNmae = jsonObject.getString("hope_nicename"); - anchorName = jsonObject.getString("anchor_nicename"); - tricksterName = jsonObject.getString("content"); - isClose = true; - if (dialog.isShowing()) { - dialog.dismiss(); - } - openType = 2; - showTrickeryDialog(); - } - } - - public CountDownTimer countDownTimerTrickery = null; - private boolean isClose = false; - private int nowTime = 0; - private Handler handlerT = new Handler(); - private int openType = 0; - - private void starTimeloud(int type, int time) { - nowTime = time; - countDownTimerTrickery = new CountDownTimer(time * 1000, 1000) { - @Override - public void onTick(long millisUntilFinished) { - nowTime = nowTime - 1; - if (nowTime < 0) { - if (countDownTimerTrickery != null) { - countDownTimerTrickery.cancel(); - } - nowTime = 0; - } - tv_trickery_time.setText("" + nowTime); - if (isClose) { - countDownTimerTrickery.cancel(); - countDownTimerTrickery = null; - lt_trickery.setVisibility(View.GONE); - } - } - - /** - *倒计时结束后调用的 - */ - @Override - public void onFinish() { - tv_trickery_time.setText("0"); - if (type == 1) { - lt_trickery.setBackground(mContext.getResources().getDrawable(R.mipmap.img_buoy2)); - if (countDownTimerTrickery != null) { - countDownTimerTrickery.cancel(); - countDownTimerTrickery = null; - } - nowTime = 0; - openType = 1; - if (dialog.isShowing()) { - dialog.dismiss(); - } - starTimeloud(2, time); - } else { - lt_trickery.setVisibility(View.GONE); - timeOver(); - } - } - }; - countDownTimerTrickery.start(); - } - - public void hopeRankTurntable() { - LiveHttpUtil.userHopePrankTurntable(mLiveUid, prankid, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (countDownTimerTrickery != null) { - } - } - }); - } - - public void timeOver() { - } - //消息中心 @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) 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 d576c8f3b..2b063007d 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -5,6 +5,7 @@ import android.app.Dialog; import android.content.Context; import android.graphics.Outline; import android.os.Bundle; +import android.os.CountDownTimer; import android.os.Handler; import android.os.Message; import android.os.SystemClock; @@ -18,6 +19,7 @@ import android.view.ViewOutlineProvider; import android.view.WindowManager; import android.view.animation.Animation; import android.view.animation.AnimationUtils; +import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; @@ -55,6 +57,7 @@ import com.yunbao.common.Constants; import com.yunbao.common.bean.BannerBean; import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.API; @@ -63,6 +66,7 @@ import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DeviceUtils; import com.yunbao.common.utils.DialogUitl; @@ -255,12 +259,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public WindowManager windowManager; // public boolean isRy = false; - private Banner mBanner1, mBanner2; + private Banner mBanner1, mBanner2, mBanner3; private List mBannerList1 = new ArrayList<>(); private List mBannerList2 = new ArrayList<>(); + private List mBannerList3 = new ArrayList<>(); private LinearLayout btn_event2; private ImageView imgEvent; private View btnEvent; + private View btnEvent3; + private LinearLayout lt_trickery; + private TextView tv_trickery_time; + private RecyclerView fastMsgRecyclerView; private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter; @@ -596,11 +605,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void init() { EventBus.getDefault().register(this); btnEvent = findViewById(R.id.btn_event); + btnEvent3 = findViewById(R.id.btn_event3); imgEvent = (ImageView) findViewById(R.id.img_event); btn_event2 = (LinearLayout) findViewById(R.id.btn_event2); mBanner1 = (Banner) findViewById(R.id.banner1); time = (TextView) findViewById(R.id.time); mBanner2 = (Banner) findViewById(R.id.banner2); + mBanner3 = (Banner) findViewById(R.id.banner3); pkText1 = (TextView) findViewById(R.id.pk_text1); pkText2 = (TextView) findViewById(R.id.pk_text2); pkText3 = (TextView) findViewById(R.id.pk_text3); @@ -652,11 +663,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis msg2 = (View) findViewById(R.id.room_msg_user); msgNumber = (TextView) findViewById(R.id.room_msg_num); msgUserIcon = (RoundedImageView) findViewById(R.id.room_msg_user_icon); - msgLayout= (ConstraintLayout) findViewById(R.id.room_msg_layout); + msgLayout = (ConstraintLayout) findViewById(R.id.room_msg_layout); ViewClicksAntiShake.clicksAntiShake(msg, this::openChatWindow); ViewClicksAntiShake.clicksAntiShake(msg2, this::openChatWindow); - if(!SpUtil.getInstance().getBooleanValue("private_chat_message_switch")){ + lt_trickery = (LinearLayout) findViewById(R.id.lt_trickery); + tv_trickery_time = (TextView) findViewById(R.id.tv_trickery_time); + lt_trickery.setOnClickListener(this); + dialog = new Dialog(mContext, R.style.dialog); + + if (!SpUtil.getInstance().getBooleanValue("private_chat_message_switch")) { msgLayout.setVisibility(View.GONE); } @@ -737,7 +753,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis gif_view = (LinearLayout) findViewById(R.id.gif_view); chat_view = (RelativeLayout) findViewById(R.id.chat_view); - int topMargin=mScreenWdith * 720 / 960 + 210; + int topMargin = mScreenWdith * 720 / 960 + 210; RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) chat_view.getLayoutParams(); params.topMargin = topMargin; @@ -745,7 +761,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis RelativeLayout.LayoutParams msgLayoutLayoutParams = (RelativeLayout.LayoutParams) msgLayout.getLayoutParams(); - msgLayoutLayoutParams.topMargin=topMargin+DpUtil.dp2px(50); + msgLayoutLayoutParams.topMargin = topMargin + DpUtil.dp2px(50); msgLayout.setLayoutParams(msgLayoutLayoutParams); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) @@ -889,6 +905,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10); } }); + mBanner3.setOutlineProvider(new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10); + } + }); //打招呼消息 fastMsgRecyclerView = (RecyclerView) findViewById(R.id.room_fast_msg); fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false)); @@ -901,7 +923,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis params1.bottomMargin = 0; mChatRecyclerView.setLayoutParams(params1); }); - // mBanner2.setVisibility(View.GONE); + // mBanner2.setVisibility(View.GONE); if (fastMsgRecyclerView.getVisibility() == View.GONE) { params1.bottomMargin = 0; mChatRecyclerView.setLayoutParams(params1); @@ -915,12 +937,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis findViewById(R.id.open_sidebar).setVisibility(View.GONE); findViewById(R.id.btn_follow).setVisibility(View.GONE); } + reloadIM(); + configBanner3(); } private void showBanner2() { if (mBannerList2 == null || mBannerList2.size() == 0 || mBanner2 == null) { return; } + btn_event2.setVisibility(View.VISIBLE); if (mBannerList2.size() == 1) { mBanner2.setAutoPlay(false) .setPages(mBannerList2, new CustomViewHolder()) @@ -976,7 +1001,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }) .start(); } - reloadIM(); } /** @@ -985,7 +1009,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void onResume() { super.onResume(); - changeMsgView(msg2,msg); + changeMsgView(msg2, msg); reloadIM(); } @@ -1680,24 +1704,27 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } else if (i == R.id.user_guard) { // ((LiveActivity) mContext).openUserMoreListWindow(2, true); ((LiveActivity) mContext).openNewGuardListWindow(); - } else if (i==R.id.room_msg){ - changeMsgView(msg,msg2); - }else if (i==R.id.room_msg_user){ - changeMsgView(msg2,msg); + } else if (i == R.id.room_msg) { + changeMsgView(msg, msg2); + } else if (i == R.id.room_msg_user) { + changeMsgView(msg2, msg); + } else if (i == R.id.lt_trickery) { + showTrickeryDialog(); } } /** * 私信的切换动画 + * * @param out 隐去的view - * @param in 展示的view + * @param in 展示的view */ - private void changeMsgView(View out,View in){ - if(in.getVisibility()==View.VISIBLE){ + private void changeMsgView(View out, View in) { + if (in.getVisibility() == View.VISIBLE) { return; } - Animation animation= AnimationUtils.loadAnimation(mContext,R.anim.view_room_msg_out); + Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.view_room_msg_out); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { @@ -1716,7 +1743,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }); out.startAnimation(animation); - Animation start=AnimationUtils.loadAnimation(mContext,R.anim.view_room_msg_in); + Animation start = AnimationUtils.loadAnimation(mContext, R.anim.view_room_msg_in); start.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { @@ -1739,7 +1766,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis /** * 从右侧私聊悬浮窗打开私聊界面 */ - private void openChatWindow(){ + private void openChatWindow() { /*LiveChatListDialogFragment chat=new LiveChatListDialogFragment(); chat.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoomChatDialogFragment");*/ ((LiveActivity) mContext).openChatListWindow(); @@ -1748,16 +1775,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis /** * 更新左上角数标 + * * @param number 数字 */ public void onMessageIMEvent(int number) { - String num=""; - if(number!=0){ - changeMsgView(msg,msg2); - if(number>99){ - num="99+"; - }else{ - num=number+""; + String num = ""; + if (number != 0) { + changeMsgView(msg, msg2); + if (number > 99) { + num = "99+"; + } else { + num = number + ""; } msgNumber.setText(num); } @@ -1766,26 +1794,26 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis /** * 刷新im消息,以便更新私信悬浮窗UI */ - public void reloadIM(){ - RongIMClient.getInstance().getConversationListByPage(new RongIMClient.ResultCallback>() { - @Override - public void onSuccess(List conversations) { - if(conversations!=null&&!conversations.isEmpty()){ - Conversation conversation = conversations.get(0); - UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(conversation.getTargetId()); - if(userInfo!=null){ - ImgLoader.display(mContext,userInfo.getPortraitUri().toString(),msgUserIcon); - } - } - } + public void reloadIM() { + RongIMClient.getInstance().getConversationListByPage(new RongIMClient.ResultCallback>() { + @Override + public void onSuccess(List conversations) { + if (conversations != null && !conversations.isEmpty()) { + Conversation conversation = conversations.get(0); + UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(conversation.getTargetId()); + if (userInfo != null) { + ImgLoader.display(mContext, userInfo.getPortraitUri().toString(), msgUserIcon); + } + } + } - @Override - public void onError(RongIMClient.ErrorCode errorCode) { - Log.e("IM","IM会话获取失败 = "+errorCode); + @Override + public void onError(RongIMClient.ErrorCode errorCode) { + Log.e("IM", "IM会话获取失败 = " + errorCode); - } - },0,10, Conversation.ConversationType.PRIVATE); - RongIMClient.getInstance().getUnreadCount(new Conversation.ConversationType[]{Conversation.ConversationType.PRIVATE},true,new RongIMClient.ResultCallback() { + } + }, 0, 10, Conversation.ConversationType.PRIVATE); + RongIMClient.getInstance().getUnreadCount(new Conversation.ConversationType[]{Conversation.ConversationType.PRIVATE}, true, new RongIMClient.ResultCallback() { @Override public void onSuccess(Integer integer) { onMessageIMEvent(integer); @@ -1803,9 +1831,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 私信来消息了,刷新悬浮窗UI */ @Subscribe(threadMode = ThreadMode.MAIN) - public void sendMessage(io.rong.imlib.model.Message bean){ + public void sendMessage(io.rong.imlib.model.Message bean) { reloadIM(); } + /** * 关注主播 */ @@ -2517,6 +2546,268 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } + private LiveGiftBean bean1; + + /** + * 初始化新人任务 + */ + private void configBanner3() { + LiveHttpUtil.getFrontTask(IMLoginManager.get(mContext).getUserInfo().getToken(), "" + IMLoginManager.get(mContext).getUserInfo().getId(), new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + JSONObject old_obj = JSON.parseObject(info[0]); + + JSONObject obj = old_obj.getJSONObject("task"); + if (obj != null) { + JSONObject obj1 = old_obj.getJSONObject("gift"); + JSONObject reward_one = old_obj.getJSONObject("reward_one"); + + String gold = reward_one.getString("gold"); + String experience = reward_one.getString("experience"); + bean1 = new LiveGiftBean(); + bean1.setSwf("111.svga"); + bean1.setChecked(false); + bean1.setIcon(obj1.getString("gifticon")); + bean1.setId(obj1.getIntValue("id")); + bean1.setName(obj1.getString("giftname")); + bean1.setTag("1"); + + if (IMLoginManager.get(mContext).isisNewUserOne() == false) { + if (obj.getString("sendgift").equals("0")) { + IMLoginManager.get(mContext).setNewUserGif(true); + EventBus.getDefault().post("svga_new_user_gif"); + } + } + BannerBean banner3Bean = new BannerBean(); + banner3Bean.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); + banner3Bean.setLink(obj.getString("sendgift")); + mBannerList3.add(banner3Bean); + + + BannerBean banner3Bean1 = new BannerBean(); + banner3Bean1.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); + banner3Bean1.setLink(obj.getString("attent")); + mBannerList3.add(banner3Bean1); + + BannerBean banner3Bean2 = new BannerBean(); + banner3Bean2.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); + banner3Bean2.setLink(obj.getString("illumine")); + mBannerList3.add(banner3Bean2); + + if (obj.getString("sendgift").equals("0") && !IMLoginManager.get(mContext).isisNewUserOne()) { + showBanner3(bean1); + } else if (obj.getString("attent").equals("0") && !IMLoginManager.get(mContext).isisNewUserOne()) { + showBanner3(bean1); + } else if (obj.getString("illumine").equals("0") && !IMLoginManager.get(mContext).isisNewUserOne()) { + showBanner3(bean1); + } + } + } + }); + } + + /** + * 展示新人任务 Banner + */ + private void showBanner3(LiveGiftBean bean1) { + btnEvent3.setVisibility(View.VISIBLE); + if (mBannerList3 == null || mBannerList3.size() == 0 || mBanner3 == null || bean1 == null) { + return; + } + mBanner3.setAutoPlay(true) + .setPages(mBannerList3, new Banner3CustomViewHolder()) + .setDelayTime(3000) + .setBannerStyle(BannerConfig.NOT_INDICATOR) + .setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int p) { + if (mBannerList3 != null) { + if (mBannerList3.get(p).getLink().equals("0")) { + if (p == 0) { + ((LiveAudienceActivity) mContext).openGiftWindow("" + bean1.getId(), "1"); + EventBus.getDefault().post("svga_new_user_gif"); + } else if (p == 1) { + EventBus.getDefault().post("svga_new_user_follow"); + } else if (p == 2) { + EventBus.getDefault().post("svga_new_user_double"); + } + } + } + } + }) + .start(); + } + + private int nowTime = 0; + private int openType = 0; + private boolean isClose = false; + private String nums = "0", prankid = "", content = "", name = ""; + private String userNmae = "", anchorName = "", tricksterName = ""; + + + public CountDownTimer countDownTimerTrickery = null; + + /** + * 打开或者关闭整蛊 + */ + public void closeAndOpenTrickery(String msgtype, int time, JSONObject jsonObject) { + nowTime = time; + tv_trickery_time.setText("" + nowTime); + openType = 0; + if ("1".equals(msgtype)) { + nums = jsonObject.getString("nums"); + prankid = jsonObject.getString("prankid"); + content = jsonObject.getString("content"); + name = jsonObject.getString("user_nicename"); + lt_trickery.setVisibility(View.VISIBLE); + lt_trickery.setBackground(mContext.getResources().getDrawable(R.mipmap.img_buoy)); + isClose = false; + starTimeloud(1, time); + } else { + userNmae = jsonObject.getString("hope_nicename"); + anchorName = jsonObject.getString("anchor_nicename"); + tricksterName = jsonObject.getString("content"); + isClose = true; + if (dialog.isShowing()) { + dialog.dismiss(); + } + openType = 2; + showTrickeryDialog(); + } + } + + public void hopeRankTurntable() { + LiveHttpUtil.userHopePrankTurntable(mLiveUid, prankid, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (countDownTimerTrickery != null) { + } + } + }); + } + + private void starTimeloud(int type, int time) { + nowTime = time; + countDownTimerTrickery = new CountDownTimer(time * 1000, 1000) { + @Override + public void onTick(long millisUntilFinished) { + nowTime = nowTime - 1; + if (nowTime < 0) { + if (countDownTimerTrickery != null) { + countDownTimerTrickery.cancel(); + } + nowTime = 0; + } + tv_trickery_time.setText("" + nowTime); + if (isClose) { + countDownTimerTrickery.cancel(); + countDownTimerTrickery = null; + lt_trickery.setVisibility(View.GONE); + } + } + + /** + *倒计时结束后调用的 + */ + @Override + public void onFinish() { + tv_trickery_time.setText("0"); + if (type == 1) { + lt_trickery.setBackground(mContext.getResources().getDrawable(R.mipmap.img_buoy2)); + if (countDownTimerTrickery != null) { + countDownTimerTrickery.cancel(); + countDownTimerTrickery = null; + } + nowTime = 0; + openType = 1; + if (dialog.isShowing()) { + dialog.dismiss(); + } + starTimeloud(2, time); + } else { + lt_trickery.setVisibility(View.GONE); + timeOver(); + } + } + }; + countDownTimerTrickery.start(); + } + + public void timeOver() { + } + + + private Dialog dialog; + + private void showTrickeryDialog() { + dialog.setContentView(R.layout.dialog_trickery); + dialog.setCancelable(true); + dialog.setCanceledOnTouchOutside(true); + + TextView tv_trickster_initiator, tv_trickster_content, tv_trickery_number_zuanshi, tv_username, tv_anchorname, tv_trickster_name; + Button bt_trickster_confirm; + LinearLayout lt_trickster_salvation, lt_trickster_top, lt_trickster, lt_trickster_suc; + lt_trickster_top = (LinearLayout) dialog.findViewById(R.id.lt_trickster_top); + lt_trickster = (LinearLayout) dialog.findViewById(R.id.lt_trickster); + lt_trickster_suc = (LinearLayout) dialog.findViewById(R.id.lt_trickster_suc); + + tv_trickster_initiator = (TextView) dialog.findViewById(R.id.tv_trickster_initiator); + tv_trickster_content = (TextView) dialog.findViewById(R.id.tv_trickster_content); + + tv_trickery_number_zuanshi = (TextView) dialog.findViewById(R.id.tv_trickery_number_zuanshi); + + bt_trickster_confirm = (Button) dialog.findViewById(R.id.bt_trickster_confirm); + lt_trickster_salvation = (LinearLayout) dialog.findViewById(R.id.lt_trickster_salvation); + + tv_trickster_initiator.setText(name); + tv_trickster_content.setText(content); + tv_trickery_number_zuanshi.setText(mContext.getResources().getString(R.string.consume) + nums); + + tv_username = (TextView) dialog.findViewById(R.id.tv_username); + tv_anchorname = (TextView) dialog.findViewById(R.id.tv_anchorname); + tv_trickster_name = (TextView) dialog.findViewById(R.id.tv_trickster_name); + + if (openType == 0) { + lt_trickster_top.setBackground(mContext.getResources().getDrawable(R.mipmap.img_pop_zhengjou)); + lt_trickster_salvation.setVisibility(View.VISIBLE); + bt_trickster_confirm.setVisibility(View.GONE); + bt_trickster_confirm.setText(mContext.getResources().getString(R.string.confirm)); + lt_trickster.setVisibility(View.VISIBLE); + lt_trickster_suc.setVisibility(View.GONE); + } else if (openType == 1) { + lt_trickster_top.setBackground(mContext.getResources().getDrawable(R.mipmap.img_pop_ing)); + lt_trickster_salvation.setVisibility(View.GONE); + bt_trickster_confirm.setVisibility(View.VISIBLE); + lt_trickster.setVisibility(View.VISIBLE); + lt_trickster_suc.setVisibility(View.GONE); + } else if (openType == 2) { + lt_trickster_top.setBackground(mContext.getResources().getDrawable(R.mipmap.img_pop_chenggong)); + lt_trickster_salvation.setVisibility(View.GONE); + bt_trickster_confirm.setVisibility(View.VISIBLE); + bt_trickster_confirm.setText(mContext.getResources().getString(R.string.trickster_thanks)); + lt_trickster.setVisibility(View.GONE); + lt_trickster_suc.setVisibility(View.VISIBLE); + + tv_username.setText(userNmae); + tv_anchorname.setText(anchorName); + tv_trickster_name.setText(tricksterName); + } + bt_trickster_confirm.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dialog.dismiss(); + } + }); + lt_trickster_salvation.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + hopeRankTurntable(); + } + }); + dialog.show(); + } + + @Override public void onDestroy() { super.onDestroy(); @@ -2539,6 +2830,41 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis fastMsgRecyclerView.getLayoutParams(); params1.rightMargin = 0; fastMsgRecyclerView.setLayoutParams(params1); + } else if ("showBanner".equals(str)) { + showBanner3(bean1); + } else if ("stop_svga_new_user_double".equals(str) && mBannerList3.size() > 2) { + + mBannerList3.get(2).setLink("1"); + mBanner3.update(mBannerList3); + if (mBannerList3.get(0).getLink().equals("1")) { + if (mBannerList3.get(1).getLink().equals("1")) { + if (mBannerList3.get(2).getLink().equals("1")) { + btnEvent3.setVisibility(View.GONE); + } + } + } + } else if ("stop_svga_new_user_follow".equals(str) && mBannerList3.size() > 1) { + mBannerList3.get(1).setLink("1"); + + mBanner3.update(mBannerList3); + if (mBannerList3.get(0).getLink().equals("1")) { + if (mBannerList3.get(1).getLink().equals("1")) { + if (mBannerList3.get(2).getLink().equals("1")) { + btnEvent3.setVisibility(View.GONE); + } + } + } + } else if ("stop_new_user_gif".equals(str) && mBannerList3.size() > 0) { + IMLoginManager.get(mContext).setNewUserGif(false); + mBannerList3.get(0).setLink("1"); + mBanner3.update(mBannerList3); + if (mBannerList3.get(0).getLink().equals("1")) { + if (mBannerList3.get(1).getLink().equals("1")) { + if (mBannerList3.get(2).getLink().equals("1")) { + btnEvent3.setVisibility(View.GONE); + } + } + } } } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index d43ba3cdb..5e96ff630 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -1,5 +1,10 @@ package com.yunbao.live.views; +import static com.yunbao.common.CommonAppContext.logger; +import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; +import static com.yunbao.live.views.LivePlayRyViewHolder.Micing; +import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive; + import android.app.Activity; import android.app.Dialog; import android.content.Intent; @@ -26,7 +31,6 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; import com.facebook.appevents.AppEventsLogger; -import com.google.firebase.analytics.FirebaseAnalytics; import com.tencent.imsdk.v2.V2TIMCallback; import com.tencent.imsdk.v2.V2TIMManager; import com.yunbao.common.CommonAppConfig; @@ -98,11 +102,6 @@ import io.rong.imlib.chatroom.base.RongChatRoomClient; import io.rong.imlib.model.Conversation; import io.rong.message.TextMessage; -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; -import static com.yunbao.live.views.LivePlayRyViewHolder.Micing; -import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive; - /** * 竖屏直播间UI逻辑 */ @@ -169,7 +168,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe private List greetings = new ArrayList<>(); private Handler liveHandler = new Handler(); //公共參數 - private OpenParametersModel openParametersModel = null; + private OpenParametersModel openParametersModel = null; public PortraitLiveManager(Activity context, Intent intent) { this.mContext = context; @@ -296,7 +295,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (mLiveAudienceViewHolder != null) { mLiveAudienceViewHolder.removeFromParent(); - mLiveAudienceViewHolder.countDownTimerTrickery = null; mLiveAudienceViewHolder.removeCallbacks(); mLiveAudienceViewHolder.release(); } @@ -329,6 +327,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.removeFromParent(); mLiveRoomViewHolder.clearData(); + mLiveRoomViewHolder.countDownTimerTrickery = null; mLiveRoomViewHolder = null; } if (mLiveEndViewHolder != null) { @@ -961,8 +960,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void prankTurntable(String msgtype, int time, JSONObject jsonObject) { - if (mLiveAudienceViewHolder != null) { - mLiveAudienceViewHolder.closeAndOpenTrickery(msgtype, time, jsonObject); + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.closeAndOpenTrickery(msgtype, time, jsonObject); } } diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index 50220642e..2cbe474d2 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -36,54 +36,6 @@ - - - - - - - - - - - + + + + + + + + + + + + + android:orientation="vertical" + android:visibility="gone"> + android:orientation="vertical" + android:visibility="gone"> @@ -775,6 +827,7 @@ +