diff options
author | Allan Wang <me@allanwang.ca> | 2021-11-19 21:35:49 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2021-11-19 21:35:49 -0800 |
commit | 4135d5e7734592deb7107ea9a751b153536d01f7 (patch) | |
tree | 600be889a83fc832443344357fef12aaef607008 /app | |
parent | e6a45b29cae18161edd05337ae6ba3482ba3068c (diff) | |
download | frost-4135d5e7734592deb7107ea9a751b153536d01f7.tar.gz frost-4135d5e7734592deb7107ea9a751b153536d01f7.tar.bz2 frost-4135d5e7734592deb7107ea9a751b153536d01f7.zip |
Clean up and fix changes from compose test
Diffstat (limited to 'app')
-rw-r--r-- | app/build.gradle | 8 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt | 23 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt | 8 |
3 files changed, 17 insertions, 22 deletions
diff --git a/app/build.gradle b/app/build.gradle index ba0b2018..2655f695 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -274,9 +274,9 @@ dependencies { implementation "androidx.biometric:biometric:${Versions.andxBiometric}" - implementation 'com.github.piasy:BigImageViewer:1.8.1' - implementation 'com.github.piasy:GlideImageLoader:1.8.1' - implementation 'com.github.piasy:GlideImageViewFactory:1.8.1' + implementation "com.github.piasy:BigImageViewer:${Versions.bigImageViewer}" + implementation "com.github.piasy:GlideImageLoader:${Versions.bigImageViewer}" + implementation "com.github.piasy:GlideImageViewFactory:${Versions.bigImageViewer}" implementation kau.Dependencies.hilt kapt kau.Dependencies.hiltCompiler @@ -318,8 +318,6 @@ dependencies { testImplementation "com.squareup.okhttp3:mockwebserver:${Versions.okhttp}" androidTestImplementation "com.squareup.okhttp3:mockwebserver:${Versions.okhttp}" -// implementation "com.davemorrissey.labs:subsampling-scale-image-view:${Versions.scaleImageView}" - implementation "androidx.room:room-ktx:${Versions.room}" implementation "androidx.room:room-runtime:${Versions.room}" kapt "androidx.room:room-compiler:${Versions.room}" diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt index 0f1cf4a5..e1a6a931 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt @@ -219,6 +219,18 @@ class ImageActivity : KauBaseActivity() { setOnClickListener { state.onClick(this@ImageActivity) } } + imageProgress.tint(foregroundTint) + error.apply { + invisible() + setState(FabStates.ERROR) + } + download.apply { + setState(FabStates.DOWNLOAD) + } + share.apply { + setState(FabStates.SHARE) + } + imagePhoto.setImageLoaderCallback(object : ImageLoader.Callback { override fun onCacheHit(imageType: Int, image: File?) {} @@ -237,17 +249,6 @@ class ImageActivity : KauBaseActivity() { } }) - imageProgress.tint(foregroundTint) - error.apply { - invisible() - setState(FabStates.ERROR) - } - download.apply { - setState(FabStates.DOWNLOAD) - } - share.apply { - setState(FabStates.SHARE) - } activityThemer.setFrostColors { themeWindow = false } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt index 37f8fab3..70f911a8 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt @@ -31,15 +31,12 @@ import kotlinx.coroutines.withTimeout /** * Attempts to get the fbcdn url of the supplied image redirect url */ -suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): String? { - L.v { "Image full size 1 from $url" } - return withContext(Dispatchers.IO) { +suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): String? = + withContext(Dispatchers.IO) { try { withTimeout(timeout) { - L.v { "Image full size from $url" } val redirect = requestBuilder().url(url).get().call() .execute().body?.string() ?: return@withTimeout null - L.v { "Image full size from redirect $redirect" } FB_REDIRECT_URL_MATCHER.find(redirect)[1]?.formattedFbUrl } } catch (e: Exception) { @@ -47,4 +44,3 @@ suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): Stri null } } -} |