Improved setup

This commit is contained in:
M66B 2019-01-15 09:46:25 +00:00
parent ffef493530
commit 711e887619
8 changed files with 110 additions and 66 deletions

6
FAQ.md
View File

@ -222,7 +222,11 @@ Unfortunately, it is impossible to make everybody happy and adding lots of setti
Preferably select Gmail as provider and select an account on your device.
To login to Gmail / G suite you'll often need an app password, for example when two factor authentication is enabled.
If you want/need to use a username/password instead of selecting an account, you'll need to enable access for "less secure" apps,
see [here](https://support.google.com/accounts/answer/6010255) for Google's instructions
or go [directy to the setting](https://www.google.com/settings/security/lesssecureapps).
To login to Gmail / G suite you'll sometimes 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).
If this doesn't work, see here for more solutions: [https://support.google.com/mail/accounts/answer/78754](https://support.google.com/mail/accounts/answer/78754)

View File

@ -2,6 +2,7 @@
Setting up FairEmail is fairly simple.
You'll need to add at least one account to receive email and at least one identity if you want to send email.
The quick setup will add an account and an identity in one go for most major providers.
## Requirements
@ -11,22 +12,16 @@ An internet connection is required to setup accounts and identities.
## Quick setup
Just enter your name, email address and password and tap *Quick setup*.
Just enter your name, email address and password and tap *Go*.
If you have a Google account, you can use *Select account* instead of entering an email address and a password.
If you have a Google account, preferably use *Select account* instead of entering an email address and a password.
This will work for most major email providers.
If the quick setup doesn't work, you'll need to setup an account and an identity in another way, see below for instructions.
To use Gmail, you'll need to enable access for "less secure" apps,
see [here](https://support.google.com/accounts/answer/6010255) for Google's instructions
or go [directy to the setting](https://www.google.com/settings/security/lesssecureapps).
Less secure is relative and other providers just allow access in the same way,
but if you are concerned you can complete the setup by setting up an account and an identity in another way too, see below.
## Account - to receive email
## Setup account - to receive email
To add an account, tap on *Manage accounts* and tap on the orange *add* button at the bottom.
Select a provider from the list, enter the username, which is mostly your email address and enter your password.
@ -41,7 +36,7 @@ else check the setup instructions of your provider for the right IMAP host name
For more about this, please see [here](https://github.com/M66B/open-source-email/blob/master/FAQ.md#authorizing-accounts).
## Identity - to send email
## Setup identity - to send email
Similarly, to add an identity, tap on *Manage identity* and tap on the orange *add* button at the bottom.
Enter the name you want to appear in de from address of the emails you send and select a linked account.
@ -50,13 +45,13 @@ Tap *Save* to add the identity.
See [this FAQ](https://github.com/M66B/open-source-email/blob/master/FAQ.md#FAQ9) about using aliases.
## Permissions - to access contact information
## Grant permissions - to access contact information
If you want to lookup email addresses, have contact photos shown, etc, you'll need to grant read contacts permission to FairEmail.
Just tap *Grant permissions* and select *Allow*.
## Battery optimizations - to continuously receive email
## Setup battery optimizations - to continuously receive email
On recent Android versions, Android will put apps to sleep when the screen is off for some time to reduce battery usage.
If you want to receive new emails without delays, you should disable battery optimizations for FairEmail.

View File

@ -129,9 +129,6 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
DrawerItem item = (DrawerItem) parent.getAdapter().getItem(position);
switch (item.getId()) {
case R.string.title_setup_help:
onMenuHelp();
break;
case R.string.title_setup_export:
onMenuExport();
break;
@ -170,11 +167,6 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
PackageManager pm = getPackageManager();
DrawerAdapter drawerArray = new DrawerAdapter(this);
if (getIntentHelp().resolveActivity(pm) != null) {
drawerArray.add(new DrawerItem(this, R.layout.item_drawer, R.drawable.baseline_live_help_24, R.string.title_setup_help));
drawerArray.add(new DrawerItem(R.layout.item_drawer_separator));
}
if (getIntentExport().resolveActivity(pm) != null)
drawerArray.add(new DrawerItem(this, R.layout.item_drawer, R.drawable.baseline_archive_24, R.string.title_setup_export));
if (getIntentImport().resolveActivity(pm) != null)
@ -333,10 +325,6 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
.show();
}
private void onMenuHelp() {
startActivity(getIntentHelp());
}
private void onManageNotifications() {
startActivity(getIntentNotifications(this));
}
@ -410,12 +398,6 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
fragmentTransaction.commit();
}
private Intent getIntentHelp() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://github.com/M66B/open-source-email/blob/master/SETUP.md#setup-help"));
return intent;
}
private static Intent getIntentNotifications(Context context) {
return new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
.putExtra("app_package", context.getPackageName())

View File

@ -40,6 +40,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import java.util.List;
@ -56,27 +57,27 @@ public class FragmentSetup extends FragmentEx {
private Button btnQuick;
private Button btnAccount;
private TextView tvAccountDone;
private Button btnAccount;
private TextView tvNoPrimaryDrafts;
private Button btnIdentity;
private TextView tvIdentityDone;
private Button btnIdentity;
private Button btnPermissions;
private TextView tvPermissionsDone;
private Button btnPermissions;
private Button btnDoze;
private TextView tvDozeDone;
private Button btnDoze;
private Button btnData;
private Button btnInbox;
private int textColorPrimary;
private int colorWarning;
private Drawable check;
private boolean inbox = false;
private static final String[] permissions = new String[]{
Manifest.permission.READ_CONTACTS
};
@ -96,21 +97,23 @@ public class FragmentSetup extends FragmentEx {
// Get controls
btnQuick = view.findViewById(R.id.btnQuick);
btnAccount = view.findViewById(R.id.btnAccount);
tvAccountDone = view.findViewById(R.id.tvAccountDone);
btnAccount = view.findViewById(R.id.btnAccount);
tvNoPrimaryDrafts = view.findViewById(R.id.tvNoPrimaryDrafts);
btnIdentity = view.findViewById(R.id.btnIdentity);
tvIdentityDone = view.findViewById(R.id.tvIdentityDone);
btnIdentity = view.findViewById(R.id.btnIdentity);
btnPermissions = view.findViewById(R.id.btnPermissions);
tvPermissionsDone = view.findViewById(R.id.tvPermissionsDone);
btnPermissions = view.findViewById(R.id.btnPermissions);
btnDoze = view.findViewById(R.id.btnDoze);
tvDozeDone = view.findViewById(R.id.tvDozeDone);
btnDoze = view.findViewById(R.id.btnDoze);
btnData = view.findViewById(R.id.btnData);
btnInbox = view.findViewById(R.id.btnInbox);
// Wire controls
btnQuick.setOnClickListener(new View.OnClickListener() {
@ -181,24 +184,33 @@ public class FragmentSetup extends FragmentEx {
}
});
btnInbox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
// Initialize
tvAccountDone.setText(null);
tvAccountDone.setCompoundDrawables(null, null, null, null);
tvNoPrimaryDrafts.setVisibility(View.GONE);
btnIdentity.setEnabled(false);
tvIdentityDone.setText(null);
tvIdentityDone.setCompoundDrawables(null, null, null, null);
btnIdentity.setEnabled(false);
tvPermissionsDone.setText(null);
tvPermissionsDone.setCompoundDrawables(null, null, null, null);
btnDoze.setEnabled(false);
tvDozeDone.setText(null);
tvDozeDone.setCompoundDrawables(null, null, null, null);
btnDoze.setEnabled(false);
btnData.setVisibility(View.GONE);
btnInbox.setEnabled(false);
int[] grantResults = new int[permissions.length];
for (int i = 0; i < permissions.length; i++)
grantResults[i] = ContextCompat.checkSelfPermission(getActivity(), permissions[i]);
@ -257,14 +269,15 @@ public class FragmentSetup extends FragmentEx {
public void onChanged(@Nullable List<EntityAccount> accounts) {
done = (accounts != null && accounts.size() > 0);
inbox = done;
getActivity().invalidateOptionsMenu();
btnIdentity.setEnabled(done);
tvAccountDone.setText(done ? R.string.title_setup_done : R.string.title_setup_to_do);
tvAccountDone.setTextColor(done ? textColorPrimary : colorWarning);
tvAccountDone.setCompoundDrawablesWithIntrinsicBounds(done ? check : null, null, null, null);
btnIdentity.setEnabled(done);
btnInbox.setEnabled(done);
if (livePrimaryDrafts == null)
livePrimaryDrafts = db.folder().livePrimaryDrafts();
else
@ -340,21 +353,32 @@ public class FragmentSetup extends FragmentEx {
@Override
public void onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.menu_inbox).setVisible(inbox);
PackageManager pm = getContext().getPackageManager();
menu.findItem(R.id.menu_help).setVisible(getIntentHelp().resolveActivity(pm) != null);
super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_inbox:
finish();
case R.id.menu_help:
onMenuHelp();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void onMenuHelp() {
startActivity(getIntentHelp());
}
private Intent getIntentHelp() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://github.com/M66B/open-source-email/blob/master/SETUP.md#setup-help"));
return intent;
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == ActivitySetup.REQUEST_PERMISSION)
@ -369,10 +393,10 @@ public class FragmentSetup extends FragmentEx {
break;
}
btnPermissions.setEnabled(!has);
tvPermissionsDone.setText(has ? R.string.title_setup_done : R.string.title_setup_to_do);
tvPermissionsDone.setTextColor(has ? textColorPrimary : colorWarning);
tvPermissionsDone.setCompoundDrawablesWithIntrinsicBounds(has ? check : null, null, null, null);
btnPermissions.setEnabled(!has);
if (has && !init)
new SimpleTask<Void>() {

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,2L5,2c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h4l3,3 3,-3h4c1.1,0 2,-0.9 2,-2L21,4c0,-1.1 -0.9,-2 -2,-2zM13,18h-2v-2h2v2zM15.07,10.25l-0.9,0.92C13.45,11.9 13,12.5 13,14h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,8c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"/>
</vector>

View File

@ -101,6 +101,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableStart="@drawable/baseline_check_24"
android:drawablePadding="6dp"
android:text="@string/title_setup_done"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:attr/textColorPrimary"
@ -177,6 +178,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableStart="@drawable/baseline_check_24"
android:drawablePadding="6dp"
android:text="@string/title_setup_done"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:attr/textColorPrimary"
@ -241,6 +243,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableStart="@drawable/baseline_check_24"
android:drawablePadding="6dp"
android:text="@string/title_setup_done"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:attr/textColorPrimary"
@ -252,7 +255,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_setup_manage"
android:text="@string/title_setup_grant"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPermissionsDone" />
@ -306,6 +309,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableStart="@drawable/baseline_check_24"
android:drawablePadding="6dp"
android:text="@string/title_setup_done"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:attr/textColorPrimary"
@ -334,5 +338,48 @@
android:text="@string/title_setup_data"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnDoze" />
<!-- inbox -->
<View
android:id="@+id/vSeparatorInbox"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="12dp"
android:background="?attr/colorSeparator"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnData" />
<ImageView
android:id="@+id/five"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginTop="12dp"
android:src="@drawable/baseline_looks_5_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorInbox" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="12dp"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/title_setup_inbox"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/five"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/five" />
<Button
android:id="@+id/btnInbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_setup_go"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/five" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -2,8 +2,8 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_inbox"
android:icon="@drawable/baseline_mail_24"
android:title="@string/title_folder_unified"
android:id="@+id/menu_help"
android:icon="@drawable/baseline_help_24"
android:title="@string/title_setup_help"
app:showAsAction="always" />
</menu>

View File

@ -86,24 +86,26 @@
<string name="title_setup_password_invalid">Password invalid</string>
<string name="title_setup_exported">Settings exported</string>
<string name="title_setup_imported">Settings imported</string>
<string name="title_setup_quick">Quick config</string>
<string name="title_setup_quick_remark">Quick config can be used for most major providers</string>
<string name="title_setup_quick">Quick setup</string>
<string name="title_setup_quick_remark">To quickly setup an account and identity for most major providers</string>
<string name="title_setup_go">Go</string>
<string name="title_setup_setting_gmail">Enable access for "less secure" apps</string>
<string name="title_setup_no_settings">No settings found for \'%1$s\'</string>
<string name="title_setup_quick_success">An account and an identity have successfully been added</string>
<string name="title_setup_quick_failed">You can try to configure an account and an identity below too</string>
<string name="title_setup_manage">Manage</string>
<string name="title_setup_grant">Grant</string>
<string name="title_setup_account">Setup accounts</string>
<string name="title_setup_account_remark">To receive email</string>
<string name="title_setup_identity">Setup identities</string>
<string name="title_setup_identity_remark">To send email</string>
<string name="title_setup_permissions">Setup permissions</string>
<string name="title_setup_permissions">Grant permissions</string>
<string name="title_setup_permissions_remark">To access contact information (optional)</string>
<string name="title_setup_doze">Setup battery optimizations</string>
<string name="title_setup_doze_remark">To continuously receive email (optional)</string>
<string name="title_setup_doze_instructions">In the next dialog, select \"All apps\" at the top, select this app and select and confirm \"Don\'t optimize\"</string>
<string name="title_setup_data">Disable data saving</string>
<string name="title_setup_inbox">Read messages</string>
<string name="title_setup_notifications">Manage notifications</string>
<string name="title_setup_to_do">To do</string>
<string name="title_setup_done">Done</string>