Skip to content

Commit

Permalink
Merge pull request #2278 from syphyr/invisible_cursor
Browse files Browse the repository at this point in the history
Make cursor in Search bar invisible when keyboard is hidden
  • Loading branch information
marunjar authored May 4, 2024
2 parents 920417f + f76957a commit b27c452
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/src/main/java/fr/neamar/kiss/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ public void onBackPressed() {
// (which means pressing back in minimalistic mode with history displayed
// will hide history again)
searchEditText.setText("");
searchEditText.setCursorVisible(false);
}

// Calling super.onBackPressed() will quit the launcher, only do this if KISS is not the user's default home.
Expand Down Expand Up @@ -890,6 +891,7 @@ public void onWindowFocusChanged(boolean hasFocus) {

public void showKeyboard() {
searchEditText.requestFocus();
searchEditText.setCursorVisible(true);
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
assert mgr != null;
mgr.showSoftInput(searchEditText, InputMethodManager.SHOW_IMPLICIT);
Expand All @@ -910,6 +912,7 @@ public void hideKeyboard() {
systemUiVisibilityHelper.onKeyboardVisibilityChanged(false);
dismissPopup();

searchEditText.setCursorVisible(false);
searchEditText.clearFocus();
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
android:layout_toEndOf="@id/leftHandSideButtonsWrapper"
android:layout_toRightOf="@id/leftHandSideButtonsWrapper"
android:background="@android:color/transparent"
android:cursorVisible="false"
android:hint="@string/ui_search_hint"
android:imeOptions="flagNoExtractUi|actionSearch"
android:importantForAutofill="no"
Expand Down

0 comments on commit b27c452

Please sign in to comment.