From 062ecad4fd795dedd37c1eed39d1078f6474a165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 25 Jan 2024 16:13:17 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BB=AE=E3=82=A2=E3=82=AF=E3=82=B7=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setting/SettingTagManageFragment.java | 41 +++++++++++++++++++ .../main/res/menu/setting_tag_manage_menu.xml | 10 +++++ 2 files changed, 51 insertions(+) create mode 100644 feature/setting/src/main/res/menu/setting_tag_manage_menu.xml diff --git a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTagManageFragment.java b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTagManageFragment.java index f3346f14..5363deee 100644 --- a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTagManageFragment.java +++ b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTagManageFragment.java @@ -2,11 +2,14 @@ package one.nem.lacerta.setting; import android.os.Bundle; +import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; +import androidx.navigation.Navigation; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Toast; /** * A simple {@link Fragment} subclass. @@ -37,4 +40,42 @@ public class SettingTagManageFragment extends Fragment { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_setting_tag_manage, container, false); } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + } + + /** + * ToolbarをInitする + * + * @param toolbar Toolbar + * @param showBackButton 戻るボタンを表示するか + * @param title タイトル + */ + private void toolbarSetup(Toolbar toolbar, boolean showBackButton, String title) { + getActivity().runOnUiThread(() -> { + if (showBackButton) { + toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px); + toolbar.setNavigationOnClickListener(v -> { + //this.libraryItemPage = lacertaLibrary.getLibraryPage(this.libraryItemPage.getParentId(), 10).join(); + // Back + Navigation.findNavController(requireView()).popBackStack(); + }); + } else { + toolbar.setNavigationIcon(null); + } + toolbar.setTitle(title); + toolbar.getMenu().clear(); + toolbar.inflateMenu(R.menu.setting_tag_manage_menu); + toolbar.setOnMenuItemClickListener(item -> { + if (item.getItemId() == R.id.setting_tag_manage_menu_add) { + Toast.makeText(getContext(), "Add Clicked", Toast.LENGTH_SHORT).show(); + return true; + } else { + return false; + } + }); + }); + } } \ No newline at end of file diff --git a/feature/setting/src/main/res/menu/setting_tag_manage_menu.xml b/feature/setting/src/main/res/menu/setting_tag_manage_menu.xml new file mode 100644 index 00000000..f012a68b --- /dev/null +++ b/feature/setting/src/main/res/menu/setting_tag_manage_menu.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file