mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08: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:
parent
2d23a8e1c6
commit
c2146ffe69
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user