mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-02 00:17:41 +01:00
Enable change animations in the conversation list.
This commit is contained in:
committed by
Cody Henthorne
parent
58774033b7
commit
fadbb0adc5
@@ -492,7 +492,6 @@ public class ConversationListFragment extends MainFragment implements Conversati
|
||||
|
||||
initializeSearchListener();
|
||||
initializeFilterListener();
|
||||
itemAnimator.disable();
|
||||
SpoilerAnnotation.resetRevealedSpoilers();
|
||||
|
||||
if (mainToolbarViewModel.getState().getValue().getMode() != MainToolbarMode.SEARCH && list.getAdapter() != defaultAdapter) {
|
||||
@@ -550,7 +549,6 @@ public class ConversationListFragment extends MainFragment implements Conversati
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
AppForegroundObserver.addListener(appForegroundObserver);
|
||||
itemAnimator.disable();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1576,6 +1574,34 @@ public class ConversationListFragment extends MainFragment implements Conversati
|
||||
chatFolderList.getLayoutManager().startSmoothScroll(smoothScroller);
|
||||
}
|
||||
|
||||
// Manage change animations so we don't animate the list when switching folders
|
||||
itemAnimator.disableChangeAnimations();
|
||||
defaultAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
||||
@Override
|
||||
public void onChanged() {
|
||||
defaultAdapter.unregisterAdapterDataObserver(this);
|
||||
itemAnimator.enableChangeAnimations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeInserted(int positionStart, int itemCount) {
|
||||
defaultAdapter.unregisterAdapterDataObserver(this);
|
||||
itemAnimator.enableChangeAnimations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeChanged(int positionStart, int itemCount) {
|
||||
defaultAdapter.unregisterAdapterDataObserver(this);
|
||||
itemAnimator.enableChangeAnimations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeRemoved(int positionStart, int itemCount) {
|
||||
defaultAdapter.unregisterAdapterDataObserver(this);
|
||||
itemAnimator.enableChangeAnimations();
|
||||
}
|
||||
});
|
||||
|
||||
viewModel.select(chatFolder);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ public class ConversationListItemAnimator extends DefaultItemAnimator {
|
||||
private boolean shouldDisable;
|
||||
|
||||
public ConversationListItemAnimator() {
|
||||
setSupportsChangeAnimations(false);
|
||||
setMoveDuration(0);
|
||||
setAddDuration(0);
|
||||
setChangeDuration(ANIMATION_DURATION);
|
||||
}
|
||||
|
||||
@MainThread
|
||||
@@ -32,6 +32,16 @@ public class ConversationListItemAnimator extends DefaultItemAnimator {
|
||||
setMoveDuration(0);
|
||||
}
|
||||
|
||||
@MainThread
|
||||
public void disableChangeAnimations() {
|
||||
setChangeDuration(0);
|
||||
}
|
||||
|
||||
@MainThread
|
||||
public void enableChangeAnimations() {
|
||||
setChangeDuration(ANIMATION_DURATION);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* We need to reasonably ensure that the animation has started before we disable things here, so we add a slight delay.
|
||||
|
||||
Reference in New Issue
Block a user