Removed Glide warnings

This commit is contained in:
Sylvain Berfini 2020-10-15 10:22:06 +02:00
parent e34f12af19
commit 1bbc5a4ee3
4 changed files with 46 additions and 7 deletions

View file

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

View file

@ -20,4 +20,6 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep public class * extends androidx.fragment.app.Fragment { *; }
-keep public class * extends androidx.fragment.app.Fragment { *; }
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl

View file

@ -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 <T> 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<Drawable?> {
override fun onLoadFailed(
e: GlideException?,

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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)
}
}