fix:修复新人任务与整蛊无法点击的问题

fix:修复新人任务与整蛊被遮挡问题
update:将view_live_audience.xml的banner转移至view_live_room.lxml
This commit is contained in:
zlzw 2022-09-06 14:14:15 +08:00
parent cc92c3b04e
commit ff6fb98a8e
7 changed files with 517 additions and 481 deletions

View File

@ -1,9 +1,9 @@
package com.yunbao.live.presenter; package com.yunbao.live.presenter;
import android.Manifest; import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.graphics.Outline;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@ -14,7 +14,6 @@ import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import android.widget.TextView; import android.widget.TextView;
@ -26,10 +25,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.facebook.appevents.AppEventsLogger; import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics; 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.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.bean.BannerBean; 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.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.ClickUtil; import com.yunbao.common.utils.ClickUtil;
import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
@ -111,12 +105,10 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
private View btnWishList; private View btnWishList;
private View btnTurnTable; private View btnTurnTable;
private View btnEvent3;
private View btn_onecz_event; private View btn_onecz_event;
private String eventUrl; private String eventUrl;
// //
public Banner mBanner3;
private List<BannerBean> mBannerList1 = new ArrayList<>(); private List<BannerBean> mBannerList1 = new ArrayList<>();
private List<BannerBean> mBannerList3 = new ArrayList<>(); private List<BannerBean> mBannerList3 = new ArrayList<>();
@ -130,45 +122,11 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) { public void onUpdata(String str) {
if ("showBanner".equals(str)) { if ("stop_svga_new_user_double1".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)) {
AdjustEvent adjustEvent1 = new AdjustEvent("80lzdi"); AdjustEvent adjustEvent1 = new AdjustEvent("80lzdi");
Adjust.trackEvent(adjustEvent1); Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("80lzdi", new HttpCallback() { CommonHttpUtil.setAdvertisingChannels("80lzdi", new HttpCallback() {
@SuppressLint("MissingPermission")
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0) { if (code == 0) {
@ -180,6 +138,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
AdjustEvent adjustEvent2 = new AdjustEvent("6va52i"); AdjustEvent adjustEvent2 = new AdjustEvent("6va52i");
Adjust.trackEvent(adjustEvent2); Adjust.trackEvent(adjustEvent2);
CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() { CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() {
@SuppressLint("MissingPermission")
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0) { if (code == 0) {
@ -193,6 +152,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
AdjustEvent adjustEvent1 = new AdjustEvent("f084wh"); AdjustEvent adjustEvent1 = new AdjustEvent("f084wh");
Adjust.trackEvent(adjustEvent1); Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("f084wh", new HttpCallback() { CommonHttpUtil.setAdvertisingChannels("f084wh", new HttpCallback() {
@SuppressLint("MissingPermission")
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0) { if (code == 0) {
@ -204,6 +164,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
AdjustEvent adjustEvent2 = new AdjustEvent("6va52i"); AdjustEvent adjustEvent2 = new AdjustEvent("6va52i");
Adjust.trackEvent(adjustEvent2); Adjust.trackEvent(adjustEvent2);
CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() { CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() {
@SuppressLint("MissingPermission")
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0) { if (code == 0) {
@ -217,6 +178,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
AdjustEvent adjustEvent1 = new AdjustEvent("aqqz70"); AdjustEvent adjustEvent1 = new AdjustEvent("aqqz70");
Adjust.trackEvent(adjustEvent1); Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("aqqz70", new HttpCallback() { CommonHttpUtil.setAdvertisingChannels("aqqz70", new HttpCallback() {
@SuppressLint("MissingPermission")
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0) { if (code == 0) {
@ -228,6 +190,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
AdjustEvent adjustEvent2 = new AdjustEvent("6va52i"); AdjustEvent adjustEvent2 = new AdjustEvent("6va52i");
Adjust.trackEvent(adjustEvent2); Adjust.trackEvent(adjustEvent2);
CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() { CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() {
@SuppressLint("MissingPermission")
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0) { if (code == 0) {
@ -263,49 +226,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
toast.show(); toast.show();
} }
class MyCustomViewHolder implements BannerViewHolder<BannerBean> {
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) { public LiveLinkMicPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, int liveSdk, View root) {
mContext = context; mContext = context;
@ -324,18 +245,8 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
btnWishList.setOnClickListener(this); btnWishList.setOnClickListener(this);
btnTurnTable.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 bannerBean = new BannerBean();
bannerBean.setImageUrl("https://downs.yaoulive.com/img/BTN_WEEKSTAR%20%281%29.png"); 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); 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); 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() { private void getEvent() {

View File

@ -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<BannerBean> {
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;
}
}

View File

@ -2,13 +2,11 @@ package com.yunbao.live.views;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler; import android.os.Handler;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
@ -17,14 +15,11 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ViewFlipper; import android.widget.ViewFlipper;
import com.alibaba.fastjson.JSONObject;
import com.opensource.svgaplayer.SVGACallback; import com.opensource.svgaplayer.SVGACallback;
import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView; 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.LiveMicUserDialogFragment;
import com.yunbao.live.dialog.LivePromotionDialogFragment; import com.yunbao.live.dialog.LivePromotionDialogFragment;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.http.LiveHttpUtil;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -73,8 +67,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
private String mLiveUid; private String mLiveUid;
private String mStream; private String mStream;
private String url; private String url;
private LinearLayout lt_trickery;
private TextView tv_trickery_time;
private View v_msg_redpoint, stationHornBanner; private View v_msg_redpoint, stationHornBanner;
private Activity context; private Activity context;
private SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow, svga_station_horn; 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 int icon = 0;
private String nobleName, nobleTtext; private String nobleName, nobleTtext;
private ImageView giftImage, liveNewPeople; private ImageView giftImage, liveNewPeople;
private String newPeopleUrl=null; private String newPeopleUrl = null;
public LiveAudienceViewHolder(Context context, ViewGroup parentView) { public LiveAudienceViewHolder(Context context, ViewGroup parentView) {
super(context, parentView); super(context, parentView);
@ -242,11 +234,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
}); });
findViewById(R.id.btn_more).setOnClickListener(this); 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); v_msg_redpoint = (View) findViewById(R.id.v_msg_redpoint);
//获取系统未读消息 //获取系统未读消息
@ -343,8 +330,8 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
public void removeCallbacks() { public void removeCallbacks() {
handler .removeCallbacks(runnable); handler.removeCallbacks(runnable);
handler .removeCallbacks(runnable1); handler.removeCallbacks(runnable1);
} }
public void setLiveInfo(String liveUid, String stream, String urls, int isattention) { public void setLiveInfo(String liveUid, String stream, String urls, int isattention) {
@ -368,7 +355,8 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
}, 10000);//3秒后执行Runnable中的run方法 }, 10000);//3秒后执行Runnable中的run方法
getNewPeopleInfo(); getNewPeopleInfo();
} }
public void getNewPeopleInfo(){
public void getNewPeopleInfo() {
API.get().pdLiveApi(mContext) API.get().pdLiveApi(mContext)
.getNewPeopleInfo() .getNewPeopleInfo()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
@ -377,9 +365,9 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
NewPeopleInfo peopleInfo = stringResponseModel.getData().getInfo(); NewPeopleInfo peopleInfo = stringResponseModel.getData().getInfo();
if (peopleInfo.getIsShow()) { if (peopleInfo.getIsShow()) {
liveNewPeople.setVisibility(View.VISIBLE); liveNewPeople.setVisibility(View.VISIBLE);
if (peopleInfo.getLink().startsWith("http")){ if (peopleInfo.getLink().startsWith("http")) {
newPeopleUrl=peopleInfo.getLink()+"?"; newPeopleUrl = peopleInfo.getLink() + "?";
}else { } else {
newPeopleUrl = CommonAppConfig.HOST + "/" + peopleInfo.getLink(); newPeopleUrl = CommonAppConfig.HOST + "/" + peopleInfo.getLink();
} }
} }
@ -404,15 +392,12 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
} else if (i == R.id.btn_gift) { } else if (i == R.id.btn_gift) {
openGiftWindow(); openGiftWindow();
//全屏 //全屏
} else if (i == R.id.btn_more) { } else if (i == R.id.btn_more) {
((LiveActivity) mContext).openMoreWindow(); ((LiveActivity) mContext).openMoreWindow();
} else if (i == R.id.btn_zg) { } else if (i == R.id.btn_zg) {
openZGListWindow(); openZGListWindow();
} else if (i == R.id.lt_trickery) { } else if (i == R.id.live_new_people) {
showTrickeryDialog();
}else if (i==R.id.live_new_people){
openNewPeopleDialog(); openNewPeopleDialog();
} }
@ -421,9 +406,9 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
/** /**
* 打开新人特惠对话框 * 打开新人特惠对话框
*/ */
private void openNewPeopleDialog(){ private void openNewPeopleDialog() {
Bundle bundle=new Bundle(); Bundle bundle = new Bundle();
String url= newPeopleUrl+"&g=Appapi&m=Turntable&a=tricky"; String url = newPeopleUrl + "&g=Appapi&m=Turntable&a=tricky";
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
bundle.putString("url", url); bundle.putString("url", url);
@ -448,174 +433,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); 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) @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)

View File

@ -5,6 +5,7 @@ import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.graphics.Outline; import android.graphics.Outline;
import android.os.Bundle; import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.os.SystemClock; import android.os.SystemClock;
@ -18,6 +19,7 @@ import android.view.ViewOutlineProvider;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -55,6 +57,7 @@ import com.yunbao.common.Constants;
import com.yunbao.common.bean.BannerBean; import com.yunbao.common.bean.BannerBean;
import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.HourRank;
import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.API; 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.http.HttpCallback;
import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DeviceUtils; import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
@ -255,12 +259,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public WindowManager windowManager; public WindowManager windowManager;
// public boolean isRy = false; // public boolean isRy = false;
private Banner mBanner1, mBanner2; private Banner mBanner1, mBanner2, mBanner3;
private List<BannerBean> mBannerList1 = new ArrayList<>(); private List<BannerBean> mBannerList1 = new ArrayList<>();
private List<BannerBean> mBannerList2 = new ArrayList<>(); private List<BannerBean> mBannerList2 = new ArrayList<>();
private List<BannerBean> mBannerList3 = new ArrayList<>();
private LinearLayout btn_event2; private LinearLayout btn_event2;
private ImageView imgEvent; private ImageView imgEvent;
private View btnEvent; private View btnEvent;
private View btnEvent3;
private LinearLayout lt_trickery;
private TextView tv_trickery_time;
private RecyclerView fastMsgRecyclerView; private RecyclerView fastMsgRecyclerView;
private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter; private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter;
@ -596,11 +605,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void init() { public void init() {
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
btnEvent = findViewById(R.id.btn_event); btnEvent = findViewById(R.id.btn_event);
btnEvent3 = findViewById(R.id.btn_event3);
imgEvent = (ImageView) findViewById(R.id.img_event); imgEvent = (ImageView) findViewById(R.id.img_event);
btn_event2 = (LinearLayout) findViewById(R.id.btn_event2); btn_event2 = (LinearLayout) findViewById(R.id.btn_event2);
mBanner1 = (Banner) findViewById(R.id.banner1); mBanner1 = (Banner) findViewById(R.id.banner1);
time = (TextView) findViewById(R.id.time); time = (TextView) findViewById(R.id.time);
mBanner2 = (Banner) findViewById(R.id.banner2); mBanner2 = (Banner) findViewById(R.id.banner2);
mBanner3 = (Banner) findViewById(R.id.banner3);
pkText1 = (TextView) findViewById(R.id.pk_text1); pkText1 = (TextView) findViewById(R.id.pk_text1);
pkText2 = (TextView) findViewById(R.id.pk_text2); pkText2 = (TextView) findViewById(R.id.pk_text2);
pkText3 = (TextView) findViewById(R.id.pk_text3); 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); msg2 = (View) findViewById(R.id.room_msg_user);
msgNumber = (TextView) findViewById(R.id.room_msg_num); msgNumber = (TextView) findViewById(R.id.room_msg_num);
msgUserIcon = (RoundedImageView) findViewById(R.id.room_msg_user_icon); 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(msg, this::openChatWindow);
ViewClicksAntiShake.clicksAntiShake(msg2, 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); msgLayout.setVisibility(View.GONE);
} }
@ -737,7 +753,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
gif_view = (LinearLayout) findViewById(R.id.gif_view); gif_view = (LinearLayout) findViewById(R.id.gif_view);
chat_view = (RelativeLayout) findViewById(R.id.chat_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) RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)
chat_view.getLayoutParams(); chat_view.getLayoutParams();
params.topMargin = topMargin; params.topMargin = topMargin;
@ -745,7 +761,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
RelativeLayout.LayoutParams msgLayoutLayoutParams = (RelativeLayout.LayoutParams) msgLayout.getLayoutParams(); RelativeLayout.LayoutParams msgLayoutLayoutParams = (RelativeLayout.LayoutParams) msgLayout.getLayoutParams();
msgLayoutLayoutParams.topMargin=topMargin+DpUtil.dp2px(50); msgLayoutLayoutParams.topMargin = topMargin + DpUtil.dp2px(50);
msgLayout.setLayoutParams(msgLayoutLayoutParams); msgLayout.setLayoutParams(msgLayoutLayoutParams);
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) 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); 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 = (RecyclerView) findViewById(R.id.room_fast_msg);
fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false)); fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
@ -915,12 +937,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
findViewById(R.id.open_sidebar).setVisibility(View.GONE); findViewById(R.id.open_sidebar).setVisibility(View.GONE);
findViewById(R.id.btn_follow).setVisibility(View.GONE); findViewById(R.id.btn_follow).setVisibility(View.GONE);
} }
reloadIM();
configBanner3();
} }
private void showBanner2() { private void showBanner2() {
if (mBannerList2 == null || mBannerList2.size() == 0 || mBanner2 == null) { if (mBannerList2 == null || mBannerList2.size() == 0 || mBanner2 == null) {
return; return;
} }
btn_event2.setVisibility(View.VISIBLE);
if (mBannerList2.size() == 1) { if (mBannerList2.size() == 1) {
mBanner2.setAutoPlay(false) mBanner2.setAutoPlay(false)
.setPages(mBannerList2, new CustomViewHolder()) .setPages(mBannerList2, new CustomViewHolder())
@ -976,7 +1001,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}) })
.start(); .start();
} }
reloadIM();
} }
/** /**
@ -985,7 +1009,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
changeMsgView(msg2,msg); changeMsgView(msg2, msg);
reloadIM(); reloadIM();
} }
@ -1680,24 +1704,27 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} else if (i == R.id.user_guard) { } else if (i == R.id.user_guard) {
// ((LiveActivity) mContext).openUserMoreListWindow(2, true); // ((LiveActivity) mContext).openUserMoreListWindow(2, true);
((LiveActivity) mContext).openNewGuardListWindow(); ((LiveActivity) mContext).openNewGuardListWindow();
} else if (i==R.id.room_msg){ } else if (i == R.id.room_msg) {
changeMsgView(msg,msg2); changeMsgView(msg, msg2);
}else if (i==R.id.room_msg_user){ } else if (i == R.id.room_msg_user) {
changeMsgView(msg2,msg); changeMsgView(msg2, msg);
} else if (i == R.id.lt_trickery) {
showTrickeryDialog();
} }
} }
/** /**
* 私信的切换动画 * 私信的切换动画
*
* @param out 隐去的view * @param out 隐去的view
* @param in 展示的view * @param in 展示的view
*/ */
private void changeMsgView(View out,View in){ private void changeMsgView(View out, View in) {
if(in.getVisibility()==View.VISIBLE){ if (in.getVisibility() == View.VISIBLE) {
return; 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() { animation.setAnimationListener(new Animation.AnimationListener() {
@Override @Override
public void onAnimationStart(Animation animation) { public void onAnimationStart(Animation animation) {
@ -1716,7 +1743,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
}); });
out.startAnimation(animation); 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() { start.setAnimationListener(new Animation.AnimationListener() {
@Override @Override
public void onAnimationStart(Animation animation) { 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(); /*LiveChatListDialogFragment chat=new LiveChatListDialogFragment();
chat.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoomChatDialogFragment");*/ chat.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoomChatDialogFragment");*/
((LiveActivity) mContext).openChatListWindow(); ((LiveActivity) mContext).openChatListWindow();
@ -1748,16 +1775,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
/** /**
* 更新左上角数标 * 更新左上角数标
*
* @param number 数字 * @param number 数字
*/ */
public void onMessageIMEvent(int number) { public void onMessageIMEvent(int number) {
String num=""; String num = "";
if(number!=0){ if (number != 0) {
changeMsgView(msg,msg2); changeMsgView(msg, msg2);
if(number>99){ if (number > 99) {
num="99+"; num = "99+";
}else{ } else {
num=number+""; num = number + "";
} }
msgNumber.setText(num); msgNumber.setText(num);
} }
@ -1766,26 +1794,26 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
/** /**
* 刷新im消息以便更新私信悬浮窗UI * 刷新im消息以便更新私信悬浮窗UI
*/ */
public void reloadIM(){ public void reloadIM() {
RongIMClient.getInstance().getConversationListByPage(new RongIMClient.ResultCallback<List<Conversation>>() { RongIMClient.getInstance().getConversationListByPage(new RongIMClient.ResultCallback<List<Conversation>>() {
@Override @Override
public void onSuccess(List<Conversation> conversations) { public void onSuccess(List<Conversation> conversations) {
if(conversations!=null&&!conversations.isEmpty()){ if (conversations != null && !conversations.isEmpty()) {
Conversation conversation = conversations.get(0); Conversation conversation = conversations.get(0);
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(conversation.getTargetId()); UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(conversation.getTargetId());
if(userInfo!=null){ if (userInfo != null) {
ImgLoader.display(mContext,userInfo.getPortraitUri().toString(),msgUserIcon); ImgLoader.display(mContext, userInfo.getPortraitUri().toString(), msgUserIcon);
} }
} }
} }
@Override @Override
public void onError(RongIMClient.ErrorCode errorCode) { public void onError(RongIMClient.ErrorCode errorCode) {
Log.e("IM","IM会话获取失败 = "+errorCode); Log.e("IM", "IM会话获取失败 = " + errorCode);
} }
},0,10, Conversation.ConversationType.PRIVATE); }, 0, 10, Conversation.ConversationType.PRIVATE);
RongIMClient.getInstance().getUnreadCount(new Conversation.ConversationType[]{Conversation.ConversationType.PRIVATE},true,new RongIMClient.ResultCallback<Integer>() { RongIMClient.getInstance().getUnreadCount(new Conversation.ConversationType[]{Conversation.ConversationType.PRIVATE}, true, new RongIMClient.ResultCallback<Integer>() {
@Override @Override
public void onSuccess(Integer integer) { public void onSuccess(Integer integer) {
onMessageIMEvent(integer); onMessageIMEvent(integer);
@ -1803,9 +1831,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 私信来消息了刷新悬浮窗UI * 私信来消息了刷新悬浮窗UI
*/ */
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void sendMessage(io.rong.imlib.model.Message bean){ public void sendMessage(io.rong.imlib.model.Message bean) {
reloadIM(); 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 @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
@ -2539,6 +2830,41 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
fastMsgRecyclerView.getLayoutParams(); fastMsgRecyclerView.getLayoutParams();
params1.rightMargin = 0; params1.rightMargin = 0;
fastMsgRecyclerView.setLayoutParams(params1); 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);
}
}
}
} }
} }

View File

@ -1,5 +1,10 @@
package com.yunbao.live.views; 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.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
@ -26,7 +31,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils; import com.blankj.utilcode.util.GsonUtils;
import com.facebook.appevents.AppEventsLogger; import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.tencent.imsdk.v2.V2TIMCallback; import com.tencent.imsdk.v2.V2TIMCallback;
import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMManager;
import com.yunbao.common.CommonAppConfig; 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.imlib.model.Conversation;
import io.rong.message.TextMessage; 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逻辑 * 竖屏直播间UI逻辑
*/ */
@ -296,7 +295,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (mLiveAudienceViewHolder != null) { if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeFromParent(); mLiveAudienceViewHolder.removeFromParent();
mLiveAudienceViewHolder.countDownTimerTrickery = null;
mLiveAudienceViewHolder.removeCallbacks(); mLiveAudienceViewHolder.removeCallbacks();
mLiveAudienceViewHolder.release(); mLiveAudienceViewHolder.release();
} }
@ -329,6 +327,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.removeFromParent(); mLiveRoomViewHolder.removeFromParent();
mLiveRoomViewHolder.clearData(); mLiveRoomViewHolder.clearData();
mLiveRoomViewHolder.countDownTimerTrickery = null;
mLiveRoomViewHolder = null; mLiveRoomViewHolder = null;
} }
if (mLiveEndViewHolder != null) { if (mLiveEndViewHolder != null) {
@ -961,8 +960,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override @Override
public void prankTurntable(String msgtype, int time, JSONObject jsonObject) { public void prankTurntable(String msgtype, int time, JSONObject jsonObject) {
if (mLiveAudienceViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveAudienceViewHolder.closeAndOpenTrickery(msgtype, time, jsonObject); mLiveRoomViewHolder.closeAndOpenTrickery(msgtype, time, jsonObject);
} }
} }

View File

@ -36,54 +36,6 @@
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/lt_trickery"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_marginBottom="18dp"
android:background="@mipmap/img_buoy"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/tv_trickery_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="9dp"
android:text="60"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_event3"
android:layout_width="67dp"
android:layout_height="90dp"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_marginBottom="88dp"
android:background="@mipmap/live_mission_box"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<com.ms.banner.Banner
android:id="@+id/banner3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
app:delay_time="5000"
app:indicator_height="8dp"
app:indicator_width="8dp" />
</LinearLayout>
<LinearLayout <LinearLayout

View File

@ -12,20 +12,71 @@
<LinearLayout <LinearLayout
android:id="@+id/bannerLayout" android:id="@+id/bannerLayout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="216dp" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:gravity="bottom"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:id="@+id/lt_trickery"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_gravity="right"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@mipmap/img_buoy"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/tv_trickery_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="9dp"
android:text="60"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_event3"
android:layout_width="67dp"
android:layout_height="90dp"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:background="@mipmap/live_mission_box"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<com.ms.banner.Banner
android:id="@+id/banner3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
app:delay_time="5000"
app:indicator_height="8dp"
app:indicator_width="8dp" />
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/btn_event1" android:id="@+id/btn_event1"
android:layout_width="68dp" android:layout_width="68dp"
android:layout_height="68dp" android:layout_height="68dp"
android:layout_gravity="right" android:layout_gravity="right"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:layout_marginBottom="18dp" android:layout_marginBottom="5dp"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"> android:orientation="vertical"
android:visibility="gone">
<com.ms.banner.Banner <com.ms.banner.Banner
android:id="@+id/banner1" android:id="@+id/banner1"
@ -44,9 +95,10 @@
android:layout_height="80dp" android:layout_height="80dp"
android:layout_gravity="right" android:layout_gravity="right"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:layout_marginBottom="45dp" android:layout_marginBottom="25dp"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"> android:orientation="vertical"
android:visibility="gone">
<com.ms.banner.Banner <com.ms.banner.Banner
android:id="@+id/banner2" android:id="@+id/banner2"
@ -745,9 +797,9 @@
android:id="@+id/room_msg" android:id="@+id/room_msg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:layout_marginStart="5dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -765,8 +817,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="right"
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:gravity="right"
android:text="@string/room_msg" android:text="@string/room_msg"
android:textColor="#99ffffff" android:textColor="#99ffffff"
android:textSize="12sp" /> android:textSize="12sp" />
@ -775,6 +827,7 @@
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/chat_view" android:id="@+id/chat_view"
android:layout_width="match_parent" android:layout_width="match_parent"