Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 741ac6ff authored by Aga Wronska's avatar Aga Wronska
Browse files

Force show keyboard when presenting FragmentDialogs with EditText.

Bug: 26823589
Change-Id: I593ed0e7ef40c9c95c311ca529d3826d73496458
parent 404635cd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -82,6 +82,9 @@ public class CreateDirectoryFragment extends DialogFragment {
        builder.setNegativeButton(android.R.string.cancel, null);
        final AlertDialog dialog = builder.create();

        // Workaround for the problem - virtual keyboard doesn't show on the phone.
        Shared.ensureKeyboardPresent(context, dialog);

        editText.setOnEditorActionListener(
                new OnEditorActionListener() {
                    @Override
+14 −0
Original line number Diff line number Diff line
@@ -17,9 +17,12 @@
package com.android.documentsui;

import android.content.Context;
import android.content.res.Configuration;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.format.Time;
import android.view.WindowManager;
import android.app.AlertDialog;

import java.text.Collator;
import java.util.ArrayList;
@@ -155,4 +158,15 @@ public final class Shared {

        return sCollator.compare(lhs, rhs);
    }

    public static boolean isHardwareKeyboardAvailable(Context context) {
        return context.getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS;
    }

    public static void ensureKeyboardPresent(Context context, AlertDialog dialog) {
        if (!isHardwareKeyboardAvailable(context)) {
            dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
        }
    }

}
+3 −0
Original line number Diff line number Diff line
@@ -92,6 +92,9 @@ public class RenameDocumentFragment extends DialogFragment {

        final AlertDialog dialog = builder.create();

        // Workaround for the problem - virtual keyboard doesn't show on the phone.
        Shared.ensureKeyboardPresent(context, dialog);

        mEditText.setOnEditorActionListener(
                new OnEditorActionListener() {
                    @Override