Revised account/identity setup

pull/147/head
M66B 6 years ago
parent 78d5f588d8
commit ec4e658580

@ -180,8 +180,7 @@ IMAP STARTTLS: the EFF [writes](https://www.eff.org/nl/deeplinks/2018/06/announc
Empty password: your username is likely easily guessed, so this is very insecure.
If you still want to use an invalid security certificate, IMAP STARTTLS or an empty password,
you'll need to enable insecure connections in the advanced settings and also in the account and/or identity settings.
Additionally, IMAP STARTTLS needs to be enabled in the account settings too.
you'll need to enable insecure connections in the account and/or identity settings.
<a name="faq5"></a>

@ -29,14 +29,12 @@ import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
@ -157,9 +155,6 @@ public class FragmentAccount extends FragmentEx {
setSubtitle(R.string.title_edit_account);
setHasOptionsMenu(true);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
final boolean insecure = prefs.getBoolean("insecure", false);
view = (ViewGroup) inflater.inflate(R.layout.fragment_account, container, false);
// Get controls
@ -218,8 +213,6 @@ public class FragmentAccount extends FragmentEx {
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long itemid) {
Provider provider = (Provider) adapterView.getSelectedItem();
grpServer.setVisibility(position == 1 ? View.VISIBLE : View.GONE);
cbStartTls.setVisibility(position == 1 && insecure ? View.VISIBLE : View.GONE);
cbInsecure.setVisibility(position == 1 && insecure ? View.VISIBLE : View.GONE);
grpAuthorize.setVisibility(position > 0 ? View.VISIBLE : View.GONE);
btnAuthorize.setVisibility(provider.type == null ? View.GONE : View.VISIBLE);

@ -21,12 +21,10 @@ package eu.faircode.email;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.Html;
import android.text.TextUtils;
@ -115,6 +113,7 @@ public class FragmentIdentity extends FragmentEx {
private ProgressBar pbSave;
private ProgressBar pbWait;
private Group grpAuthorize;
private Group grpAdvanced;
private long id = -1;
@ -136,9 +135,6 @@ public class FragmentIdentity extends FragmentEx {
setSubtitle(R.string.title_edit_identity);
setHasOptionsMenu(true);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
final boolean insecure = prefs.getBoolean("insecure", false);
view = (ViewGroup) inflater.inflate(R.layout.fragment_identity, container, false);
// Get controls
@ -177,6 +173,7 @@ public class FragmentIdentity extends FragmentEx {
pbSave = view.findViewById(R.id.pbSave);
pbWait = view.findViewById(R.id.pbWait);
grpAuthorize = view.findViewById(R.id.grpAuthorize);
grpAdvanced = view.findViewById(R.id.grpAdvanced);
// Wire controls
@ -184,11 +181,10 @@ public class FragmentIdentity extends FragmentEx {
spAccount.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
btnAdvanced.setVisibility(position > 0 ? View.VISIBLE : View.GONE);
grpAuthorize.setVisibility(position > 0 ? View.VISIBLE : View.GONE);
if (position == 0)
grpAdvanced.setVisibility(View.GONE);
tilPassword.setPasswordVisibilityToggleEnabled(position == 0);
btnSave.setVisibility(position > 0 ? View.VISIBLE : View.GONE);
Integer tag = (Integer) adapterView.getTag();
if (tag != null && tag.equals(position))
@ -284,7 +280,6 @@ public class FragmentIdentity extends FragmentEx {
public void onClick(View v) {
int visibility = (grpAdvanced.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
grpAdvanced.setVisibility(visibility);
cbInsecure.setVisibility(insecure ? visibility : View.GONE);
if (visibility == View.VISIBLE)
new Handler().post(new Runnable() {
@Override
@ -606,9 +601,11 @@ public class FragmentIdentity extends FragmentEx {
tilPassword.setPasswordVisibilityToggleEnabled(id < 0);
btnSave.setVisibility(View.GONE);
btnAdvanced.setVisibility(View.GONE);
grpAdvanced.setVisibility(View.GONE);
pbSave.setVisibility(View.GONE);
grpAuthorize.setVisibility(View.GONE);
grpAdvanced.setVisibility(View.GONE);
return view;
}

@ -55,7 +55,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
private SwitchCompat swMetered;
private Spinner spDownload;
private SwitchCompat swInsecure;
private SwitchCompat swUnified;
private SwitchCompat swThreading;
@ -94,7 +93,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
swMetered = view.findViewById(R.id.swMetered);
spDownload = view.findViewById(R.id.spDownload);
swInsecure = view.findViewById(R.id.swInsecure);
swUnified = view.findViewById(R.id.swUnified);
swThreading = view.findViewById(R.id.swThreading);
@ -161,14 +159,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
}
});
swInsecure.setChecked(prefs.getBoolean("insecure", false));
swInsecure.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("insecure", checked).apply();
}
});
swUnified.setChecked(prefs.getBoolean("unified", true));
swUnified.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override

@ -567,7 +567,7 @@
android:id="@+id/grpServer"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvDomain,etDomain,btnAutoConfig,tvImap,tvPop,tvHost,etHost,tvPort,etPort" />
app:constraint_referenced_ids="tvDomain,etDomain,btnAutoConfig,tvImap,tvPop,tvHost,etHost,cbStartTls,cbInsecure,tvPort,etPort" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAuthorize"

@ -12,17 +12,36 @@
android:layout_height="wrap_content"
android:padding="12dp">
<!--- linked account -->
<TextView
android:id="@+id/tvAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_account_linked"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Spinner
android:id="@+id/spAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAccount" />
<!-- name -->
<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:autofillHints="name"
android:text="@string/title_identity_name"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="@id/spAccount" />
<EditText
android:id="@+id/etName"
@ -53,25 +72,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvEmail" />
<!--- linked account -->
<TextView
android:id="@+id/tvAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_account_linked"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etEmail" />
<Spinner
android:id="@+id/spAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAccount" />
<TextView
android:id="@+id/tvDisplay"
android:layout_width="wrap_content"
@ -81,7 +81,7 @@
android:text="@string/title_display_name"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spAccount" />
app:layout_constraintTop_toBottomOf="@id/etEmail" />
<EditText
android:id="@+id/etDisplay"
@ -500,10 +500,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAuthorize"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvName,etName,tvEmail,etEmail,tvDisplay,etDisplay,btnColor,vwColor,ibColorDefault,tvSignature,etSignature,ibPro,btnAdvanced,btnSave" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAdvanced"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvReplyTo,etReplyTo,tvBcc,etBcc,cbDeliveryReceipt,cbReadReceipt,tvReceipt,tvProvider,spProvider,tvDomain,etDomain,btnAutoConfig,tvSmtp,tvHost,etHost,cbStartTls,tvPort,etPort,tvUser,etUser,tvPassword,tilPassword,cbSynchronize,cbPrimary,tvSent,spSent,tvSentHint" />
app:constraint_referenced_ids="tvReplyTo,etReplyTo,tvBcc,etBcc,cbDeliveryReceipt,cbReadReceipt,tvReceipt,tvProvider,spProvider,tvDomain,etDomain,btnAutoConfig,tvSmtp,tvHost,etHost,cbStartTls,cbInsecure,tvPort,etPort,tvUser,etUser,tvPassword,tilPassword,cbSynchronize,cbPrimary,tvSent,spSent,tvSentHint" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

@ -135,18 +135,6 @@
app:barrierDirection="bottom"
app:constraint_referenced_ids="tvDownload,spDownload" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swInsecure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:text="@string/title_allow_insecure"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/barrier1"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvSectionDisplay"
android:layout_width="wrap_content"
@ -156,7 +144,7 @@
android:text="@string/title_advanced_section_display"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swInsecure" />
app:layout_constraintTop_toBottomOf="@id/barrier1" />
<View
android:id="@+id/vSeparator3"

Loading…
Cancel
Save