diff --git a/app/build.gradle b/app/build.gradle index df642204c..df64d20d7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -153,6 +153,7 @@ repositories { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.media:media:1.2.0' implementation 'androidx.fragment:fragment-ktx:1.2.5' @@ -163,9 +164,12 @@ dependencies { implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0' implementation 'androidx.recyclerview:recyclerview:1.1.0' - implementation 'com.google.android:flexbox:2.0.0' - implementation 'com.github.bumptech.glide:glide:4.11.0' + implementation 'com.google.android.material:material:1.2.1' + implementation 'com.google.android:flexbox:2.0.0' + + implementation 'com.github.bumptech.glide:glide:4.11.0' + kapt 'com.github.bumptech.glide:compiler:4.11.0' if (firebaseEnabled()) { implementation 'com.google.firebase:firebase-messaging:19.0.1' diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 18e792993..832ea9d5c 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -20,4 +20,6 @@ # hide the original source file name. #-renamesourcefileattribute SourceFile --keep public class * extends androidx.fragment.app.Fragment { *; } \ No newline at end of file +-keep public class * extends androidx.fragment.app.Fragment { *; } +-keep public class * extends com.bumptech.glide.module.AppGlideModule +-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl \ No newline at end of file diff --git a/app/src/main/java/org/linphone/utils/DataBindingUtils.kt b/app/src/main/java/org/linphone/utils/DataBindingUtils.kt index bf640f56b..a09d9b3a8 100644 --- a/app/src/main/java/org/linphone/utils/DataBindingUtils.kt +++ b/app/src/main/java/org/linphone/utils/DataBindingUtils.kt @@ -33,7 +33,6 @@ import android.view.inputmethod.EditorInfo import android.widget.* import android.widget.SeekBar.OnSeekBarChangeListener import androidx.databinding.* -import com.bumptech.glide.Glide import com.bumptech.glide.load.DataSource import com.bumptech.glide.load.engine.GlideException import com.bumptech.glide.request.RequestListener @@ -272,7 +271,7 @@ fun setEntries( @BindingAdapter("glideAvatarFallback") fun loadAvatarWithGlideFallback(imageView: ImageView, path: String?) { if (path != null && path.isNotEmpty() && FileUtils.isExtensionImage(path)) { - Glide.with(imageView).load(path).apply(RequestOptions.circleCropTransform()).into(imageView) + GlideApp.with(imageView).load(path).apply(RequestOptions.circleCropTransform()).into(imageView) } else { Log.w("[Data Binding] [Glide] Can't load $path") imageView.setImageResource(R.drawable.avatar) @@ -282,7 +281,7 @@ fun loadAvatarWithGlideFallback(imageView: ImageView, path: String?) { @BindingAdapter("glidePath") fun loadImageWithGlide(imageView: ImageView, path: String) { if (path.isNotEmpty() && FileUtils.isExtensionImage(path)) { - Glide.with(imageView).load(path).into(imageView) + GlideApp.with(imageView).load(path).into(imageView) } else { Log.w("[Data Binding] [Glide] Can't load $path") } @@ -296,7 +295,7 @@ fun loadAvatarWithGlide(imageView: ImageView, path: Uri?) { @BindingAdapter("glideAvatar") fun loadAvatarWithGlide(imageView: ImageView, path: String?) { if (path != null) { - Glide.with(imageView).load(path).apply(RequestOptions.circleCropTransform()).listener(object : + GlideApp.with(imageView).load(path).apply(RequestOptions.circleCropTransform()).listener(object : RequestListener { override fun onLoadFailed( e: GlideException?, diff --git a/app/src/main/java/org/linphone/utils/LinphoneGlideModule.kt b/app/src/main/java/org/linphone/utils/LinphoneGlideModule.kt new file mode 100644 index 000000000..65cd2e460 --- /dev/null +++ b/app/src/main/java/org/linphone/utils/LinphoneGlideModule.kt @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2010-2020 Belledonne Communications SARL. + * + * This file is part of linphone-android + * (see https://www.linphone.org). + * + * 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 org.linphone.utils + +import android.content.Context +import android.util.Log +import com.bumptech.glide.GlideBuilder +import com.bumptech.glide.annotation.GlideModule +import com.bumptech.glide.module.AppGlideModule + +@GlideModule +class LinphoneGlideModule : AppGlideModule() { + override fun applyOptions(context: Context, builder: GlideBuilder) { + // Tells Glide to only log errors, prevents warnings because contact doesn't have a picture + builder.setLogLevel(Log.ERROR) + } +}