Always show keyboard implicit

pull/198/head
M66B 3 years ago
parent f98dcd4fd7
commit 9ccef2608f

@ -85,10 +85,12 @@ import android.view.ViewAnimationUtils;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
import android.view.textclassifier.ConversationAction;
import android.view.textclassifier.ConversationActions;
import android.webkit.WebSettings;
@ -4725,7 +4727,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
});
pw.showAtLocation(parentFragment.getView(), Gravity.TOP | Gravity.END, 0, 0);
Helper.showKeyboard(etSearch);
final InputMethodManager imm =
(InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null)
imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
}
private int find(String query, int result) {
@ -6479,7 +6484,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
btnColor.setColor(color);
etNotes.selectAll();
Helper.showKeyboard(etNotes);
btnColor.setOnClickListener(new View.OnClickListener() {
@Override
@ -6560,6 +6564,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.create();
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@ -6646,7 +6656,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
View view = LayoutInflater.from(context).inflate(R.layout.dialog_keyword_add, null);
final EditText etKeyword = view.findViewById(R.id.etKeyword);
etKeyword.setText(null);
Helper.showKeyboard(etKeyword);
return new AlertDialog.Builder(context)
.setView(view)
@ -6696,6 +6705,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.setNegativeButton(android.R.string.cancel, null)
.create();
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}
}
public static class FragmentDialogLabelsManage extends FragmentDialogBase {

@ -323,8 +323,6 @@ public class FragmentDialogSearch extends FragmentDialogBase {
cbHeaders.setVisibility(View.GONE);
cbHtml.setVisibility(View.GONE);
Helper.showKeyboard(etQuery);
final AlertDialog dialog = new AlertDialog.Builder(context)
.setView(dview)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@ -487,6 +485,12 @@ public class FragmentDialogSearch extends FragmentDialogBase {
return dialog;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}
@Override
public void onDismiss(@NonNull DialogInterface dialog) {
super.onDismiss(dialog);

@ -924,34 +924,6 @@ public class Helper {
return color;
}
static void showKeyboard(final View view) {
final InputMethodManager imm =
(InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm == null)
return;
if (view.hasFocus())
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
final View.OnFocusChangeListener listener = view.getOnFocusChangeListener();
view.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (listener != null)
listener.onFocusChange(v, hasFocus);
if (hasFocus)
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
else
imm.toggleSoftInput(0, 0);
}
});
if (!view.hasFocus())
view.requestFocus();
}
static void hideKeyboard(final View view) {
InputMethodManager imm =
(InputMethodManager) view.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);

@ -121,7 +121,10 @@
android:maxLines="1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ibFlow" />
app:layout_constraintTop_toBottomOf="@id/ibFlow">
<requestFocus />
</eu.faircode.email.TextViewAutoCompleteClearable>
<eu.faircode.email.FixedTextView
android:id="@+id/tvSearch1"

Loading…
Cancel
Save