public void setSelectedTextColor(int selectedTextColor){ if(mTextColorSelected == selectedTextColor) return; mTextColorSelected = selectedTextColor; postInvalidate(); }
public void setNormalTextColor(int normalTextColor){ if(mTextColorNormal == normalTextColor) return; mTextColorNormal = normalTextColor; postInvalidate(); }
public void setHintTextColor(int hintTextColor){ if(mTextColorHint == hintTextColor) return; mTextColorHint = hintTextColor; mPaintHint.setColor(mTextColorHint); postInvalidate(); }
public void setDividerColor(int dividerColor){ if(mDividerColor == dividerColor) return; mDividerColor = dividerColor; mPaintDivider.setColor(mDividerColor); postInvalidate(); }
public void setPickedIndexRelativeToRaw(int pickedIndexToRaw){ if(mMinShowIndex > -1){ if(mMinShowIndex <= pickedIndexToRaw && pickedIndexToRaw <= mMaxShowIndex){ mPrevPickedIndex = pickedIndexToRaw; correctPositionByDefaultValue(pickedIndexToRaw - mMinShowIndex, mWrapSelectorWheel && mWrapSelectorWheelCheck); postInvalidate(); } } }
private void internalSetWrapToLinear(){ int rawIndex = getPickedIndexRelativeToRaw(); correctPositionByDefaultValue(rawIndex - mMinShowIndex, false); mWrapSelectorWheel = false; postInvalidate(); }
public void setMinAndMaxShowIndex(int minShowIndex, int maxShowIndex, boolean needRefresh){ if(minShowIndex > maxShowIndex){ throw new IllegalArgumentException("minShowIndex should be less than maxShowIndex, minShowIndex is " + minShowIndex + ", maxShowIndex is " + maxShowIndex + "."); } if(mDisplayedValues == null){ throw new IllegalArgumentException("mDisplayedValues should not be null, you need to set mDisplayedValues first."); } else { if(minShowIndex < 0){ throw new IllegalArgumentException("minShowIndex should not be less than 0, now minShowIndex is " + minShowIndex); } else if(minShowIndex > mDisplayedValues.length - 1){ throw new IllegalArgumentException("minShowIndex should not be greater than (mDisplayedValues.length - 1), now " + "(mDisplayedValues.length - 1) is " + (mDisplayedValues.length - 1) + " minShowIndex is " + minShowIndex); } if(maxShowIndex < 0){ throw new IllegalArgumentException("maxShowIndex should not be less than 0, now maxShowIndex is " + maxShowIndex); } else if(maxShowIndex > mDisplayedValues.length - 1){ throw new IllegalArgumentException("maxShowIndex should not be greater than (mDisplayedValues.length - 1), now " + "(mDisplayedValues.length - 1) is " + (mDisplayedValues.length - 1) + " maxShowIndex is " + maxShowIndex); } } mMinShowIndex = minShowIndex; mMaxShowIndex = maxShowIndex; if(needRefresh){ mPrevPickedIndex = 0 + mMinShowIndex; correctPositionByDefaultValue(0, mWrapSelectorWheel && mWrapSelectorWheelCheck); postInvalidate(); } }
public void setPickedIndexRelativeToMin(int pickedIndexToMin){ if(0 <= pickedIndexToMin && pickedIndexToMin < getOneRecycleSize()){ mPrevPickedIndex = pickedIndexToMin + mMinShowIndex; correctPositionByDefaultValue(pickedIndexToMin, mWrapSelectorWheel && mWrapSelectorWheelCheck); postInvalidate(); } }
public void setWrapSelectorWheel(boolean wrapSelectorWheel){ if(mWrapSelectorWheel != wrapSelectorWheel) { if(!wrapSelectorWheel) { if(mScrollState == OnScrollListener.SCROLL_STATE_IDLE){ internalSetWrapToLinear(); }else{ mPendingWrapToLinear = true; } }else{ mWrapSelectorWheel = wrapSelectorWheel; updateWrapStateByContent(); postInvalidate(); } } }
@Override public void computeScroll() { if(mItemHeight == 0) return; if (mScroller.computeScrollOffset()) { mCurrDrawGlobalY = mScroller.getCurrY(); calculateFirstItemParameterByGlobalY(); postInvalidate(); } }
public void setDisplayedValues(String[] newDisplayedValues){ stopRefreshing(); stopScrolling(); if(newDisplayedValues == null){ throw new IllegalArgumentException("newDisplayedValues should not be null."); } if(mMaxValue - mMinValue + 1 > newDisplayedValues.length){ throw new IllegalArgumentException("mMaxValue - mMinValue + 1 should not be greater than mDisplayedValues.length, now " + "((mMaxValue - mMinValue + 1) is " + (mMaxValue - mMinValue + 1) + " newDisplayedValues.length is " + newDisplayedValues.length + ", you need to set MaxValue and MinValue before setDisplayedValues(String[])"); } updateContent(newDisplayedValues); updateMaxWHOfDisplayedValues(true); mPrevPickedIndex = 0 + mMinShowIndex; correctPositionByDefaultValue(0, mWrapSelectorWheel && mWrapSelectorWheelCheck); postInvalidate(); mHandlerInMainThread.sendEmptyMessage(HANDLER_WHAT_REQUEST_LAYOUT); }
public void stopScrolling(){ if(mScroller != null){ if(!mScroller.isFinished()){ mScroller.startScroll(0, mScroller.getCurrY(), 0, 0, 1); mScroller.abortAnimation(); postInvalidate(); } } }
public void setDisplayedValuesAndPickedIndex(String[] newDisplayedValues, int pickedIndex, boolean needRefresh){ stopScrolling(); if(newDisplayedValues == null){ throw new IllegalArgumentException("newDisplayedValues should not be null."); } if(pickedIndex < 0){ throw new IllegalArgumentException("pickedIndex should not be negative, now pickedIndex is " + pickedIndex); } updateContent(newDisplayedValues); updateMaxWHOfDisplayedValues(true); updateNotWrapYLimit(); updateValue(); mPrevPickedIndex = pickedIndex + mMinShowIndex; correctPositionByDefaultValue(pickedIndex, mWrapSelectorWheel && mWrapSelectorWheelCheck); if(needRefresh){ mHandlerInNewThread.sendMessageDelayed(getMsg(HANDLER_WHAT_REFRESH), 0); postInvalidate(); } }
mHandlerInNewThread.sendMessageDelayed(getMsg(HANDLER_WHAT_REFRESH, 0, 0, new Boolean(needRespond)), duration / 4); postInvalidate();
willPickIndex = getWillPickIndexByGlobalY(mCurrDrawGlobalY + mCurrDrawFirstItemY); postInvalidate(); }else{ onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);