1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-23 07:07:30 +00:00
This commit is contained in:
Austin Huang 2021-01-05 16:39:17 -05:00
parent 8f041b558a
commit 3dd66d9bc7
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

View File

@ -25,6 +25,7 @@ import awais.instagrabber.databinding.ItemFeedVideoBinding;
import awais.instagrabber.models.FeedModel; import awais.instagrabber.models.FeedModel;
import awais.instagrabber.models.PostsLayoutPreferences; import awais.instagrabber.models.PostsLayoutPreferences;
import awais.instagrabber.models.enums.MediaItemType; import awais.instagrabber.models.enums.MediaItemType;
import awais.instagrabber.utils.TextUtils;
public final class FeedAdapterV2 extends ListAdapter<FeedModel, RecyclerView.ViewHolder> { public final class FeedAdapterV2 extends ListAdapter<FeedModel, RecyclerView.ViewHolder> {
private static final String TAG = "FeedAdapterV2"; private static final String TAG = "FeedAdapterV2";
@ -46,7 +47,13 @@ public final class FeedAdapterV2 extends ListAdapter<FeedModel, RecyclerView.Vie
@Override @Override
public boolean areContentsTheSame(@NonNull final FeedModel oldItem, @NonNull final FeedModel newItem) { public boolean areContentsTheSame(@NonNull final FeedModel oldItem, @NonNull final FeedModel newItem) {
return oldItem.getPostId().equals(newItem.getPostId()) && oldItem.getPostCaption().equals(newItem.getPostCaption()); boolean result = oldItem.getPostId().equals(newItem.getPostId());
if (TextUtils.isEmpty(oldItem.getPostCaption())) {
return result ? TextUtils.isEmpty(newItem.getPostCaption()) : false;
}
else {
return result ? oldItem.getPostCaption().equals(newItem.getPostCaption()) : false;
}
} }
}; };
private final AdapterSelectionCallback adapterSelectionCallback = new AdapterSelectionCallback() { private final AdapterSelectionCallback adapterSelectionCallback = new AdapterSelectionCallback() {