From 434d58bd47df557746c46fb2bf5b7daec31bb557 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 11:36:45 +0900 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E3=81=97=E3=81=84=E3=83=80=E3=82=A4?= =?UTF-8?q?=E3=82=A2=E3=83=AD=E3=82=B0=E3=82=92=E4=BD=BF=E7=94=A8=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerListFragment.java | 22 ++++++++++++------- .../lacerta_dialog_edit_text_layout.xml | 1 + 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java index 4c306755..790820b8 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java @@ -13,6 +13,8 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Toast; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; + import java.util.ArrayList; import javax.inject.Inject; @@ -158,14 +160,18 @@ public class ViewerListFragment extends Fragment { .commit(); return true; } else if (item.getItemId() == R.id.action_rename) { - // TODO-rca: デザインをMaterial Design 3に合わせたカスタムダイアログにする - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireContext()); builder.setTitle("ファイル名の変更"); - builder.setMessage("ファイル名を入力してください"); - final android.widget.EditText input = new android.widget.EditText(getContext()); - input.setText(documentName); - builder.setView(input); - builder.setPositiveButton("作成", (dialog, which) -> { + + View view = LayoutInflater.from(requireContext()).inflate(one.nem.lacerta.shared.ui.R.layout.lacerta_dialog_edit_text_layout, null); + final com.google.android.material.textfield.TextInputEditText input = view.findViewById(one.nem.lacerta.shared.ui.R.id.custom_edit_text); + final com.google.android.material.textfield.TextInputLayout inputLayout = view.findViewById(one.nem.lacerta.shared.ui.R.id.custom_text_input_layout); + inputLayout.setHint("ファイル名"); + + builder.setView(view); + + builder.setPositiveButton("変更", (dialog, which) -> { document.renameDocument(documentId, input.getText().toString()).thenAccept(aVoid -> { getActivity().runOnUiThread(() -> { toolbar.setTitle(input.getText().toString()); @@ -176,8 +182,8 @@ public class ViewerListFragment extends Fragment { builder.setNegativeButton("キャンセル", (dialog, which) -> { dialog.cancel(); }); - builder.show(); + builder.show(); return true; } else if (item.getItemId() == R.id.action_delete) { // TODO-rca: デザインをMaterial Design 3に合わせたカスタムダイアログにする diff --git a/shared/ui/src/main/res/layout/lacerta_dialog_edit_text_layout.xml b/shared/ui/src/main/res/layout/lacerta_dialog_edit_text_layout.xml index 0aed315c..b5d2b1d4 100644 --- a/shared/ui/src/main/res/layout/lacerta_dialog_edit_text_layout.xml +++ b/shared/ui/src/main/res/layout/lacerta_dialog_edit_text_layout.xml @@ -5,6 +5,7 @@ android:id="@+id/custom_text_input_layout" android:layout_width="match_parent" android:layout_height="wrap_content" + android:paddingTop="8dp" android:paddingHorizontal="16dp" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">