mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-05 12:24:26 +01:00
Added login instructions
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user