mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
仮アクション追加
This commit is contained in:
parent
cdc3019807
commit
062ecad4fd
|
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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>
|
Loading…
Reference in New Issue
Block a user