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

Commit 87553010 authored by Aga Wronska's avatar Aga Wronska Committed by Android (Google) Code Review
Browse files

Merge "Force show keyboard when presenting FragmentDialogs with EditText." into nyc-dev

parents 99a4966e 02c532fb
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