本文整理匯總了Java中android.widget.TextView.OnEditorActionListener類的典型用法代碼示例。如果您正苦於以下問題:Java OnEditorActionListener類的具體用法?Java OnEditorActionListener怎麽用?Java OnEditorActionListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
OnEditorActionListener類屬於android.widget.TextView包,在下文中一共展示了OnEditorActionListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupEditText
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
public static void setupEditText(Activity activity, final Enterable ent, EditText et) {
OnEditorActionListener tveal = new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEND ||
(event.getKeyCode() == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN)) {
ent.onEnter();
return true;
}
return false;
}
};
et.setOnEditorActionListener(tveal);
et.requestFocus();
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}
示例2: initView
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
private void initView() {
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_input_number, null);
et_number = (EditText) view.findViewById(R.id.et_number);
tv_name = (TextView) view.findViewById(R.id.tv_name);
view.findViewById(R.id.btn_ok).setOnClickListener(this);
view.findViewById(R.id.btn_close).setOnClickListener(this);
addView(view, new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
et_number.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
// TODO Auto-generated method stub
if (actionId == EditorInfo.IME_ACTION_DONE) {
inputOk();
}
return false;
}
});
}
示例3: initViews
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
private void initViews() {
getVerifiCodeButton = getView(R.id.btn_send_verifi_code);
getVerifiCodeButton.setOnClickListener(this);
phoneEdit = getView(R.id.et_phone);
phoneEdit.setImeOptions(EditorInfo.IME_ACTION_NEXT);// 下一步
verifyCodeEdit = getView(R.id.et_verifiCode);
verifyCodeEdit.setImeOptions(EditorInfo.IME_ACTION_NEXT);// 下一步
passwordEdit = getView(R.id.et_password);
passwordEdit.setImeOptions(EditorInfo.IME_ACTION_DONE);
passwordEdit.setImeOptions(EditorInfo.IME_ACTION_GO);
passwordEdit.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
// 點擊虛擬鍵盤的done
if (actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_ACTION_GO) {
commit();
}
return false;
}
});
}
示例4: createPasswordPinView
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
protected void createPasswordPinView(int paramInt1, int paramInt2)
{
this.mMainView.findViewById(2131755690).setVisibility(0);
this.mPasswordView = ((EditText)this.mMainView.findViewById(paramInt1));
this.mPasswordView.setVisibility(0);
this.mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener()
{
public final boolean onEditorAction(TextView paramAnonymousTextView, int paramAnonymousInt, KeyEvent paramAnonymousKeyEvent)
{
if (paramAnonymousInt == 6)
{
PurchaseAuthenticationChallengeBaseStep.this.logClickAndSubmitResponse(true);
return true;
}
return false;
}
});
this.mPasswordView.setHintTextColor(ContextCompat.getColor(((PurchaseFragment)this.mParentFragment).getContext(), 2131689798));
this.mHelpToggleView = ((ImageView)this.mMainView.findViewById(2131755691));
this.mHelpToggleView.setOnClickListener(this);
this.mHelpToggleView.setContentDescription(getString(paramInt2));
this.mErrorView = ((TextView)this.mMainView.findViewById(2131755481));
if (!TextUtils.isEmpty(this.mErrorMessage)) {
showErrorMessage(this.mErrorMessage);
}
}
示例5: onCreate
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Firebase.setAndroidContext(this);
setContentView(R.layout.activity_main);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.build();
firebase = new Firebase(Consts.FIREBASE_URL);
username = (TextView) findViewById(R.id.username);
userImage = (ImageView) findViewById(R.id.user_image);
code = (EditText) findViewById(R.id.code);
code.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
join();
return true;
}
});
code.requestFocus();
}
示例6: setCommentView
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
private void setCommentView() {
if (entry.canComment()) {
edtNewCom.setEnabled(true);
edtNewCom.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((actionId == EditorInfo.IME_ACTION_SEND && !TextUtils.isEmpty(edtNewCom.getText().toString())) ||
(actionId == EditorInfo.IME_NULL && event != null && event.getAction() == KeyEvent.ACTION_DOWN &&
event.getKeyCode() == KeyEvent.KEYCODE_ENTER))
doInsComment(edtNewCom.getText().toString());
return false;
}
});
} else {
edtNewCom.setEnabled(false);
edtNewCom.setOnEditorActionListener(null);
edtNewCom.setText(R.string.entry_cant_comm);
}
}
示例7: DelegatingEditText
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
public DelegatingEditText(Context context, AttributeSet attrs) {
super(context, attrs);
setOrientation(VERTICAL);
mContext = context;
LayoutInflater inflater = LayoutInflater.from(context);
inflater.inflate(R.layout.delegating_edit_text, this, /* attachToRoot */ true);
messageView = (TextView) findViewById(R.id.edit_text_message);
delegateEditText = (EditText) findViewById(R.id.delegate_edit_text);
delegateEditText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionCode, KeyEvent event) {
messageView.setText("typed: " + delegateEditText.getText());
messageView.setVisibility(View.VISIBLE);
InputMethodManager imm =
(InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(delegateEditText.getWindowToken(), 0);
return true;
}
});
}
示例8: installListeners
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
@Override
protected void installListeners() {
// TODO Auto-generated method stub
mEditText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
// TODO Auto-generated method stub
if (actionId == EditorInfo.IME_ACTION_GO) {
try {
Integer page = Integer.valueOf(mEditText.getText()
.toString());
if (page > 0 && page <= mMaxPages) {
mCurrentPage = page;
loadPage();
}
} catch (Exception e) {
// TODO: handle exception
}
}
return false;
}
});
}
示例9: DelegatingEditText
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
public DelegatingEditText(Context context, AttributeSet attrs) {
super(context, attrs);
setOrientation(VERTICAL);
mContext = context;
LayoutInflater inflater = LayoutInflater.from(context);
inflater.inflate(R.layout.delegating_edit_text, this, /* attachToRoot */ true);
messageView = (TextView) findViewById(R.id.edit_text_message);
delegateEditText = (EditText) findViewById(R.id.delegate_edit_text);
delegateEditText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionCode, KeyEvent event) {
messageView.setText("typed: " + delegateEditText.getText());
messageView.setVisibility(View.VISIBLE);
InputMethodManager imm =
(InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(delegateEditText.getWindowToken(), 0);
return true;
}
});
}
示例10: onCreateActionView
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
@Override
public View onCreateActionView() {
// Inflate the action view to be shown on the action bar.
LayoutInflater layoutInflater = LayoutInflater.from(mContext);
View view = layoutInflater.inflate(R.layout.edit_weight_layout,
null);
text = (EditText) view.findViewById(R.id.weightText);
text.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
if (text.getText().toString() != null) {
weight = Integer
.parseInt(text.getText().toString());
}
}
return false;
}
});
return view;
}
示例11: populateNewCommentInputView
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
private void populateNewCommentInputView(View newCommentView, final Post post) {
// User's image
ImageView ivPosterProfile = (ImageView) newCommentView.findViewById(R.id.ivPosterProfile);
ivPosterProfile.setImageResource(ModelUtils.getImageResourceForUser((User) User
.getCurrentUser()));
final EditText etComment = (EditText) newCommentView.findViewById(R.id.etComment);
etComment.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_SEND) {
SaveCommentListener saveCommentListener = (SaveCommentListener) (LCDetailsActivity) getContext();
saveCommentListener.onSaveComment(
post.getObjectId(), etComment.getText().toString());
handled = true;
}
return handled;
}
});
}
示例12: initDataToComponent
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
private void initDataToComponent(String query ){
if(editTextVenue == null) {
editTextVenue = ( EditText) findViewById( R.id.editTextVenue);
}
if(query!=null && !query.equals( "")) {
editTextVenue.setText( query);
editTextVenue.setTextIsSelectable( true);
editTextVenue.setFocusable( true);
editTextVenue.setFocusableInTouchMode( true);
}
editTextVenue.setOnEditorActionListener( new OnEditorActionListener( ){
@Override
public boolean onEditorAction( TextView v, int actionId, KeyEvent event){
searchVenue( editTextVenue.getText( ).toString( ), lat, lng);
return false;
}
});
}
示例13: onCreate
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_layout_changes);
mContainerView = (ViewGroup) findViewById(R.id.container);
edittext = (EditText) findViewById(R.id.editbox);
edittext.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(!edittext.getEditableText().toString().trim().equals(""))
{
mylist.add(edittext.getEditableText().toString());
addItem(mylist.size()-1);
edittext.setText("");
}
return true;
}
});
}
示例14: onCreate
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/* Verification du mot de passe lors du clic sur 'Ok' du clavier */
((EditText) findViewById(R.id.motDePasse))
.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
toMenu(v);
return true;
}
});
manageFileProcedureUsed();
}
示例15: setSearchBarEnterAction
import android.widget.TextView.OnEditorActionListener; //導入依賴的package包/類
private void setSearchBarEnterAction() {
final EditText searchBar = (EditText) findViewById(R.id.searchBar);
searchBar.setOnEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
searchQuery = searchBar.getText().toString();
cleanSearchQuery();
sendSearchRequest();
return true;
} else {
return false;
}
}
});
}