mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-04 02:28:18 +00:00
Merge branch 'M66B:master' into tutorial
This commit is contained in:
commit
f3589fd302
13 changed files with 116 additions and 24 deletions
2
FAQ.md
2
FAQ.md
|
@ -2781,7 +2781,7 @@ To set the poll interval:
|
|||
(adb shell) adb shell am start-foreground-service -a eu.faircode.email.INTERVAL --ei minutes nnn
|
||||
```
|
||||
|
||||
Where *nnn* is one of 0, 15, 30, 60, 120, 240, 480, 1440. A value of 0 means push messages.
|
||||
Where *nnn* is one of 0, 5, 15, 30, 60, 120, 240, 480, 1440. A value of 0 means push messages.
|
||||
|
||||
You can automatically send commands with for example [Tasker](https://tasker.joaoapps.com/userguide/en/intents.html):
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ dependencies {
|
|||
def activity_version = "1.5.0" // 1.6.0-alpha03
|
||||
def fragment_version = "1.5.0"
|
||||
def windows_version = "1.0.0" // 1.1.0-alpha01
|
||||
def webkit_version = "1.5.0-alpha01"
|
||||
def webkit_version = "1.5.0-beta01"
|
||||
def recyclerview_version = "1.2.1" // 1.3.0-alpha02
|
||||
def coordinatorlayout_version = "1.2.0"
|
||||
def constraintlayout_version = "2.1.4" // 2.2.0-alpha01
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -161,7 +162,7 @@ public class ActivityAMP extends ActivityBase {
|
|||
WebSettings settings = wvAmp.getSettings();
|
||||
boolean dark = (Helper.isDarkTheme(this) && !force_light);
|
||||
boolean canDarken = WebViewEx.isFeatureSupported(this, WebViewFeature.ALGORITHMIC_DARKENING);
|
||||
if (canDarken)
|
||||
if (canDarken && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
WebSettingsCompat.setAlgorithmicDarkeningAllowed(settings, dark);
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
@Override
|
||||
public void run() {
|
||||
drawerLayout.closeDrawer(drawerContainer);
|
||||
onMenuOrder(R.string.title_setup_reorder_accounts, EntityAccount.class);
|
||||
onMenuOrder(R.string.title_setup_reorder_accounts, EntityAccount.class.getName());
|
||||
}
|
||||
}));
|
||||
|
||||
|
@ -247,7 +247,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
@Override
|
||||
public void run() {
|
||||
drawerLayout.closeDrawer(drawerContainer);
|
||||
onMenuOrder(R.string.title_setup_reorder_folders, TupleFolderSort.class);
|
||||
onMenuOrder(R.string.title_setup_reorder_folders, TupleFolderSort.class.getName());
|
||||
}
|
||||
}).setSeparated());
|
||||
|
||||
|
@ -552,13 +552,13 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
}
|
||||
}
|
||||
|
||||
private void onMenuOrder(int title, Class clazz) {
|
||||
private void onMenuOrder(int title, String className) {
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||
getSupportFragmentManager().popBackStack("order", FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("title", title);
|
||||
args.putString("class", clazz.getName());
|
||||
args.putString("class", className);
|
||||
|
||||
FragmentOrder fragment = new FragmentOrder();
|
||||
fragment.setArguments(args);
|
||||
|
@ -2003,7 +2003,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
else if (ACTION_IMPORT_CERTIFICATE.equals(action))
|
||||
onImportCertificate(intent);
|
||||
else if (ACTION_SETUP_REORDER.equals(action))
|
||||
onMenuOrder(R.string.title_setup_reorder_accounts, EntityAccount.class);
|
||||
onMenuOrder(R.string.title_setup_reorder_accounts, intent.getStringExtra("className"));
|
||||
else if (ACTION_SETUP_MORE.equals(action))
|
||||
onSetupMore(intent);
|
||||
}
|
||||
|
|
|
@ -6248,6 +6248,25 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
}
|
||||
|
||||
private void onActionForceLight(TupleMessageEx message) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.dialog_dark, null);
|
||||
final Button btnIssue = view.findViewById(R.id.btnIssue);
|
||||
|
||||
btnIssue.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Uri uri = Uri.parse("https://issuetracker.google.com/issues/237785596");
|
||||
Helper.view(v.getContext(), uri, true);
|
||||
}
|
||||
});
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setView(view)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (canDarken) {
|
||||
boolean force_light = !properties.getValue("force_light", message.id);
|
||||
properties.setValue("force_light", message.id, force_light);
|
||||
|
@ -7040,7 +7059,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
this.check_blocklist = prefs.getBoolean("check_blocklist", false);
|
||||
|
||||
this.email_format = ("sender".equals(sort)
|
||||
? MessageHelper.AddressFormat.EMAIL_ONLY
|
||||
? MessageHelper.AddressFormat.EMAIL_NAME
|
||||
: MessageHelper.getAddressFormat(context));
|
||||
this.prefer_contact = prefs.getBoolean("prefer_contact", false);
|
||||
this.only_contact = prefs.getBoolean("only_contact", false);
|
||||
|
@ -7711,7 +7730,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
if (!sort.equals(this.sort)) {
|
||||
this.sort = sort;
|
||||
this.email_format = ("sender".equals(sort)
|
||||
? MessageHelper.AddressFormat.EMAIL_ONLY
|
||||
? MessageHelper.AddressFormat.EMAIL_NAME
|
||||
: MessageHelper.getAddressFormat(context));
|
||||
properties.refresh();
|
||||
// Needed to redraw item decorators / add/remove size
|
||||
|
|
|
@ -23,6 +23,7 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -84,7 +85,7 @@ public class FragmentDialogOpenFull extends FragmentDialogBase {
|
|||
|
||||
boolean dark = (Helper.isDarkTheme(context) && !force_light);
|
||||
boolean canDarken = WebViewEx.isFeatureSupported(context, WebViewFeature.ALGORITHMIC_DARKENING);
|
||||
if (canDarken)
|
||||
if (canDarken && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
WebSettingsCompat.setAlgorithmicDarkeningAllowed(settings, dark);
|
||||
|
||||
settings.setLoadsImagesAutomatically(true);
|
||||
|
|
|
@ -120,7 +120,8 @@ public class FragmentSetup extends FragmentBase {
|
|||
private CardView cardExtra;
|
||||
private TextView tvExtra;
|
||||
private Button btnNotification;
|
||||
private Button btnReorder;
|
||||
private Button btnReorderAccounts;
|
||||
private Button btnReorderFolders;
|
||||
private Button btnDelete;
|
||||
private Button btnApp;
|
||||
private Button btnMore;
|
||||
|
@ -199,7 +200,8 @@ public class FragmentSetup extends FragmentBase {
|
|||
cardExtra = view.findViewById(R.id.cardExtra);
|
||||
tvExtra = view.findViewById(R.id.tvExtra);
|
||||
btnNotification = view.findViewById(R.id.btnNotification);
|
||||
btnReorder = view.findViewById(R.id.btnReorder);
|
||||
btnReorderAccounts = view.findViewById(R.id.btnReorderAccounts);
|
||||
btnReorderFolders = view.findViewById(R.id.btnReorderFolders);
|
||||
btnDelete = view.findViewById(R.id.btnDelete);
|
||||
btnApp = view.findViewById(R.id.btnApp);
|
||||
btnMore = view.findViewById(R.id.btnMore);
|
||||
|
@ -628,14 +630,25 @@ public class FragmentSetup extends FragmentBase {
|
|||
}
|
||||
});
|
||||
|
||||
btnReorder.setOnClickListener(new View.OnClickListener() {
|
||||
btnReorderAccounts.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SETUP_REORDER));
|
||||
public void onClick(View v) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(v.getContext());
|
||||
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SETUP_REORDER)
|
||||
.putExtra("className", EntityAccount.class.getName()));
|
||||
}
|
||||
});
|
||||
|
||||
btnReorderFolders.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(v.getContext());
|
||||
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SETUP_REORDER)
|
||||
.putExtra("className", TupleFolderSort.class.getName()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
btnDelete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -920,6 +920,7 @@ public class Helper {
|
|||
Intent view = new Intent(Intent.ACTION_VIEW, uri);
|
||||
Intent chooser = Intent.createChooser(view, context.getString(R.string.title_select_app));
|
||||
try {
|
||||
EntityLog.log(context, "Launching chooser uri=" + uri);
|
||||
context.startActivity(chooser);
|
||||
} catch (ActivityNotFoundException ex) {
|
||||
Log.w(ex);
|
||||
|
@ -935,6 +936,9 @@ public class Helper {
|
|||
if (task)
|
||||
view.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
view.setPackage(open_with_pkg);
|
||||
EntityLog.log(context, "Launching view uri=" + uri +
|
||||
" intent=" + view +
|
||||
" extras=" + TextUtils.join(", ", Log.getExtras(view.getExtras())));
|
||||
context.startActivity(view);
|
||||
} catch (Throwable ex) {
|
||||
reportNoViewer(context, uri, ex);
|
||||
|
@ -974,7 +978,6 @@ public class Helper {
|
|||
languages.add(slocale.getLanguage() + ";q=0.7");
|
||||
}
|
||||
languages.add("*;q=0.5");
|
||||
Log.i("MMM " + TextUtils.join(", ", languages));
|
||||
|
||||
Bundle headers = new Bundle();
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language
|
||||
|
@ -985,6 +988,9 @@ public class Helper {
|
|||
customTabsIntent.intent.setPackage(open_with_pkg);
|
||||
|
||||
try {
|
||||
EntityLog.log(context, "Launching tab uri=" + uri +
|
||||
" intent=" + customTabsIntent.intent +
|
||||
" extras=" + TextUtils.join(", ", Log.getExtras(customTabsIntent.intent.getExtras())));
|
||||
customTabsIntent.launchUrl(context, uri);
|
||||
} catch (Throwable ex) {
|
||||
reportNoViewer(context, uri, ex);
|
||||
|
|
|
@ -2721,7 +2721,7 @@ public class MessageHelper {
|
|||
}
|
||||
}
|
||||
|
||||
enum AddressFormat {NAME_ONLY, EMAIL_ONLY, NAME_EMAIL}
|
||||
enum AddressFormat {NAME_ONLY, EMAIL_ONLY, NAME_EMAIL, EMAIL_NAME}
|
||||
|
||||
static AddressFormat getAddressFormat(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
@ -2792,6 +2792,8 @@ public class MessageHelper {
|
|||
|
||||
if (format == AddressFormat.NAME_EMAIL && !TextUtils.isEmpty(email))
|
||||
formatted.add(personal + " <" + email + ">");
|
||||
else if (format == AddressFormat.EMAIL_NAME && !TextUtils.isEmpty(email))
|
||||
formatted.add("<" + email + "> " + personal);
|
||||
else
|
||||
formatted.add(personal);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|||
// https://developer.android.com/reference/android/webkit/WebSettings#setAlgorithmicDarkeningAllowed(boolean)
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme
|
||||
boolean canDarken = WebViewEx.isFeatureSupported(context, WebViewFeature.ALGORITHMIC_DARKENING);
|
||||
if (canDarken)
|
||||
if (canDarken && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
WebSettingsCompat.setAlgorithmicDarkeningAllowed(settings, dark && !force_light);
|
||||
setBackgroundColor(canDarken && dark && !force_light ? Color.TRANSPARENT : Color.WHITE);
|
||||
|
||||
|
@ -368,7 +368,10 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|||
}
|
||||
|
||||
public static boolean isFeatureSupported(Context context, String feature) {
|
||||
if (WebViewFeature.ALGORITHMIC_DARKENING.equals(feature))
|
||||
if (WebViewFeature.ALGORITHMIC_DARKENING.equals(feature)) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
|
||||
return false;
|
||||
|
||||
try {
|
||||
PackageInfo pkg = WebViewCompat.getCurrentWebViewPackage(context);
|
||||
if (pkg != null && pkg.versionCode / 100000 < 5005) // Version 102.*
|
||||
|
@ -376,6 +379,7 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return WebViewFeature.isFeatureSupported(feature);
|
||||
|
|
32
app/src/main/res/layout/dialog_dark.xml
Normal file
32
app/src/main/res/layout/dialog_dark.xml
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<eu.faircode.email.ScrollViewEx xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="24dp"
|
||||
android:scrollbarStyle="outsideOverlay">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title_compat_dark"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnIssue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_info"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvMessage" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</eu.faircode.email.ScrollViewEx>
|
|
@ -938,7 +938,7 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/btnNotification" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnReorder"
|
||||
android:id="@+id/btnReorderAccounts"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -949,6 +949,18 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvNotificationHint" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnReorderFolders"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:drawableEnd="@drawable/twotone_reorder_24"
|
||||
android:drawablePadding="6dp"
|
||||
android:text="@string/title_setup_reorder_folders"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnReorderAccounts" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDelete"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
|
@ -959,7 +971,7 @@
|
|||
android:drawablePadding="6dp"
|
||||
android:text="@string/title_delete_account"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnReorder" />
|
||||
app:layout_constraintTop_toBottomOf="@id/btnReorderFolders" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDeleteHint"
|
||||
|
@ -1053,7 +1065,7 @@
|
|||
android:id="@+id/grpExtra"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="btnNotification,tvNotificationHint,btnReorder,btnDelete,tvDeleteHint,btnApp,btnMore" />
|
||||
app:constraint_referenced_ids="btnNotification,tvNotificationHint,btnReorderAccounts,btnReorderFolders,btnDelete,tvDeleteHint,btnApp,btnMore" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -1989,6 +1989,8 @@
|
|||
<string name="title_widget_background">Background color</string>
|
||||
<string name="title_widget_day_night">Follow dark system theme</string>
|
||||
|
||||
<string name="title_compat_dark">Google removed dark mode for Android versions before version 10</string>
|
||||
|
||||
<string name="title_accessibility_collapsed">Collapsed</string>
|
||||
<string name="title_accessibility_expanded">Expanded</string>
|
||||
<string name="title_accessibility_seen">Read</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue