替换优化后SVGA库

调整部分图片加载大小:如小图标没必要加载原图,设为32x32即可
更新kotlin和gradle依赖版本
This commit is contained in:
zlzw 2022-09-13 17:15:33 +08:00
parent dd39064ca5
commit 7d72a65f89
14 changed files with 38 additions and 20 deletions

View File

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

View File

@ -113,7 +113,6 @@ public class AppContext extends CommonAppContext {
super.onCreate();
//注册全局异常捕获
//registerError();
// ImageLoadUtils.initImageLoader(this);
sInstance = this;
L.setDeBug(BuildConfig.DEBUG);
AppEventsLogger.activateApp(this);

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' }
@ -15,10 +15,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

@ -103,7 +103,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

@ -69,6 +69,13 @@ public class ImgLoader {
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;

View File

@ -13,6 +13,7 @@ public class SVGAViewUtils {
@Override
public void onFinished() {
//动画结束后调用clear释放资源
svga.clear();
}

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,

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;
@ -472,6 +473,8 @@ public class LiveAudienceActivity extends LiveActivity {
@Override
protected void onDestroy() {
super.onDestroy();
ToastUtil.show("Clear!");
ImgLoader.clearMemory(this);
overridePendingTransition(0, 0);
Bus.getOff(this);
L.e("LiveAudienceActivity-------onDestroy------->");

View File

@ -113,7 +113,7 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
itemView.setTag(position);
if (payload == null) {
ImgLoader.displayAvatar(mContext, userBean.getAvatar(), mAvatar,16,16);
ImgLoader.displayAvatar(mContext, userBean.getAvatar(), mAvatar,64,64);
// ImageLoadUtils.loadUrl(userBean.getAvatar(),32,32,mAvatar);
}

View File

@ -141,7 +141,7 @@ import static com.yunbao.common.CommonAppContext.isReady;
@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;
@ -1123,7 +1123,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

@ -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