cool transition
This commit is contained in:
parent
87c2d82462
commit
5d8cf8a605
2 changed files with 21 additions and 7 deletions
|
@ -13,7 +13,10 @@ import android.view.ViewGroup
|
|||
import android.view.animation.AccelerateDecelerateInterpolator
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.core.app.ActivityOptionsCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.util.Pair
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -319,6 +322,7 @@ class MediaAdaptor(
|
|||
itemView.setSafeOnClickListener {
|
||||
clicked(
|
||||
bindingAdapterPosition,
|
||||
binding.itemCompactImage,
|
||||
resizeBitmap(getBitmapFromImageView(binding.itemCompactImage), 100)
|
||||
)
|
||||
}
|
||||
|
@ -332,6 +336,7 @@ class MediaAdaptor(
|
|||
itemView.setSafeOnClickListener {
|
||||
clicked(
|
||||
bindingAdapterPosition,
|
||||
binding.itemCompactImage,
|
||||
resizeBitmap(getBitmapFromImageView(binding.itemCompactImage), 100)
|
||||
)
|
||||
}
|
||||
|
@ -346,6 +351,7 @@ class MediaAdaptor(
|
|||
binding.itemCompactImage.setSafeOnClickListener {
|
||||
clicked(
|
||||
bindingAdapterPosition,
|
||||
binding.itemCompactImage,
|
||||
resizeBitmap(getBitmapFromImageView(binding.itemCompactImage), 100)
|
||||
)
|
||||
}
|
||||
|
@ -361,12 +367,14 @@ class MediaAdaptor(
|
|||
binding.itemCompactImage.setSafeOnClickListener {
|
||||
clicked(
|
||||
bindingAdapterPosition,
|
||||
binding.itemCompactImage,
|
||||
resizeBitmap(getBitmapFromImageView(binding.itemCompactImage), 100)
|
||||
)
|
||||
}
|
||||
binding.itemCompactTitleContainer.setSafeOnClickListener {
|
||||
clicked(
|
||||
bindingAdapterPosition,
|
||||
binding.itemCompactImage,
|
||||
resizeBitmap(getBitmapFromImageView(binding.itemCompactImage), 100)
|
||||
)
|
||||
}
|
||||
|
@ -375,7 +383,7 @@ class MediaAdaptor(
|
|||
}
|
||||
}
|
||||
|
||||
fun clicked(position: Int, bitmap: Bitmap? = null) {
|
||||
fun clicked(position: Int, itemCompactImage: ImageView?, bitmap: Bitmap? = null) {
|
||||
if ((mediaList?.size ?: 0) > position && position != -1) {
|
||||
val media = mediaList?.get(position)
|
||||
if (bitmap != null) MediaSingleton.bitmap = bitmap
|
||||
|
@ -384,7 +392,13 @@ class MediaAdaptor(
|
|||
Intent(activity, MediaDetailsActivity::class.java).putExtra(
|
||||
"media",
|
||||
media as Serializable
|
||||
), null
|
||||
), ActivityOptionsCompat.makeSceneTransitionAnimation(
|
||||
activity,
|
||||
Pair.create(
|
||||
itemCompactImage,
|
||||
ViewCompat.getTransitionName(activity.findViewById(R.id.itemCompactImage))!!
|
||||
),
|
||||
).toBundle()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue