Merge branch 'dev_Memory' into dev_test

# Conflicts:
#	app/src/main/java/com/shayu/phonelive/AppContext.java
#	common/src/main/java/com/yunbao/common/glide/ImgLoader.java
#	dependencies.gradle
#	live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java
#	live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java
#	main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java
#	main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java
This commit is contained in:
zlzw 2022-09-22 14:43:57 +08:00
commit ff7bfc040d
37 changed files with 319 additions and 169 deletions

View File

@ -87,6 +87,7 @@ android {
}
debug {
signingConfig signingConfigs.release
debuggable true
}
}
lintOptions {
@ -111,6 +112,8 @@ dependencies {
api project(':video')
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
// implementation rootProject.ext.dependencies["leakcanary"]
}
//

View File

@ -4,16 +4,13 @@ import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.net.http.HttpResponseCache;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustConfig;
@ -50,8 +47,6 @@ import com.yunbao.main.activity.MsgSettActivity;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import io.rong.imkit.config.RongConfigCenter;

View File

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

View File

@ -386,7 +386,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setBackgroundColor(0xffffffff);
mImageViewList.add(imageView);
ImgLoader.display(mContext, mAdList.get(i).getUrl(), imageView);
ImgLoader.display(mContext, mAdList.get(i).getUrl(), imageView,480,960);
}
for (int i = imgSize - 1; i >= 0; i--) {
mContainer.addView(mImageViewList.get(i));
@ -544,7 +544,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
public void onDataUserInfoEvent(DataUserInfoEvent event) {
if (event.isUpDataSuccess()) {
//融云连接服务器
RongcloudIMManager.connectIM(this);
RongcloudIMManager.connectIM(getApplication());
forwardMainActivity();
} else {
releaseVideo();

View File

@ -4,7 +4,7 @@ apply from: "dependencies.gradle"
buildscript {
ext.kotlin_version = '1.4.32'
ext.kotlin_version = '1.6.20'
repositories {
maven { url "https://mvn.mob.com/android" }
maven { url 'https://maven.aliyun.com/repository/public' }
@ -16,10 +16,10 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
classpath 'com.android.tools.build:gradle:4.0.2'
//png工具
classpath 'com.chenenyu:img-optimizer:1.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32"
classpath 'com.chenenyu:img-optimizer:1.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20"
classpath 'com.google.gms:google-services:4.3.3'
}

View File

@ -104,7 +104,9 @@ dependencies {
api rootProject.ext.dependencies["gif-drawable"]
//svga播放器
api rootProject.ext.dependencies["SVGAPlayer"]
//api rootProject.ext.dependencies["SVGAPlayer"]
implementation 'com.squareup.wire:wire-runtime:4.4.1'
api files('libs/library-release.aar')
//
api rootProject.ext.dependencies["qiniu-sdk"]

Binary file not shown.

View File

@ -2,7 +2,9 @@ package com.yunbao.common.glide;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.media.ThumbnailUtils;
import android.net.Uri;
import android.text.TextUtils;
import android.widget.ImageView;
@ -13,6 +15,7 @@ import androidx.annotation.Nullable;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import com.yunbao.common.R;
@ -33,36 +36,120 @@ public class ImgLoader {
sBlurTransformation = new BlurTransformation(25);
}
public static void display(Context context, String url, ImageView imageView) {
display(context, url, imageView, -1, -1);
}
public static void display(Context context, String url, ImageView imageView, int width, int height) {
if (!contextIsExist(context)) {
return;
}
Glide.with(context).asDrawable().load(url).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
Glide.with(context)
.asBitmap()
.load(url)
.skipMemoryCache(SKIP_MEMORY_CACHE)
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
if (width == -1 || height == -1) {
imageView.setImageBitmap(resource);
} else {
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
imageView.setImageBitmap(bitmap);
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
public static void display2(Context context, String url, ImageView imageView) {
display2(context, url, imageView, -1, -1);
}
/**
* 手动清空内存
*/
public static void clearMemory(Context context){
Glide.get(context)
.clearMemory();
}
public static void display2(Context context, String url, ImageView imageView, int width, int height) {
if (!contextIsExist(context)) {
return;
}
Glide.with(context).asDrawable().load(url).placeholder(imageView.getDrawable()).dontAnimate().skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
Glide.with(context)
.asBitmap()
.load(url)
.placeholder(imageView.getDrawable())
.dontAnimate()
.skipMemoryCache(SKIP_MEMORY_CACHE)
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
if (width == -1 || height == -1) {
imageView.setImageBitmap(resource);
} else {
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
imageView.setImageBitmap(bitmap);
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
public static void display2(Context context, int url, ImageView imageView) {
if (!contextIsExist(context)) {
return;
}
Glide.with(context).asDrawable().load(url).placeholder(imageView.getDrawable()).dontAnimate().skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
Glide.with(context)
.asDrawable()
.load(url)
.placeholder(imageView.getDrawable())
.dontAnimate()
.skipMemoryCache(SKIP_MEMORY_CACHE)
.into(imageView);
}
public static void displayWithError(Context context, String url, ImageView imageView, int errorRes) {
displayWithError(context, url, imageView, errorRes, -1, -1);
}
public static void displayWithError(Context context, String url, ImageView imageView, int errorRes, int width, int height) {
if (!contextIsExist(context)) {
return;
}
if (imageView == null) {
return;
}
Glide.with(context).asDrawable().load(url).error(errorRes).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
Glide.with(context)
.asBitmap()
.load(url)
.error(errorRes)
.skipMemoryCache(SKIP_MEMORY_CACHE)
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
if (width == -1 || height == -1) {
imageView.setImageBitmap(resource);
} else {
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
imageView.setImageBitmap(bitmap);
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
public static void displayWithError(Context context, int url, ImageView imageView, int errorRes) {
@ -79,8 +166,34 @@ public class ImgLoader {
if (!contextIsExist(context)) {
return;
}
displayWithError(context, url, imageView, R.mipmap.icon_avatar_placeholder);
displayAvatar(context, url, imageView, -1, -1);
}
public static void displayAvatar(Context context, String url, ImageView imageView, int width, int height) {
if (!contextIsExist(context)) {
return;
}
Glide.with(context)
.asBitmap()
.load(url)
.error(R.mipmap.icon_avatar_placeholder)
.skipMemoryCache(SKIP_MEMORY_CACHE)
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
if (width == -1 || height == -1) {
imageView.setImageBitmap(resource);
} else {
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
imageView.setImageBitmap(bitmap);
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
public static void displayAvatar(Context context, int url, ImageView imageView) {
@ -95,14 +208,22 @@ public class ImgLoader {
if (!contextIsExist(context)) {
return;
}
Glide.with(context).asDrawable().load(file).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
Glide.with(context)
.asDrawable()
.load(file)
.skipMemoryCache(SKIP_MEMORY_CACHE)
.into(imageView);
}
public static void display(Context context, int res, ImageView imageView) {
if (!contextIsExist(context)) {
return;
}
Glide.with(context).asDrawable().load(res).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
Glide.with(context)
.asDrawable()
.load(res)
.skipMemoryCache(SKIP_MEMORY_CACHE)
.into(imageView);
}
/**
@ -112,7 +233,11 @@ public class ImgLoader {
if (!contextIsExist(context)) {
return;
}
Glide.with(context).asDrawable().load(Uri.fromFile(new File(videoPath))).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
Glide.with(context)
.asDrawable()
.load(Uri.fromFile(new File(videoPath)))
.skipMemoryCache(SKIP_MEMORY_CACHE)
.into(imageView);
}
/**
@ -122,7 +247,11 @@ public class ImgLoader {
if (!contextIsExist(context)) {
return;
}
Glide.with(context).asGif().load(videoPath).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
Glide.with(context)
.asGif()
.load(videoPath)
.skipMemoryCache(SKIP_MEMORY_CACHE)
.into(imageView);
}
public static void displayDrawable(Context context, String url, final DrawableCallback callback) {
@ -190,27 +319,67 @@ public class ImgLoader {
* 显示模糊的毛玻璃图片
*/
public static void displayBlur(Context context, String url, ImageView imageView) {
displayBlur(context, url, imageView, -1, -1);
}
public static void displayBlur(Context context, String url, ImageView imageView, int width, int height) {
if (!contextIsExist(context)) {
return;
}
Glide.with(context).asDrawable().load(url)
Glide.with(context)
.asBitmap()
.load(url)
.skipMemoryCache(SKIP_MEMORY_CACHE)
.apply(RequestOptions.bitmapTransform(sBlurTransformation))
.into(imageView);
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
if (width == -1 || height == -1) {
imageView.setImageBitmap(resource);
} else {
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
imageView.setImageBitmap(bitmap);
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
/**
* 显示模糊的毛玻璃图片
*/
public static void displayBlurLive(Context context, String url, ImageView imageView) {
displayBlurLive(context, url, imageView, -1, -1);
}
public static void displayBlurLive(Context context, String url, ImageView imageView, int width, int height) {
if (!contextIsExist(context)) {
return;
}
Glide.with(context).asDrawable().load(url)
Glide.with(context).asBitmap().load(url)
.skipMemoryCache(SKIP_MEMORY_CACHE)
.apply(RequestOptions.bitmapTransform(new BlurTransformation(100)))
.apply(RequestOptions.bitmapTransform(new BlurTransformation(20)))
.placeholder(R.mipmap.live_bg)
.into(imageView);
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
if (width == -1 || height == -1) {
imageView.setImageBitmap(resource);
} else {
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
imageView.setImageBitmap(bitmap);
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
private static boolean contextIsExist(Context context) {

View File

@ -0,0 +1,32 @@
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() {
//动画结束后调用clear释放资源
svga.clear();
}
@Override
public void onRepeat() {
}
@Override
public void onStep(int i, double v) {
}
});
svga.startAnimation();
}
}

View File

@ -8,6 +8,7 @@ import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.ms.banner.holder.BannerViewHolder;
import com.yunbao.common.bean.BannerBean;
import com.yunbao.common.glide.ImgLoader;
public class CustomViewHolder implements BannerViewHolder<BannerBean> {
@ -20,7 +21,8 @@ public class CustomViewHolder implements BannerViewHolder<BannerBean> {
);
imageView.setLayoutParams(params);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
Glide.with(context).load(data.getImageUrl()).into(imageView);
//Glide.with(context).load(data.getImageUrl()).into(imageView);
ImgLoader.display(context,data.getImageUrl(),imageView,600,170);
return imageView;
}

View File

@ -15,7 +15,7 @@ ext {
"glide-transformations": 'jp.wasabeef:glide-transformations:3.1.1',//Glide的transformation库,,,,
"roundedimageview" : 'com.makeramen:roundedimageview:2.3.0', //ImageView
"gif-drawable" : 'pl.droidsonroids.gif:android-gif-drawable:1.2.23',//gif库gif用
"SVGAPlayer" : 'com.github.yyued:SVGAPlayer-Android:2.6.0', //svga播放器
"SVGAPlayer" : 'com.github.yyued:SVGAPlayer-Android:2.6.1', //svga播放器
"qiniu-sdk" : 'com.qiniu:qiniu-android-sdk:7.2.1',//
// "tencent-cosxml" : 'com.tencent.qcloud:cosxml:5.4.13',//
// "tencent-wechat-sdk" : 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+',//sdk,
@ -29,6 +29,7 @@ ext {
"Luban" : 'top.zibin:Luban:1.1.8',//
"arouter" : 'com.alibaba:arouter-api:1.5.2',//ARouter
"arouter-compiler" : 'com.alibaba:arouter-compiler:1.2.2',
"leakcanary" : 'com.squareup.leakcanary:leakcanary-android:2.9.1',
"blank-utilcode" : 'com.blankj:utilcode:1.30.0',
]

View File

@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

View File

@ -36,6 +36,7 @@ import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.EffectsSettingsDialog;
import com.yunbao.common.dialog.LiveChargeDialogFragment;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
@ -474,6 +475,7 @@ public class LiveAudienceActivity extends LiveActivity {
@Override
protected void onDestroy() {
super.onDestroy();
ImgLoader.clearMemory(this);
overridePendingTransition(0, 0);
Bus.getOff(this);
L.e("LiveAudienceActivity-------onDestroy------->");

View File

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

View File

@ -1,36 +1,35 @@
package com.yunbao.live.adapter;
import static android.text.TextUtils.isEmpty;
import android.content.Context;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.CommonAppConfig;
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.glide.ImgLoader;
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.URL;
import java.util.ArrayList;
import java.util.List;
import static android.text.TextUtils.isEmpty;
/**
* Created by cxf on 2018/10/10.
*/
@ -114,35 +113,10 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
itemView.setTag(position);
if (payload == null) {
ImgLoader.displayAvatar(mContext, userBean.getAvatar(), mAvatar);
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(userBean.getLevel());
// if (levelBean != null) {
// ImgLoader.display(mContext, levelBean.getThumbIcon(), mIcon);
// }
ImgLoader.displayAvatar(mContext, userBean.getAvatar(), mAvatar,64,64);
// ImageLoadUtils.loadUrl(userBean.getAvatar(),32,32,mAvatar);
}
int guardType = userBean.getGuardType();
// if (guardType == Constants.GUARD_TYPE_NONE) {
// if (mIcon.getVisibility() != View.VISIBLE) {
// 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")) {
@ -152,7 +126,7 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
gift_svga.setImageDrawable(drawable);
gift_svga.startAnimation();
SVGAViewUtils.playEndClear(gift_svga);
}
@Override
@ -166,21 +140,6 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
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 +175,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() {
if (mList != null) {
mList.clear();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,12 +20,14 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.ViewFlipper;
import com.opensource.svgaplayer.SVGACallback;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.glide.ImgLoader;
@ -35,6 +37,7 @@ import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -123,7 +126,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
svga_new_user_gif.setImageDrawable(drawable);
svga_new_user_gif.startAnimation();
SVGAViewUtils.playEndClear(svga_new_user_gif);
}
@Override
@ -142,7 +145,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
SVGADrawable drawable = new SVGADrawable(videoItem);
svga_new_user_double.setImageDrawable(drawable);
svga_new_user_double.setBackgroundResource(R.mipmap.black_bg);
svga_new_user_double.startAnimation();
SVGAViewUtils.playEndClear(svga_new_user_double);
}
@Override
@ -159,7 +162,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
svga_new_user_follow.setImageDrawable(drawable);
svga_new_user_follow.startAnimation();
SVGAViewUtils.playEndClear(svga_new_user_follow);
}
@Override

View File

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

View File

@ -240,7 +240,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
//直播间背景
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack);
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack,400,600);
//ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack);
mask.setVisibility(View.VISIBLE);
mLivePlayViewHolder.setCover(data.getThumb());
mLivePlayViewHolder.play(data.getPull());

View File

@ -141,7 +141,7 @@ import kotlin.Unit;
@Route(path = RouteUtil.PATH_MAIN)
public class MainActivity extends AbsActivity implements MainAppBarLayoutListener {
public static RelativeLayout rt_main_tab;
public RelativeLayout rt_main_tab;
private ViewGroup mRootView;
private TabButtonGroup mTabButtonGroup;
private ViewPager mViewPager;
@ -1100,7 +1100,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
mMainHomeCommunityViewHolder.mValueCallback2 = null;
}
public static void isClose(String isClose) {
public void isClose(String isClose) {
if ("0".equals(isClose)) {
isTabClose = true;
rt_main_tab.setVisibility(View.INVISIBLE);

View File

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

View File

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

View File

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

View File

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

View File

@ -24,6 +24,7 @@ import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.main.R;
@ -287,7 +288,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
svga1.setImageDrawable(drawable);
svga1.startAnimation();
SVGAViewUtils.playEndClear(svga1);
}
@Override
@ -362,7 +363,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
svga2.setImageDrawable(drawable);
svga2.startAnimation();
SVGAViewUtils.playEndClear(svga2);
}
@Override
@ -437,7 +438,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
svga3.setImageDrawable(drawable);
svga3.startAnimation();
SVGAViewUtils.playEndClear(svga3);
}
@Override

View File

@ -35,6 +35,9 @@ public class FloatBannerView extends FrameLayout {
private Handler bannerHandler = new Handler();
private int index = 0;
private String Uid;
//小图标没必要用高清原图压缩至x32可以节约内存
private final int iconWidth=32;
private final int iconHeight=32;
public FloatBannerView(Context context) {
super(context);
@ -76,9 +79,9 @@ public class FloatBannerView extends FrameLayout {
}
list.clear();
list.addAll(mList);
ImgLoader.displayAvatar(getContext(), list.get(0).getAvatar(), clipImage3);
ImgLoader.displayAvatar(getContext(), list.get(1).getAvatar(), clipImage2);
ImgLoader.displayAvatar(getContext(), list.get(2).getAvatar(), clipImage1);
ImgLoader.displayAvatar(getContext(), list.get(0).getAvatar(), clipImage3,iconWidth,iconHeight);
ImgLoader.displayAvatar(getContext(), list.get(1).getAvatar(), clipImage2,iconWidth,iconHeight);
ImgLoader.displayAvatar(getContext(), list.get(2).getAvatar(), clipImage1,iconWidth,iconHeight);
bannerHandler.post(mFlipRunnable);
});
@ -107,8 +110,8 @@ public class FloatBannerView extends FrameLayout {
float targetX = bannerLayout2.getX() - bannerLayout3.getX();
float targetY = bannerLayout2.getY() - bannerLayout3.getY();
bannerLayout3.setVisibility(GONE);
ImgLoader.displayAvatar(getContext(), list.get(next).getAvatar(), clipImage3);
ImgLoader.displayAvatar(getContext(), list.get(next).getAvatar(), clipImage2);
ImgLoader.displayAvatar(getContext(), list.get(next).getAvatar(), clipImage3,iconWidth,iconHeight);
ImgLoader.displayAvatar(getContext(), list.get(next).getAvatar(), clipImage2,iconWidth,iconHeight);
TranslateAnimation animationTranslate = new TranslateAnimation(0, -targetX / 1.2f, 0, -targetY / 1.2f);
ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 1.2f, 1f, 1.2f);
AnimationSet animationSet1 = new AnimationSet(true);
@ -122,7 +125,7 @@ public class FloatBannerView extends FrameLayout {
public void onAnimationStart(Animation animation) {
int show = finalNext + 1;
ImgLoader.displayAvatar(getContext(), list.get(show >= list.size() ? 0 : show).getAvatar(), clipImage1);
ImgLoader.displayAvatar(getContext(), list.get(show >= list.size() ? 0 : show).getAvatar(), clipImage1,iconWidth,iconHeight);
}
@Override
@ -154,7 +157,7 @@ public class FloatBannerView extends FrameLayout {
@Override
public void onAnimationEnd(Animation animation) {
ImgLoader.displayAvatar(getContext(), list.get(finalNext).getAvatar(), clipImage4);
ImgLoader.displayAvatar(getContext(), list.get(finalNext).getAvatar(), clipImage4,iconWidth,iconHeight);
index = index + 1;
bannerHandler.postDelayed(mFlipRunnable, delayMillis);
bannerLayout3.clearAnimation();

View File

@ -255,7 +255,9 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
@JavascriptInterface
public void isCloseNavigation(String isClose) {
MainActivity.isClose(isClose);
if(nowMainActivity!=null) {
nowMainActivity.isClose(isClose);
}
}
@JavascriptInterface

View File

@ -76,7 +76,7 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder {
.load(bean.getContent_pic_size_three())
.into(liveType);
}
ImgLoader.display(itemView.getContext(), bean.getThumb(), mCover);
ImgLoader.display(itemView.getContext(), bean.getThumb(), mCover,300,300);
bgs.setVisibility(View.VISIBLE);
pkico.setVisibility(View.GONE);
pkAvatar.setVisibility(View.GONE);

View File

@ -18,6 +18,7 @@ import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.bean.WeekListBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.live.bean.LiveBean;
import com.yunbao.main.R;
@ -66,7 +67,7 @@ public class MainHomeLiveWeekItemViewHolder<T> extends RecyclerView.ViewHolder {
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
weekSvga.setImageDrawable(drawable);
weekSvga.startAnimation();
SVGAViewUtils.playEndClear(weekSvga);
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.OnItemClickListener;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -312,7 +313,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
gift_svga.setImageDrawable(drawable);
gift_svga.startAnimation();
SVGAViewUtils.playEndClear(gift_svga);
}
@Override

View File

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

View File

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