kopia lustrzana https://github.com/ryukoposting/Signal-Android
Add state logging when we reject an item animation from occurring.
rodzic
d8a4678b8f
commit
ecc43f1dea
|
@ -791,8 +791,10 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
|||
|
||||
public void scrollToBottom() {
|
||||
if (getListLayoutManager().findFirstVisibleItemPosition() < SCROLL_ANIMATION_THRESHOLD) {
|
||||
Log.d(TAG, "scrollToBottom: Smooth scrolling to bottom of screen.");
|
||||
list.smoothScrollToPosition(0);
|
||||
} else {
|
||||
Log.d(TAG, "scrollToBottom: Scrolling to bottom of screen.");
|
||||
list.scrollToPosition(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.animation.AnimatorSet
|
|||
import android.animation.ValueAnimator
|
||||
import androidx.core.animation.doOnEnd
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.conversation.ConversationAdapter
|
||||
|
||||
/**
|
||||
|
@ -19,11 +20,6 @@ class ConversationItemAnimator(
|
|||
private val isParentFilled: () -> Boolean
|
||||
) : RecyclerView.ItemAnimator() {
|
||||
|
||||
private enum class Operation {
|
||||
ADD,
|
||||
CHANGE
|
||||
}
|
||||
|
||||
private data class TweeningInfo(
|
||||
val startValue: Float,
|
||||
val endValue: Float
|
||||
|
@ -63,11 +59,12 @@ class ConversationItemAnimator(
|
|||
return false
|
||||
}
|
||||
|
||||
return animateSlide(viewHolder, preLayoutInfo, postLayoutInfo, Operation.ADD)
|
||||
return animateSlide(viewHolder, preLayoutInfo, postLayoutInfo)
|
||||
}
|
||||
|
||||
private fun animateSlide(viewHolder: RecyclerView.ViewHolder, preLayoutInfo: ItemHolderInfo?, postLayoutInfo: ItemHolderInfo, operation: Operation): Boolean {
|
||||
private fun animateSlide(viewHolder: RecyclerView.ViewHolder, preLayoutInfo: ItemHolderInfo?, postLayoutInfo: ItemHolderInfo): Boolean {
|
||||
if (isInMultiSelectMode() || !shouldPlayMessageAnimations()) {
|
||||
Log.d(TAG, "Dropping slide animation: (${isInMultiSelectMode()}, ${shouldPlayMessageAnimations()}) :: ${viewHolder.absoluteAdapterPosition}")
|
||||
dispatchAnimationFinished(viewHolder)
|
||||
return false
|
||||
}
|
||||
|
@ -84,6 +81,7 @@ class ConversationItemAnimator(
|
|||
}.toFloat()
|
||||
|
||||
if (translationY == 0f) {
|
||||
viewHolder.itemView.translationY = 0f
|
||||
dispatchAnimationFinished(viewHolder)
|
||||
return false
|
||||
}
|
||||
|
@ -101,9 +99,10 @@ class ConversationItemAnimator(
|
|||
dispatchAnimationFinished(viewHolder)
|
||||
false
|
||||
} else {
|
||||
animateSlide(viewHolder, preLayoutInfo, postLayoutInfo, Operation.CHANGE)
|
||||
animateSlide(viewHolder, preLayoutInfo, postLayoutInfo)
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "Dropping persistence animation: (${isInMultiSelectMode()}, ${shouldPlayMessageAnimations()}, ${isParentFilled()}) :: ${viewHolder.absoluteAdapterPosition}")
|
||||
dispatchAnimationFinished(viewHolder)
|
||||
false
|
||||
}
|
||||
|
@ -118,6 +117,7 @@ class ConversationItemAnimator(
|
|||
}
|
||||
|
||||
override fun runPendingAnimations() {
|
||||
Log.d(TAG, "Starting ${pendingSlideAnimations.size} animations.")
|
||||
runPendingSlideAnimations()
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ class ConversationItemAnimator(
|
|||
slideAnimations[item]?.sharedAnimator?.cancel()
|
||||
}
|
||||
|
||||
fun endSlideAnimations() {
|
||||
private fun endSlideAnimations() {
|
||||
slideAnimations.values.map { it.sharedAnimator }.forEach {
|
||||
it.cancel()
|
||||
}
|
||||
|
@ -186,7 +186,12 @@ class ConversationItemAnimator(
|
|||
|
||||
private fun dispatchFinishedWhenDone() {
|
||||
if (!isRunning) {
|
||||
Log.d(TAG, "Finished running animations.")
|
||||
dispatchAnimationsFinished()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = Log.tag(ConversationItemAnimator::class.java)
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue