仮アクション追加

This commit is contained in:
ろむねこ 2024-01-25 16:13:17 +09:00
parent cdc3019807
commit 062ecad4fd
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168
2 changed files with 51 additions and 0 deletions

View File

@ -2,11 +2,14 @@ package one.nem.lacerta.setting;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Toast;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
@ -37,4 +40,42 @@ public class SettingTagManageFragment extends Fragment {
// Inflate the layout for this fragment // Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_setting_tag_manage, container, false); 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;
}
});
});
}
} }

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/setting_tag_manage_menu_add"
android:icon="@drawable/outline_developer_mode_24"
android:title="@string/placeholder"
app:showAsAction="ifRoom"/>
</menu>