diff options
author | Allan Wang <me@allanwang.ca> | 2021-11-19 21:09:43 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2021-11-19 21:09:43 -0800 |
commit | 4799eebdc642f740b55aad2e0d9a3624fc11c53f (patch) | |
tree | a6a0431c0cd1ada5f3e185ed7208c866b44a0029 /app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt | |
parent | 8c343fd09cdf80cfbcdf49fd5cc72bec759478cf (diff) | |
download | frost-4799eebdc642f740b55aad2e0d9a3624fc11c53f.tar.gz frost-4799eebdc642f740b55aad2e0d9a3624fc11c53f.tar.bz2 frost-4799eebdc642f740b55aad2e0d9a3624fc11c53f.zip |
Snapshot work
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt | 30 |
1 files changed, 17 insertions, 13 deletions
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 b5e41751..6d618347 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt @@ -43,6 +43,7 @@ import ca.allanwang.kau.utils.tint import ca.allanwang.kau.utils.toast import ca.allanwang.kau.utils.withAlpha import ca.allanwang.kau.utils.withMinAlpha +import com.github.piasy.biv.view.ImageShownCallback import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.floatingactionbutton.FloatingActionButton import com.mikepenz.iconics.typeface.IIcon @@ -166,7 +167,9 @@ class ImageActivity : KauBaseActivity() { val result = if (!imageUrl.isIndirectImageUrl) imageUrl else cookie?.getFullSizedImageUrl(imageUrl) ?: imageUrl if (result != imageUrl) - L.v { "Launching with true url $result" } + L.v { "Launching image with true url $result" } + else + L.v { "Launching image with url $result" } result } binding = ActivityImage2Binding.inflate(layoutInflater) @@ -175,15 +178,22 @@ class ImageActivity : KauBaseActivity() { launch(CoroutineExceptionHandler { _, throwable -> loadError(throwable) }) { val tempFile = downloadTempImage() this@ImageActivity.tempFile = tempFile - binding.imageProgress.fadeOut() -// binding.imagePhoto.setImageURI(frostUriFromFile(tempFile)) -// Glide.with(binding.imagePhoto).asFile().load(trueImageUrl) - binding.imagePhoto.showImage(Uri.parse(trueImageUrl.await())) -// binding.imagePhoto.setImage(ImageSource.uri(frostUriFromFile(tempFile))) - binding.imagePhoto.animate().alpha(1f).scaleXY(1f).start() + binding.showImage(trueImageUrl.await()) } } + private fun ActivityImage2Binding.showImage(url: String) { + imageProgress.fadeOut() + imagePhoto.showImage(Uri.parse(url)) + imagePhoto.setImageShownCallback(object : ImageShownCallback { + override fun onThumbnailShown() {} + + override fun onMainImageShown() { + imagePhoto.animate().alpha(1f).scaleXY(1f).start() + } + }) + } + private fun ActivityImage2Binding.init() { imageContainer.setBackgroundColor(baseBackgroundColor) toolbar.setBackgroundColor(baseBackgroundColor) @@ -228,12 +238,6 @@ class ImageActivity : KauBaseActivity() { share.apply { setState(FabStates.SHARE) } -// imagePhoto.setOnImageEventListener(object : -// SubsamplingScaleImageView.DefaultOnImageEventListener() { -// override fun onImageLoadError(e: Exception) { -// loadError(e) -// } -// }) activityThemer.setFrostColors { themeWindow = false } |