mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 18:00:02 +01:00
Implement feedback for Material3 Gallery refresh.
This commit is contained in:
committed by
Cody Henthorne
parent
8767f775e9
commit
c5f4a9c89e
@@ -16,6 +16,7 @@ import org.thoughtcrime.securesms.components.recyclerview.GridDividerDecoration
|
||||
import org.thoughtcrime.securesms.mediasend.Media
|
||||
import org.thoughtcrime.securesms.mediasend.MediaRepository
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaCountIndicatorButton
|
||||
import org.thoughtcrime.securesms.util.Material3OnScrollHelper
|
||||
import org.thoughtcrime.securesms.util.Stopwatch
|
||||
import org.thoughtcrime.securesms.util.ViewUtil
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
|
||||
@@ -75,6 +76,8 @@ class MediaGalleryFragment : Fragment(R.layout.v2_media_gallery_fragment) {
|
||||
onBack()
|
||||
}
|
||||
|
||||
Material3OnScrollHelper(requireActivity(), toolbar).attach(galleryRecycler)
|
||||
|
||||
if (callbacks.isCameraEnabled()) {
|
||||
toolbar.setOnMenuItemClickListener { item ->
|
||||
if (item.itemId == R.id.action_camera) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingModel
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingViewHolder
|
||||
import org.thoughtcrime.securesms.util.visible
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
typealias OnMediaFolderClicked = (MediaFolder) -> Unit
|
||||
typealias OnMediaClicked = (Media, Boolean) -> Unit
|
||||
@@ -132,6 +133,7 @@ object MediaGallerySelectableItem {
|
||||
val end = if (isSelected) 1f else 0f
|
||||
|
||||
animator = ValueAnimator.ofFloat(start, end).apply {
|
||||
duration = TimeUnit.MILLISECONDS.toMillis(100L)
|
||||
addUpdateListener { animator ->
|
||||
val fraction = animator.animatedValue as Float
|
||||
updateImageView(fraction)
|
||||
|
||||
@@ -34,6 +34,7 @@ object MediaReviewSelectedItem {
|
||||
|
||||
private val imageView: ImageView = itemView.findViewById(R.id.media_review_selected_image)
|
||||
private val playOverlay: ImageView = itemView.findViewById(R.id.media_review_play_overlay)
|
||||
private val trashOverlay: ImageView = itemView.findViewById(R.id.media_review_trash_overlay)
|
||||
|
||||
override fun bind(model: Model) {
|
||||
Glide.with(imageView)
|
||||
@@ -42,7 +43,7 @@ object MediaReviewSelectedItem {
|
||||
.into(imageView)
|
||||
|
||||
playOverlay.visible = MediaUtil.isNonGifVideo(model.media) && !model.isSelected
|
||||
imageView.isSelected = model.isSelected
|
||||
trashOverlay.visible = model.isSelected
|
||||
|
||||
itemView.contentDescription = if (model.isSelected) {
|
||||
context.getString(R.string.MediaReviewSelectedItem__tap_to_remove)
|
||||
|
||||
Reference in New Issue
Block a user