1
1
package net .coding .program .common ;
2
2
3
+ import android .app .Activity ;
3
4
import android .content .Context ;
4
5
import android .content .res .ColorStateList ;
5
6
import android .graphics .Color ;
@@ -78,8 +79,9 @@ private EditText initKeyword(FilterListener filterListener) {
78
79
EditText etSearch = (EditText ) drawerLayout .findViewById (R .id .et_search );
79
80
80
81
if (mFilterModel != null && !TextUtils .isEmpty (mFilterModel .keyword )) {
81
- etSearch . setText ( mFilterModel .keyword ) ;
82
+ mFilterModel .keyword = "" ;
82
83
}
84
+ etSearch .setText ("" );
83
85
etSearch .setOnEditorActionListener ((v , actionId , event ) -> {
84
86
if (actionId == EditorInfo .IME_ACTION_SEARCH ) {
85
87
if (filterListener != null ) {
@@ -92,6 +94,14 @@ private EditText initKeyword(FilterListener filterListener) {
92
94
}
93
95
return false ;
94
96
});
97
+ etSearch .setOnFocusChangeListener (new View .OnFocusChangeListener () {
98
+ @ Override
99
+ public void onFocusChange (View v , boolean hasFocus ) {
100
+ if (!hasFocus ) {
101
+ Global .hideSoftKeyboard (((Activity ) mContext ));
102
+ }
103
+ }
104
+ });
95
105
return etSearch ;
96
106
}
97
107
@@ -101,6 +111,8 @@ private void dismiss() {
101
111
if (drawerLayout .isDrawerOpen (GravityCompat .END )) {
102
112
drawerLayout .closeDrawer (GravityCompat .END );
103
113
}
114
+
115
+ Global .hideSoftKeyboard (((Activity ) mContext ));
104
116
}
105
117
106
118
private void iniLabels (FilterListener filterListener , EditText etSearch ) {
0 commit comments