tylersuehr7 / chips-input-layout

A customizable Android ViewGroup for displaying Chips (specified in the Material Design Guide).
MIT License
583 stars 63 forks source link

Keep keyboard active when chip added #23

Closed najmsheikh closed 6 years ago

najmsheikh commented 6 years ago

Currently, when the user enters some text and clicks the DONE/NEXT button on the keyboard, it adds the chip but then closes the keyboard while maintaining focus. Is it possible to keep the keyboard active after a chip has been added?

tylersuehr7 commented 6 years ago

I'll have to look into getting the keyboard to stay open when this occurs, but I think that it is the default behavior when the editor action is pressed though. Currently, when a chip has been added, I'm not explicitly close keyboard, so it may a framework thing.

Also when I set the action to be NEXT on my HTC One device, the keyboard does stay open when adding new chips but this isn't the same functionality on some other devices I tested it on though.

najmsheikh commented 6 years ago

I think you're right in that the close action is device dependent. However, to circumvent that, would it be possible to add custom delimiters? Like say I setup a space U+0020 as a delimiter. Every time I type in a space in the chips input, all the text before the space will become a "tag". Would that be doable?

tylersuehr7 commented 6 years ago

That could be a possible way to circumvent that issue actually; I can totally try to implement something like that where pressing the space would create the chip, without closing the keyboard, with the only downside being that you need to use single words though - which might not be an issue for some use cases. It could potentially be a boolean field for turning that on and off from the ChipsInputLayout

najmsheikh commented 6 years ago

Yep! Though that's why I brought up custom delimiters because then someone could set it up using, say, spaces or with commas. It'll be up to the developer. Thanks!

majid701 commented 6 years ago

@tylersuehr7 would love this feature. Any timelines on when it would be implemented?

appdev commented 6 years ago

just chane ChipsEditText

 @Override
    public void onEditorAction(int actionCode) {
        if (mKeyboardListener != null && actionCode == EditorInfo.IME_ACTION_DONE) {
            this.mKeyboardListener.onKeyboardActionDone(getText().toString());
        } else
            super.onEditorAction(actionCode);
    }