mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
新しいダイアログを使用するように
This commit is contained in:
parent
b341c78432
commit
434d58bd47
|
@ -13,6 +13,8 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -158,14 +160,18 @@ public class ViewerListFragment extends Fragment {
|
||||||
.commit();
|
.commit();
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_rename) {
|
} 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.setTitle("ファイル名の変更");
|
||||||
builder.setMessage("ファイル名を入力してください");
|
|
||||||
final android.widget.EditText input = new android.widget.EditText(getContext());
|
View view = LayoutInflater.from(requireContext()).inflate(one.nem.lacerta.shared.ui.R.layout.lacerta_dialog_edit_text_layout, null);
|
||||||
input.setText(documentName);
|
final com.google.android.material.textfield.TextInputEditText input = view.findViewById(one.nem.lacerta.shared.ui.R.id.custom_edit_text);
|
||||||
builder.setView(input);
|
final com.google.android.material.textfield.TextInputLayout inputLayout = view.findViewById(one.nem.lacerta.shared.ui.R.id.custom_text_input_layout);
|
||||||
builder.setPositiveButton("作成", (dialog, which) -> {
|
inputLayout.setHint("ファイル名");
|
||||||
|
|
||||||
|
builder.setView(view);
|
||||||
|
|
||||||
|
builder.setPositiveButton("変更", (dialog, which) -> {
|
||||||
document.renameDocument(documentId, input.getText().toString()).thenAccept(aVoid -> {
|
document.renameDocument(documentId, input.getText().toString()).thenAccept(aVoid -> {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
toolbar.setTitle(input.getText().toString());
|
toolbar.setTitle(input.getText().toString());
|
||||||
|
@ -176,8 +182,8 @@ public class ViewerListFragment extends Fragment {
|
||||||
builder.setNegativeButton("キャンセル", (dialog, which) -> {
|
builder.setNegativeButton("キャンセル", (dialog, which) -> {
|
||||||
dialog.cancel();
|
dialog.cancel();
|
||||||
});
|
});
|
||||||
builder.show();
|
|
||||||
|
|
||||||
|
builder.show();
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_delete) {
|
} else if (item.getItemId() == R.id.action_delete) {
|
||||||
// TODO-rca: デザインをMaterial Design 3に合わせたカスタムダイアログにする
|
// TODO-rca: デザインをMaterial Design 3に合わせたカスタムダイアログにする
|
||||||
|
|
|
@ -5,6 +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:paddingTop="8dp"
|
||||||
android:paddingHorizontal="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user