mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-03 12:48:56 +08:00
modify numberpicker
This commit is contained in:
parent
f67a974aba
commit
e9a6607b26
@ -463,7 +463,6 @@ void NumberPicker::scrollBy(int x, int y){
|
|||||||
mCurrentScrollOffset = mInitialScrollOffset;
|
mCurrentScrollOffset = mInitialScrollOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOGV("%d,%d:(%d->%d)",x,y,startScrollOffset,mCurrentScrollOffset);
|
|
||||||
if (startScrollOffset != mCurrentScrollOffset) {
|
if (startScrollOffset != mCurrentScrollOffset) {
|
||||||
onScrollChanged(0, mCurrentScrollOffset, 0, startScrollOffset);
|
onScrollChanged(0, mCurrentScrollOffset, 0, startScrollOffset);
|
||||||
}
|
}
|
||||||
@ -854,11 +853,11 @@ int NumberPicker::resolveSizeAndStateRespectingMinSize(int minSize, int measured
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NumberPicker::initializeSelectorWheelIndices(){
|
void NumberPicker::initializeSelectorWheelIndices(){
|
||||||
const int count= (int)mSelectorIndices.size();
|
const int valueCount= (mMaxValue-mMinValue+1);
|
||||||
mSelectorIndices.resize(std::min((mMaxValue-mMinValue+1),mMaxSelectorIndices));
|
mSelectorIndices.resize(std::min(valueCount,mMaxSelectorIndices));
|
||||||
mMiddleItemIndex = mSelectorIndices.size()/2;
|
mMiddleItemIndex = mSelectorIndices.size()/2;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < mMaxSelectorIndices; i++) {
|
||||||
int selectorIndex = ( count + mValue + (i - mMiddleItemIndex) ) % count;
|
int selectorIndex = ( valueCount + mValue + (i - mMiddleItemIndex) ) % valueCount;
|
||||||
if (mWrapSelectorWheel) {
|
if (mWrapSelectorWheel) {
|
||||||
selectorIndex = getWrappedSelectorIndex(selectorIndex);
|
selectorIndex = getWrappedSelectorIndex(selectorIndex);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user