Skip to content

Commit c96799e

Browse files
committed
Fix not insert tab
1 parent 5aff820 commit c96799e

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

lib-n-ide/src/main/java/com/duy/ide/editor/view/SuggestionEditor.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -420,18 +420,20 @@ protected boolean setFrame(final int l, int t, final int r, int b) {
420420

421421
@Override
422422
public boolean onKeyUp(int keyCode, KeyEvent event) {
423-
boolean consumed = mPopup.onKeyUp(keyCode, event);
424-
if (consumed) {
425-
switch (keyCode) {
426-
// if the list accepts the key events and the key event
427-
// was a click, the text view gets the selected item
428-
// from the drop down as its content
429-
case KeyEvent.KEYCODE_ENTER:
430-
case KeyEvent.KEYCODE_DPAD_CENTER:
431-
if (event.hasNoModifiers()) {
432-
performCompletion();
433-
}
434-
return true;
423+
if (keyCode != KeyEvent.KEYCODE_TAB) {
424+
boolean consumed = mPopup.onKeyUp(keyCode, event);
425+
if (consumed) {
426+
switch (keyCode) {
427+
// if the list accepts the key events and the key event
428+
// was a click, the text view gets the selected item
429+
// from the drop down as its content
430+
case KeyEvent.KEYCODE_ENTER:
431+
case KeyEvent.KEYCODE_DPAD_CENTER:
432+
if (event.hasNoModifiers()) {
433+
performCompletion();
434+
}
435+
return true;
436+
}
435437
}
436438
}
437439
return super.onKeyUp(keyCode, event);
@@ -465,8 +467,10 @@ private void performCompletion(int position) {
465467

466468
@Override
467469
public boolean onKeyDown(int keyCode, KeyEvent event) {
468-
if (mPopup.onKeyDown(keyCode, event)) {
469-
return true;
470+
if (keyCode != KeyEvent.KEYCODE_TAB) {
471+
if (mPopup.onKeyDown(keyCode, event)) {
472+
return true;
473+
}
470474
}
471475
boolean handled = super.onKeyDown(keyCode, event);
472476

lib-n-ide/src/main/res-file-expoler/layout/list_item_suggest_default.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
android:layout_height="match_parent"
2020
android:layout_gravity="center_vertical"
2121
android:background="?selectableItemBackground"
22+
android:clickable="true"
23+
android:focusable="true"
2224
android:gravity="center_vertical"
2325
android:minHeight="25dp"
2426
android:orientation="horizontal">

0 commit comments

Comments
 (0)