diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index afb66994e2..8d7e4280c8 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -63,7 +63,6 @@ import androidx.annotation.Nullable; import androidx.constraintlayout.widget.Group; import androidx.fragment.app.FragmentTransaction; import androidx.lifecycle.Lifecycle; -import androidx.localbroadcastmanager.content.LocalBroadcastManager; import com.android.colorpicker.ColorPickerDialog; import com.android.colorpicker.ColorPickerSwatch; @@ -135,7 +134,6 @@ public class FragmentAccount extends FragmentBase { private Spinner spLeft; private Spinner spRight; - private CheckBox cbIdentity; private Button btnSave; private ContentLoadingProgressBar pbSave; private TextView tvError; @@ -213,7 +211,6 @@ public class FragmentAccount extends FragmentBase { spLeft = view.findViewById(R.id.spLeft); spRight = view.findViewById(R.id.spRight); - cbIdentity = view.findViewById(R.id.cbIdentity); btnSave = view.findViewById(R.id.btnSave); pbSave = view.findViewById(R.id.pbSave); tvError = view.findViewById(R.id.tvError); @@ -267,7 +264,6 @@ public class FragmentAccount extends FragmentBase { etPrefix.setText(provider.prefix); grpFolders.setVisibility(View.GONE); - cbIdentity.setVisibility(View.GONE); btnSave.setVisibility(View.GONE); } @@ -459,7 +455,6 @@ public class FragmentAccount extends FragmentBase { btnCheck.setVisibility(View.GONE); pbCheck.setVisibility(View.GONE); - cbIdentity.setVisibility(View.GONE); btnSave.setVisibility(View.GONE); pbSave.setVisibility(View.GONE); tvError.setVisibility(View.GONE); @@ -706,7 +701,6 @@ public class FragmentAccount extends FragmentBase { @Override protected void onException(Bundle args, Throwable ex) { grpFolders.setVisibility(View.GONE); - cbIdentity.setVisibility(View.GONE); btnSave.setVisibility(View.GONE); if (ex instanceof IllegalArgumentException) @@ -779,7 +773,7 @@ public class FragmentAccount extends FragmentBase { args.putSerializable("left", left); args.putSerializable("right", right); - new SimpleTask() { + new SimpleTask() { @Override protected void onPreExecute(Bundle args) { saving = true; @@ -798,7 +792,7 @@ public class FragmentAccount extends FragmentBase { } @Override - protected Long onExecute(Context context, Bundle args) throws Throwable { + protected Void onExecute(Context context, Bundle args) throws Throwable { long id = args.getLong("id"); int auth_type = args.getInt("auth_type"); @@ -1056,18 +1050,12 @@ public class FragmentAccount extends FragmentBase { nm.cancel("receive", account.id.intValue()); } - return account.id; + return null; } @Override - protected void onExecuted(Bundle args, Long id) { + protected void onExecuted(Bundle args, Void data) { getFragmentManager().popBackStack(); - if (cbIdentity.isChecked()) { - LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); - lbm.sendBroadcast( - new Intent(ActivitySetup.ACTION_EDIT_IDENTITY) - .putExtra("account", id)); - } } @Override @@ -1164,8 +1152,6 @@ public class FragmentAccount extends FragmentBase { cbBrowse.setChecked(account == null ? true : account.browse); etInterval.setText(account == null ? "" : Long.toString(account.poll_interval)); - cbIdentity.setChecked(account == null); - color = (account == null || account.color == null ? Color.TRANSPARENT : account.color); new SimpleTask() { @@ -1468,7 +1454,6 @@ public class FragmentAccount extends FragmentBase { } grpFolders.setVisibility(folders.size() > 1 ? View.VISIBLE : View.GONE); - cbIdentity.setVisibility(folders.size() > 1 ? View.VISIBLE : View.GONE); btnSave.setVisibility(folders.size() > 1 ? View.VISIBLE : View.GONE); } diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index d250edd4cb..909fcf9f4a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -121,7 +121,6 @@ public class FragmentIdentity extends FragmentBase { private Group grpAdvanced; private long id = -1; - private long account = -1; private boolean saving = false; private int auth_type = ConnectionHelper.AUTH_TYPE_PASSWORD; private int color = Color.TRANSPARENT; @@ -134,7 +133,6 @@ public class FragmentIdentity extends FragmentBase { // Get arguments Bundle args = getArguments(); id = args.getLong("id", -1); - account = args.getLong("account", -1); } @Override @@ -214,11 +212,9 @@ public class FragmentIdentity extends FragmentBase { auth_type = account.auth_type; // Select associated provider - if (position == 0) { + if (position == 0) spProvider.setSelection(0); - etHost.setText(account.host.replace("imap", "smtp")); - etPort.setText(null); - } else { + else { boolean found = false; for (int pos = 1; pos < spProvider.getAdapter().getCount(); pos++) { EmailProvider provider = (EmailProvider) spProvider.getItemAtPosition(pos); @@ -896,7 +892,7 @@ public class FragmentIdentity extends FragmentBase { spAccount.setSelection(0); for (int pos = 0; pos < accounts.size(); pos++) { EntityAccount account = accounts.get(pos); - if (account.id.equals(identity == null ? FragmentIdentity.this.account : identity.account)) { + if (account.id.equals((identity == null ? -1 : identity.account))) { spAccount.setTag(pos); spAccount.setSelection(pos); // OAuth token could be updated diff --git a/app/src/main/res/layout/fragment_account.xml b/app/src/main/res/layout/fragment_account.xml index 1d75c41684..083474fcd2 100644 --- a/app/src/main/res/layout/fragment_account.xml +++ b/app/src/main/res/layout/fragment_account.xml @@ -702,15 +702,6 @@ - -