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