This commit is contained in:
ろむねこ 2024-01-22 19:41:54 +09:00
parent fe4999384a
commit a0f89de1ac
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -52,6 +52,8 @@ public class LibraryPageFragment extends Fragment {
private String folderId; private String folderId;
private String title; private String title;
private String publicPath; private String publicPath;
private String currentId;
private String parentId;
private PublicPath currentPublicPath; private PublicPath currentPublicPath;
@Inject @Inject
@ -68,12 +70,12 @@ public class LibraryPageFragment extends Fragment {
// Required empty public constructor // Required empty public constructor
} }
public static LibraryPageFragment newInstance(String folderId, String title, String publicPath) { public static LibraryPageFragment newInstance(String folderId, String title, String parentId) {
LibraryPageFragment fragment = new LibraryPageFragment(); LibraryPageFragment fragment = new LibraryPageFragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString("folderId", folderId); args.putString("folderId", folderId);
args.putString("title", title); args.putString("title", title);
args.putString("publicPath", publicPath); args.putString("publicPath", parentId);
fragment.setArguments(args); fragment.setArguments(args);
return fragment; return fragment;
} }
@ -130,17 +132,18 @@ public class LibraryPageFragment extends Fragment {
if (getArguments() != null) { if (getArguments() != null) {
this.folderId = getArguments().getString("folderId"); this.folderId = getArguments().getString("folderId");
this.title = getArguments().getString("title"); this.title = getArguments().getString("title");
this.publicPath = getArguments().getString("publicPath"); this.parentId = getArguments().getString("parentId");
// Log // Log
logger.debug("LibraryTopFragment", "args" logger.debug("LibraryTopFragment", "args"
+ ", folderId: " + this.folderId + ", folderId: " + this.folderId
+ ", title: " + this.title + ", title: " + this.title
+ ", publicPath: " + this.publicPath); + ", parentId: " + this.parentId);
} }
if (this.folderId == null) { // Root if (this.folderId == null) { // Root
toolbarSetup(view.findViewById(R.id.library_toolbar), false, "ライブラリ", "Placeholder"); toolbarSetup(view.findViewById(R.id.library_toolbar), false, "ライブラリ", "Placeholder");
lacertaLibrary.getLibraryPage(10).thenAccept(libraryItemPage -> { lacertaLibrary.getLibraryPage(10).thenAccept(libraryItemPage -> {
this.currentId = libraryItemPage.getPageId(); // Currentを保存
logger.debug("LibraryTopFragment", "Item selected! libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size()); logger.debug("LibraryTopFragment", "Item selected! libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size());
listItemAdapter.setLibraryItemPage(libraryItemPage); listItemAdapter.setLibraryItemPage(libraryItemPage);
getActivity().runOnUiThread(() -> { getActivity().runOnUiThread(() -> {
@ -151,6 +154,7 @@ public class LibraryPageFragment extends Fragment {
} else { // Root以外 } else { // Root以外
toolbarSetup(view.findViewById(R.id.library_toolbar), true, this.title, "Placeholder"); toolbarSetup(view.findViewById(R.id.library_toolbar), true, this.title, "Placeholder");
lacertaLibrary.getLibraryPage(this.folderId, 10).thenAccept(libraryItemPage -> { lacertaLibrary.getLibraryPage(this.folderId, 10).thenAccept(libraryItemPage -> {
this.currentId = libraryItemPage.getPageId(); // Currentを保存
logger.debug("LibraryTopFragment", "Item selected! libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size()); logger.debug("LibraryTopFragment", "Item selected! libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size());
listItemAdapter.setLibraryItemPage(libraryItemPage); listItemAdapter.setLibraryItemPage(libraryItemPage);
getActivity().runOnUiThread(() -> { getActivity().runOnUiThread(() -> {
@ -214,7 +218,8 @@ public class LibraryPageFragment extends Fragment {
input.setText("フォルダ名"); input.setText("フォルダ名");
builder.setView(input); builder.setView(input);
builder.setPositiveButton("作成", (dialog, which) -> { builder.setPositiveButton("作成", (dialog, which) -> {
lacertaLibrary.createFolder(this.currentPublicPath.getStringPath(), input.getText().toString()).thenAccept(folderId -> { logger.debug("LibraryTopFragment", "Creating folder: Name: " + input.getText().toString() + ", publicPath: " + publicPath);
lacertaLibrary.createFolder("hoge", input.getText().toString()).thenAccept(folderId -> {
logger.debug("LibraryTopFragment", "folderId: " + folderId); logger.debug("LibraryTopFragment", "folderId: " + folderId);
}); });
// Refresh // Refresh