From 80ca6242b72fdcc606c41817e7025dab46006139 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 9 Aug 2017 18:51:37 -0700 Subject: Move glide loader to onCreate (#135) --- .../com/pitchedapps/frost/activities/LoginActivity.kt | 15 +++++---------- docs/Changelog.md | 7 +++++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt index eb991599..fa26502a 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt @@ -12,6 +12,7 @@ import ca.allanwang.kau.utils.bindView import ca.allanwang.kau.utils.fadeIn import ca.allanwang.kau.utils.fadeOut import com.bumptech.glide.Glide +import com.bumptech.glide.RequestManager import com.bumptech.glide.load.DataSource import com.bumptech.glide.load.engine.GlideException import com.bumptech.glide.request.RequestListener @@ -44,6 +45,7 @@ class LoginActivity : BaseActivity() { val profileObservable = SingleSubject.create() val usernameObservable = SingleSubject.create() + lateinit var profileLoader: RequestManager // Helper to set and enable swipeRefresh var refresh: Boolean @@ -68,6 +70,7 @@ class LoginActivity : BaseActivity() { loadInfo(cookie) }) } + profileLoader = Glide.with(profile) } fun loadInfo(cookie: CookieModel) { @@ -78,7 +81,7 @@ class LoginActivity : BaseActivity() { (foundImage, name) -> refresh = false if (!foundImage) { - L.eThrow("Could not get profile photo; Invalid userId?") + L.e("Could not get profile photo; Invalid userId?") L.i(null, cookie.toString()) } textview.text = String.format(getString(R.string.welcome), name) @@ -102,7 +105,7 @@ class LoginActivity : BaseActivity() { fun loadProfile(id: Long) { - Glide.with(profile).load(PROFILE_PICTURE_URL(id)).withRoundIcon().listener(object : RequestListener { + profileLoader.load(PROFILE_PICTURE_URL(id)).withRoundIcon().listener(object : RequestListener { override fun onResourceReady(resource: Drawable?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { profileObservable.onSuccess(true) return false @@ -119,12 +122,4 @@ class LoginActivity : BaseActivity() { fun loadUsername(cookie: CookieModel) { cookie.fetchUsername { usernameObservable.onSuccess(it) } } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - if (requestCode == 999) { - L.d("Result found for activity with result $resultCode") - L.d("Intent data ${data?.extras.toString()}") - } else - super.onActivityResult(requestCode, resultCode, data) - } } \ No newline at end of file diff --git a/docs/Changelog.md b/docs/Changelog.md index a7a855f7..1eddde9c 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,10 +1,13 @@ # Changelog ## Beta Updates -* Fixed notification titles -* Added support for downloading videos +* Fix notification titles +* ALPHA: Add support for downloading videos (hit the download button) * Deny intents for login so the page loads properly (thank you @Zenexer) * Reduce injection offset and move injectors to an earlier method +* Add option to disable media loading on metered network +* Fix menu section +* Add more background setters to help transparent themes ## v1.5.0 * Experimental: Add notifications for messages; report to me if this drains your battery -- cgit v1.2.3