This commit is contained in:
zlzw 2022-09-09 13:36:01 +08:00
parent b515e9eea2
commit 89ed3f5121
27 changed files with 181 additions and 129 deletions

View File

@ -111,5 +111,7 @@ dependencies {
api project(':video') api project(':video')
annotationProcessor rootProject.ext.dependencies["arouter-compiler"] annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
implementation rootProject.ext.dependencies["leakcanary"]
} }

View File

@ -3,6 +3,7 @@ package com.shayu.phonelive;
import android.app.Activity; import android.app.Activity;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.content.Context; import android.content.Context;
import android.net.Uri;
import android.net.http.HttpResponseCache; import android.net.http.HttpResponseCache;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -30,6 +31,8 @@ import com.tencent.imsdk.v2.V2TIMUserInfo;
import com.yunbao.common.BuildConfig; import com.yunbao.common.BuildConfig;
import com.yunbao.common.CommonAppContext; import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.glide.ImageLoadUtils;
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.manager.imrongcloud.InstructorSendReward; import com.yunbao.common.manager.imrongcloud.InstructorSendReward;
@ -120,6 +123,7 @@ public class AppContext extends CommonAppContext {
super.onCreate(); super.onCreate();
//注册全局异常捕获 //注册全局异常捕获
//registerError(); //registerError();
ImageLoadUtils.initImageLoader(this);
sInstance = this; sInstance = this;
L.setDeBug(BuildConfig.DEBUG); L.setDeBug(BuildConfig.DEBUG);
AppEventsLogger.activateApp(this); AppEventsLogger.activateApp(this);

View File

@ -94,8 +94,9 @@ public class NeverCrashUtils {
if (isDebugMode()) { if (isDebugMode()) {
Log.e(TAG, "未捕获的主线程异常行为", e); Log.e(TAG, "未捕获的主线程异常行为", e);
} }
e.printStackTrace();
Toast.makeText(application, "发生闪退", Toast.LENGTH_SHORT).show(); Toast.makeText(application, "发生闪退", Toast.LENGTH_SHORT).show();
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()),throwableToString(e),"error.log"); // FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()),throwableToString(e),"error.log");
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e); getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
} }
} }
@ -106,6 +107,7 @@ public class NeverCrashUtils {
if (isDebugMode()) { if (isDebugMode()) {
Log.e(TAG, "未捕获的子线程异常行为", e); Log.e(TAG, "未捕获的子线程异常行为", e);
} }
e.printStackTrace();
Toast.makeText(application, "发生闪退", Toast.LENGTH_SHORT).show(); Toast.makeText(application, "发生闪退", Toast.LENGTH_SHORT).show();
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()),throwableToString(e),"error.log"); FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()),throwableToString(e),"error.log");
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e); getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);

View File

@ -128,6 +128,8 @@ dependencies {
// //
api rootProject.ext.dependencies["Luban"] api rootProject.ext.dependencies["Luban"]
//
api rootProject.ext.dependencies["imageloader"]
//Picker控件 //Picker控件
api files('libs/AndroidPicker-1.5.6.jar') api files('libs/AndroidPicker-1.5.6.jar')

View File

@ -0,0 +1,64 @@
package com.yunbao.common.glide;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.view.View;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.ImageSize;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
import jp.wasabeef.glide.transformations.BlurTransformation;
public class ImageLoadUtils {
public static void initImageLoader(Context context) {
ImageLoader imageLoader = ImageLoader.getInstance();
ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(context)
.diskCache(new UnlimitedDiskCache(context.getCacheDir()))
.diskCacheSize(50 * 1024 * 1024)
.diskCacheFileCount(100)
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024)
.build();
imageLoader.init(configuration);
}
private static ImageLoader getLoader() {
return ImageLoader.getInstance();
}
private static DisplayImageOptions getDisplayImageOptions() {
return new DisplayImageOptions.Builder()
.bitmapConfig(Bitmap.Config.RGB_565)
.build();
}
public static void loadUrl(String url, int width, int height, ImageView imageView) {
//ImageSize size = new ImageSize(width, height);
//getLoader().displayImage(url,imageView,size);
}
public static void loadUrlToBlur(Context context,String url,int width,int height,ImageView imageView){
getLoader().loadImage(url,new ImageSize(width,height),getDisplayImageOptions(),new SimpleImageLoadingListener(){
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
super.onLoadingComplete(imageUri, view, loadedImage);
Glide.with(context).asBitmap().load(loadedImage)
.skipMemoryCache(false)
.apply(RequestOptions.bitmapTransform( new BlurTransformation(25)))
.into(imageView);
}
});
}
}

View File

@ -0,0 +1,31 @@
package com.yunbao.common.utils;
import com.opensource.svgaplayer.SVGACallback;
import com.opensource.svgaplayer.SVGAImageView;
public class SVGAViewUtils {
public static void playEndClear(SVGAImageView svga){
svga.setCallback(new SVGACallback() {
@Override
public void onPause() {
}
@Override
public void onFinished() {
svga.clear();
}
@Override
public void onRepeat() {
}
@Override
public void onStep(int i, double v) {
}
});
svga.startAnimation();
}
}

View File

@ -30,6 +30,8 @@ ext {
"arouter" : 'com.alibaba:arouter-api:1.5.2',//ARouter "arouter" : 'com.alibaba:arouter-api:1.5.2',//ARouter
"arouter-compiler" : 'com.alibaba:arouter-compiler:1.2.2', "arouter-compiler" : 'com.alibaba:arouter-compiler:1.2.2',
"blank-utilcode" : 'com.blankj:utilcode:1.25.9', "blank-utilcode" : 'com.blankj:utilcode:1.25.9',
"leakcanary" : 'com.squareup.leakcanary:leakcanary-android:2.9.1',
"imageloader" : 'com.nostra13.universalimageloader:universal-image-loader:1.9.5',
] ]

View File

@ -39,6 +39,7 @@ import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -160,7 +161,7 @@ public class ZhuangBanActivity extends AbsActivity {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
svga.setImageDrawable(drawable); svga.setImageDrawable(drawable);
svga.setLoops(1); svga.setLoops(1);
svga.startAnimation(); SVGAViewUtils.playEndClear(svga);
} }
@Override @Override

View File

