From 489336504d1dbad6c667b916a23b9a4c3ad06c45 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Tue, 22 Nov 2022 00:19:07 +0600 Subject: [PATCH] Set glide internal logging level to error issue: https://gitlab.e.foundation/e/os/backlog/-/issues/663 We don't want to clutter logcat with warn level logs & only shows error level logs. - setUp GlideModule to enable configuration for Glide - add proguard rules for glide - set glides log level to ERROR --- app/build.gradle | 4 ++- app/proguard-rules.pro | 14 ++++++++ .../ApplicationGlideModule.java | 36 +++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/foundation/e/drive/configurations/ApplicationGlideModule.java diff --git a/app/build.gradle b/app/build.gradle index be6b5805..dacbb1ef 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -86,7 +86,9 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.4.1' implementation "androidx.constraintlayout:constraintlayout:2.1.3" implementation 'com.google.android.material:material:1.6.0' - implementation 'com.github.bumptech.glide:glide:4.13.1' + implementation 'com.github.bumptech.glide:glide:4.14.2' + implementation 'com.github.bumptech.glide:annotations:4.14.2' + annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2' implementation "androidx.work:work-runtime:2.7.1" implementation 'androidx.test:core:1.4.0' implementation 'com.jakewharton.timber:timber:5.0.1' diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index f1b42451..e251250e 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -19,3 +19,17 @@ # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile +-keep public class * implements com.bumptech.glide.module.GlideModule +-keep class * extends com.bumptech.glide.module.AppGlideModule { + (...); +} +-keep public enum com.bumptech.glide.load.ImageHeaderParser$** { + **[] $VALUES; + public *; +} +-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder { + *** rewind(); +} + +# Uncomment for DexGuard only +#-keepresourcexmlelements manifest/application/meta-data@value=GlideModule \ No newline at end of file diff --git a/app/src/main/java/foundation/e/drive/configurations/ApplicationGlideModule.java b/app/src/main/java/foundation/e/drive/configurations/ApplicationGlideModule.java new file mode 100644 index 00000000..15f6dac8 --- /dev/null +++ b/app/src/main/java/foundation/e/drive/configurations/ApplicationGlideModule.java @@ -0,0 +1,36 @@ +/* + * Copyright MURENA SAS 2022 + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package foundation.e.drive.configurations; + +import android.content.Context; +import android.util.Log; + +import androidx.annotation.NonNull; + +import com.bumptech.glide.GlideBuilder; +import com.bumptech.glide.annotation.GlideModule; +import com.bumptech.glide.module.AppGlideModule; + +@GlideModule +public class ApplicationGlideModule extends AppGlideModule { + + @Override + public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) { + super.applyOptions(context, builder); + builder.setLogLevel(Log.ERROR); + } +} -- GitLab