private void addWatchers() { if (!watchers) { watchers = true; nameWatcher = new TextErrorWatcher(getActivity(), nameText, false); brandWatcher = new TextErrorWatcher(getActivity(), brandBox, false); categoryWatcher = new TextErrorWatcher(getActivity(), categoryBox, false); priceWatcher = new TextErrorWatcher(getActivity(), priceText, true); sizeWatcher = new TextErrorWatcher(getActivity(), sizeText, true); nameText.addTextChangedListener(nameWatcher); brandBox.addTextChangedListener(brandWatcher); categoryBox.addTextChangedListener(categoryWatcher); priceText.addTextChangedListener(priceWatcher); sizeText.addTextChangedListener(sizeWatcher); } else { nameWatcher.afterTextChanged(nameText.getEditableText()); brandWatcher.afterTextChanged(brandBox.getEditableText()); categoryWatcher.afterTextChanged(categoryBox.getEditableText()); priceWatcher.afterTextChanged(priceText.getEditableText()); sizeWatcher.afterTextChanged(sizeText.getEditableText()); } }
@Override public void onClick(View arg0) { // TODO Auto-generated method stub switch (arg0.getId()) { case com.actionbarsherlock.R.id.abs__search_src_text: mSEditText.setFocusable(true); if (mSEditText.hasFocus() && mSEditText.getEditableText().toString().equals("")) { if (!mSEditText.isPopupShowing()) { showHistory(true); } else { mSEditText.dismissDropDown(); } } break; default: break; } }