kopia lustrzana https://github.com/ryukoposting/Signal-Android
Correctly animate deletion when attaching multiple media.
rodzic
9b85907918
commit
0e08b4ee26
|
@ -238,7 +238,7 @@ class MediaReviewFragment : Fragment(R.layout.v2_media_review_fragment) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
val selectionAdapter = MappingAdapter()
|
val selectionAdapter = MappingAdapter(false)
|
||||||
MediaReviewAddItem.register(selectionAdapter) {
|
MediaReviewAddItem.register(selectionAdapter) {
|
||||||
launchGallery()
|
launchGallery()
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,16 +44,19 @@ import kotlin.jvm.functions.Function1;
|
||||||
*/
|
*/
|
||||||
public class MappingAdapter extends ListAdapter<MappingModel<?>, MappingViewHolder<?>> {
|
public class MappingAdapter extends ListAdapter<MappingModel<?>, MappingViewHolder<?>> {
|
||||||
|
|
||||||
final Map<Integer, Factory<?>> factories;
|
final Map<Integer, Factory<?>> factories = new HashMap<>();
|
||||||
final Map<Class<?>, Integer> itemTypes;
|
final Map<Class<?>, Integer> itemTypes = new HashMap<>();
|
||||||
int typeCount;
|
int typeCount = 0;
|
||||||
|
final boolean useNoCrossfadeAnimator;
|
||||||
|
|
||||||
public MappingAdapter() {
|
public MappingAdapter() {
|
||||||
|
this(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MappingAdapter(boolean useNoCrossfadeAnimator) {
|
||||||
super(new MappingDiffCallback());
|
super(new MappingDiffCallback());
|
||||||
|
|
||||||
factories = new HashMap<>();
|
this.useNoCrossfadeAnimator = useNoCrossfadeAnimator;
|
||||||
itemTypes = new HashMap<>();
|
|
||||||
typeCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,7 +74,7 @@ public class MappingAdapter extends ListAdapter<MappingModel<?>, MappingViewHold
|
||||||
@Override
|
@Override
|
||||||
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
|
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
|
||||||
super.onAttachedToRecyclerView(recyclerView);
|
super.onAttachedToRecyclerView(recyclerView);
|
||||||
if (recyclerView.getItemAnimator() != null && recyclerView.getItemAnimator().getClass() == DefaultItemAnimator.class) {
|
if (useNoCrossfadeAnimator && recyclerView.getItemAnimator() != null && recyclerView.getItemAnimator().getClass() == DefaultItemAnimator.class) {
|
||||||
recyclerView.setItemAnimator(new NoCrossfadeChangeDefaultAnimator());
|
recyclerView.setItemAnimator(new NoCrossfadeChangeDefaultAnimator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue