@Override public Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState(superState); ss.position = getSelectedItemPosition(); ss.showDropdown = mPopup != null && mPopup.isShowing(); return ss; }
@Override public InputConnection onCreateInputConnection (EditorInfo outAttrs){ if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE) return ((InternalEditText)mInputView).superOnCreateInputConnection(outAttrs); else if(mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE) return ((InternalAutoCompleteTextView)mInputView).superOnCreateInputConnection(outAttrs); else return ((InternalMultiAutoCompleteTextView)mInputView).superOnCreateInputConnection(outAttrs); }
@Override public boolean onKeyDown (int keyCode, KeyEvent event){ if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE) return ((InternalEditText)mInputView).superOnKeyDown(keyCode, event); else if(mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE) return ((InternalAutoCompleteTextView)mInputView).superOnKeyDown(keyCode, event); else return ((InternalMultiAutoCompleteTextView)mInputView).superOnKeyDown(keyCode, event); }
/** * Set the horizontal padding between this SnackBar and it's text and button. * @param padding * @return This SnackBar for chaining methods. */ public SnackBar horizontalPadding(int padding){ mText.setPadding(padding, mText.getPaddingTop(), padding, mText.getPaddingBottom()); mAction.setPadding(padding, mAction.getPaddingTop(), padding, mAction.getPaddingBottom()); return this; }
/** * Set the vertical padding between this SnackBar and it's text and button. * @param padding * @return This SnackBar for chaining methods. */ public SnackBar verticalPadding(int padding){ mText.setPadding(mText.getPaddingLeft(), padding, mText.getPaddingRight(), padding); mAction.setPadding(mAction.getPaddingLeft(), padding, mAction.getPaddingRight(), padding); return this; }
public void run() { if (mDropDownList != null && mDropDownList.getCount() > mDropDownList.getChildCount() && mDropDownList.getChildCount() <= mListItemExpandMaximum) { mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); show(); } } }
@Override public Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState(superState); ss.yearMin = mAdapter.getMinYear(); ss.yearMax = mAdapter.getMaxYear(); ss.year = mAdapter.getYear(); return ss; }
@Override public void onRestoreInstanceState(Parcelable state) { SavedState ss = (SavedState) state; super.onRestoreInstanceState(ss.getSuperState()); setYearRange(ss.yearMin, ss.yearMax); setYear(ss.year); }
@Override public boolean onKeyPreIme (int keyCode, KeyEvent event){ if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE) return ((InternalEditText)mInputView).superOnKeyPreIme(keyCode, event); else if(mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE) return ((InternalAutoCompleteTextView)mInputView).superOnKeyPreIme(keyCode, event); else return ((InternalMultiAutoCompleteTextView)mInputView).superOnKeyPreIme(keyCode, event); }
@Override public boolean onKeyShortcut (int keyCode, KeyEvent event){ if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE) return ((InternalEditText)mInputView).superOnKeyShortcut(keyCode, event); else if(mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE) return ((InternalAutoCompleteTextView)mInputView).superOnKeyShortcut(keyCode, event); else return ((InternalMultiAutoCompleteTextView)mInputView).superOnKeyShortcut(keyCode, event); }
@Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { Spinner.this.performItemClick(v, position, mAdapter.getItemId(position)); dismiss(); } });
@Override public boolean onKeyMultiple (int keyCode, int repeatCount, KeyEvent event){ if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE) return ((InternalEditText)mInputView).superOnKeyMultiple(keyCode, repeatCount, event); else if(mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE) return ((InternalAutoCompleteTextView)mInputView).superOnKeyMultiple(keyCode, repeatCount, event); else return ((InternalMultiAutoCompleteTextView)mInputView).superOnKeyMultiple(keyCode, repeatCount, event); }
@Override public boolean onKeyUp (int keyCode, KeyEvent event){ if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE) return ((InternalEditText)mInputView).superOnKeyUp(keyCode, event); else if(mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE) return ((InternalAutoCompleteTextView)mInputView).superOnKeyUp(keyCode, event); else return ((InternalMultiAutoCompleteTextView)mInputView).superOnKeyUp(keyCode, event); }
@Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (mPopup != null && mPopup.isShowing()) mPopup.dismiss(); }
/** * @return The currently selected item or null if the popup is not showing. */ public Object getSelectedItem() { if (!isShowing()) { return null; } return mDropDownList.getSelectedItem(); }
@Override public void onClick(View v) { if (mActionClickListener != null) mActionClickListener.onActionClick(SnackBar.this, mActionId); dismiss(); }
/** * Set the padding between this SnackBar and it's text and button. * @param horizontalPadding The horizontal padding. * @param verticalPadding The vertical padding. * @return This SnackBar for chaining methods. */ public SnackBar padding(int horizontalPadding, int verticalPadding){ mText.setPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding); mAction.setPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding); return this; }
@Override public int[] onCreateDrawableState(int extraSpace) { final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); int[] additionalStates = mChecked ? STATE_CHECKED : null; if (additionalStates != null) mergeDrawableStates(drawableState, additionalStates); return drawableState; } }
/** <p>Only work when autoComplete mode is {@link #AUTOCOMPLETE_MODE_SINGLE} or {@link #AUTOCOMPLETE_MODE_MULTI}</p> */ public void onFilterComplete(int count) { if(mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE) ((InternalAutoCompleteTextView)mInputView).superOnFilterComplete(count); else if(mAutoCompleteMode == AUTOCOMPLETE_MODE_MULTI) ((InternalMultiAutoCompleteTextView)mInputView).superOnFilterComplete(count); }