Browse Source

Added login instructions

main
M66B 6 years ago
parent
commit
7507da113c
8 changed files with 111 additions and 12 deletions
  1. +2
    -3
      FAQ.md
  2. +13
    -0
      app/src/main/java/eu/faircode/email/FragmentAccount.java
  3. +17
    -1
      app/src/main/java/eu/faircode/email/FragmentIdentity.java
  4. +2
    -0
      app/src/main/java/eu/faircode/email/Provider.java
  5. +29
    -1
      app/src/main/res/layout/fragment_account.xml
  6. +29
    -1
      app/src/main/res/layout/fragment_identity.xml
  7. +1
    -0
      app/src/main/res/values/strings.xml
  8. +18
    -6
      app/src/main/res/xml/providers.xml

+ 2
- 3
FAQ.md View File

@ -45,12 +45,11 @@ Without [IMAP IDLE](https://en.wikipedia.org/wiki/IMAP_IDLE) emails need to be p
which is a waste of battery power and internet bandwidth and will delay notification of new emails.
<a name="FAQ6"></a>
**(6) How can I set a Google app password?**
**(6) How can I login to Gmail / G suite?**
To login to Gmail / G suite you'll often need an app password, for example when two factor authentication is enabled.
See here for instructions: [https://support.google.com/accounts/answer/185833](https://support.google.com/accounts/answer/185833).
This will be easier after implementing [this feature](https://github.com/M66B/open-source-email/issues/17).
<br>
If you have another question, you can use [this forum](https://forum.xda-developers.com/android/apps-games/source-email-t3824168).


+ 13
- 0
app/src/main/java/eu/faircode/email/FragmentAccount.java View File

@ -23,7 +23,9 @@ import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@ -70,6 +72,7 @@ public class FragmentAccount extends FragmentEx {
private EditText etPort;
private EditText etUser;
private TextInputLayout tilPassword;
private TextView tvLink;
private CheckBox cbSynchronize;
private CheckBox cbPrimary;
private CheckBox cbStoreSent;
@ -86,6 +89,7 @@ public class FragmentAccount extends FragmentEx {
private ProgressBar pbSave;
private ImageButton ibDelete;
private ProgressBar pbWait;
private Group grpInstructions;
private Group grpFolders;
@Override
@ -106,6 +110,7 @@ public class FragmentAccount extends FragmentEx {
etPort = view.findViewById(R.id.etPort);
etUser = view.findViewById(R.id.etUser);
tilPassword = view.findViewById(R.id.tilPassword);
tvLink = view.findViewById(R.id.tvLink);
cbSynchronize = view.findViewById(R.id.cbSynchronize);
cbPrimary = view.findViewById(R.id.cbPrimary);
cbStoreSent = view.findViewById(R.id.cbStoreSent);
@ -122,6 +127,7 @@ public class FragmentAccount extends FragmentEx {
pbSave = view.findViewById(R.id.pbSave);
ibDelete = view.findViewById(R.id.ibDelete);
pbWait = view.findViewById(R.id.pbWait);
grpInstructions = view.findViewById(R.id.grpInstructions);
grpFolders = view.findViewById(R.id.grpFolders);
// Wire controls
@ -135,6 +141,10 @@ public class FragmentAccount extends FragmentEx {
adapterView.setTag(position);
Provider provider = (Provider) adapterView.getSelectedItem();
tvLink.setText(Html.fromHtml("<a href=\"" + provider.link + "\">" + provider.link + "</a>"));
grpInstructions.setVisibility(provider.link == null ? View.GONE : View.VISIBLE);
if (provider.imap_port != 0) {
etName.setText(provider.name);
etHost.setText(provider.imap_host);
@ -578,6 +588,7 @@ public class FragmentAccount extends FragmentEx {
// Initialize
Helper.setViewsEnabled(view, false);
tilPassword.setPasswordVisibilityToggleEnabled(id < 0);
tvLink.setMovementMethod(LinkMovementMethod.getInstance());
btnCheck.setEnabled(false);
pbCheck.setVisibility(View.GONE);
btnSave.setVisibility(View.GONE);
@ -594,6 +605,7 @@ public class FragmentAccount extends FragmentEx {
super.onSaveInstanceState(outState);
outState.putInt("provider", spProvider.getSelectedItemPosition());
outState.putString("password", tilPassword.getEditText().getText().toString());
outState.putInt("instructions", grpInstructions.getVisibility());
}
@Override
@ -637,6 +649,7 @@ public class FragmentAccount extends FragmentEx {
spProvider.setTag(provider);
spProvider.setSelection(provider);
tilPassword.getEditText().setText(savedInstanceState.getString("password"));
grpInstructions.setVisibility(savedInstanceState.getInt("instructions"));
}
Helper.setViewsEnabled(view, true);


+ 17
- 1
app/src/main/java/eu/faircode/email/FragmentIdentity.java View File

@ -23,8 +23,10 @@ import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.Editable;
import android.text.Html;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -37,6 +39,7 @@ import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.textfield.TextInputLayout;
@ -51,6 +54,7 @@ import javax.mail.Transport;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.Group;
import androidx.lifecycle.Observer;
public class FragmentIdentity extends FragmentEx {
@ -65,12 +69,14 @@ public class FragmentIdentity extends FragmentEx {
private EditText etPort;
private EditText etUser;
private TextInputLayout tilPassword;
private TextView tvLink;
private CheckBox cbSynchronize;
private CheckBox cbPrimary;
private Button btnSave;
private ProgressBar pbSave;
private ImageButton ibDelete;
private ProgressBar pbWait;
private Group grpInstructions;
@Override
@Nullable
@ -94,12 +100,14 @@ public class FragmentIdentity extends FragmentEx {
etPort = view.findViewById(R.id.etPort);
etUser = view.findViewById(R.id.etUser);
tilPassword = view.findViewById(R.id.tilPassword);
tvLink = view.findViewById(R.id.tvLink);
cbSynchronize = view.findViewById(R.id.cbSynchronize);
cbPrimary = view.findViewById(R.id.cbPrimary);
btnSave = view.findViewById(R.id.btnSave);
pbSave = view.findViewById(R.id.pbSave);
ibDelete = view.findViewById(R.id.ibDelete);
pbWait = view.findViewById(R.id.pbWait);
grpInstructions = view.findViewById(R.id.grpInstructions);
// Wire controls
@ -159,6 +167,10 @@ public class FragmentIdentity extends FragmentEx {
adapterView.setTag(position);
Provider provider = (Provider) adapterView.getSelectedItem();
tvLink.setText(Html.fromHtml("<a href=\"" + provider.link + "\">" + provider.link + "</a>"));
grpInstructions.setVisibility(provider.link == null ? View.GONE : View.VISIBLE);
if (provider.smtp_port != 0) {
etHost.setText(provider.smtp_host);
etPort.setText(Integer.toString(provider.smtp_port));
@ -357,6 +369,7 @@ public class FragmentIdentity extends FragmentEx {
// Initialize
Helper.setViewsEnabled(view, false);
tilPassword.setPasswordVisibilityToggleEnabled(id < 0);
tvLink.setMovementMethod(LinkMovementMethod.getInstance());
btnSave.setEnabled(false);
pbSave.setVisibility(View.GONE);
ibDelete.setVisibility(View.GONE);
@ -370,6 +383,7 @@ public class FragmentIdentity extends FragmentEx {
outState.putInt("account", spAccount.getSelectedItemPosition());
outState.putInt("provider", spProvider.getSelectedItemPosition());
outState.putString("password", tilPassword.getEditText().getText().toString());
outState.putInt("instructions", grpInstructions.getVisibility());
}
@Override
@ -405,8 +419,10 @@ public class FragmentIdentity extends FragmentEx {
cbPrimary.setChecked(identity == null ? true : identity.primary);
etName.requestFocus();
} else
} else {
tilPassword.getEditText().setText(savedInstanceState.getString("password"));
grpInstructions.setVisibility(savedInstanceState.getInt("instructions"));
}
Helper.setViewsEnabled(view, true);


+ 2
- 0
app/src/main/java/eu/faircode/email/Provider.java View File

@ -34,6 +34,7 @@ import java.util.Locale;
public class Provider {
public String name;
public String link;
public String imap_host;
public int imap_port;
public String smtp_host;
@ -60,6 +61,7 @@ public class Provider {
else if ("provider".equals(xml.getName())) {
provider = new Provider();
provider.name = xml.getAttributeValue(null, "name");
provider.link = xml.getAttributeValue(null, "link");
} else if ("imap".equals(xml.getName())) {
provider.imap_host = xml.getAttributeValue(null, "host");
provider.imap_port = xml.getAttributeIntValue(null, "port", 0);


+ 29
- 1
app/src/main/res/layout/fragment_account.xml View File

@ -158,6 +158,28 @@
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/tvInstructions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:freezesText="true"
android:text="@string/title_instructions"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tilPassword" />
<TextView
android:id="@+id/tvLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:freezesText="true"
android:text="link"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvInstructions" />
<CheckBox
android:id="@+id/cbSynchronize"
android:layout_width="wrap_content"
@ -165,7 +187,7 @@
android:layout_marginTop="12dp"
android:text="@string/title_synchronize_account"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tilPassword" />
app:layout_constraintTop_toBottomOf="@id/tvLink" />
<CheckBox
android:id="@+id/cbPrimary"
@ -382,6 +404,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpInstructions"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvInstructions,tvLink" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpFolders"
android:layout_width="0dp"


+ 29
- 1
app/src/main/res/layout/fragment_identity.xml View File

@ -230,6 +230,28 @@
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/tvInstructions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:freezesText="true"
android:text="@string/title_instructions"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tilPassword" />
<TextView
android:id="@+id/tvLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:freezesText="true"
android:text="link"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvInstructions" />
<CheckBox
android:id="@+id/cbSynchronize"
android:layout_width="wrap_content"
@ -237,7 +259,7 @@
android:layout_marginTop="12dp"
android:text="@string/title_synchronize_identity"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tilPassword" />
app:layout_constraintTop_toBottomOf="@id/tvLink" />
<CheckBox
android:id="@+id/cbPrimary"
@ -287,5 +309,11 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpInstructions"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvInstructions,tvLink" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

+ 1
- 0
app/src/main/res/values/strings.xml View File

@ -84,6 +84,7 @@
<string name="title_port">Port number</string>
<string name="title_user">User name</string>
<string name="title_password">Password</string>
<string name="title_instructions">Instructions</string>
<string name="title_store_sent">Store sent messages (enable if needed only)</string>
<string name="title_interval">Poll/keep-alive interval (minutes)</string>
<string name="title_synchronize_account">Synchronize (receive messages)</string>


+ 18
- 6
app/src/main/res/xml/providers.xml View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<providers>
<provider name="Gmail">
<provider
name="Gmail"
link="https://support.google.com/mail/answer/7126229">
<imap
host="imap.gmail.com"
port="993" />
@ -9,7 +11,9 @@
port="465"
starttls="false" />
</provider>
<provider name="Outlook">
<provider
name="Outlook"
link="https://support.office.com/en-us/article/pop-imap-and-smtp-settings-for-outlook-com-d088b986-291d-42b8-9564-9c414e2aa040">
<imap
host="imap-mail.outlook.com"
port="993" />
@ -29,7 +33,9 @@
starttls="false" />
</provider-->
<!-- no IMAP IDLE -->
<provider name="Yahoo!">
<provider
name="Yahoo!"
link="https://help.yahoo.com/kb/SLN4075.html">
<imap
host="imap.mail.yahoo.com"
port="993" />
@ -38,7 +44,9 @@
port="465"
starttls="false" />
</provider>
<provider name="Posteo.de">
<provider
name="Posteo.de"
link="https://posteo.de/en/help/how-do-i-set-up-posteo-in-an-email-client-pop3-imap-and-smtp">
<imap
host="posteo.de"
port="993" />
@ -56,7 +64,9 @@
port="465"
starttls="false" />
</provider>
<provider name="FastMail">
<provider
name="FastMail"
link="https://www.fastmail.com/help/technical/servernamesandports.html">
<imap
host="imap.fastmail.com"
port="993" />
@ -93,7 +103,9 @@
port="465"
starttls="false" />
</provider>
<provider name="gmx.com">
<provider
name="gmx.com"
link="https://support.gmx.com/pop-imap/imap/index.html#breadcrumb_help_pop-imap_imap_server">
<imap
host="imap.gmx.com"
port="993" />


Loading…
Cancel
Save