mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 17:53:14 +00:00
リネームできるように
This commit is contained in:
parent
6fdef14eec
commit
f673954bef
|
@ -147,14 +147,14 @@ public class ViewerContainerFragment extends Fragment {
|
||||||
|
|
||||||
ImageButton imageButton = customView.findViewById(R.id.tab_modify);
|
ImageButton imageButton = customView.findViewById(R.id.tab_modify);
|
||||||
imageButton.setOnClickListener(v -> {
|
imageButton.setOnClickListener(v -> {
|
||||||
renameCombinedDocument(viewerViewPagerAdapter.getFragmentTargetId(position), viewerViewPagerAdapter.getFragmentTitle(position));
|
renameCombinedDocument(this.documentId, viewerViewPagerAdapter.getFragmentTargetId(position), viewerViewPagerAdapter.getFragmentTitle(position));
|
||||||
});
|
});
|
||||||
|
|
||||||
tab.setCustomView(customView);
|
tab.setCustomView(customView);
|
||||||
}).attach();
|
}).attach();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renameCombinedDocument(String documentId, String current) {
|
private void renameCombinedDocument(String parentId, String childId, String current) {
|
||||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext());
|
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext());
|
||||||
builder.setTitle("アイテム名の変更");
|
builder.setTitle("アイテム名の変更");
|
||||||
builder.setMessage("アイテム名を入力してください");
|
builder.setMessage("アイテム名を入力してください");
|
||||||
|
@ -167,10 +167,13 @@ public class ViewerContainerFragment extends Fragment {
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
|
|
||||||
builder.setPositiveButton("変更", (dialog, which) -> {
|
builder.setPositiveButton("変更", (dialog, which) -> {
|
||||||
document.renameDocument(documentId, textInputEditText.getText().toString()).thenAccept(aVoid -> {
|
document.renameDocument(childId, textInputEditText.getText().toString()).thenCombine(
|
||||||
|
lacertaLibrary.updateTitleCache(parentId, childId, textInputEditText.getText().toString()), (aVoid, aVoid2) -> {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
this.documentName = textInputEditText.getText().toString();
|
Toast.makeText(getContext(), "変更しました", Toast.LENGTH_SHORT).show();
|
||||||
|
dialog.dismiss();
|
||||||
});
|
});
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
builder.setNegativeButton("キャンセル", (dialog, which) -> {
|
builder.setNegativeButton("キャンセル", (dialog, which) -> {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user