高等级入场提示

This commit is contained in:
18401019693 2023-03-27 14:22:29 +08:00
parent 62e2b93bd5
commit 86c5334ab4
17 changed files with 312 additions and 17 deletions

View File

@ -23,7 +23,7 @@ public class NewLevelModel extends BaseModel {
@SerializedName("colour")
private String colour;
@SerializedName("live_icon")
private String liveIcon;
private String liveIcon = "https://downs.yaoulive.com/level1/img_1-9.png";
public static NewLevelModel objectFromData(String str) {

View File

@ -1086,6 +1086,7 @@
<string name="register_and_log_in">註冊並登錄</string>
<string name="enjoy_a_lot">開通貴族,尊享超多特權!</string>
<string name="say_something3">說點什麽吧...</string>
<string name="come_hint">%s 来了</string>

View File

@ -451,7 +451,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
LiveChatBean lvBean = new LiveChatBean();
lvBean.setType(-2);
lvBean.setId(url);
lvBean.setAttention(isattention == 0);
lvBean.setAttention(isattention != 0);
LiveRoomViewHolder.insertChat(lvBean, 1);
Log.i("chatMgs", liveUid + "|" + mLiveUid);
}

View File

@ -6,7 +6,9 @@ import static com.yunbao.live.views.LivePushRyViewHolder.btn_close;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Outline;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
@ -23,7 +25,9 @@ import android.view.ViewOutlineProvider;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -106,6 +110,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.utils.formatBigNum;
import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.common.views.weight.ClipPathCircleImage;
import com.yunbao.common.views.weight.FullServiceNotificationView;
import com.yunbao.common.views.weight.NobleNoticeView;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -148,6 +153,7 @@ import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter;
import com.yunbao.live.presenter.LiveGiftAnimPresenter;
import com.yunbao.live.presenter.LiveLightAnimPresenter;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.utils.LiveTextRender;
import com.yunbao.live.utils.LoadDian9TuUtil;
import org.greenrobot.eventbus.EventBus;
@ -296,12 +302,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private List<BannerBean> mBannerList2 = new ArrayList<>();
private List<BannerBean> mBannerList3 = new ArrayList<>();
private List<BannerBean> mBannerList4 = new ArrayList<>();
private LinearLayout btn_event2, btn_event3, btn_event4;
private LinearLayout btn_event2, btn_event3, btn_event4, enterRoomLeave2;
private ImageView imgEvent;
private View btnEvent;
private LinearLayout lt_trickery;
private TextView tv_trickery_time;
private FrameLayout enterRoomLeave, enterRoomBg;
private RecyclerView fastMsgRecyclerView;
private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter;
@ -684,6 +690,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
imgEvent = (ImageView) findViewById(R.id.img_event);
btn_event2 = (LinearLayout) findViewById(R.id.btn_event2);
btn_event4 = (LinearLayout) findViewById(R.id.btn_event4);
enterRoomLeave = (FrameLayout) findViewById(R.id.enter_room_leave);
enterRoomBg = (FrameLayout) findViewById(R.id.enter_room_bg);
enterRoomLeave2 = (LinearLayout) findViewById(R.id.enter_room_leave2);
mBanner1 = (Banner) findViewById(R.id.banner1);
time = (TextView) findViewById(R.id.time);
mBanner2 = (Banner) findViewById(R.id.banner2);
@ -1241,6 +1250,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mBannerList4.clear();
updataCleanMic();
initStarChallengeStatus();
enterRoomLeave.setVisibility(View.GONE);
}
public void clearChat() {
@ -3464,8 +3474,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
.start();
}
/**
* 新版UI隐藏活动轮播入口
*/
private void showBanner4() {
btn_event4.setVisibility(View.VISIBLE);
btn_event4.setVisibility(View.GONE);
if (mBannerList4 == null || mBannerList4.size() == 0 || mBanner4 == null) {
return;
}
@ -4211,14 +4224,113 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void changeMessageLandscape(int landscape) {
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
mChatRecyclerView.getLayoutParams();
RelativeLayout.LayoutParams enterRoomParams = (RelativeLayout.LayoutParams) enterRoomLeave.getLayoutParams();
if (landscape == 2) {
params1.height = DpUtil.dp2px(200);
enterRoomParams.bottomMargin = -DpUtil.dp2px(65);
} else {
params1.height = DpUtil.dp2px(310);
enterRoomParams.bottomMargin = -DpUtil.dp2px(70);
}
mChatRecyclerView.setLayoutParams(params1);
enterRoomLeave.setLayoutParams(enterRoomParams);
}
public void showHighGrade(LiveUserGiftBean model) {
ImageView imageView = (ImageView) findViewById(R.id.image_view);
ClipPathCircleImage imageAvatar = (ClipPathCircleImage) findViewById(R.id.image_avatar);
TextView userName = (TextView) findViewById(R.id.user_name);
userName.setText(String.format(mContext.getString(R.string.come_hint), model.getUserNiceName()));
ImgLoader.display(mContext, model.getAvatar(), imageAvatar);
int level = model.getLevel();
if (level < 50) {
enterRoomLeave.setBackgroundResource(R.drawable.background_30);
enterRoomLeave2.setBackgroundResource(R.drawable.bg_30_leave);
} else if (level > 49 && level < 60) {
enterRoomLeave.setBackgroundResource(R.drawable.background_50);
enterRoomLeave2.setBackgroundResource(R.drawable.bg_50_leave);
} else if (level > 59 && level < 80) {
enterRoomLeave.setBackgroundResource(R.drawable.background_60);
enterRoomLeave2.setBackgroundResource(R.drawable.bg_60_leave);
} else if (level > 79 && level < 90) {
enterRoomLeave.setBackgroundResource(R.drawable.background_80);
enterRoomLeave2.setBackgroundResource(R.drawable.bg_80_leave);
} else if (level > 99) {
enterRoomLeave.setBackgroundResource(R.drawable.background_100);
enterRoomLeave2.setBackgroundResource(R.drawable.bg_100_leave);
}
new LiveTextRender().getLiveLevelImage(mContext, model.getLevel(), new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
ImgLoader.display2(mContext, drawable, imageView);
}
@Override
public void onLoadFailed() {
}
});
enterRoomLeave.post(() -> {
enterRoomLeave.setVisibility(View.VISIBLE);
TranslateAnimation animationTranslate = new TranslateAnimation(enterRoomLeave.getMeasuredWidth(), 0, 0, 0);
AnimationSet animationSet1 = new AnimationSet(true);
animationSet1.addAnimation(animationTranslate);
animationSet1.setFillAfter(true);
animationSet1.setDuration(500);
animationSet1.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
enterRoomLeave.startAnimation(animationSet1);
});
}
/**
* 隐藏高等级入场提示
*/
public void hideHighGrade() {
if (enterRoomLeave.getVisibility() == View.GONE) return;
TranslateAnimation animationTranslate = new TranslateAnimation(0, -(enterRoomLeave.getMeasuredWidth() + DpUtil.dp2px(6)), 0, 0);
AnimationSet animationSet1 = new AnimationSet(true);
animationSet1.addAnimation(animationTranslate);
animationSet1.setFillAfter(true);
animationSet1.setDuration(100);
animationSet1.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
enterRoomLeave.setVisibility(View.GONE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
enterRoomLeave.startAnimation(animationSet1);
}
}

