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

Commit 7289c029 authored by Aga Wronska's avatar Aga Wronska Committed by android-build-merger
Browse files

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

am: 87553010

* commit '87553010':
  Force show keyboard when presenting FragmentDialogs with EditText.
parents b11601fa 87553010
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -82,6 +82,9 @@ public class CreateDirectoryFragment extends DialogFragment {
        builder.setNegativeButton(android.R.string.cancel, null);
        builder.setNegativeButton(android.R.string.cancel, null);
        final AlertDialog dialog = builder.create();
        final AlertDialog dialog = builder.create();


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

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


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


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


        return sCollator.compare(lhs, rhs);
        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 Original line Diff line number Diff line
@@ -92,6 +92,9 @@ public class RenameDocumentFragment extends DialogFragment {


        final AlertDialog dialog = builder.create();
        final AlertDialog dialog = builder.create();


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

        mEditText.setOnEditorActionListener(
        mEditText.setOnEditorActionListener(
                new OnEditorActionListener() {
                new OnEditorActionListener() {
                    @Override
                    @Override