新增直播间冠名礼物特效
This commit is contained in:
@@ -57,6 +57,7 @@ public class LiveReceiveGiftBean extends BaseModel {
|
||||
private boolean isBlindBox = false;
|
||||
private String namingLiveuid;
|
||||
private String namingUid;
|
||||
private String naming_user_id;
|
||||
private String namingLiveName;
|
||||
private String namingUserName;
|
||||
private String namingLiveAvatar;
|
||||
@@ -89,6 +90,14 @@ public class LiveReceiveGiftBean extends BaseModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNaming_user_id() {
|
||||
return naming_user_id;
|
||||
}
|
||||
|
||||
public void setNaming_user_id(String naming_user_id) {
|
||||
this.naming_user_id = naming_user_id;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
@@ -14,10 +15,15 @@ import android.view.animation.Animation;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.ScaleAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.AbsViewHolder;
|
||||
import com.yunbao.live.R;
|
||||
@@ -31,7 +37,10 @@ import com.yunbao.live.utils.LiveTextRender;
|
||||
|
||||
public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
|
||||
private View mRoot, root_back;
|
||||
private View mRoot;
|
||||
private SVGAImageView root_back;
|
||||
private SVGAImageView giftNamingIcon;
|
||||
private LinearLayout contentLayout;
|
||||
private View mBg;
|
||||
private View mStar;
|
||||
private ImageView mAvatar;
|
||||
@@ -41,7 +50,6 @@ public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
private TextView mGiftCount;
|
||||
private TextView mGiftGroupCount;
|
||||
private TextView mMulSign;//乘号
|
||||
private ImageView giftNamingIcon;
|
||||
private int mDp214;
|
||||
private ObjectAnimator mAnimator;
|
||||
private Animation mAnimation;//礼物数字执行的放大动画
|
||||
@@ -64,7 +72,8 @@ public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
@Override
|
||||
public void init() {
|
||||
mRoot = findViewById(R.id.root);
|
||||
root_back = findViewById(R.id.root_back);
|
||||
View namingView = LayoutInflater.from(mContext).inflate(R.layout.view_whole_station_horn, null, false);
|
||||
root_back = (SVGAImageView) findViewById(R.id.root_back_naming);
|
||||
mBg = findViewById(R.id.bg);
|
||||
mStar = findViewById(R.id.star);
|
||||
mAvatar = (ImageView) findViewById(R.id.avatar);
|
||||
@@ -74,7 +83,8 @@ public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
mGiftCount = (TextView) findViewById(R.id.gift_count);
|
||||
mGiftGroupCount = (TextView) findViewById(R.id.gift_group_count);
|
||||
mMulSign = (TextView) findViewById(R.id.mul_sign);
|
||||
giftNamingIcon = (ImageView) findViewById(R.id.gift_naming_icon);
|
||||
giftNamingIcon = (SVGAImageView) findViewById(R.id.gift_naming_icon);
|
||||
contentLayout = (LinearLayout) findViewById(R.id.content_layout);
|
||||
mDp214 = DpUtil.dp2px(214);
|
||||
mHandler = new Handler() {
|
||||
@Override
|
||||
@@ -151,6 +161,8 @@ public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
}
|
||||
if (!isSameUser) {
|
||||
ImgLoader.displayAvatar(mContext, bean.getAvatar(), mAvatar);
|
||||
|
||||
|
||||
mName.setText(bean.getUserNiceName());
|
||||
lian = false;
|
||||
}
|
||||
@@ -168,8 +180,17 @@ public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
if (mGiftCount != null && mGiftCount.getVisibility() == View.VISIBLE) {
|
||||
mGiftCount.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if (mAnimator != null) {
|
||||
mAnimator.start();
|
||||
if(bean.getUid().equals(bean.getNaming_user_id())){
|
||||
if (mStar != null && mStar.getVisibility() != View.VISIBLE) {
|
||||
mStar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (mHandler != null) {
|
||||
mHandler.sendEmptyMessageDelayed(0, 200);
|
||||
}
|
||||
}else{
|
||||
if (mAnimator != null) {
|
||||
mAnimator.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lian) {
|
||||
@@ -181,19 +202,45 @@ public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
mGiftCount.setText(new LiveTextRender().renderGiftCount(mLianCount));
|
||||
}
|
||||
mLastGiftKey = bean.getKey();
|
||||
if (!TextUtils.isEmpty(bean.getNamingLiveuid()) &&
|
||||
!TextUtils.isEmpty(bean.getNamingUid()) &&
|
||||
!TextUtils.equals(bean.getNamingLiveuid(), "0") &&
|
||||
!TextUtils.equals(bean.getNamingUid(), "0")) {
|
||||
giftNamingIcon.setVisibility(View.VISIBLE);
|
||||
root_back.setBackgroundResource(R.mipmap.icon_live_gift_anim_11);
|
||||
/*root_back.setBackgroundResource(R.drawable.background_naming);
|
||||
findViewById(R.id.naming_icon).setVisibility(View.VISIBLE);*/
|
||||
// if (bean.getUid().equals(bean.getNaming_user_id())) {
|
||||
if (bean.getUid().equals(bean.getNaming_user_id())) {
|
||||
SVGAVideoEntity drawable = null;
|
||||
if(WordUtil.isNewZh()&&LiveRoomViewHolder.drawableTitleCn!=null){
|
||||
drawable = LiveRoomViewHolder.drawableTitleCn;
|
||||
}else if(!WordUtil.isNewZh()&&LiveRoomViewHolder.drawableTitleEn!=null){
|
||||
drawable = LiveRoomViewHolder.drawableTitleEn;
|
||||
}
|
||||
if(drawable!=null){
|
||||
L.eSw("-----------------");
|
||||
giftNamingIcon.setImageDrawable(new SVGADrawable(drawable));
|
||||
giftNamingIcon.setLoops(0);
|
||||
giftNamingIcon.startAnimation();
|
||||
giftNamingIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
ViewGroup.LayoutParams params = root_back.getLayoutParams();
|
||||
params.height = DpUtil.dp2px(45);
|
||||
root_back.setLayoutParams(params);
|
||||
|
||||
ViewGroup.LayoutParams params1 = contentLayout.getLayoutParams();
|
||||
params1.height = DpUtil.dp2px(45);
|
||||
contentLayout.setLayoutParams(params1);
|
||||
|
||||
if(LiveRoomViewHolder.drawableBg!=null){
|
||||
root_back.setImageDrawable(new SVGADrawable(LiveRoomViewHolder.drawableBg));
|
||||
root_back.setLoops(0);
|
||||
root_back.startAnimation();
|
||||
}
|
||||
} else {
|
||||
giftNamingIcon.setVisibility(View.VISIBLE);
|
||||
root_back.setBackgroundResource(R.mipmap.icon_live_gift_anim_11);
|
||||
//root_back.setBackgroundResource(R.mipmap.icon_live_gift_anim_3);
|
||||
findViewById(R.id.naming_icon).setVisibility(View.GONE);
|
||||
ViewGroup.LayoutParams params = root_back.getLayoutParams();
|
||||
params.height = DpUtil.dp2px(50);
|
||||
root_back.setLayoutParams(params);
|
||||
|
||||
ViewGroup.LayoutParams params1= contentLayout.getLayoutParams();
|
||||
params1.height = DpUtil.dp2px(50);
|
||||
contentLayout.setLayoutParams(params1);
|
||||
|
||||
root_back.setImageDrawable(mContent.getResources().getDrawable(R.mipmap.icon_live_gift_anim_3));
|
||||
giftNamingIcon.setVisibility(View.GONE);
|
||||
}
|
||||
if (lian && mGiftCount != null && mAnimation != null) {
|
||||
mGiftCount.startAnimation(mAnimation);
|
||||
|
||||
@@ -69,6 +69,7 @@ import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.yunbao.common.bean.PrankProgressBean;
|
||||
import com.yunbao.common.fragment.GiftWallMainTab1Fragment;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
@@ -436,6 +437,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
|
||||
private static boolean isSw;
|
||||
|
||||
public static SVGAVideoEntity drawableTitleCn;
|
||||
public static SVGAVideoEntity drawableTitleEn;
|
||||
public static SVGAVideoEntity drawableBg;
|
||||
|
||||
public LiveRoomViewHolder setGuardType(int guardType) {
|
||||
this.guardType = guardType;
|
||||
return this;
|
||||
@@ -595,7 +600,43 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mSVGAImageView = svgaImageView;
|
||||
mLiveGiftPrizePoolContainer = liveGiftPrizePoolContainer;
|
||||
this.windowManager = windowManager;
|
||||
initSvgaNaming();
|
||||
}
|
||||
|
||||
private void initSvgaNaming() {
|
||||
new SVGAParser(mContext).decodeFromAssets("gift_live_naming_bg.svga", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(@NonNull SVGAVideoEntity videoItem) {
|
||||
drawableBg = videoItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
System.err.println("-------------SVGA报错了");
|
||||
}
|
||||
}, null);
|
||||
new SVGAParser(mContext).decodeFromAssets("gift_live_naming_title_cn.svga", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(@NonNull SVGAVideoEntity videoItem) {
|
||||
drawableTitleCn = videoItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
System.err.println("-------------SVGA报错了");
|
||||
}
|
||||
}, null);
|
||||
new SVGAParser(mContext).decodeFromAssets("gift_live_naming_title_en.svga", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(@NonNull SVGAVideoEntity videoItem) {
|
||||
drawableTitleEn = videoItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
System.err.println("-------------SVGA报错了");
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
public void clearList() {
|
||||
@@ -3657,8 +3698,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIVE_WKS));
|
||||
}
|
||||
});
|
||||
wksAndGiftWall.addView(weekView);
|
||||
wksAndGiftWall.startFlipping();
|
||||
//wksAndGiftWall.addView(weekView);
|
||||
//wksAndGiftWall.startFlipping();
|
||||
new LoadDian9TuUtil().loadDian9TuAssets2(mContext, liveWksLayout, "rectangle_new.png", 1);
|
||||
}
|
||||
|
||||
@@ -4643,6 +4684,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mRefreshUserListCallback = null;
|
||||
mTimeChargeCallback = null;
|
||||
Contexts = null;
|
||||
drawableBg = null;
|
||||
drawableTitleCn = null;
|
||||
drawableTitleEn = null;
|
||||
}
|
||||
|
||||
public void clearData() {
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
tools:visibility="visible"
|
||||
android:visibility="invisible">
|
||||
|
||||
<View
|
||||
android:id="@+id/root_back"
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/root_back_naming"
|
||||
android:layout_width="204dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_height="40dp"
|
||||
android:scaleType="fitStart"
|
||||
android:layout_gravity="bottom"
|
||||
app:autoPlay="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:background="@mipmap/icon_live_gift_anim_3" />
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/bg"
|
||||
@@ -36,8 +38,9 @@
|
||||
android:visibility="invisible" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical"
|
||||
@@ -45,9 +48,9 @@
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_oval="true" />
|
||||
@@ -76,11 +79,13 @@
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_marginLeft="10dp"
|
||||
android:id="@+id/gift_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
@@ -123,11 +128,10 @@
|
||||
android:textColor="#DB7008"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="20dp"
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginStart="17dp"
|
||||
android:id="@+id/gift_naming_icon"
|
||||
android:src="@mipmap/gift_naming_icon"
|
||||
android:layout_width="27dp"
|
||||
android:layout_height="12dp"/>
|
||||
|
||||
|
||||
137
live/src/main/res/layout/view_live_gift_naming.xml
Normal file
137
live/src/main/res/layout/view_live_gift_naming.xml
Normal file
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:clipChildren="false"
|
||||
tools:visibility="visible"
|
||||
android:visibility="invisible">
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/root_back"
|
||||
android:layout_width="204dp"
|
||||
android:layout_height="45dp"
|
||||
android:scaleType="fitStart"
|
||||
android:layout_gravity="bottom"
|
||||
app:autoPlay="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/bg"
|
||||
android:layout_width="204dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:background="@mipmap/icon_live_gift_anim_4"
|
||||
android:translationX="-214dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/star"
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginLeft="214dp"
|
||||
android:background="@mipmap/icon_live_gift_anim_5"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_oval="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_marginLeft="10dp"
|
||||
android:id="@+id/gift_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gift_group_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mul_sign"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/yellow4"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gift_count"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="32dp"
|
||||
android:singleLine="true"
|
||||
android:visibility="invisible" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/naming_icon"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="11dp"
|
||||
android:background="@drawable/background_naming_icon"
|
||||
android:gravity="center"
|
||||
android:text="@string/the_title_financier2"
|
||||
android:textColor="#DB7008"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:id="@+id/gift_naming_icon"
|
||||
android:layout_width="27dp"
|
||||
android:layout_height="12dp"/>
|
||||
|
||||
</FrameLayout>
|
||||
Reference in New Issue
Block a user