mirror of https://github.com/M66B/FairEmail.git
Added option to show keyboard by default (enabled)
This commit is contained in:
parent
d710ddfdaa
commit
917bac6825
|
@ -76,6 +76,7 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
@ -2944,12 +2945,23 @@ public class FragmentCompose extends FragmentBase {
|
|||
new Handler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
View target;
|
||||
if (TextUtils.isEmpty(etTo.getText().toString().trim()))
|
||||
etTo.requestFocus();
|
||||
target = etTo;
|
||||
else if (TextUtils.isEmpty(etSubject.getText().toString()))
|
||||
etSubject.requestFocus();
|
||||
target = etSubject;
|
||||
else
|
||||
etBody.requestFocus();
|
||||
target = etBody;
|
||||
|
||||
target.requestFocus();
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean keyboard = prefs.getBoolean("keyboard", true);
|
||||
if (keyboard) {
|
||||
InputMethodManager imm =
|
||||
(InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(target, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import androidx.appcompat.widget.SwitchCompat;
|
|||
import androidx.preference.PreferenceManager;
|
||||
|
||||
public class FragmentOptionsSend extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private SwitchCompat swKeyboard;
|
||||
private SwitchCompat swPrefixOnce;
|
||||
private SwitchCompat swPlainOnly;
|
||||
private SwitchCompat swAutoResize;
|
||||
|
@ -47,7 +48,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
private Spinner spSendDelayed;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"prefix_once", "plain_only", "autoresize", "resize", "autosend", "send_delayed"
|
||||
"keyboard", "prefix_once", "plain_only", "autoresize", "resize", "autosend", "send_delayed"
|
||||
};
|
||||
|
||||
@Override
|
||||
|
@ -60,6 +61,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
|
||||
// Get controls
|
||||
|
||||
swKeyboard = view.findViewById(R.id.swKeyboard);
|
||||
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
|
||||
swPlainOnly = view.findViewById(R.id.swPlainOnly);
|
||||
swAutoResize = view.findViewById(R.id.swAutoResize);
|
||||
|
@ -74,6 +76,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swKeyboard.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("keyboard", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swPrefixOnce.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -174,6 +183,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
private void setOptions() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swKeyboard.setChecked(prefs.getBoolean("keyboard", true));
|
||||
swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", false));
|
||||
swPlainOnly.setChecked(prefs.getBoolean("plain_only", false));
|
||||
|
||||
|
|
|
@ -18,6 +18,17 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:padding="12dp">
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swKeyboard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_keyboard"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swPrefixOnce"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -25,7 +36,7 @@
|
|||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_prefix_once"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swKeyboard"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -171,6 +171,7 @@
|
|||
<string name="title_advanced_kept_removed">Check if old messages were removed from the server</string>
|
||||
<string name="title_advanced_sync_folders">Synchronize folder list</string>
|
||||
|
||||
<string name="title_advanced_keyboard">Show keyboard by default</string>
|
||||
<string name="title_advanced_prefix_once">Prefix subject only once on replying or forwarding</string>
|
||||
<string name="title_advanced_plain_only">Send plain text only by default</string>
|
||||
<string name="title_advanced_autoresize">Automatically resize attached and embedded images</string>
|
||||
|
|
Loading…
Reference in New Issue