View File

@ -203,6 +203,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
ininView();
}
/**
* 初始化布局
*/
@ -249,6 +250,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public void run() {
loading.setVisibility(View.GONE);
enterRoomLeaveHandler.post(enterRoomLeaveRunnable);
}
};
@ -335,7 +337,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
});
mLiveRoomViewHolder.resetView();
enterRoomModel.clear();
enterRoomLeaveHandler.removeCallbacks(enterRoomLeaveRunnable);
mLiveRoomViewHolder.setAvatar(data.getAvatar());
mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor());
mLiveRoomViewHolder.setName(data.getUserNiceName());
@ -410,13 +413,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.setAnchorGoodNumber(data.getLiveInfo().getGoodnum());
List<BannerBean> bannerBeans = new ArrayList<>();
//心愿单
if (data.getWishList().getWishList().size() > 0) {
BannerBean bannerModel = new BannerBean();
bannerModel.setShow_type("2");
bannerModel.setLink(CommonAppConfig.HOST + "/index.php");
bannerModel.setImageUrl(data.getWishList().getImg());
bannerBeans.add(bannerModel);
}
// if (data.getWishList().getWishList().size() > 0) {
// BannerBean bannerModel = new BannerBean();
// bannerModel.setShow_type("2");
// bannerModel.setLink(CommonAppConfig.HOST + "/index.php");
// bannerModel.setImageUrl(data.getWishList().getImg());
// bannerBeans.add(bannerModel);
// }
//活动列表
if (data.getLiveRoomActivityModels().size() > 0) {
@ -1005,15 +1008,54 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
}
//高等级用户进入房间排序列表
private List<LiveUserGiftBean> enterRoomModel = new ArrayList<>();
private Handler enterRoomLeaveHandler = new Handler();
private Runnable enterRoomLeaveRunnable = new Runnable() {
@Override
public void run() {
if (enterRoomModel.size() > 0) {
if (mLiveRoomViewHolder != null) {
LiveUserGiftBean model = enterRoomModel.get(0);
mLiveRoomViewHolder.showHighGrade(model);
enterRoomModel.remove(0);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mLiveRoomViewHolder.hideHighGrade();
enterRoomLeaveHandler.post(enterRoomLeaveRunnable);
}
}, 3000);
}
} else {
enterRoomLeaveHandler.postDelayed(enterRoomLeaveRunnable, 200);
}
}
};
@Override
public void onEnterRoom(LiveEnterRoomBean bean) {
if (mLiveRoomViewHolder != null) {
if (!bean.getUserBean().getCar().getWords().equals("")) {
bean.getLiveChatBean().setContent(bean.getUserBean().getCar().getWords());
}
mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1);
mLiveRoomViewHolder.onEnterRoom(bean);
LiveChatBean liveChatBean = bean.getLiveChatBean();
LiveUserGiftBean liveUserGiftBean = bean.getUserBean();
int level = liveUserGiftBean.getLevel();
if (level >= 10) {
//高等级飘屏
liveUserGiftBean.setUserNiceName(liveChatBean.getUserNiceName());
enterRoomModel.add(liveUserGiftBean);
} else {
mLiveRoomViewHolder.insertChat(liveChatBean, 1);
}
}
//
}
@Override

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="12dp" />
<solid android:color="#36FF7C33" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="12dp" />
<solid android:color="#107733FF" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="12dp" />
<solid android:color="#13A533FF" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="12dp" />
<solid android:color="#16FFA133" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="12dp" />
<solid android:color="#15F98C4F" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="12dp"/>
<gradient
android:startColor="#27FF3F33"
android:endColor="#45FB8560"
android:angle="0"/>
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="12dp"/>
<gradient
android:startColor="#1033DDFF"
android:endColor="#00548CFF"
android:angle="0"/>
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="12dp"/>
<gradient
android:startColor="#10D117FF"
android:endColor="#297654FF"
android:angle="0"/>
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="12dp"/>
<gradient
android:startColor="#16FFAD33"
android:endColor="#16FF8754"
android:angle="0"/>
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="12dp"/>
<gradient
android:startColor="#36EA882E"
android:endColor="#26FF7D54"
android:angle="0"/>
</shape>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/enter_room_bg"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/enter_room_leave2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="6dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/image_view"
android:layout_width="18dp"
android:layout_height="18dp"
android:scaleType="centerCrop" />
<com.yunbao.common.views.weight.ClipPathCircleImage
android:id="@+id/image_avatar"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginStart="4dp"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="6dp"
android:text="@string/come_hint"
android:textColor="#fff"
android:textSize="10sp" />
</LinearLayout>
</FrameLayout>

View File

@ -6,7 +6,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="45dp"
android:paddingTop="15dp">
@ -215,7 +214,15 @@
</LinearLayout>
<include
android:id="@+id/enter_room_leave"
layout="@layout/view_enter_room_leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/chat_recyclerView"
android:layout_marginStart="3dp"
android:layout_marginBottom="-350dp"
android:visibility="gone" />
</RelativeLayout>
<FrameLayout