Fix issue #629 - Remove animations after refresh

This commit is contained in:
Thomas 2022-12-13 16:28:26 +01:00
parent a7563d2859
commit 269b83607c
3 changed files with 16 additions and 0 deletions

View file

@ -28,6 +28,7 @@ import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -262,6 +263,11 @@ public class FragmentMastodonConversation extends Fragment implements Conversati
if (binding == null || !isAdded() || getActivity() == null) { if (binding == null || !isAdded() || getActivity() == null) {
return; return;
} }
RecyclerView.ItemAnimator animator = binding.recyclerView.getItemAnimator();
if (animator instanceof SimpleItemAnimator) {
((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
}
binding.loader.setVisibility(View.GONE); binding.loader.setVisibility(View.GONE);
binding.noAction.setVisibility(View.GONE); binding.noAction.setVisibility(View.GONE);
binding.swipeContainer.setRefreshing(false); binding.swipeContainer.setRefreshing(false);

View file

@ -32,6 +32,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
@ -253,6 +254,10 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
if (binding == null || !isAdded() || getActivity() == null) { if (binding == null || !isAdded() || getActivity() == null) {
return; return;
} }
RecyclerView.ItemAnimator animator = binding.recyclerView.getItemAnimator();
if (animator instanceof SimpleItemAnimator) {
((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
}
binding.loader.setVisibility(View.GONE); binding.loader.setVisibility(View.GONE);
binding.noAction.setVisibility(View.GONE); binding.noAction.setVisibility(View.GONE);
binding.swipeContainer.setRefreshing(false); binding.swipeContainer.setRefreshing(false);

View file

@ -39,6 +39,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -538,6 +539,10 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
if (statusReport != null) { if (statusReport != null) {
scrollToTop(); scrollToTop();
} }
RecyclerView.ItemAnimator animator = binding.recyclerView.getItemAnimator();
if (animator instanceof SimpleItemAnimator) {
((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
}
mLayoutManager = new LinearLayoutManager(requireActivity()); mLayoutManager = new LinearLayoutManager(requireActivity());
mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
binding.recyclerView.setLayoutManager(mLayoutManager); binding.recyclerView.setLayoutManager(mLayoutManager);