From 3714ef8d9f36912f5585c1fe738f0bd2e6320bc0 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 23 Nov 2022 18:21:32 +0100 Subject: [PATCH] Refactoring --- .../main/java/eu/faircode/email/FragmentDialogEditName.java | 6 ++++-- app/src/main/res/layout/dialog_edit_name.xml | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogEditName.java b/app/src/main/java/eu/faircode/email/FragmentDialogEditName.java index 219affa894..0e18f54252 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogEditName.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogEditName.java @@ -22,6 +22,7 @@ package eu.faircode.email; import static android.app.Activity.RESULT_OK; import android.app.Dialog; +import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.view.LayoutInflater; @@ -37,7 +38,8 @@ public class FragmentDialogEditName extends FragmentDialogBase { @NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { - View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_edit_name, null); + final Context context = getContext(); + View view = LayoutInflater.from(context).inflate(R.layout.dialog_edit_name, null); final EditText etName = view.findViewById(R.id.etName); final CheckBox cbPrimary = view.findViewById(R.id.cbPrimary); @@ -46,7 +48,7 @@ public class FragmentDialogEditName extends FragmentDialogBase { cbPrimary.setChecked(args.getBoolean("primary")); cbPrimary.setVisibility(args.containsKey("primary") ? View.VISIBLE : View.GONE); - return new AlertDialog.Builder(getContext()) + return new AlertDialog.Builder(context) .setView(view) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override diff --git a/app/src/main/res/layout/dialog_edit_name.xml b/app/src/main/res/layout/dialog_edit_name.xml index d0a73fec1f..c726d4234b 100644 --- a/app/src/main/res/layout/dialog_edit_name.xml +++ b/app/src/main/res/layout/dialog_edit_name.xml @@ -42,5 +42,4 @@ android:textAppearance="@style/TextAppearance.AppCompat.Medium" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/etName" /> - \ No newline at end of file