Migrate to Glide (#1175)
* Replace Picasso library with Glide library tuskyapp#1082 * Replace Picasso library with Glide library tuskyapp#1082 * Update load emoji with glide * Update context used for Glide * Removed unused import * Replace deprecated SimpleTarget with CustomTarget * Fix crash at the view image fragment, remove override image size * Replace Single.create with Single.fromCallable * View image fragment refactor * Fix after merge * Try to load cached image first and show progress view on failure * Try to load cached image first and show progress view on failure
This commit is contained in:
parent
db51c23717
commit
76ce28980c
32 changed files with 260 additions and 322 deletions
|
@ -23,12 +23,12 @@ import android.os.Bundle
|
|||
import android.service.chooser.ChooserTarget
|
||||
import android.service.chooser.ChooserTargetService
|
||||
import android.text.TextUtils
|
||||
import com.bumptech.glide.Glide
|
||||
import com.keylesspalace.tusky.R
|
||||
import com.keylesspalace.tusky.TuskyApplication
|
||||
import com.keylesspalace.tusky.db.AccountManager
|
||||
import com.keylesspalace.tusky.di.Injectable
|
||||
import com.keylesspalace.tusky.util.NotificationHelper
|
||||
import com.squareup.picasso.Picasso
|
||||
|
||||
|
||||
@TargetApi(23)
|
||||
|
@ -48,10 +48,13 @@ class AccountChooserService : ChooserTargetService(), Injectable {
|
|||
val icon: Icon = if (TextUtils.isEmpty(account.profilePictureUrl)) {
|
||||
Icon.createWithResource(applicationContext, R.drawable.avatar_default)
|
||||
} else {
|
||||
Icon.createWithBitmap(Picasso.with(this).load(account.profilePictureUrl)
|
||||
val bmp = Glide.with(this)
|
||||
.asBitmap()
|
||||
.load(account.profilePictureUrl)
|
||||
.error(R.drawable.avatar_default)
|
||||
.placeholder(R.drawable.avatar_default)
|
||||
.get())
|
||||
.submit()
|
||||
Icon.createWithBitmap(bmp.get())
|
||||
}
|
||||
val bundle = Bundle()
|
||||
bundle.putLong(NotificationHelper.ACCOUNT_ID, account.id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue