Gboard Like Search Bar In Android Ime
I want to create a search bar like Gboard inside keyboard (Android IME) as shown in picture. Gboard Sample : I have implemented an edittext on Keyboardview.xml as shown in picture
Solution 1:
So, I got a clue to solve this, from Abdul Wajid's comment above.
I use this LatinIME. Just need to update this line
publicvoidonEvent(final Event event) {
final InputTransaction completeInputTransaction =
mInputLogic.onCodeInput(mSettings.getCurrent(), event);
updateStateAfterInputTransaction(completeInputTransaction);
mKeyboardSwitcher.onEvent(event, getCurrentAutoCapsState(), getCurrentRecapitalizeState());
}
stop commit the event key pressed with some logical case,
publicvoidonEvent(final Event event) {
if (mEditField.isFocused()){
Log.d("LatinIME : field focused", "On Event: " + event.getTextToCommit() );
mEditField.append(event.getTextToCommit());
} else {
final InputTransaction completeInputTransaction =
mInputLogic.onCodeInput(mSettings.getCurrent(), event);
updateStateAfterInputTransaction(completeInputTransaction);
mKeyboardSwitcher.onEvent(event, getCurrentAutoCapsState(), getCurrentRecapitalizeState());
}
}
and done, you can control the event type that pressed.
Post a Comment for "Gboard Like Search Bar In Android Ime"