当前位置: 首页>>代码示例>>Java>>正文


Java OnEditorActionListener类代码示例

本文整理汇总了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);
}
 
开发者ID:jpace,项目名称:xumoqi,代码行数:19,代码来源:EnterableEditText.java

示例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;
		}
	});
	
}
 
开发者ID:kituri,项目名称:TankMMBaseNew,代码行数:22,代码来源:DialogInputNumber.java

示例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;
            }
        });
    }
 
开发者ID:shenhuanet,项目名称:LoginRegisterFramework,代码行数:26,代码来源:SignUpActivity.java

示例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);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:27,代码来源:PurchaseAuthenticationChallengeBaseStep.java

示例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();
}
 
开发者ID:google,项目名称:cloud-cup-android,代码行数:27,代码来源:MainActivity.java

示例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);
	}
}
 
开发者ID:tarzasai,项目名称:Flucso,代码行数:20,代码来源:EntryFragment.java

示例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;
        }
    });
}
 
开发者ID:mindbody,项目名称:Ironhide,代码行数:21,代码来源:DelegatingEditText.java

示例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;
		}
	});
}
 
开发者ID:ikantech,项目名称:yiim_v2,代码行数:25,代码来源:ViewChatRecordActivity.java

示例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;
    }
  });
}
 
开发者ID:DocuSignDev,项目名称:android-test-kit,代码行数:21,代码来源:DelegatingEditText.java

示例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;

}
 
开发者ID:LordVulkan,项目名称:Graphs,代码行数:25,代码来源:MainActivity.java

示例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;
        }
    });

}
 
开发者ID:CodePath-MAF,项目名称:AndroidClient,代码行数:25,代码来源:GoalPostsAdapter.java

示例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;
        }
    });
}
 
开发者ID:JSBerrocoso,项目名称:Android-FoursquareSearchVenues,代码行数:24,代码来源:VenueSearchActivity.java

示例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;
	}
});
  }
 
开发者ID:llellabs,项目名称:lollipopfx-kitkatjelly,代码行数:22,代码来源:LayoutChangesActivity.java

示例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();
}
 
开发者ID:jeremyfr,项目名称:co_nomad,代码行数:17,代码来源:MainActivity.java

示例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;
	    }
	 }
});
  }
 
开发者ID:Dragnipur,项目名称:TheGamesDB-Android-app,代码行数:17,代码来源:SearchActivity.java


注:本文中的android.widget.TextView.OnEditorActionListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。