@ -1,36 +1,43 @@
package com.yunbao.live.adapter; package com.yunbao.live.adapter;
import android.content.Context; import static android.text.TextUtils.isEmpty;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.media.ThumbnailUtils;
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.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition;
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;
import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity; import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.live.R;
import com.yunbao.common.bean.LevelBean;
import com.yunbao.live.bean.LiveUserGiftBean;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImageLoadUtils;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.live.R;
import com.yunbao.live.bean.LiveUserGiftBean;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static android.text.TextUtils.isEmpty;
/** /**
* Created by cxf on 2018/10/10. * Created by cxf on 2018/10/10.
*/ */
@ -103,7 +110,7 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
public Vh(View itemView) { public Vh(View itemView) {
super(itemView); super(itemView);
mWrap = (ImageView) itemView.findViewById(R.id.wrap); mWrap = (ImageView) itemView.findViewById(R.id.wrap);
gift_svga = (SVGAImageView)itemView.findViewById(R.id.gift_svga); gift_svga = (SVGAImageView) itemView.findViewById(R.id.gift_svga);
mAvatar = (ImageView) itemView.findViewById(R.id.avatar); mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
mIcon = (ImageView) itemView.findViewById(R.id.icon); mIcon = (ImageView) itemView.findViewById(R.id.icon);
mGuardIcon = (ImageView) itemView.findViewById(R.id.guard_icon); mGuardIcon = (ImageView) itemView.findViewById(R.id.guard_icon);
@ -114,37 +121,12 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
itemView.setTag(position); itemView.setTag(position);
if (payload == null) { if (payload == null) {
ImgLoader.displayAvatar(mContext, userBean.getAvatar(), mAvatar); // ImgLoader.displayAvatar(mContext, userBean.getAvatar(), mAvatar);
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(userBean.getLevel()); ImageLoadUtils.loadUrl(userBean.getAvatar(),32,32,mAvatar);
// if (levelBean != null) {
// ImgLoader.display(mContext, levelBean.getThumbIcon(), mIcon);
// }
} }
int guardType = userBean.getGuardType();
// if (guardType == Constants.GUARD_TYPE_NONE) { if (userBean.getDress() != null) {
// if (mIcon.getVisibility() != View.VISIBLE) { if (userBean.getDress().getAvatar_frame().contains("svga")) {
// mIcon.setVisibility(View.VISIBLE);
// }
// if (mGuardIcon.getVisibility() == View.VISIBLE) {
// mGuardIcon.setVisibility(View.INVISIBLE);
// }
// } else {
// if (mIcon.getVisibility() == View.VISIBLE) {
// mIcon.setVisibility(View.INVISIBLE);
// }
// if (mGuardIcon.getVisibility() != View.VISIBLE) {
// mGuardIcon.setVisibility(View.VISIBLE);
// }
// if (guardType == Constants.GUARD_TYPE_DAY) {
// mGuardIcon.setImageDrawable(mGuardDrawable0);
// }else if (guardType == Constants.GUARD_TYPE_MONTH) {
// mGuardIcon.setImageDrawable(mGuardDrawable1);
// } else if (guardType == Constants.GUARD_TYPE_YEAR) {
// mGuardIcon.setImageDrawable(mGuardDrawable2);
// }
// }
if(userBean.getDress()!=null){
if(userBean.getDress().getAvatar_frame().contains("svga")) {
try { try {
new SVGAParser(mContext).parse(new URL(userBean.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() { new SVGAParser(mContext).parse(new URL(userBean.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() {
@ -152,7 +134,7 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
gift_svga.setImageDrawable(drawable); gift_svga.setImageDrawable(drawable);
gift_svga.startAnimation(); SVGAViewUtils.playEndClear(gift_svga);
} }
@Override @Override
@ -162,25 +144,10 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
e.printStackTrace(); e.printStackTrace();
} }
}else{ } else {
ImgLoader.display(mContext,userBean.getDress().getAvatar_frame(), gift_svga); ImgLoader.display(mContext, userBean.getDress().getAvatar_frame(), gift_svga);
} }
} }
// if (position == 0) {
// if (userBean.hasContribution()) {
// mWrap.setImageResource(R.mipmap.icon_live_user_list_1);
// }
// } else if (position == 1) {
// if (userBean.hasContribution()) {
// mWrap.setImageResource(R.mipmap.icon_live_user_list_2);
// }
// } else if (position == 2) {
// if (userBean.hasContribution()) {
// mWrap.setImageResource(R.mipmap.icon_live_user_list_3);
// }
// } else {
// mWrap.setImageDrawable(null);
// }
} }
} }
@ -216,49 +183,6 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
} }
} }
// public void insertItem(LiveUserGiftBean userBean) {
// if (userBean == null) {
// return;
// }
// int position = findItemPosition(userBean.getId());
// if (position >= 0) {
// return;
// }
// int size = mList.size();
// mList.add(userBean);
// notifyDataSetChanged();
//// notifyItemInserted(size);
// }
//
// public void insertList(List<LiveUserGiftBean> list) {
// for (int i = 0; i < list.size(); i++) {
// }
// if (mList != null && list != null && list.size() > 0) {
// int position = mList.size();
// mList.addAll(list);
// notifyItemRangeInserted(position, mList.size());
// }
// }
// /**
// * 守护信息发生变化
// */
// public void onGuardChanged(String uid, int guardType) {
// if (!isEmpty(uid)) {
// for (int i = 0, size = mList.size(); i < size; i++) {
// LiveUserGiftBean bean = mList.get(i);
// if (uid.equals(bean.getId())) {
// if (bean.getGuardType() != guardType) {
// Log.d("onGuardChanged",""+bean.getGuardType());
// bean.setGuardType(guardType);
// notifyItemChanged(i, Constants.PAYLOAD);
// }
// break;
// }
// }
// }
// }
public void clear() { public void clear() {
if (mList != null) { if (mList != null) {
mList.clear(); mList.clear();

View File

@ -21,6 +21,7 @@ import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.bean.MicUserBean; import com.yunbao.live.bean.MicUserBean;
@ -96,7 +97,7 @@ public class UserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
gift_svga.setImageDrawable(drawable); gift_svga.setImageDrawable(drawable);
gift_svga.startAnimation(); SVGAViewUtils.playEndClear(gift_svga);
} }
@Override @Override

View File

@ -28,6 +28,7 @@ import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.bean.LiveUserGiftBean; import com.yunbao.live.bean.LiveUserGiftBean;
@ -252,7 +253,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
gift_svga.setImageDrawable(drawable); gift_svga.setImageDrawable(drawable);
gift_svga.startAnimation(); SVGAViewUtils.playEndClear(gift_svga);
} }
@Override @Override

