mirror of
https://github.com/yuliskov/LeanKeyboard.git
synced 2026-05-03 05:12:36 -04:00
FireTV fix (possible)
This commit is contained in:
@@ -49,6 +49,7 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi
|
||||
private PointF mTempPoint;
|
||||
private LeanbackKeyboardController.TouchEventListener mTouchEventListener;
|
||||
private long prevTime;
|
||||
private boolean mShowInput;
|
||||
|
||||
public LeanbackKeyboardController(final InputMethodService context, final LeanbackKeyboardController.InputListener listener) {
|
||||
this(context, listener, new TouchNavSpaceTracker(), new LeanbackKeyboardContainer(context));
|
||||
@@ -681,23 +682,37 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi
|
||||
}
|
||||
}
|
||||
|
||||
public void onStartInput(EditorInfo var1) {
|
||||
if (this.mContainer != null) {
|
||||
this.mContainer.onStartInput(var1);
|
||||
this.initInputView();
|
||||
public void onStartInput(EditorInfo info) {
|
||||
if (mContainer != null) {
|
||||
mContainer.onStartInput(info);
|
||||
initInputView();
|
||||
}
|
||||
|
||||
// prevent accidental kbd pop-up on FireTV devices
|
||||
// more info: https://forum.xda-developers.com/fire-tv/general/guide-change-screen-keyboard-to-leankey-t3527675/page2
|
||||
int maskAction = info.imeOptions & EditorInfo.IME_MASK_ACTION;
|
||||
mShowInput = maskAction != 0;
|
||||
}
|
||||
|
||||
public boolean showInputView() {
|
||||
return mShowInput;
|
||||
}
|
||||
|
||||
private void onHideIme() {
|
||||
mContext.requestHideSelf(InputMethodService.BACK_DISPOSITION_DEFAULT);
|
||||
}
|
||||
|
||||
public void onStartInputView() {
|
||||
this.mKeyDownReceived = false;
|
||||
if (this.mContainer != null) {
|
||||
this.mContainer.onStartInputView();
|
||||
mKeyDownReceived = false;
|
||||
|
||||
if (mContainer != null) {
|
||||
mContainer.onStartInputView();
|
||||
}
|
||||
|
||||
this.mDoubleClickDetector.reset();
|
||||
mDoubleClickDetector.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent event) {
|
||||
Object tag = view.getTag();
|
||||
if (tag != null && "Go".equals(tag)) {
|
||||
|
||||
@@ -224,15 +224,19 @@ public class LeanbackImeService extends InputMethodService {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* At this point, decision whether to show kbd taking place
|
||||
* @return whether to show kbd
|
||||
*/
|
||||
@SuppressLint("MissingSuperCall")
|
||||
@Override
|
||||
public boolean onEvaluateInputViewShown() {
|
||||
return true;
|
||||
return mKeyboardController.showInputView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinishInputView(boolean var1) {
|
||||
super.onFinishInputView(var1);
|
||||
public void onFinishInputView(boolean finishingInput) {
|
||||
super.onFinishInputView(finishingInput);
|
||||
this.sendBroadcast(new Intent(IME_CLOSE));
|
||||
this.mSuggestionsFactory.clearSuggestions();
|
||||
}
|
||||
@@ -246,7 +250,7 @@ public class LeanbackImeService extends InputMethodService {
|
||||
}
|
||||
|
||||
public void onHideIme() {
|
||||
this.requestHideSelf(0);
|
||||
requestHideSelf(InputMethodService.BACK_DISPOSITION_DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -298,6 +302,14 @@ public class LeanbackImeService extends InputMethodService {
|
||||
@Override
|
||||
public void onStartInputView(EditorInfo info, boolean restarting) {
|
||||
super.onStartInputView(info, restarting);
|
||||
|
||||
// FireTV: fix accidental kbd pop-ups
|
||||
// more info: https://forum.xda-developers.com/fire-tv/general/guide-change-screen-keyboard-to-leankey-t3527675/page2
|
||||
//if (!mKeyboardController.showInputView()) {
|
||||
// onHideIme();
|
||||
// return;
|
||||
//}
|
||||
|
||||
mKeyboardController.onStartInputView();
|
||||
sendBroadcast(new Intent(IME_OPEN));
|
||||
if (mKeyboardController.areSuggestionsEnabled()) {
|
||||
|
||||
Reference in New Issue
Block a user