mirror of
https://github.com/encounter/engine.git
synced 2026-03-30 11:09:55 -07:00
Make it possible to type numbers in Sky
I must be holding it wrong. This seems excessively low level for what we're trying to do. Partial fix for https://github.com/domokit/sky_engine/issues/466 @abarth
This commit is contained in:
@@ -4,7 +4,10 @@
|
||||
|
||||
package org.chromium.mojo.keyboard;
|
||||
|
||||
import java.lang.StringBuilder;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.inputmethod.BaseInputConnection;
|
||||
import android.view.inputmethod.CompletionInfo;
|
||||
import android.view.inputmethod.CorrectionInfo;
|
||||
@@ -71,4 +74,14 @@ public class InputConnectionAdaptor extends BaseInputConnection {
|
||||
mClient.setSelection(start, end);
|
||||
return super.setSelection(start, end);
|
||||
}
|
||||
|
||||
// Number keys come through as key events instead of commitText!?
|
||||
@Override
|
||||
public boolean sendKeyEvent(KeyEvent event) {
|
||||
if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
// 1 appears to always be the value for newCursorPosition?
|
||||
mClient.commitText(String.valueOf(event.getNumber()), 1);
|
||||
}
|
||||
return super.sendKeyEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user