@@ -141,6 +141,7 @@ private enum Direction {
141
141
private boolean mHorizontalFlingEnabled = true ;
142
142
private boolean mVerticalFlingEnabled = true ;
143
143
private int mAllDayEventHeight = 100 ;
144
+ private int mScrollDuration = 250 ;
144
145
145
146
// Listeners.
146
147
private EventClickListener mEventClickListener ;
@@ -349,6 +350,7 @@ public WeekView(Context context, AttributeSet attrs, int defStyleAttr) {
349
350
mHorizontalFlingEnabled = a .getBoolean (R .styleable .WeekView_horizontalFlingEnabled , mHorizontalFlingEnabled );
350
351
mVerticalFlingEnabled = a .getBoolean (R .styleable .WeekView_verticalFlingEnabled , mVerticalFlingEnabled );
351
352
mAllDayEventHeight = a .getDimensionPixelSize (R .styleable .WeekView_allDayEventHeight , mAllDayEventHeight );
353
+ mScrollDuration = a .getInt (R .styleable .WeekView_scrollDuration , mScrollDuration );
352
354
} finally {
353
355
a .recycle ();
354
356
}
@@ -1828,6 +1830,21 @@ public void setAllDayEventHeight(int height) {
1828
1830
mAllDayEventHeight = height ;
1829
1831
}
1830
1832
1833
+ /**
1834
+ * Get scroll duration
1835
+ * @return scroll duration
1836
+ */
1837
+ public int getScrollDuration () {
1838
+ return mScrollDuration ;
1839
+ }
1840
+
1841
+ /**
1842
+ * Set the scroll duration
1843
+ */
1844
+ public void setScrollDuration (int scrollDuration ) {
1845
+ mScrollDuration = scrollDuration ;
1846
+ }
1847
+
1831
1848
/////////////////////////////////////////////////////////////////
1832
1849
//
1833
1850
// Functions related to scrolling.
@@ -1873,7 +1890,7 @@ private void goToNearestOrigin(){
1873
1890
// Stop current animation.
1874
1891
mScroller .forceFinished (true );
1875
1892
// Snap to date.
1876
- mScroller .startScroll ((int ) mCurrentOrigin .x , (int ) mCurrentOrigin .y , -nearestOrigin , 0 , (int ) (Math .abs (nearestOrigin ) / mWidthPerDay * 500 ));
1893
+ mScroller .startScroll ((int ) mCurrentOrigin .x , (int ) mCurrentOrigin .y , -nearestOrigin , 0 , (int ) (Math .abs (nearestOrigin ) / mWidthPerDay * mScrollDuration ));
1877
1894
ViewCompat .postInvalidateOnAnimation (WeekView .this );
1878
1895
}
1879
1896
// Reset scrolling and fling direction.
0 commit comments