|
|
@ -170,7 +170,6 @@ public class SearchBookActivity extends BaseActivity { |
|
|
|
protected void initWidget() { |
|
|
|
protected void initWidget() { |
|
|
|
super.initWidget(); |
|
|
|
super.initWidget(); |
|
|
|
initSuggestionList(); |
|
|
|
initSuggestionList(); |
|
|
|
binding.etSearchKey.requestFocus();//get the focus
|
|
|
|
|
|
|
|
//enter事件
|
|
|
|
//enter事件
|
|
|
|
binding.etSearchKey.setOnEditorActionListener((textView, i, keyEvent) -> { |
|
|
|
binding.etSearchKey.setOnEditorActionListener((textView, i, keyEvent) -> { |
|
|
|
if (i == EditorInfo.IME_ACTION_UNSPECIFIED) { |
|
|
|
if (i == EditorInfo.IME_ACTION_UNSPECIFIED) { |
|
|
@ -243,6 +242,7 @@ public class SearchBookActivity extends BaseActivity { |
|
|
|
mHandler.sendMessage(mHandler.obtainMessage(1)); |
|
|
|
mHandler.sendMessage(mHandler.obtainMessage(1)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
initHistoryList(); |
|
|
|
initHistoryList(); |
|
|
|
|
|
|
|
mHandler.postDelayed(() -> binding.etSearchKey.requestFocus(), 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -557,8 +557,7 @@ public class SearchBookActivity extends BaseActivity { |
|
|
|
getData(); |
|
|
|
getData(); |
|
|
|
mSearchHistoryService.addOrUpadteHistory(searchKey); |
|
|
|
mSearchHistoryService.addOrUpadteHistory(searchKey); |
|
|
|
//收起软键盘
|
|
|
|
//收起软键盘
|
|
|
|
InputMethodManager imm = (InputMethodManager) App.getmContext().getSystemService(Context.INPUT_METHOD_SERVICE); |
|
|
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
|
|
|
assert imm != null; |
|
|
|
|
|
|
|
imm.hideSoftInputFromWindow(binding.etSearchKey.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); |
|
|
|
imm.hideSoftInputFromWindow(binding.etSearchKey.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|