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">