mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-02 11:37:37 +00:00
提出用: 代替処理実装
This commit is contained in:
5 files changed
+33
-8
No files matched your search
@@ -36,7 +36,8 @@ import one.nem.lacerta.data.Document;
|
||||
import one.nem.lacerta.data.LacertaLibrary;
|
||||
import one.nem.lacerta.model.ListItem;
|
||||
import one.nem.lacerta.model.document.DocumentMeta;
|
||||
|
||||
import one.nem.lacerta.utils.FeatureSwitch;
|
||||
import one.nem.lacerta.utils.Store;
|
||||
|
||||
|
||||
/**
|
||||
@@ -99,7 +100,13 @@ public class HomeTopFragment extends Fragment {
|
||||
}
|
||||
listItemAdapter.setListItems(listItems);
|
||||
getActivity().runOnUiThread(() -> {
|
||||
listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1);
|
||||
Log.d("HomeTopFragment", "onViewCreated: " + listItems.size());
|
||||
if (FeatureSwitch.RecyclerView.useSimpleNotifyMethod) {
|
||||
listItemAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
// IndexOutOfBoundsExceptionを吐くことがあったので
|
||||
listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -54,7 +54,11 @@ public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListIt
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return listItems == null ? 0 : listItems.size();
|
||||
if (listItems == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return listItems.size();
|
||||
}
|
||||
}
|
||||
|
||||
public static class ListItemViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
Reference in new issue
Block a user