mirror of https://github.com/M66B/FairEmail.git
Added option for incognito keyboard
This commit is contained in:
parent
5b4c674869
commit
899258c2ca
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -243,6 +243,27 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swDisplayHidden" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swIncognitoKeyboard"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_incognito_keyboard"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDisplayHiddenHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ibIncognitoKeyboard"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/title_info"
|
||||
android:tooltipText="@string/title_info"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swIncognitoKeyboard"
|
||||
app:srcCompat="@drawable/twotone_info_24" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swSecure"
|
||||
android:layout_width="0dp"
|
||||
|
@ -251,7 +272,7 @@
|
|||
android:text="@string/title_advanced_secure"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDisplayHiddenHint"
|
||||
app:layout_constraintTop_toBottomOf="@id/ibIncognitoKeyboard"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
|
|
@ -485,6 +485,7 @@
|
|||
<string name="title_advanced_tracking">Attempt to recognize and disable tracking images</string>
|
||||
<string name="title_advanced_hide_timezone">Send messages without timezone data</string>
|
||||
<string name="title_advanced_display_hidden">Display hidden message texts</string>
|
||||
<string name="title_advanced_incognito_keyboard">Use incognito keyboard</string>
|
||||
<string name="title_advanced_secure">Hide from recent apps screen and prevent taking screenshots</string>
|
||||
<string name="title_advanced_pin">PIN</string>
|
||||
<string name="title_advanced_biometrics_timeout">Biometric authentication timeout</string>
|
||||
|
|
Loading…
Reference in New Issue