diff --git a/app/build.gradle b/app/build.gradle index cbb426cb0..76e048e32 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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"] } diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index b9e13dffd..40465e7fa 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -113,7 +113,6 @@ public class AppContext extends CommonAppContext { super.onCreate(); //注册全局异常捕获 //registerError(); - // ImageLoadUtils.initImageLoader(this); sInstance = this; L.setDeBug(BuildConfig.DEBUG); AppEventsLogger.activateApp(this); diff --git a/build.gradle b/build.gradle index 8597944f4..3fc9c4bc4 100644 --- a/build.gradle +++ b/build.gradle @@ -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' } diff --git a/common/build.gradle b/common/build.gradle index eb03a2177..71c4fb2ea 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -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"] diff --git a/common/libs/library-release.aar b/common/libs/library-release.aar new file mode 100644 index 000000000..d4695eb68 Binary files /dev/null and b/common/libs/library-release.aar differ diff --git a/common/src/main/java/com/yunbao/common/glide/ImgLoader.java b/common/src/main/java/com/yunbao/common/glide/ImgLoader.java index 467cd7e0a..c44ae25dd 100644 --- a/common/src/main/java/com/yunbao/common/glide/ImgLoader.java +++ b/common/src/main/java/com/yunbao/common/glide/ImgLoader.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/utils/SVGAViewUtils.java b/common/src/main/java/com/yunbao/common/utils/SVGAViewUtils.java index 4e63d6ebf..e28e03ce9 100644 --- a/common/src/main/java/com/yunbao/common/utils/SVGAViewUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/SVGAViewUtils.java @@ -13,6 +13,7 @@ public class SVGAViewUtils { @Override public void onFinished() { + //动画结束后调用clear释放资源 svga.clear(); } diff --git a/dependencies.gradle b/dependencies.gradle index 2e349e7f2..fbb0c995d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -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,支付登录分享 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f55729f8f..9276a5849 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 68578c0a2..25609df3f 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -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------->"); diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java index bcb21a671..aa12c832b 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java @@ -113,7 +113,7 @@ public class LiveUserAdapter extends RecyclerView.Adapter { 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); } diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 17be939d2..a2dad79bc 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -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); diff --git a/main/src/main/java/com/yunbao/main/views/FloatBannerView.java b/main/src/main/java/com/yunbao/main/views/FloatBannerView.java index 8c9230469..673593b1a 100644 --- a/main/src/main/java/com/yunbao/main/views/FloatBannerView.java +++ b/main/src/main/java/com/yunbao/main/views/FloatBannerView.java @@ -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(); diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java index 82e3b5758..93418bf16 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java @@ -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