@TargetApi(16) public void onFocusChanged(boolean paramBoolean, int paramInt, Rect paramRect) { super.onFocusChanged(paramBoolean, paramInt, paramRect); triggerAutocompleteSuggestionsIfPossible(); if ((!paramBoolean) && (getError() == null) && (this.mOutOfFocusFieldValidatable != null)) { this.mOutOfFocusFieldValidatable.validate(); } if ((paramBoolean) && (getError() != null)) { announceError(); } if (this.mFocusChangeListenerList != null) { Iterator localIterator = this.mFocusChangeListenerList.iterator(); while (localIterator.hasNext()) { ((View.OnFocusChangeListener)localIterator.next()).onFocusChange(this, paramBoolean); } } }
public void createViewItems() { this.play = (ImageButton) findViewById(R.id.playButton); this.next = (ImageButton) findViewById(R.id.nextButton); this.previous = (ImageButton) findViewById(R.id.previousButton); this.random = (ImageButton) findViewById(R.id.btnShuffle); this.loop = (ImageButton) findViewById(R.id.btnRepeat); this.musicName = (TextView) findViewById(R.id.textView2); this.notConnectedWarning = (TextView) findViewById(R.id.textView4); this.warningLogo = (ImageView) findViewById(R.id.imageView2); this.mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); this.mDrawerList = (ListView) findViewById(R.id.list_slidermenu); this.upload = (ImageButton) findViewById(R.id.upload_button); this.download = (ImageButton) findViewById(R.id.download_button); this.inputSearch = (EditText) findViewById(R.id.inputSearch); OnFocusChangeListener ofcListener = new MyFocusChangeListener(); this.inputSearch.setOnFocusChangeListener(ofcListener); }
/** * Attaches onTouchListener and onFocusListener to the EditText. * * @param editText * The editText with which the onTouchListener and * onFocusChangeListener are to be associated. */ void attachOnTouchAndFocusListener(final EditText editText) { final String text = editText.getText().toString().trim(); editText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus && !(text.equals(""))) { // check if keyboard is connected but accessibility services // are disabled if (!Utils.isAccessibilityEnabled(getApplicationContext()) && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) { if (text.equals("")) { // empty EditText TTS.speak(editText.getHint().toString()); } else { if (text.matches("-?\\d+(\\.\\d+)?")) { TTS.readNumber(text); } else { TTS.speak(text); } } } } } }); }
/** * Attach onFocusChangeListener to the TextView passed as parameter to the * method. If a keyboard is connected to the device, a TTS feedback would be * given to the user informing him/her about the text on the TextView that * received focus. * * @param textView * is an instance of TextView. */ void attachListenerToTextView(final TextView textView) { textView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { // check if keyboard is connected but accessibility services // are disabled if (!Utils.isAccessibilityEnabled(getApplicationContext()) && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) giveFeedback(textView.getText().toString()); } } }); }
/** * Sets the alpha of this FocusIndicatorHelper to 0 when a view with this listener * receives focus. */ public View.OnFocusChangeListener getHideIndicatorOnFocusListener() { return new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { endCurrentAnimation(); setCurrentView(null); setAlpha(0); invalidateDirty(); } } }; }
/** * 获取焦点改变事件监听,设置EditText文本默认全选 * @return 焦点改变事件监听 */ protected OnFocusChangeListener getOnFocusChangeListener() { return new OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (hasFocus && v instanceof EditText) { ((EditText) v).setSelection(0, ((EditText) v).getText().length()); } } }; }
private void showButtonDone(){ View view=vf.getCurrentView(); EditText etContent=(EditText) view.findViewById(R.id.aty_detail_content); etContent.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean arg1) { if(arg1){ biDone.setVisibility(View.VISIBLE); }else{ biDone.setVisibility(View.GONE); } } }); }
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.entry_form); final OnFocusChangeListener decimalNumberFormatter = new DecimalNumberFormattingOnFocusChangeListener(); valueExtreme = getTextViewAndAddResettableWatcher(R.id.value_extreme); valueExtreme.setOnFocusChangeListener(decimalNumberFormatter); unitExtreme = getTextViewAndAddResettableWatcher(R.id.unit_extreme); valueMeansB = getTextViewAndAddResettableWatcher(R.id.value_means_b); valueMeansB.setOnFocusChangeListener(decimalNumberFormatter); unitMeansB = getTextViewAndAddResettableWatcher(R.id.unit_means_b); valueMeansC = getTextViewAndAddResettableWatcher(R.id.value_means_c); valueMeansC.setOnFocusChangeListener(decimalNumberFormatter); unitMeansC = getTextViewById(R.id.unit_means_c); valueResult = getTextViewById(R.id.value_result); unitResult = getTextViewById(R.id.unit_result); buttonCalculate = (Button) findViewById(R.id.entry_form_button_calculate); buttonCalculate.setOnClickListener(createCalculateButtonOnClickListener()); buttonReset = (Button) findViewById(R.id.entry_form_button_reset); buttonReset.setOnClickListener(createResetButtonOnClickListener()); requiredViewsForCalculation.add(valueExtreme); requiredViewsForCalculation.add(valueMeansB); requiredViewsForCalculation.add(valueMeansC); }
public View.OnFocusChangeListener getOnFocusChangeListener() { if (_onFocusChangeListener == null) { _onFocusChangeListener = getDecorView().getOnFocusChangeListener(); } return _onFocusChangeListener; }
/** * Attaches onTouchListener and onFocusListener to the EditText passed as a * parameter. * * @param editText * The EditText with which the onTouchListener and * onFocusListener are to be associated. */ void attachOnTouchAndFocusListener(final EditText editText) { final String text = editText.getText().toString().trim(); editText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus && !(text.equals(""))) { // check if keyboard is connected but accessibility services // are disabled if (!Utils.isAccessibilityEnabled(getApplicationContext()) && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) { if (text.equals("")) { // empty EditText TTS.speak(editText.getHint().toString()); } else { if (text.matches("-?\\d+(\\.\\d+)?")) { TTS.readNumber(text); } else { TTS.speak(text); } } } } } }); }
/** * Attaches onFocusChangeListener to the button passed as a parameter. When the button receives focus, giveFeedback method is called, that reads aloud the * string passed to it as a parameter. * * @param button is an instance of Button. */ protected void attachListener(Button button) { final String text = button.getText().toString(); button.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { giveFeedback(text); } } }); }
/** * Attachs onFocusChangeListener to the spinner passed as a parameter. When the spinner receives focus, giveFeedback method is called, that reads aloud the * string passed to it as a parameter. * * @param spinner is an instance of Spinner. */ protected void attachListenerToSpinner(Spinner spinner) { final String text = spinner.getContentDescription().toString(); spinner.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { giveFeedback(text); } } }); }
/** * Attaches onFocusChange listener to the TextView passed as a parameter to * the method, to track the change in focus of the TextView. If the TextView * receives focus, pass the content description of the TextView to * giveFeedback(). * * @param textView * This is an instance of TextView. */ public void attachListener(final TextView textView) { textView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { giveFeedback(textView.getContentDescription().toString()); } } }); }
/** * Attaches onFocusListener to the TextView passed as a parameter. The text * specified in the TextView is sent to giveFeedback method. * * @param textView * The TextView with which onFocusChange listener is to be * associated. **/ void attachListenerToTextView(TextView textView) { final String text = textView.getText().toString(); textView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { giveFeedback(text); } } }); }
/** * Attaches onFocusChange listener to the TextView passed as a parameter to * the method, to track the change in focus of the TextView. If the TextView * receives focus, pass the content description of the TextView to * giveFeedback(). * * @param textView * This is an instance of TextView. */ void attachListenerToTextView(TextView textView) { textView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { giveFeedback(((TextView) view).getText().toString()); } } }); }
/** * Attaches onFocusChange listener to the TextView passed as parameter to * the method. If a keyboard is connected to the device, a TTS feedback * would be given to the user informing him/her about the text on the * TextView that received focus. * * @param textView * This is an instance of TextView. */ void attachListenerToTextView(TextView textView) { textView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { giveFeedback(((TextView) view).getText().toString()); } } }); }
/** * Attaches onFocusChangeListener to the button passed as a parameter. When the button receives focus, giveFeedback method is called, that reads aloud the * string passed to it as a parameter. * * @param context The context of the application that invoked the method. * @param button The button with which the onFocusChange listener is to be associated. */ public static void attachListener(final Context context, Button button) { final String text = button.getText().toString(); button.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { giveFeedback(context, text); } } }); }
private OnFocusChangeListener editTextOnFocus(final int row, final int column) { return new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub if (complexInput) { if (hasFocus) { if (complexStrings.get((row - 1) * columns + column) != null && !complexStrings.get( (row - 1) * columns + column).matches( "")) { ((EditText) v).setText(complexStrings.get((row - 1) * columns + column)); } } else { try { Evaluator eval = new Evaluator(); String string = ((EditText) v).getText().toString(); if (!string.trim().matches("")) { complexStrings.put( ((row - 1) * columns + column), string); ((EditText) v).setText(eval.evaluate(string)); } } catch (EvaluationException e) { Toast.makeText(v.getContext(), e.getLocalizedMessage().toString(), Toast.LENGTH_SHORT).show(); } } } } }; }
/** * 获取焦点改变事件监听,设置EditText文本默认全选 * * @return 焦点改变事件监听 */ protected OnFocusChangeListener GetOnFocusChangeListener() { return new OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (hasFocus && v instanceof EditText) { ((EditText) v).setSelection(0, ((EditText) v).getText().length()); } } }; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Preferences.init(this, Tomdroid.CLEAR_PREFERENCES); setContentView(R.layout.note_edit); content = (EditText) findViewById(R.id.content); title = (EditText) findViewById(R.id.title); formatBar = (SlidingDrawer) findViewById(R.id.formatBar); content.setOnFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if(hasFocus && !xmlOn) { formatBar.setVisibility(View.VISIBLE); } else { formatBar.setVisibility(View.GONE); } } }); neverSaved = getIntent().getBooleanExtra(Tomdroid.IS_NEW_NOTE_EXTRA, false); uri = getIntent().getData(); }
private void initViews() { buttonStartSearch.setEnabled(false); autocompleteEditFieldDeparture = (AutoCompleteEditField) getFragmentManager() .findFragmentById(R.id.autocompleteEditFieldDeparture); autocompleteEditFieldDestination = (AutoCompleteEditField) getFragmentManager() .findFragmentById(R.id.autocompleteEditFieldDestination); autocompleteEditFieldDeparture .setHint(getString(R.string.search_hint_departure)); autocompleteEditFieldDestination .setHint(getString(R.string.search_hint_destination)); LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); autocompleteEditFieldDeparture .setTextChangeListener(new GoEuroSuggestion(locationManager)); autocompleteEditFieldDestination .setTextChangeListener(new GoEuroSuggestion(locationManager)); OnFinishedListener checkButtonAvialble = new OnFinishedListener() { public void finished() { checkButtonAvailabe(); } }; autocompleteEditFieldDeparture .setOnFinishedListener(checkButtonAvialble); autocompleteEditFieldDestination .setOnFinishedListener(checkButtonAvialble); editTextDate.setOnFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { checkButtonAvailabe(); } }); }
public void setUi() { m_oImageUpload = (LinearLayout)findViewById(R.id.img_upload); m_oImage = (ImageView)findViewById(R.id.join_image); m_oUserName = (EditText)findViewById(R.id.join_username); m_oEmail = (EditText)findViewById(R.id.join_email); m_oPassword = (EditText)findViewById(R.id.join_password); m_oPasswordConfirm = (EditText)findViewById(R.id.join_password_confirm); m_oBtnConfirm = (LinearLayout)findViewById(R.id.btn_confirm); m_oImgDoubleCheck = (ImageView)findViewById(R.id.double_check_img); m_oEmail.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub if(hasFocus==false) { if((m_oEmail.getText().toString().equals(""))) { //아이디 입력해주세요 Toast.makeText(JoinActivity.this, "이메일을 입력해주세요", Toast.LENGTH_SHORT).show(); } else { reqeustDoubleId(); } } } }); m_oImageUpload.setOnClickListener(this); m_oBtnConfirm.setOnClickListener(this); }
private void setupfocusCHangeListener(MultiAutoCompleteTextView view) { view.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub if (hasFocus) ScrollToView(v); } }); }
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.main, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); final MenuItem searchMenuItem = menu.findItem(R.id.menu_main_search); final SearchView searchView = (SearchView) searchMenuItem.getActionView(); if (null != searchView ) { searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); } SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { public boolean onQueryTextChange(String newText) { return true; } public boolean onQueryTextSubmit(String query) { query = query.trim(); if (query.length() > 0) { textToSearch = query; ((GridFragment)getSupportFragmentManager().findFragmentById(R.id.grid_fragment)).Search(); mDrawer.closeMenu(); searchMenuItem.collapseActionView(); searchView.setQuery("", false); } return true; } }; searchView.setOnQueryTextListener(queryTextListener); searchView.setOnQueryTextFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View arg0, boolean queryTextFocused) { if(!queryTextFocused) { searchMenuItem.collapseActionView(); searchView.setQuery("", false); } } }); return true; }
private void initListeners() { this.email_input.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if(!hasFocus){ isInputValide(); } } }); }
private void initListeners() { this.simple_input.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if(!hasFocus){ isInputValide(); } } }); }
private void initListeners() { // TODO Auto-generated method stub this.password_input.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub if(!hasFocus){ isInputValide(); } } }); }
void setIconFocusListener(OnFocusChangeListener focusListener) { mIconFocusListener = focusListener; }
public OnFocusChangeListener getFocusListener() { return mHelper; }
/** * @see View#setOnFocusChangeListener(OnFocusChangeListener) */ public W setOnFocusChangeListener(OnFocusChangeListener l) { mView.setOnFocusChangeListener(l); return (W)this; }
@Override public void setOnFocusChangeListener(OnFocusChangeListener f) { this.f = f; }
public void setOnQueryTextFocusChangeListener(OnFocusChangeListener listener) { this.mOnQueryTextFocusChangeListener = listener; }
public void setIconFocusListener(OnFocusChangeListener focusListener) { mIconFocusListener = focusListener; }
public void setOnQueryTextFocusChangeListener(OnFocusChangeListener onFocusChangeListener) { this.f1218s = onFocusChangeListener; }