package com.example.demo;
import android.annotation.SuppressLint;
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.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.bumptech.glide.request.RequestOptions;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import static android.view.animation.Animation.*;
public class ShowNewLuckyMsgView implements AnimationListener {
private View convertView;
private LinearLayout rootLayout;
private ViewGroup mRelLuckyMsgView;
private Animation inAnimation;
private Animation outAnimation;
private String anchorName;
private Context context;
//抽奖通道显示的两个布局
LinearLayout mLinGift;
LinearLayout mLinMsg;
//金币消息头像、昵称、中奖金币数
ImageView mImgLuckyMsgAv;
TextView mTxtLuckyMsgName;
RunTextView mTxtLuckyMsgNumber;
ImageView mImgLuckyMsgNumber;
TextView mTxtLuckyMsgRound;
ImageView mImgLuckyGiftAv;
ImageView mImgLuckyGiftCoin;
TextView mTxtLuckyGiftName;
TextView mTxtLuckyGiftAnchorName;
TextView mTxtLuckyGiftRound;
//用户头像
String userAv = "";
//用户名
String userName = "";
//中奖金额
int goodNumber = 0;
//礼物集合
List<LuckyGiftBean> giftLists = new ArrayList<>();
/**
* 第二版
*
* @param context
* @param mRelLuckyMsgView
*/
public ShowNewLuckyMsgView(Context context, ViewGroup mRelLuckyMsgView) {
this.mRelLuckyMsgView = mRelLuckyMsgView;
this.context = context;
initView();
}
public void setData(String userAv, String userName, int forAnchorGoodNumber, List<LuckyGiftBean> giftLists, String anchorName) {
this.userAv = userAv;
this.userName = userName;
this.goodNumber = forAnchorGoodNumber;
this.giftLists = giftLists;
this.anchorName = anchorName;
}
@SuppressLint("InflateParams")
public void initView() {
//抽奖消息
if (convertView == null) {
convertView = LayoutInflater.from(context).inflate(R.layout.toast_lusky_msg_toast_layout, null);
rootLayout = convertView.findViewById(R.id.toast_lucky_msg_layout);
//抽奖通道显示的两个布局
mLinGift = rootLayout.findViewById(R.id.lin_lucky_gift);
mLinMsg = rootLayout.findViewById(R.id.lin_lucky_msg);
//金币消息头像、昵称、中奖金币数
mImgLuckyMsgAv = rootLayout.findViewById(R.id.img_lucky_msg_av);
mTxtLuckyMsgName = rootLayout.findViewById(R.id.txt_lucky_msg_name);
mTxtLuckyMsgNumber = rootLayout.findViewById(R.id.txt_lucky_msg_number);
mImgLuckyMsgNumber = rootLayout.findViewById(R.id.img_lucky_msg_number);
mTxtLuckyMsgRound = rootLayout.findViewById(R.id.txt_lucky_msg_round);
mImgLuckyGiftAv = rootLayout.findViewById(R.id.img_lucky_gift_av);
mImgLuckyGiftCoin = rootLayout.findViewById(R.id.img_lucky_gift_icon);
mTxtLuckyGiftName = rootLayout.findViewById(R.id.txt_lucky_gift_name);
mTxtLuckyGiftAnchorName = rootLayout.findViewById(R.id.txt_lucky_gift_anchor_name);
mTxtLuckyGiftRound = rootLayout.findViewById(R.id.txt_lucky_gift_round);
}
//默认不显示
mLinGift.setVisibility(View.GONE);
//如果不是空的显示
if (giftLists.size() > 0) {
mLinGift.setVisibility(View.VISIBLE);
displayCircleImage(context, giftLists.get(0).getUrl(), mImgLuckyGiftCoin, 0);
displayCircleImage(context, userAv, mImgLuckyGiftAv, 0);
//昵称
mTxtLuckyGiftName.setText(userName);
//主播name
mTxtLuckyGiftAnchorName.setText(">>" + anchorName);
//round
mTxtLuckyGiftRound.setText("x" + giftLists.get(0).getCount());
giftLists.remove(0);
} else {
mLinGift.setVisibility(View.GONE);
}
//消息通道消息
mLinMsg.setVisibility(View.VISIBLE);
//头像
displayCircleImage(context, userAv, mImgLuckyMsgAv, 0);
//昵称
mTxtLuckyMsgName.setText(userName);
//中奖数
mTxtLuckyMsgNumber.runWithAnimation(
TextUtils.isEmpty(mTxtLuckyMsgNumber.getText().toString().trim()) ? 0 :
Integer.parseInt(mTxtLuckyMsgNumber.getText().toString().trim().replace(",", ""))
, goodNumber / 100);
//第几轮
mTxtLuckyMsgRound.setText(new StringBuilder("Bonus").append("1"));
startDh(context, R.anim.scalebig, mTxtLuckyMsgNumber);
startDh(context, R.anim.scalebig, mImgLuckyMsgNumber);
if (mRelLuckyMsgView.getChildCount() == 0) {
mRelLuckyMsgView.addView(convertView);
//适配阿拉伯语
inAnimation = AnimationUtils.loadAnimation(context, R.anim.lucky_msg_in);
inAnimation.setAnimationListener(this);
mLinMsg.startAnimation(inAnimation);
if (giftLists.size() != 0) {
mLinGift.startAnimation(inAnimation);
}
} else {
handler.removeCallbacksAndMessages(null);
showCount = 0;
}
handler.sendEmptyMessage(1);
}
private int showCount = 0;
Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(@NonNull Message msg) {
switch (msg.what) {
case 1:
if (showCount > 1) { //从0开始大于1,说明当前是2。也就是2s后执行
handler.sendEmptyMessageDelayed(2, 750L);
showCount = 0;
} else {
showCount++;
handler.sendEmptyMessageDelayed(1, 750L);
}
break;
case 2:
if (giftLists.size() > 0) {
Animation giftExitAnimation = AnimationUtils.loadAnimation(
context,
R.anim.lucky_gift_exit
);
giftExitAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
displayCircleImage(context, giftLists.get(0).getUrl(), mImgLuckyGiftCoin, 0);
//round
mTxtLuckyGiftRound.setText("x" + giftLists.get(0).getCount());
giftLists.remove(0);
mLinGift.setVisibility(View.VISIBLE);
mLinGift.setAnimation(inAnimation);
handler.sendEmptyMessage(1);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
mLinGift.
没有合适的资源?快使用搜索试试~ 我知道了~
android实现抖音直播间送礼动画
共138个文件
xml:83个
png:14个
bin:10个
5星 · 超过95%的资源 需积分: 31 33 下载量 71 浏览量
2022-08-05
11:59:36
上传
评论 6
收藏 539KB ZIP 举报
温馨提示
抖音直播间赠送礼物飘屏动画; 赠送金币动画; 赠送礼物动画; 可单独显示; 可混合显示; 可设置多个礼物集合自动轮播显示; 可自定义设置显示动画和时长; 可自定义UI界面; 可自定义任何代码实现; 源码开源; 可设置国际化语言; 金币支持自动累加; 支持显示金币累加动画; 礼物数量可自动累加; 礼物数量支持累加动画; 支持显示头像和昵称; 抖音直播间赠送礼物飘屏动画; 赠送金币动画; 赠送礼物动画; 可单独显示; 可混合显示; 可设置多个礼物集合自动轮播显示; 可自定义设置显示动画和时长; 可自定义UI界面; 可自定义任何代码实现; 源码开源; 可设置国际化语言; 金币支持自动累加; 支持显示金币累加动画; 礼物数量可自动累加; 礼物数量支持累加动画; 支持显示头像和昵称; 抖音直播间赠送礼物飘屏动画; 赠送金币动画; 赠送礼物动画; 可单独显示; 可混合显示; 可设置多个礼物集合自动轮播显示; 可自定义设置显示动画和时长; 可自定义UI界面; 可自定义任何代码实现; 源码开源; 可设置国际化语言; 金币支持自动累加; 支持显示金币累加动画; 礼物数量可自动累加; 礼物数量支持累加
资源详情
资源评论
资源推荐
收起资源包目录
android实现抖音直播间送礼动画 (138个子文件)
gradlew.bat 2KB
classAnalysis.bin 719KB
executionHistory.bin 671KB
outputFiles.bin 92KB
jarAnalysis.bin 89KB
fileHashes.bin 69KB
taskHistory.bin 34KB
sha1-checksums.bin 25KB
md5-checksums.bin 20KB
resourceHashesCache.bin 18KB
last-build.bin 1B
.gitignore 222B
.gitignore 6B
build.gradle 1KB
build.gradle 553B
settings.gradle 41B
gradlew 5KB
app.iml 15KB
Demo.iml 983B
gradle-wrapper.jar 53KB
ShowNewLuckyMsgView.java 10KB
MainActivity.java 3KB
LastSpacingTextView.java 2KB
RunTextView.java 1002B
ExampleInstrumentedTest.java 771B
LuckyGiftBean.java 505B
ExampleUnitTest.java 393B
buildOutputCleanup.lock 17B
checksums.lock 17B
fileHashes.lock 17B
fileContent.lock 17B
executionHistory.lock 17B
javaCompile.lock 17B
ic_launcher_round.png 16KB
icon_lucky_msg_view_msg_bg.png 13KB
ic_launcher_round.png 12KB
ic_launcher.png 10KB
icon_lucky_msg_view_gift_bg.png 10KB
ic_launcher.png 8KB
ic_launcher_round.png 7KB
ic_launcher_round.png 5KB
ic_launcher.png 5KB
ic_launcher.png 4KB
ic_launcher_round.png 3KB
ic_launcher.png 3KB
icon_coin_16x16.png 2KB
icon_small_avatar_default.png 2KB
proguard-rules.pro 770B
gradle.properties 1KB
local.properties 466B
gradle-wrapper.properties 238B
cache.properties 53B
gc.properties 0B
gc.properties 0B
build_file_checksums.ser 545B
item_lucky_msg_view.xml 8KB
workspace.xml 8KB
ic_launcher_background.xml 6KB
Project.xml 3KB
ic_launcher_foreground.xml 2KB
activity_main.xml 1KB
Gradle__com_github_bumptech_glide_gifdecoder_4_13_2_aar.xml 1KB
jarRepositories.xml 1KB
Gradle__androidx_test_espresso_espresso_idling_resource_3_2_0_aar.xml 976B
Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml 920B
Gradle__androidx_coordinatorlayout_coordinatorlayout_1_0_0_aar.xml 912B
Gradle__androidx_test_espresso_espresso_core_3_2_0_aar.xml 899B
Gradle__androidx_exifinterface_exifinterface_1_2_0_aar.xml 880B
Gradle__com_github_bumptech_glide_glide_4_13_2_aar.xml 877B
Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml 872B
Gradle__androidx_recyclerview_recyclerview_1_0_0_aar.xml 872B
Gradle__androidx_activity_activity_1_2_1_aar.xml 867B
Gradle__androidx_transition_transition_1_0_0_aar.xml 855B
Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml 848B
Gradle__androidx_test_ext_junit_1_1_1_aar.xml 846B
Gradle__androidx_fragment_fragment_1_3_1_aar.xml 840B
Gradle__androidx_test_monitor_1_2_0_aar.xml 830B
Gradle__androidx_test_core_1_2_0_aar.xml 827B
Gradle__androidx_test_runner_1_2_0_aar.xml 823B
gradle.xml 816B
Gradle__androidx_print_print_1_0_0_aar.xml 816B
Gradle__com_github_bumptech_glide_disklrucache_4_13_2_jar.xml 810B
Gradle__androidx_core_core_1_1_0_aar.xml 808B
Gradle__com_github_bumptech_glide_annotations_4_13_2_jar.xml 803B
AndroidManifest.xml 800B
Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml 793B
Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_0_aar.xml 787B
Gradle__androidx_annotation_annotation_1_1_0_jar.xml 765B
Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml 764B
Gradle__androidx_annotation_annotation_experimental_1_0_0_aar.xml 754B
Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml 747B
Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml 744B
Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml 744B
Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml 738B
Gradle__com_squareup_javawriter_2_1_1_jar.xml 737B
Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_0_aar.xml 734B
Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml 734B
Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml 734B
Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml 732B
Gradle__javax_inject_javax_inject_1_jar.xml 723B
共 138 条
- 1
- 2
谁抢我的小口口
- 粉丝: 4013
- 资源: 41
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论5