mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 01:33:16 +00:00
新しいダイアログを使用するように
This commit is contained in:
parent
a711f7284d
commit
b341c78432
|
@ -201,37 +201,17 @@ public class LibraryPageFragment extends Fragment {
|
||||||
* Currentにフォルダを作成する
|
* Currentにフォルダを作成する
|
||||||
*/
|
*/
|
||||||
private void createFolder(String pageId) {
|
private void createFolder(String pageId) {
|
||||||
// TODO-rca: デザインをMaterial Design 3に合わせたカスタムダイアログにする
|
|
||||||
// AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
|
||||||
// builder.setTitle("フォルダの作成");
|
|
||||||
// builder.setMessage("フォルダ名を入力してください");
|
|
||||||
// final android.widget.EditText input = new android.widget.EditText(getContext());
|
|
||||||
// input.setText("フォルダ名");
|
|
||||||
// builder.setView(input);
|
|
||||||
// builder.setPositiveButton("作成", (dialog, which) -> {
|
|
||||||
// lacertaLibrary.createFolder(pageId, input.getText().toString()).thenAccept(folderId -> {
|
|
||||||
// // Refresh
|
|
||||||
// updateItem(pageId);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// builder.setNegativeButton("キャンセル", (dialog, which) -> {
|
|
||||||
// dialog.cancel();
|
|
||||||
// });
|
|
||||||
// builder.show();
|
|
||||||
//
|
|
||||||
// LacertaTextInputDialog lacertaTextInputDialog = LacertaTextInputDialog.newInstance("フォルダの作成", "フォルダ名を入力してください");
|
|
||||||
// lacertaTextInputDialog.show(((AppCompatActivity) requireActivity()).getSupportFragmentManager(), "create_folder_dialog");
|
|
||||||
|
|
||||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireContext());
|
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireContext());
|
||||||
builder.setTitle("フォルダの作成");
|
builder.setTitle("フォルダの作成");
|
||||||
builder.setMessage("フォルダ名を入力してください");
|
builder.setMessage("フォルダ名を入力してください");
|
||||||
|
|
||||||
View view = LayoutInflater.from(requireContext()).inflate(one.nem.lacerta.shared.ui.R.layout.lacerta_dialog_edit_text_layout, null);
|
View view = LayoutInflater.from(requireContext()).inflate(one.nem.lacerta.shared.ui.R.layout.lacerta_dialog_edit_text_layout, null);
|
||||||
final android.widget.EditText input = view.findViewById(one.nem.lacerta.shared.ui.R.id.custom_edit_text);
|
final com.google.android.material.textfield.TextInputEditText input = view.findViewById(one.nem.lacerta.shared.ui.R.id.custom_edit_text);
|
||||||
input.setText("フォルダ名");
|
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.setView(view);
|
||||||
|
|
||||||
builder.setPositiveButton("作成", (dialog, which) -> {
|
builder.setPositiveButton("作成", (dialog, which) -> {
|
||||||
lacertaLibrary.createFolder(pageId, input.getText().toString()).thenAccept(folderId -> {
|
lacertaLibrary.createFolder(pageId, input.getText().toString()).thenAccept(folderId -> {
|
||||||
// Refresh
|
// Refresh
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
android:id="@+id/custom_text_input_layout"
|
android:id="@+id/custom_text_input_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="Custom EditText"
|
android:paddingHorizontal="16dp"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
|
Loading…
Reference in New Issue
Block a user