View File

@ -31,6 +31,7 @@ import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.bean.HotBean; import com.yunbao.live.bean.HotBean;
@ -218,7 +219,7 @@ public class LiveGiveHotDialogFragment extends AbsDialogFragment {
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
viewHolder.gift_svga.setImageDrawable(drawable); viewHolder.gift_svga.setImageDrawable(drawable);
viewHolder.gift_svga.startAnimation(); SVGAViewUtils.playEndClear(viewHolder.gift_svga);
} }
@Override @Override

View File

@ -36,6 +36,7 @@ import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -368,7 +369,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
gift_svga.setImageDrawable(drawable); gift_svga.setImageDrawable(drawable);
gift_svga.startAnimation(); SVGAViewUtils.playEndClear(gift_svga);
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.GifCacheUtil; import com.yunbao.common.utils.GifCacheUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.bean.LiveChatBean;
@ -310,7 +311,7 @@ public class LiveEnterRoomAnimPresenter {
SVGARect rect = svgaVideoEntity.getVideoSize(); SVGARect rect = svgaVideoEntity.getVideoSize();
enter_room_svg_small.setVideoItem(svgaVideoEntity); enter_room_svg_small.setVideoItem(svgaVideoEntity);
enter_room_svg_small.setLoops(1); enter_room_svg_small.setLoops(1);
enter_room_svg_small.startAnimation(); SVGAViewUtils.playEndClear(enter_room_svg_small);
} }
} else { } else {
if (mSVGImageView != null) { if (mSVGImageView != null) {
@ -318,7 +319,6 @@ public class LiveEnterRoomAnimPresenter {
SVGARect rect = svgaVideoEntity.getVideoSize(); SVGARect rect = svgaVideoEntity.getVideoSize();
mSVGImageView.setVideoItem(svgaVideoEntity); mSVGImageView.setVideoItem(svgaVideoEntity);
mSVGImageView.setLoops(1); mSVGImageView.setLoops(1);
mSVGImageView.startAnimation();
mSVGImageView.setCallback(new SVGACallback() { mSVGImageView.setCallback(new SVGACallback() {
@Override @Override
public void onPause() { public void onPause() {
@ -343,6 +343,7 @@ public class LiveEnterRoomAnimPresenter {
} }
}); });
mSVGImageView.startAnimation();
} }
} }
mIsAnimating = false; mIsAnimating = false;

View File

@ -592,6 +592,7 @@ public class LiveGiftAnimPresenter {
if (mHandler != null) { if (mHandler != null) {
mHandler.sendEmptyMessageDelayed(WHAT_GIF, diffTime); mHandler.sendEmptyMessageDelayed(WHAT_GIF, diffTime);
} }
mSVGAImageView.clear();
} }
@Override @Override
@ -614,6 +615,7 @@ public class LiveGiftAnimPresenter {
if (diffTime < 0) { if (diffTime < 0) {
diffTime = 0; diffTime = 0;
} }
mSVGAImageViewFront.clear();
// if (mHandler != null) { // if (mHandler != null) {
// mHandler.sendEmptyMessageDelayed(WHAT_GIF_All_SERVER, diffTime); // mHandler.sendEmptyMessageDelayed(WHAT_GIF_All_SERVER, diffTime);
// } // }
@ -1224,7 +1226,6 @@ public class LiveGiftAnimPresenter {
resizeSvgaImageView(rect.getWidth(), rect.getHeight()); resizeSvgaImageView(rect.getWidth(), rect.getHeight());
mSvgaPlayTime = System.currentTimeMillis(); mSvgaPlayTime = System.currentTimeMillis();
mSVGAImageView.setVideoItem(svgaVideoEntity); mSVGAImageView.setVideoItem(svgaVideoEntity);
mSVGAImageView.startAnimation();
mSVGAImageView.setCallback(new SVGACallback() { mSVGAImageView.setCallback(new SVGACallback() {
@Override @Override
public void onPause() { public void onPause() {
@ -1254,6 +1255,7 @@ public class LiveGiftAnimPresenter {
} }
}); });
mSVGAImageView.startAnimation();
} }
} }

