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.content.Intent
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.net.Uri import android.net.Uri
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
import android.text.Editable import android.text.Editable
@ -623,11 +622,9 @@ class RoomDetailFragment :
// TODO Use navigator // TODO Use navigator


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



View File

@ -153,7 +153,10 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
.load(mediaData) .load(mediaData)
.dontAnimate() .dontAnimate()
.listener(object : RequestListener<Drawable> { .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 ? //TODO ?
Timber.e("TRANSITION onLoadFailed") Timber.e("TRANSITION onLoadFailed")
imageMediaViewerImageView.isVisible = false imageMediaViewerImageView.isVisible = false
@ -161,7 +164,11 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
return false 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") Timber.e("TRANSITION onResourceReady")
imageTransitionView.isInvisible = true imageTransitionView.isInvisible = true
imageMediaViewerImageView.isVisible = false imageMediaViewerImageView.isVisible = false
@ -201,7 +208,7 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
fun newIntent(context: Context, mediaData: ImageContentRenderer.Data, shareTransitionName: String?): Intent { fun newIntent(context: Context, mediaData: ImageContentRenderer.Data, shareTransitionName: String?): Intent {
return Intent(context, ImageMediaViewerActivity::class.java).apply { return Intent(context, ImageMediaViewerActivity::class.java).apply {
putExtra(EXTRA_MEDIA_DATA, mediaData) putExtra(EXTRA_MEDIA_DATA, mediaData)
shareTransitionName?.let { putExtra(EXTRA_SHARED_TRANSITION_NAME, it) } putExtra(EXTRA_SHARED_TRANSITION_NAME, shareTransitionName)
} }
} }
} }