diff --git a/app/src/main/java/eu/faircode/email/EditTextCompose.java b/app/src/main/java/eu/faircode/email/EditTextCompose.java
index 7a655116a8..7a46c6e32d 100644
--- a/app/src/main/java/eu/faircode/email/EditTextCompose.java
+++ b/app/src/main/java/eu/faircode/email/EditTextCompose.java
@@ -52,14 +52,17 @@ public class EditTextCompose extends FixedEditText {
public EditTextCompose(Context context) {
super(context);
+ Helper.setKeyboardIncognitoMode(this, context);
}
public EditTextCompose(Context context, AttributeSet attrs) {
super(context, attrs);
+ Helper.setKeyboardIncognitoMode(this, context);
}
public EditTextCompose(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
+ Helper.setKeyboardIncognitoMode(this, context);
}
@Override
diff --git a/app/src/main/java/eu/faircode/email/EditTextPlain.java b/app/src/main/java/eu/faircode/email/EditTextPlain.java
index cb5d618ae1..2d4fab72b6 100644
--- a/app/src/main/java/eu/faircode/email/EditTextPlain.java
+++ b/app/src/main/java/eu/faircode/email/EditTextPlain.java
@@ -27,14 +27,17 @@ import android.util.AttributeSet;
public class EditTextPlain extends FixedEditText {
public EditTextPlain(Context context) {
super(context);
+ Helper.setKeyboardIncognitoMode(this, context);
}
public EditTextPlain(Context context, AttributeSet attrs) {
super(context, attrs);
+ Helper.setKeyboardIncognitoMode(this, context);
}
public EditTextPlain(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
+ Helper.setKeyboardIncognitoMode(this, context);
}
@Override
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java
index 1e2aac20e4..23012cc213 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java
@@ -69,6 +69,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private Button btnBiometrics;
private Spinner spBiometricsTimeout;
private SwitchCompat swDisplayHidden;
+ private SwitchCompat swIncognitoKeyboard;
+ private ImageButton ibIncognitoKeyboard;
private SwitchCompat swSecure;
private SwitchCompat swSafeBrowsing;
private ImageButton ibSafeBrowsing;
@@ -84,7 +86,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
"confirm_links", "browse_links", "confirm_images", "confirm_html",
"disable_tracking", "hide_timezone",
"pin", "biometrics", "biometrics_timeout",
- "display_hidden", "secure", "safe_browsing",
+ "display_hidden", "incognito_keyboard", "secure", "safe_browsing",
"disconnect_links", "disconnect_images"
};
@@ -108,6 +110,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
btnBiometrics = view.findViewById(R.id.btnBiometrics);
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout);
swDisplayHidden = view.findViewById(R.id.swDisplayHidden);
+ swIncognitoKeyboard = view.findViewById(R.id.swIncognitoKeyboard);
+ ibIncognitoKeyboard = view.findViewById(R.id.ibIncognitoKeyboard);
swSecure = view.findViewById(R.id.swSecure);
swSafeBrowsing = view.findViewById(R.id.swSafeBrowsing);
ibSafeBrowsing = view.findViewById(R.id.ibSafeBrowsing);
@@ -227,6 +231,21 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
}
});
+ swIncognitoKeyboard.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? View.GONE : View.VISIBLE);
+ swIncognitoKeyboard.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("incognito_keyboard", checked).apply();
+ }
+ });
+
+ ibIncognitoKeyboard.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Helper.view(getContext(), Uri.parse("https://developer.android.com/reference/android/view/inputmethod/EditorInfo#IME_FLAG_NO_PERSONALIZED_LEARNING"), true);
+ }
+ });
+
swSecure.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -377,6 +396,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
}
swDisplayHidden.setChecked(prefs.getBoolean("display_hidden", false));
+ swIncognitoKeyboard.setChecked(prefs.getBoolean("incognito_keyboard", false));
swSecure.setChecked(prefs.getBoolean("secure", false));
swSafeBrowsing.setChecked(prefs.getBoolean("safe_browsing", false));
diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java
index e33ad326db..a5a6937e92 100644
--- a/app/src/main/java/eu/faircode/email/Helper.java
+++ b/app/src/main/java/eu/faircode/email/Helper.java
@@ -503,6 +503,20 @@ public class Helper {
PackageManager.DONT_KILL_APP);
}
+ static void setKeyboardIncognitoMode(EditText view, Context context) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
+ return;
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ boolean incognito_keyboard = prefs.getBoolean("incognito_keyboard", false);
+ if (incognito_keyboard)
+ try {
+ view.setImeOptions(view.getImeOptions() | EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING);
+ } catch (Throwable ex) {
+ Log.e(ex);
+ }
+ }
+
// View
static Intent getChooser(Context context, Intent intent) {
diff --git a/app/src/main/res/layout/fragment_options_privacy.xml b/app/src/main/res/layout/fragment_options_privacy.xml
index fa031bba81..1df29a1518 100644
--- a/app/src/main/res/layout/fragment_options_privacy.xml
+++ b/app/src/main/res/layout/fragment_options_privacy.xml
@@ -243,6 +243,27 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDisplayHidden" />
+
+
+
+
Attempt to recognize and disable tracking images
Send messages without timezone data
Display hidden message texts
+ Use incognito keyboard
Hide from recent apps screen and prevent taking screenshots
PIN
Biometric authentication timeout