|
|
|
|
@ -4,6 +4,8 @@ import android.app.Activity; |
|
|
|
|
import android.content.Intent; |
|
|
|
|
import android.os.Bundle; |
|
|
|
|
import android.text.TextUtils; |
|
|
|
|
import android.view.KeyEvent; |
|
|
|
|
import android.view.MotionEvent; |
|
|
|
|
import android.view.View; |
|
|
|
|
import android.view.WindowManager; |
|
|
|
|
import android.widget.EditText; |
|
|
|
|
@ -74,6 +76,7 @@ public class SearchActivity extends BaseActivity { |
|
|
|
|
private PinyinAdapter wordAdapter; |
|
|
|
|
private String searchTitle = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected int getLayoutResID() { |
|
|
|
|
return R.layout.activity_search; |
|
|
|
|
@ -192,9 +195,13 @@ public class SearchActivity extends BaseActivity { |
|
|
|
|
etSearch.setOnClickListener(new View.OnClickListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onClick(View v) { |
|
|
|
|
// Toast.makeText(mContext,"点击",Toast.LENGTH_SHORT).show();
|
|
|
|
|
enableKeyboard(SearchActivity.this); |
|
|
|
|
SearchActivity.this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// etSearch.setOnFocusChangeListener(tvSearchFocusChangeListener);
|
|
|
|
|
keyboard.setOnSearchKeyListener(new SearchKeyboard.OnSearchKeyListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onSearchKey(int pos, String key) { |
|
|
|
|
@ -397,6 +404,7 @@ public class SearchActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void cancel() { |
|
|
|
|
OkGo.getInstance().cancelTag("search"); |
|
|
|
|
} |
|
|
|
|
@ -415,4 +423,18 @@ public class SearchActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
EventBus.getDefault().unregister(this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean dispatchKeyEvent(KeyEvent event) { |
|
|
|
|
if (event.getAction() == KeyEvent.ACTION_DOWN) { |
|
|
|
|
int keyCode = event.getKeyCode(); |
|
|
|
|
if (keyCode == KeyEvent.KEYCODE_MENU) { |
|
|
|
|
// Toast.makeText(mContext,"菜单键",Toast.LENGTH_SHORT).show();
|
|
|
|
|
enableKeyboard(SearchActivity.this); |
|
|
|
|
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); |
|
|
|
|
} |
|
|
|
|
} else if (event.getAction() == KeyEvent.ACTION_UP) { |
|
|
|
|
} |
|
|
|
|
return super.dispatchKeyEvent(event); |
|
|
|
|
} |
|
|
|
|
} |