update Glide to 4.0.0

This commit is contained in:
tibbi 2017-06-30 22:34:06 +02:00
parent fab5120d1e
commit 9109f1e19c
5 changed files with 9 additions and 10 deletions

View file

@ -29,6 +29,6 @@ ext {
propMinSdkVersion = 16
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '2.21.17'
propVersionName = '2.22.0'
kotlin_version = '1.1.3'
}

View file

@ -28,9 +28,10 @@ android {
dependencies {
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
compile 'com.booking:rtlviewpager:1.0.1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1'
}
buildscript {

View file

@ -7,10 +7,11 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade
import com.bumptech.glide.request.RequestOptions
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.extensions.baseConfig
import com.simplemobiletools.commons.extensions.formatSize
import com.simplemobiletools.commons.extensions.getCacheStrategy
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
import com.simplemobiletools.commons.models.FileDirItem
import kotlinx.android.synthetic.main.filepicker_list_item.view.*
@ -59,7 +60,8 @@ class FilepickerItemsAdapter(val context: Context, private val mItems: List<File
list_item_details.text = getChildrenCnt(fileDirItem)
} else {
val path = fileDirItem.path
Glide.with(context).load(path).diskCacheStrategy(path.getCacheStrategy()).error(fileDrawable).centerCrop().crossFade().into(list_item_icon)
val options = RequestOptions().centerCrop().error(fileDrawable)
Glide.with(context).load(path).transition(withCrossFade()).apply(options).into(list_item_icon)
list_item_details.text = fileDirItem.size.formatSize()
}
@ -74,7 +76,7 @@ class FilepickerItemsAdapter(val context: Context, private val mItems: List<File
}
fun stopLoad() {
Glide.clear(view.list_item_icon)
Glide.with(context).clear(view.list_item_icon)
}
}
}

View file

@ -1,7 +1,6 @@
package com.simplemobiletools.commons.extensions
import android.content.Context
import com.bumptech.glide.load.engine.DiskCacheStrategy
import java.util.*
fun String.getFilenameFromPath() = substring(lastIndexOf("/") + 1)
@ -41,8 +40,6 @@ fun String.isVideoFast() = videoExtensions.any { endsWith(it, true) }
// fast extension check, not guaranteed to be accurate
fun String.isImageFast() = photoExtensions.any { endsWith(it, true) }
fun String.getCacheStrategy() = if (isGif()) DiskCacheStrategy.SOURCE else DiskCacheStrategy.RESULT
fun String.getMimeTypeFromPath(): String {
val typesMap = HashMap<String, String>().apply {
put("323", "text/h323")

View file

@ -12,8 +12,7 @@
android:id="@+id/list_item_icon"
android:layout_width="@dimen/normal_icon_size"
android:layout_height="@dimen/normal_icon_size"
android:paddingBottom="@dimen/medium_margin"
android:paddingTop="@dimen/medium_margin"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_folder"/>
<com.simplemobiletools.commons.views.MyTextView