@@ -96,6 +96,7 @@ public class WeekView extends View {
96
96
private int mEventMarginVertical = 0 ;
97
97
private Calendar mFirstVisibleDay ;
98
98
private Calendar mLastVisibleDay ;
99
+ private float mXScrollingSpeed = 1f ;
99
100
100
101
// Listeners.
101
102
private EventClickListener mEventClickListener ;
@@ -138,7 +139,7 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve
138
139
mStickyScroller .forceFinished (true );
139
140
140
141
if (mCurrentFlingDirection .isHorizontal ()){
141
- mScroller .fling ((int ) mCurrentOrigin .x , 0 , (int ) velocityX , 0 , Integer .MIN_VALUE , Integer .MAX_VALUE , 0 , 0 );
142
+ mScroller .fling ((int ) mCurrentOrigin .x , 0 , (int ) ( velocityX * mXScrollingSpeed ) , 0 , Integer .MIN_VALUE , Integer .MAX_VALUE , 0 , 0 );
142
143
}
143
144
else if (mCurrentFlingDirection == Direction .VERTICAL ){
144
145
mScroller .fling (0 , (int ) mCurrentOrigin .y , 0 , (int ) velocityY , 0 , 0 , (int ) -(mHourHeight * 24 + mHeaderTextHeight + mHeaderRowPadding * 2 - getHeight ()), 0 );
@@ -235,6 +236,7 @@ public WeekView(Context context, AttributeSet attrs, int defStyleAttr) {
235
236
mDayNameLength = a .getInteger (R .styleable .WeekView_dayNameLength , mDayNameLength );
236
237
mOverlappingEventGap = a .getDimensionPixelSize (R .styleable .WeekView_overlappingEventGap , mOverlappingEventGap );
237
238
mEventMarginVertical = a .getDimensionPixelSize (R .styleable .WeekView_eventMarginVertical , mEventMarginVertical );
239
+ mXScrollingSpeed = a .getFloat (R .styleable .WeekView_xScrollingSpeed , mXScrollingSpeed );
238
240
} finally {
239
241
a .recycle ();
240
242
}
@@ -1137,6 +1139,17 @@ public Calendar getLastVisibleDay() {
1137
1139
return mLastVisibleDay ;
1138
1140
}
1139
1141
1142
+ public float getXScrollingSpeed () {
1143
+ return mXScrollingSpeed ;
1144
+ }
1145
+
1146
+ /**
1147
+ * Sets the speed for horizontal scrolling.
1148
+ * @param xScrollingSpeed The new horizontal scrolling speed.
1149
+ */
1150
+ public void setXScrollingSpeed (float xScrollingSpeed ) {
1151
+ this .mXScrollingSpeed = xScrollingSpeed ;
1152
+ }
1140
1153
/////////////////////////////////////////////////////////////////
1141
1154
//
1142
1155
// Functions related to scrolling.
0 commit comments