mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
ドキュメントを正常に取得できるように
This commit is contained in:
parent
2f3a331527
commit
01f28ecd4d
|
@ -81,10 +81,13 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
|||
LibraryItemPage libraryItemPage = new LibraryItemPage();
|
||||
|
||||
List<FolderEntity> folderEntities = getFolderEntitiesByPublicPath("/").join();
|
||||
logger.debug("LacertaLibraryImpl", "folderEntities.size(): " + folderEntities.size());
|
||||
List<DocumentEntity> documentEntities = getDocumentEntitiesByPublicPath("/").join();
|
||||
logger.debug("LacertaLibraryImpl", "documentEntities.size(): " + documentEntities.size());
|
||||
|
||||
ArrayList<ListItem> listItems = new ArrayList<>();
|
||||
for (FolderEntity folderEntity : folderEntities) {
|
||||
logger.debug("LacertaLibraryImpl", "folderEntity.name: " + folderEntity.name);
|
||||
ListItem listItem = new ListItem();
|
||||
listItem.setItemType(ListItemType.ITEM_TYPE_FOLDER);
|
||||
listItem.setTitle(folderEntity.name);
|
||||
|
@ -93,16 +96,21 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
|||
listItems.add(listItem);
|
||||
}
|
||||
for (DocumentEntity documentEntity : documentEntities) {
|
||||
logger.debug("LacertaLibraryImpl", "documentEntity.title: " + documentEntity.title);
|
||||
ListItem listItem = new ListItem();
|
||||
listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT);
|
||||
listItem.setTitle(documentEntity.title);
|
||||
listItem.setDescription(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm").format(documentEntity.updatedAt.toInstant()));
|
||||
// listItem.setDescription(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm").format(documentEntity.updatedAt.toInstant()));
|
||||
listItem.setItemId(documentEntity.id);
|
||||
listItems.add(listItem);
|
||||
}
|
||||
|
||||
libraryItemPage.setPageTitle("/");
|
||||
libraryItemPage.setPageId("root");
|
||||
libraryItemPage.setListItems(listItems);
|
||||
|
||||
logger.debug("LacertaLibraryImpl", "libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size());
|
||||
|
||||
return libraryItemPage;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import one.nem.lacerta.data.Document;
|
|||
import one.nem.lacerta.data.LacertaLibrary;
|
||||
import one.nem.lacerta.model.document.DocumentMeta;
|
||||
import one.nem.lacerta.model.document.tag.DocumentTag;
|
||||
import one.nem.lacerta.utils.LacertaLogger;
|
||||
|
||||
|
||||
|
||||
|
@ -45,6 +46,9 @@ public class LibraryTopFragment extends Fragment {
|
|||
@Inject
|
||||
LacertaLibrary lacertaLibrary;
|
||||
|
||||
@Inject
|
||||
LacertaLogger logger;
|
||||
|
||||
public LibraryTopFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
@ -82,9 +86,10 @@ public class LibraryTopFragment extends Fragment {
|
|||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
lacertaLibrary.getLibraryPage(10).thenAccept(libraryItemPage -> {
|
||||
logger.debug("LibraryTopFragment", "Item selected! libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size());
|
||||
listItemAdapter.setLibraryItemPage(libraryItemPage);
|
||||
getActivity().runOnUiThread(() -> {
|
||||
listItemAdapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size());
|
||||
listItemAdapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size() - 1);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user