This commit is contained in:
ろむねこ 2024-01-22 18:35:18 +09:00
parent 6e0c473c66
commit 734f75b4c7
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -107,6 +107,7 @@ public class LibraryPageFragment extends Fragment {
public void onFolderSelected(String folderId, String folderName) {
logger.debug("LibraryTopFragment", "Folder selected! folderId: " + folderId + ", folderName: " + folderName);
// 画面遷移
Toast.makeText(getContext(), "Folder selected! folderId: " + folderId + ", folderName: " + folderName, Toast.LENGTH_SHORT).show();
FragmentNavigation fragmentNavigation = (FragmentNavigation) getActivity();
assert fragmentNavigation != null;
fragmentNavigation.navigateToFragment(LibraryPageFragment.newInstance(folderId));
@ -129,10 +130,7 @@ public class LibraryPageFragment extends Fragment {
logger.debug("LibraryTopFragment", "Item selected! libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size());
listItemAdapter.setLibraryItemPage(libraryItemPage);
getActivity().runOnUiThread(() -> {
// ActionBarのタイトルを変更する
getActivity().setTitle("ライブラリ");
// ActionBarに戻るボタンを非表示にする
// getActivity().getActionBar().setDisplayHomeAsUpEnabled(false);
toolbarSetup(view.findViewById(R.id.library_toolbar), false, "ライブラリ", "Placeholder");
listItemAdapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size() - 1);
});
this.currentTotalItemCount = libraryItemPage.getListItems().size();
@ -141,11 +139,8 @@ public class LibraryPageFragment extends Fragment {
lacertaLibrary.getLibraryPage(this.folderId, 10).thenAccept(libraryItemPage -> {
logger.debug("LibraryTopFragment", "Item selected! libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size());
listItemAdapter.setLibraryItemPage(libraryItemPage);
toolbarSetup(view.findViewById(R.id.library_toolbar), true, libraryItemPage.getPageTitle(), "Placeholder");
getActivity().runOnUiThread(() -> {
// ActionBarのタイトルを変更する
getActivity().setTitle(libraryItemPage.getPageTitle());
// ActionBarに戻るボタンを表示する
// getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
listItemAdapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size() - 1);
});
this.currentTotalItemCount = libraryItemPage.getListItems().size();
@ -174,6 +169,7 @@ public class LibraryPageFragment extends Fragment {
}
private void toolbarSetup(Toolbar toolbar, boolean showBackButton, String title, String subtitle) {
getActivity().runOnUiThread(() -> {
if (showBackButton) {
toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px);
toolbar.setNavigationOnClickListener(v -> {
@ -193,6 +189,7 @@ public class LibraryPageFragment extends Fragment {
return false;
}
});
});
}
private void createFolder() {