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