Cleaning / Review

This commit is contained in:
Valere 2019-07-19 12:12:17 +02:00
parent d78ff7ab08
commit 3965218bf9
2 changed files with 14 additions and 10 deletions

View File

@ -22,7 +22,6 @@ import android.content.Context
import android.content.Intent
import android.graphics.drawable.ColorDrawable
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.Parcelable
import android.text.Editable
@ -623,11 +622,9 @@ class RoomDetailFragment :
// TODO Use navigator

val intent = ImageMediaViewerActivity.newIntent(vectorBaseActivity, mediaData, ViewCompat.getTransitionName(view))
var bundle: Bundle? = null
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(requireActivity(), view, ViewCompat.getTransitionName(view)
val bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
requireActivity(), view, ViewCompat.getTransitionName(view)
?: "").toBundle()
}
startActivity(intent, bundle)
}


View File

@ -153,7 +153,10 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
.load(mediaData)
.dontAnimate()
.listener(object : RequestListener<Drawable> {
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
override fun onLoadFailed(e: GlideException?,
model: Any?,
target: Target<Drawable>?,
isFirstResource: Boolean): Boolean {
//TODO ?
Timber.e("TRANSITION onLoadFailed")
imageMediaViewerImageView.isVisible = false
@ -161,7 +164,11 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
return false
}

override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
override fun onResourceReady(resource: Drawable?,
model: Any?,
target: Target<Drawable>?,
dataSource: DataSource?,
isFirstResource: Boolean): Boolean {
Timber.e("TRANSITION onResourceReady")
imageTransitionView.isInvisible = true
imageMediaViewerImageView.isVisible = false
@ -201,7 +208,7 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
fun newIntent(context: Context, mediaData: ImageContentRenderer.Data, shareTransitionName: String?): Intent {
return Intent(context, ImageMediaViewerActivity::class.java).apply {
putExtra(EXTRA_MEDIA_DATA, mediaData)
shareTransitionName?.let { putExtra(EXTRA_SHARED_TRANSITION_NAME, it) }
putExtra(EXTRA_SHARED_TRANSITION_NAME, shareTransitionName)
}
}
}