public class MyNumberPicker extends android.widget.NumberPicker { private final String TAG = MyNumberPicker.class.getSimpleName(); View.OnFocusChangeListener mOnFocusChangeListener; public MyNumberPicker(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void setOnFocusChangeListener(View.OnFocusChangeListener listener){ mOnFocusChangeListener = listener; } @Override protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) { Log.d(TAG,"onFocusChanged called by the view system"); super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); if (mOnFocusChangeListener != null) { mOnFocusChangeListener.onFocusChange(this, gainFocus); } } }
@Override public void onFocusChange(View view, final boolean b) { if(focusChangeListener != null){ focusChangeListener.onFocusChange(view, b); } if(chipLayout.getWidth() < 1){ ViewTreeObserver vto = chipLayout.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT < 16) { chipLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this); } else { chipLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); } changeBackground(b); } }); }else{ changeBackground(b); } }
@Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { raiseLabel(true); setColors(mAccentColor); mTextView.setTypeface(Typeface.DEFAULT_BOLD); } else { if (mEditText.getText().toString().isEmpty()) { InputLayout.this.fallLabel(); } setColors(black_26p); mTextView.setTypeface(Typeface.DEFAULT); } if (mOnFocusChangeListener != null) { mOnFocusChangeListener.onFocusChange(v, hasFocus); } } });
@Override protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) { if (mFocusChangeListener != null) { mFocusChangeListener.onFocusChange(this, gainFocus); } super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); }
@Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { setClearIconVisible(getText().length() > 0); } else { setClearIconVisible(false); } if (mOnFocusChangeListener != null) { mOnFocusChangeListener.onFocusChange(v, hasFocus); } }
public void setViewFocus(boolean hasFocus) { if (onFocusChangeListener != null) { onFocusChangeListener.onFocusChange(realView, hasFocus); } }
public void setViewFocus(boolean hasFocus) { if (onFocusChangeListener != null) { onFocusChangeListener.onFocusChange(realView, hasFocus); } }
@Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { setClearIconVisible(getText().length() > 0); } else { setClearIconVisible(false); } if (mOnFocusChangeListener != null) { mOnFocusChangeListener.onFocusChange(v, hasFocus); } }
public void setViewFocus(boolean hasFocus) { if (onFocusChangeListener != null) { onFocusChangeListener.onFocusChange(realView, hasFocus); } }
public void onFocusChange(View view, boolean focused) { // When a text area is focused, webview's focus is false if (!focused) { driver.setEditAreaHasFocus(true); } focusListener.onFocusChange(view, focused); } });
final View.OnFocusChangeListener userNameEtFocusListener = userNameEt.getOnFocusChangeListener(); userNameEt.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { userNameEtFocusListener.onFocusChange(v, hasFocus); if (!hasFocus){ userInfoValidator.checkUserNameAvailable(userNameEt.getText().toString()); } } });
@Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { if (!isValid()) { editText.setError(invalidMessage); } } if (originalOnFocusChangeListener != null) originalOnFocusChangeListener.onFocusChange(v, hasFocus); } });
@Override public void onFocusChange(View view, boolean hasFocus) { if (onFocusChangeListener != null) { onFocusChangeListener.onFocusChange(view, hasFocus); } if (hasFocus) { this.setSelection(firstAllowedPosition); this.requestFocus(); } }
public void setViewFocus(boolean hasFocus) { if (onFocusChangeListener != null) { onFocusChangeListener.onFocusChange(realView, hasFocus); } }
@Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { setClearIconVisible(getText().length() > 0); } else { setClearIconVisible(false); } if (mOnFocusChangeListener != null) { mOnFocusChangeListener.onFocusChange(v, hasFocus); } }
@Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { setClearIconVisible(getText().length() > 0); } else { setClearIconVisible(false); } if (mOnFocusChangeListener != null) { mOnFocusChangeListener.onFocusChange(v, hasFocus); } }
public void onFocusChange(View v, boolean hasFocus) { if (mOnQueryTextFocusChangeListener != null) { mOnQueryTextFocusChangeListener.onFocusChange(SearchView.this, hasFocus); } } });
final View.OnFocusChangeListener oldNameFocusListener = textInputLayout.getEditText().getOnFocusChangeListener(); textInputLayout.getEditText().setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { oldNameFocusListener.onFocusChange(v, hasFocus); } });
public void setViewFocus(boolean hasFocus) { this.isFocused = hasFocus; if (onFocusChangeListener != null) { onFocusChangeListener.onFocusChange(realView, hasFocus); } }
@Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { setClearIconVisible(getText().length() > 0); } else { setClearIconVisible(false); } if (mOnFocusChangeListener != null) { mOnFocusChangeListener.onFocusChange(v, hasFocus); } }