martin-stone / hsv-alpha-color-picker-android

A color picker and a color preference for use in Android applications.
Apache License 2.0
290 stars 60 forks source link

Soft keyboard popups by default #27

Closed aloz77 closed 7 years ago

aloz77 commented 7 years ago

Great lib. However in Android 6 the soft keyboard popups when opening com.rarepebble.colorpicker.ColorPreference as the hex field is gaining focus. Is there a way to avoid keyboard?

martin-stone commented 7 years ago

I can't reproduce this. For me the hex field has focus but the keyboard doesn't show until I tap on it. I'm running the demo app on the emulator at API 23.

What device are you seeing this on? Is it running stock Android?

aloz77 commented 7 years ago

I can reproduce the issue with Demo app on stock Android 6.0.1 on Nexus 7 and standard keyboard. The keyboard is popping up if the hex field is enabled.

martin-stone commented 7 years ago

Thanks: Reproduced in a Nexus 7 emulator and the latest release (2.0.1) fixes it for me. Can you confirm that it solves it for you?

aloz77 commented 7 years ago

Thank your, looks much better. There is no keyboard popping up. When tapping on the hex field the fullscreen editor opens for the value. You could probably improve it by adding android:imeOptions="flagNoExtractUi" to the edittext view.

martin-stone commented 7 years ago

Again, I'm not getting the full-screen editor, but it's easy enough for me to add the flag. I'll include that in the next release.

MPArnold commented 4 years ago

After the AndroidX implementation the soft keyboard again started popping up by default on my clone. For what it's worth, I added this to the end of ColorPreferenceFragment.java ...

@NonNull
@Override
/** [ Hide the soft keyboard after accessing the dialog ] */
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    Window window = dialog.getWindow();
    window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
    return dialog;
}

Beautiful color picker by the way! Any special instructions on crediting the author?