mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 07:53: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.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に合わせたカスタムダイアログにする
|
||||
|
|
|
@ -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">
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user