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);
}
项目:LoginRegisterFramework
文件:SignUpActivity.java
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,KeyEvent event) {
// 点击虚拟键盘的done
if (actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_ACTION_GO) {
commit();
}
return false;
}
});
}
项目:FMTech
文件:PurchaseAuthenticationChallengeBaseStep.java
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);
}
}
项目:A-week-to-develop-android-app-plan
文件:SignUpActivity.java
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,KeyEvent event) {
// 点击虚拟键盘的done
if (actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_ACTION_GO) {
commit();
}
return false;
}
});
}
项目:cloud-cup-android
文件:MainActivity.java
@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,KeyEvent event) {
join();
return true;
}
});
code.requestFocus();
}
项目:TankMMBaseNew
文件:DialogInputNumber.java
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,KeyEvent event) {
// Todo Auto-generated method stub
if (actionId == EditorInfo.IME_ACTION_DONE) {
inputOk();
}
return false;
}
});
}
项目:Flucso
文件:EntryFragment.java
private void setCommentView() {
if (entry.canComment()) {
edtNewCom.setEnabled(true);
edtNewCom.setonEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v,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);
}
}
项目:Ironhide
文件:DelegatingEditText.java
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;
}
});
}
项目:yiim_v2
文件:ViewChatRecordActivity.java
@Override
protected void installListeners() {
// Todo Auto-generated method stub
mEditText.setonEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v,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;
}
});
}
项目:android-test-kit
文件:DelegatingEditText.java
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,/* 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,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;
}
});
}
项目:Graphs
文件:MainActivity.java
@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,KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
if (text.getText().toString() != null) {
weight = Integer
.parseInt(text.getText().toString());
}
}
return false;
}
});
return view;
}
项目:AndroidClient
文件:GoalPostsAdapter.java
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,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;
}
});
}
项目:Android-FoursquareSearchVenues
文件:VenueSearchActivity.java
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,KeyEvent event){
searchVenue( editTextVenue.getText( ).toString( ),lat,lng);
return false;
}
});
}
项目:lollipopfx-kitkatjelly
文件:LayoutChangesActivity.java
@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,KeyEvent event) {
if(!edittext.getEditableText().toString().trim().equals(""))
{
mylist.add(edittext.getEditableText().toString());
addItem(mylist.size()-1);
edittext.setText("");
}
return true;
}
});
}
项目:co_nomad
文件:MainActivity.java
@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,KeyEvent event) {
toMenu(v);
return true;
}
});
manageFileProcedureUsed();
}
项目:TheGamesDB-Android-app
文件:SearchActivity.java
private void setSearchBarEnteraction() {
final EditText searchBar = (EditText) findViewById(R.id.searchBar);
searchBar.setonEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView v,KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
searchQuery = searchBar.getText().toString();
cleanSearchQuery();
sendSearchRequest();
return true;
} else {
return false;
}
}
});
}
项目:CSipSimple
文件:PickupSipUri.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pickup_uri);
//Set window size
// LayoutParams params = getwindow().getAttributes();
// params.width = LayoutParams.FILL_PARENT;
// getwindow().setAttributes((android.view.WindowManager.LayoutParams) params);
//Set title
// Todo -- use dialog instead
// ((TextView) findViewById(R.id.my_title)).setText(R.string.pickup_sip_uri);
// ((ImageView) findViewById(R.id.my_icon)).setimageResource(android.R.drawable.ic_menu_call);
okBtn = (Button) findViewById(R.id.ok);
okBtn.setonClickListener(this);
Button btn = (Button) findViewById(R.id.cancel);
btn.setonClickListener(this);
sipUri = (EditSipUri) findViewById(R.id.sip_uri);
sipUri.getTextField().setonEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView tv,int action,KeyEvent arg2) {
if(action == EditorInfo.IME_ACTION_GO) {
sendPositiveResult();
return true;
}
return false;
}
});
sipUri.setShowExternals(false);
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
super.onCreateDialog(savedInstanceState);
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.sync_custom_passphrase,null);
mEnterPassphrase = (EditText) view.findViewById(R.id.passphrase);
mConfirmPassphrase = (EditText) view.findViewById(R.id.confirm_passphrase);
mConfirmPassphrase.setonEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v,KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
tryToSubmitPassphrase();
}
return false;
}
});
TextView instructionsView =
(TextView) view.findViewById(R.id.custom_passphrase_instructions);
instructionsView.setMovementMethod(LinkMovementMethod.getInstance());
instructionsView.setText(getInstructionsText());
AlertDialog dialog = new AlertDialog.Builder(getActivity(),R.style.AlertDialogTheme)
.setView(view)
.setTitle(R.string.sync_passphrase_type_custom_dialog_title)
.setPositiveButton(R.string.save,null)
.setNegativeButton(R.string.cancel,null)
.create();
dialog.getDelegate().setHandleNativeActionModesEnabled(false);
return dialog;
}
项目:Android-SerialPort-API
文件:ConsoleActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.console);
// setTitle("Loopback test");
mReception = (EditText) findViewById(R.id.EditTextReception);
EditText Emission = (EditText) findViewById(R.id.EditTextEmission);
Emission.setonEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView v,KeyEvent event) {
int i;
CharSequence t = v.getText();
char[] text = new char[t.length()];
for (i = 0; i < t.length(); i++) {
text[i] = t.charat(i);
}
try {
mOutputStream.write(new String(text).getBytes());
mOutputStream.write('\n');
} catch (IOException e) {
e.printstacktrace();
}
return false;
}
});
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
super.onCreateDialog(savedInstanceState);
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.sync_custom_passphrase,null)
.create();
dialog.getDelegate().setHandleNativeActionModesEnabled(false);
return dialog;
}
项目:SimpleFlickrSearch
文件:SearchFragment.java
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.search_fragment,container,false);
searchBarIV = (ImageView) rootView.findViewById(R.id.search);
searchBarIV.setonClickListener(this);
iconIV = (ImageView) rootView.findViewById(R.id.searchIcon);
iconIV.setonClickListener(this);
text = (TextView) rootView.findViewById(R.id.text);
text.setonEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView v,KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
Bundle searchTag = new Bundle();
searchTag.putString(SEARCH_TAG_KEY,text.getText().toString().trim());
((MainActivity)getActivity()).movetoPhotosFragment(searchTag);
//startActivity(new Intent(getActivity(),FriendsActivity.class));
}
return false;
}
});
searchToBar = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.anim_search_to_bar);
barToSearch = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.anim_bar_to_search);
interp = AnimationUtils.loadInterpolator(this.getActivity(),android.R.interpolator.linear_out_slow_in);
duration = getResources().getInteger(R.integer.duration_bar);
// iv is sized to hold the search+bar so when only showing the search icon,translate the
// whole view left by half the difference to keep it centered
offset = -71f * (int) getResources().getdisplayMetrics().scaledDensity;
searchBarIV.setTranslationX(offset);
rootView.setonClickListener(this);
return rootView;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
super.onCreateDialog(savedInstanceState);
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.sync_custom_passphrase,KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
tryToSubmitPassphrase();
}
return false;
}
});
AlertDialog dialog = new AlertDialog.Builder(getActivity(),R.style.AlertDialogTheme)
.setView(view)
.setTitle(R.string.sync_passphrase_type_custom)
.setPositiveButton(R.string.ok,null)
.create();
dialog.getDelegate().setHandleNativeActionModesEnabled(false);
return dialog;
}
项目:MVPAndroidBootstrap
文件:EditTextUtil.java
public static OnEditorActionListener getSoftInputHideEditorActionListener(final Context context,final EditText editText) {
OnEditorActionListener hideEditorListener = new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v,KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
EditTextUtil.hideSoftInPut(editText,context);
return true;
}
return false;
}
};
return hideEditorListener;
}
项目:RxAndroidBootstrap
文件:EditTextUtil.java
public static OnEditorActionListener getSoftInputHideEditorActionListener(final Context context,context);
return true;
}
return false;
}
};
return hideEditorListener;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
super.onCreateDialog(savedInstanceState);
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.sync_custom_passphrase,null)
.create();
dialog.getDelegate().setHandleNativeActionModesEnabled(false);
return dialog;
}
项目:BotLibre
文件:EditText.java
public void setonEditorActionListener(OnEditorActionListener listener) {
((JTextField)this.component).addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent arg0) {
listener.onEditorAction(EditText.this,new KeyEvent());
}
});
}
项目:Passbook
文件:HomeActivity.java
private void popinput() {
if(mPwdEdit!=null) {
mPwdEdit.postDelayed(new Runnable() {
@Override
public void run() {
mPwdEdit.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mPwdEdit,InputMethodManager.SHOW_FORCED);
}
},100);
OnEditorActionListener eal = new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView edit,int id,KeyEvent event) {
if(id == EditorInfo.IME_ACTION_DONE) {
onConfirm(null);
return true;
}
return false;
}
};
EditText et_confirm = (EditText)findViewById(R.id.confirm);
if(et_confirm.getVisibility() == View.VISIBLE) {
mPwdEdit.setImeOptions(EditorInfo.IME_ACTION_NEXT);
et_confirm.setonEditorActionListener(eal);
}
else {
mPwdEdit.setonEditorActionListener(eal);
}
}
}
项目:AndJie
文件:JieEditTextDel.java
@Override
public boolean onEditorAction(TextView v,KeyEvent event) {
for (OnEditorActionListener l : mOnEditorActionListener) {
l.onEditorAction(v,actionId,event);
return true;
}
return false;
}
项目:yiim_v2
文件:FriendAddActivity.java
@Override
protected void installListeners() {
// Todo Auto-generated method stub
mSearchEditText.setonEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v,KeyEvent event) {
// Todo Auto-generated method stub
if (actionId == EditorInfo.IME_ACTION_GO) {
onSearchClick(null);
}
return false;
}
});
}
private void inicializarEditText() {
mEtRespuesta.setonEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v,KeyEvent event) {
if (EditorInfo.IME_ACTION_DONE == actionId) {
checkSolution();
}
return false;
}
});
}
项目:android-shared
文件:ViewsFinder.java
/**
* @param runnable
* @param imeActionId
* @param views
*/
public void onEditorAction(final EditTextRunnable runnable,final int imeActionId,final EditText... views) {
onEditorAction(new OnEditorActionListener() {
@Override
public boolean onEditorAction(final TextView v,final int actionId,final KeyEvent event) {
return imeActionId == actionId && runnable.run();
}
},views);
}
项目:android-shared
文件:ViewsFinder.java
项目:android-shared
文件:ViewsFinder.java
项目:android-shared
文件:ViewsFinder.java
/**
* @param runnable
* @param imeActionId
* @param views
*/
public void onEditorAction(final EditTextRunnable runnable,final FloatLabelEditText... views) {
onEditorAction(new OnEditorActionListener() {
@Override
public boolean onEditorAction(final TextView v,final KeyEvent event) {
return imeActionId == actionId && runnable.run();
}
},final FloatLabelEditText... views) {
for (final FloatLabelEditText view : views) {
if (view != null) {
view.setonEditorActionListener(listener);
}
}
}
项目:android-shared
文件:ViewsFinder.java