[Android] SearchFragment: open/close the soft input automatically
Ludovic Fauvet
git at videolan.org
Mon Apr 14 19:26:16 CEST 2014
vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Mon Apr 14 19:08:57 2014 +0200| [b91b84f80bebeec37205c4a299d7e568d3ec7e9a] | committer: Ludovic Fauvet
SearchFragment: open/close the soft input automatically
- SHOW_IMPLICIT makes the opening works on Android 2.3
- hideSoftInputFromWindow hides the keyboard on all versions when
leaving the search fragment
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=b91b84f80bebeec37205c4a299d7e568d3ec7e9a
---
vlc-android/src/org/videolan/vlc/gui/SearchFragment.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java b/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
index eded762..374a367 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
@@ -87,10 +87,19 @@ public class SearchFragment extends SherlockListFragment {
mSearchText.requestFocus();
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
- imm.showSoftInput(mSearchText, InputMethodManager.RESULT_SHOWN);
+ imm.showSoftInput(mSearchText, InputMethodManager.SHOW_IMPLICIT);
+
showSearchHistory();
}
+ @Override
+ public void onPause() {
+ super.onPause();
+
+ InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);
+ }
+
private void search(CharSequence key, int type) {
// set result adapter to the list
More information about the Android
mailing list