Added option to prevent fullscreen keyboard

pull/190/head
M66B 5 years ago
parent 502de67f2b
commit 62f9bd1fee

@ -208,6 +208,7 @@ import static android.app.Activity.RESULT_CANCELED;
import static android.app.Activity.RESULT_FIRST_USER;
import static android.app.Activity.RESULT_OK;
import static android.system.OsConstants.ENOSPC;
import static android.view.inputmethod.EditorInfo.IME_FLAG_NO_FULLSCREEN;
import static android.widget.AdapterView.INVALID_POSITION;
public class FragmentCompose extends FragmentBase {
@ -754,6 +755,17 @@ public class FragmentCompose extends FragmentBase {
//if (beige && !Helper.isDarkTheme(getContext()))
// view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.lightColorBackground_cards_beige));
boolean keyboard_no_fullscreen = prefs.getBoolean("keyboard_no_fullscreen", false);
if (keyboard_no_fullscreen) {
// https://developer.android.com/reference/android/view/inputmethod/EditorInfo#IME_FLAG_NO_FULLSCREEN
etExtra.setImeOptions(etExtra.getImeOptions() | IME_FLAG_NO_FULLSCREEN);
etTo.setImeOptions(etTo.getImeOptions() | IME_FLAG_NO_FULLSCREEN);
etCc.setImeOptions(etCc.getImeOptions() | IME_FLAG_NO_FULLSCREEN);
etBcc.setImeOptions(etBcc.getImeOptions() | IME_FLAG_NO_FULLSCREEN);
etSubject.setImeOptions(etSubject.getImeOptions() | IME_FLAG_NO_FULLSCREEN);
etBody.setImeOptions(etBody.getImeOptions() | IME_FLAG_NO_FULLSCREEN);
}
etExtra.setHint("");
tvDomain.setText(null);
tvPlainTextOnly.setVisibility(View.GONE);

@ -43,6 +43,7 @@ import androidx.preference.PreferenceManager;
public class FragmentOptionsSend extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
private SwitchCompat swKeyboard;
private SwitchCompat swKeyboardNoFullscreen;
private SwitchCompat swSuggestSent;
private SwitchCompat swSuggestReceived;
private SwitchCompat swSuggestFrequently;
@ -72,7 +73,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private SwitchCompat swLookupMx;
private final static String[] RESET_OPTIONS = new String[]{
"keyboard", "suggest_sent", "suggested_received", "suggest_frequently",
"keyboard", "keyboard_no_fullscreen", "suggest_sent", "suggested_received", "suggest_frequently",
"send_reminders", "send_delayed",
"compose_font", "prefix_once", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
"signature_location", "signature_reply", "signature_forward",
@ -92,6 +93,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
// Get controls
swKeyboard = view.findViewById(R.id.swKeyboard);
swKeyboardNoFullscreen = view.findViewById(R.id.swKeyboardNoFullscreen);
swSuggestSent = view.findViewById(R.id.swSuggestSent);
swSuggestReceived = view.findViewById(R.id.swSuggestReceived);
swSuggestFrequently = view.findViewById(R.id.swSuggestFrequently);
@ -133,6 +135,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
swKeyboardNoFullscreen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("keyboard_no_fullscreen", checked).apply();
}
});
swSuggestSent.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -392,6 +401,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
swKeyboard.setChecked(prefs.getBoolean("keyboard", true));
swKeyboardNoFullscreen.setChecked(prefs.getBoolean("keyboard_no_fullscreen", false));
swSuggestSent.setChecked(prefs.getBoolean("suggest_sent", true));
swSuggestReceived.setChecked(prefs.getBoolean("suggest_received", false));
swSuggestFrequently.setChecked(prefs.getBoolean("suggest_frequently", false));

@ -41,6 +41,17 @@
app:layout_constraintTop_toBottomOf="@id/tvCaptionGeneral"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swKeyboardNoFullscreen"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_keyboard_no_fullscreen"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swKeyboard"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSuggestLocal"
android:layout_width="wrap_content"
@ -50,7 +61,7 @@
android:text="@string/title_advanced_suggest_local"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swKeyboard" />
app:layout_constraintTop_toBottomOf="@id/swKeyboardNoFullscreen" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSuggestLocalHint"

@ -305,6 +305,7 @@
<string name="title_advanced_tune_keep_alive">Automatically tune the keep-alive interval</string>
<string name="title_advanced_keyboard">Show keyboard by default</string>
<string name="title_advanced_keyboard_no_fullscreen">Prevent fullscreen keyboard</string>
<string name="title_advanced_suggest_local">Suggest locally stored contacts</string>
<string name="title_advanced_suggest_sent">Suggest addresses found in sent messages</string>
<string name="title_advanced_suggest_received">Suggest addresses found in received messages</string>

Loading…
Cancel
Save