本文整理汇总了Java中android.view.inputmethod.EditorInfo.IME_ACTION_SEARCH属性的典型用法代码示例。如果您正苦于以下问题:Java EditorInfo.IME_ACTION_SEARCH属性的具体用法?Java EditorInfo.IME_ACTION_SEARCH怎么用?Java EditorInfo.IME_ACTION_SEARCH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.inputmethod.EditorInfo
的用法示例。
在下文中一共展示了EditorInfo.IME_ACTION_SEARCH属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEditorAction
@Override
public boolean onEditorAction(TextView arg0, int actionId, KeyEvent arg2) {
// hide the keyboard and search the web when the enter key
// button is pressed
if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_ACTION_NEXT
|| actionId == EditorInfo.IME_ACTION_SEND
|| actionId == EditorInfo.IME_ACTION_SEARCH
|| (arg2.getAction() == KeyEvent.KEYCODE_ENTER)) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
searchTheWeb(mSearch.getText().toString());
final LightningView currentView = mTabsManager.getCurrentTab();
if (currentView != null) {
currentView.requestFocus();
}
return true;
}
return false;
}
示例2: onEditorAction
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
try {
if (userLocation != null) {
searchPresenter.getNearStations(new LatLng(userLocation.getLatitude(), userLocation.getLongitude()));
} else {
resultsRecyclerView.setVisibility(View.GONE);
emptyTextView.setVisibility(View.VISIBLE);
emptyTextView.setText(getString(R.string.error_generic));
return false;
}
} catch (Throwable throwable) {
resultsRecyclerView.setVisibility(View.GONE);
emptyTextView.setVisibility(View.VISIBLE);
emptyTextView.setText(getString(R.string.error_generic));
return false;
}
return true;
}
return false;
}
示例3: onEditorAction
@Override
public boolean onEditorAction(TextView arg0, int actionId, KeyEvent arg2) {
// hide the keyboard and search the web when the enter key
// button is pressed
if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_ACTION_NEXT
|| actionId == EditorInfo.IME_ACTION_SEND
|| actionId == EditorInfo.IME_ACTION_SEARCH
|| (arg2.getAction() == KeyEvent.KEYCODE_ENTER)) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
searchTheWeb(mSearch.getText().toString());
LightningView v=getCurrentWebView();
if (v != null) {
v.requestFocus();
}
return true;
}
return false;
}
示例4: imeActionName
public static String imeActionName(final int imeOptions) {
final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION;
switch (actionId) {
case EditorInfo.IME_ACTION_UNSPECIFIED:
return "actionUnspecified";
case EditorInfo.IME_ACTION_NONE:
return "actionNone";
case EditorInfo.IME_ACTION_GO:
return "actionGo";
case EditorInfo.IME_ACTION_SEARCH:
return "actionSearch";
case EditorInfo.IME_ACTION_SEND:
return "actionSend";
case EditorInfo.IME_ACTION_NEXT:
return "actionNext";
case EditorInfo.IME_ACTION_DONE:
return "actionDone";
case EditorInfo.IME_ACTION_PREVIOUS:
return "actionPrevious";
default:
return "actionUnknown(" + actionId + ")";
}
}
示例5: updateImeOptions
private void updateImeOptions() {
// Default to IME_ACTION_DONE
int returnKeyFlag = EditorInfo.IME_ACTION_DONE;
if (mReturnKeyType != null) {
switch (mReturnKeyType) {
case "go":
returnKeyFlag = EditorInfo.IME_ACTION_GO;
break;
case "next":
returnKeyFlag = EditorInfo.IME_ACTION_NEXT;
break;
case "none":
returnKeyFlag = EditorInfo.IME_ACTION_NONE;
break;
case "previous":
returnKeyFlag = EditorInfo.IME_ACTION_PREVIOUS;
break;
case "search":
returnKeyFlag = EditorInfo.IME_ACTION_SEARCH;
break;
case "send":
returnKeyFlag = EditorInfo.IME_ACTION_SEND;
break;
case "done":
returnKeyFlag = EditorInfo.IME_ACTION_DONE;
break;
}
}
if (mDisableFullscreen) {
setImeOptions(returnKeyFlag | EditorInfo.IME_FLAG_NO_FULLSCREEN);
} else {
setImeOptions(returnKeyFlag);
}
}
示例6: onEditorAction
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
String item = v.getText().toString().trim();
if (v.getText().length() > 0) {
mPresenter.addHistory(mContext, item);
v.setText("");
SearchResultActivity.startActivity(mContext, item);
}
}
return false;
}
示例7: onEditorAction
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
mButtonSearch.performClick();
return true;
}
return false;
}
示例8: onEditorAction
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
// 当按了搜索之后关闭软键盘
((InputMethodManager) et_vin.getContext().getSystemService(Context.INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
VinGotMsg(et_vin.getText().toString());
return true;
}
return false;
}
示例9: onEditorAction
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
/* 点击搜索按钮 */
if (actionId == EditorInfo.IME_ACTION_SEARCH /*||(event!=null&&event.getKeyCode()== KeyEvent.KEYCODE_ENTER)*/ && !TextUtils.isEmpty(v.getText())) {
if (sListener != null) {
sListener.onSearch(v.getText().toString());
}
((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(v.getWindowToken(), 0);
return true;
}
return false;
}
示例10: setImeOptions
/**
* This looks at the ime options given by the current editor, to set the
* appropriate label on the keyboard's enter key (if it has one).
*/
void setImeOptions(Resources res, int options) {
if (mEnterKey == null) {
return;
}
switch (options&(EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) {
case EditorInfo.IME_ACTION_GO:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = "ENT";
break;
case EditorInfo.IME_ACTION_NEXT:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = "N";
break;
case EditorInfo.IME_ACTION_SEARCH:
// mEnterKey.icon = "K";
mEnterKey.label = null;
break;
case EditorInfo.IME_ACTION_SEND:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = "HH";
break;
default:
// mEnterKey.icon = "U";
mEnterKey.label = null;
break;
}
}
示例11: setImeOptions
/**
* This looks at the ime options given by the current editor, to set the
* appropriate label on the keyboard's enter key (if it has one).
*/
void setImeOptions(Context context, int options) {
if (mEnterKey == null) {
return;
}
switch (options&(EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) {
case EditorInfo.IME_ACTION_GO:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = context.getResources().getText(R.string.label_go_key);
break;
case EditorInfo.IME_ACTION_NEXT:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = context.getResources().getText(R.string.label_next_key);
break;
case EditorInfo.IME_ACTION_SEARCH:
mEnterKey.icon = ContextCompat.getDrawable(context, R.drawable.sym_keyboard_search);
mEnterKey.label = null;
break;
case EditorInfo.IME_ACTION_SEND:
mEnterKey.iconPreview = null;
mEnterKey.icon = null;
mEnterKey.label = context.getResources().getText(R.string.label_send_key);
break;
default:
mEnterKey.icon = ContextCompat.getDrawable(context, R.drawable.sym_keyboard_return);
mEnterKey.label = null;
break;
}
}
示例12: onEditorAction
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
// Skip if it's not the right action
if (actionId != EditorInfo.IME_ACTION_SEARCH) {
return false;
}
// Skip if the query is empty
String query = v.getText().toString();
if (query.isEmpty()) {
return false;
}
return mLauncher.startActivitySafely(v, createMarketSearchIntent(query), null);
}
示例13: onEditorAction
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (listener != null && actionId == EditorInfo.IME_ACTION_SEARCH) {
listener.onClicked(v, ACTION_SEARCH_SUBMIT, etSearchHint.getText().toString());
}
return false;
}
示例14: onEditorAction
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
if (EditorInfo.IME_ACTION_SEND == actionId) {
onPushAction();
return true;
}
else
if ( (EditorInfo.IME_ACTION_SEARCH == actionId ) && ( textView.getId() == R.id.et_contract_account) ){
onContractEntered( mEtContract.getText().toString());
}
return false;
}
示例15: getDescriptionForActionKey
/**
* Returns a context-sensitive description of the "Enter" action key.
*
* @param context The package's context.
* @param keyboard The keyboard on which the key resides.
* @param key The key to describe.
* @return Returns a context-sensitive description of the "Enter" action key.
*/
private static String getDescriptionForActionKey(final Context context, final Keyboard keyboard,
final Key key) {
final KeyboardId keyboardId = keyboard.mId;
final int actionId = keyboardId.imeAction();
final int resId;
// Always use the label, if available.
if (!TextUtils.isEmpty(key.getLabel())) {
return key.getLabel().trim();
}
// Otherwise, use the action ID.
switch (actionId) {
case EditorInfo.IME_ACTION_SEARCH:
resId = R.string.spoken_description_search;
break;
case EditorInfo.IME_ACTION_GO:
resId = R.string.label_go_key;
break;
case EditorInfo.IME_ACTION_SEND:
resId = R.string.label_send_key;
break;
case EditorInfo.IME_ACTION_NEXT:
resId = R.string.label_next_key;
break;
case EditorInfo.IME_ACTION_DONE:
resId = R.string.label_done_key;
break;
case EditorInfo.IME_ACTION_PREVIOUS:
resId = R.string.label_previous_key;
break;
default:
resId = R.string.spoken_description_return;
}
return context.getString(resId);
}