View File

@ -37,6 +37,7 @@ import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -125,7 +126,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
svga_new_user_gif.setImageDrawable(drawable); svga_new_user_gif.setImageDrawable(drawable);
svga_new_user_gif.startAnimation(); SVGAViewUtils.playEndClear(svga_new_user_gif);
} }
@Override @Override
@ -144,7 +145,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
svga_new_user_double.setImageDrawable(drawable); svga_new_user_double.setImageDrawable(drawable);
svga_new_user_double.setBackgroundResource(R.mipmap.black_bg); svga_new_user_double.setBackgroundResource(R.mipmap.black_bg);
svga_new_user_double.startAnimation(); SVGAViewUtils.playEndClear(svga_new_user_double);
} }
@Override @Override
@ -161,7 +162,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
svga_new_user_follow.setImageDrawable(drawable); svga_new_user_follow.setImageDrawable(drawable);
svga_new_user_follow.startAnimation(); SVGAViewUtils.playEndClear(svga_new_user_follow);
} }
@Override @Override
@ -248,7 +249,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
@Override @Override
public void onFinished() { public void onFinished() {
svga_station_horn.clear();
} }
@Override @Override

View File

@ -72,6 +72,7 @@ import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
@ -356,7 +357,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
mSVGAImageView.setImageDrawable(drawable); mSVGAImageView.setImageDrawable(drawable);
mSVGAImageView.startAnimation(); SVGAViewUtils.playEndClear(mSVGAImageView);
} }
@Override @Override

View File

@ -34,6 +34,7 @@ import com.yunbao.common.Constants;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.custom.MyViewPager; import com.yunbao.common.custom.MyViewPager;
import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.glide.ImageLoadUtils;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
@ -239,7 +240,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null); mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
//直播间背景 //直播间背景
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack); //ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack);
ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack);
mask.setVisibility(View.VISIBLE); mask.setVisibility(View.VISIBLE);
mLivePlayViewHolder.setCover(data.getThumb()); mLivePlayViewHolder.setCover(data.getThumb());
mLivePlayViewHolder.play(data.getPull()); mLivePlayViewHolder.play(data.getPull());

View File

@ -46,6 +46,7 @@ import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
@ -145,7 +146,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
guidSvga.setImageDrawable(drawable); guidSvga.setImageDrawable(drawable);
guidSvga.startAnimation(); SVGAViewUtils.playEndClear(guidSvga);
} }
@Override @Override

View File

@ -44,6 +44,7 @@ import com.yunbao.common.utils.GifCacheUtil;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil; import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -187,7 +188,7 @@ public class RewardActivity extends AbsActivity {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
svga.setImageDrawable(drawable); svga.setImageDrawable(drawable);
svga.setLoops(1); svga.setLoops(1);
svga.startAnimation(); SVGAViewUtils.playEndClear(svga);
} }
@Override @Override

