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,24 +169,26 @@ 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) {
if (showBackButton) { getActivity().runOnUiThread(() -> {
toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px); if (showBackButton) {
toolbar.setNavigationOnClickListener(v -> { toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px);
getParentFragmentManager().popBackStack(); toolbar.setNavigationOnClickListener(v -> {
}); getParentFragmentManager().popBackStack();
} else { });
toolbar.setNavigationIcon(null);
}
toolbar.setTitle(title);
if (subtitle != null) toolbar.setSubtitle(subtitle);
toolbar.inflateMenu(R.menu.dir_menu);
toolbar.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.menu_item_create_new_folder) {
createFolder();
return true;
} else { } else {
return false; toolbar.setNavigationIcon(null);
} }
toolbar.setTitle(title);
if (subtitle != null) toolbar.setSubtitle(subtitle);
toolbar.inflateMenu(R.menu.dir_menu);
toolbar.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.menu_item_create_new_folder) {
createFolder();
return true;
} else {
return false;
}
});
}); });
} }