View File

@ -35,6 +35,7 @@ import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.GifCacheUtil; import com.yunbao.common.utils.GifCacheUtil;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -192,7 +193,7 @@ public class ZhuangBanActivity extends AbsActivity {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
svga.setImageDrawable(drawable); svga.setImageDrawable(drawable);
svga.setLoops(1); svga.setLoops(1);
svga.startAnimation(); SVGAViewUtils.playEndClear(svga);
} }
@Override @Override

View File

@ -28,6 +28,7 @@ import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.WeekListBean; import com.yunbao.common.bean.WeekListBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.live.bean.LiveBean; import com.yunbao.live.bean.LiveBean;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.views.MainHomeLiveItemViewHolder; import com.yunbao.main.views.MainHomeLiveItemViewHolder;
@ -205,7 +206,7 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
week_svga.setImageDrawable(drawable); week_svga.setImageDrawable(drawable);
week_svga.startAnimation(); SVGAViewUtils.playEndClear(week_svga);
Log.e("MainHomeLiveAdapter", position + " ***************" + "onComplete"); Log.e("MainHomeLiveAdapter", position + " ***************" + "onComplete");
} }

View File

@ -23,6 +23,7 @@ import com.yunbao.common.custom.MyRadioButton;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -281,7 +282,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
svga1.setImageDrawable(drawable); svga1.setImageDrawable(drawable);
svga1.startAnimation(); SVGAViewUtils.playEndClear(svga1);
} }
@Override @Override
@ -347,7 +348,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
svga2.setImageDrawable(drawable); svga2.setImageDrawable(drawable);
svga2.startAnimation(); SVGAViewUtils.playEndClear(svga2);
} }
@Override @Override
@ -426,7 +427,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
svga3.setImageDrawable(drawable); svga3.setImageDrawable(drawable);
svga3.startAnimation(); SVGAViewUtils.playEndClear(svga3);
} }
@Override @Override

View File

@ -18,6 +18,7 @@ import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity; import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.bean.WeekListBean; import com.yunbao.common.bean.WeekListBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.live.bean.LiveBean; import com.yunbao.live.bean.LiveBean;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -66,7 +67,7 @@ public class MainHomeLiveWeekItemViewHolder<T> extends RecyclerView.ViewHolder {
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
weekSvga.setImageDrawable(drawable); weekSvga.setImageDrawable(drawable);
weekSvga.startAnimation(); SVGAViewUtils.playEndClear(weekSvga);
weekSvga.setClearsAfterStop(false); weekSvga.setClearsAfterStop(false);
} }

View File

@ -39,6 +39,7 @@ 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.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.AbsMainViewHolder; import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -312,7 +313,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
gift_svga.setImageDrawable(drawable); gift_svga.setImageDrawable(drawable);
gift_svga.startAnimation(); SVGAViewUtils.playEndClear(gift_svga);
} }
@Override @Override

View File

@ -29,6 +29,7 @@ import com.yunbao.common.glide.ImgLoader;
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.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.views.AbsMainViewHolder; import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.live.activity.LiveRecordActivity; import com.yunbao.live.activity.LiveRecordActivity;
import com.yunbao.live.activity.RoomManageActivity; import com.yunbao.live.activity.RoomManageActivity;
@ -266,7 +267,7 @@ public class MainMeViewHolder1 extends AbsMainViewHolder implements OnItemClickL
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
gift_svga.setImageDrawable(drawable); gift_svga.setImageDrawable(drawable);
gift_svga.startAnimation(); SVGAViewUtils.playEndClear(gift_svga);
} }
@Override @Override

View File

@ -42,6 +42,7 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
@ -467,7 +468,7 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh
public void onComplete(SVGAVideoEntity videoItem) { public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem); SVGADrawable drawable = new SVGADrawable(videoItem);
gift_svga.setImageDrawable(drawable); gift_svga.setImageDrawable(drawable);
gift_svga.startAnimation(); SVGAViewUtils.playEndClear(gift_svga);
} }
@Override @Override