@@ -94,6 +94,7 @@ public class WeekView extends View {
94
94
private int mDayNameLength = LENGTH_LONG ;
95
95
private int mOverlappingEventGap = 0 ;
96
96
private int mEventMarginVertical = 0 ;
97
+ private float mXScrollingSpeed = 1f ;
97
98
private Calendar mFirstVisibleDay ;
98
99
private Calendar mLastVisibleDay ;
99
100
@@ -134,7 +135,7 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve
134
135
mStickyScroller .forceFinished (true );
135
136
136
137
if (mCurrentFlingDirection == Direction .HORIZONTAL ){
137
- mScroller .fling ((int ) mCurrentOrigin .x , 0 , (int ) velocityX , 0 , Integer .MIN_VALUE , Integer .MAX_VALUE , 0 , 0 );
138
+ mScroller .fling ((int ) mCurrentOrigin .x , 0 , (int ) ( velocityX * mXScrollingSpeed ) , 0 , Integer .MIN_VALUE , Integer .MAX_VALUE , 0 , 0 );
138
139
}
139
140
else if (mCurrentFlingDirection == Direction .VERTICAL ){
140
141
mScroller .fling (0 , (int ) mCurrentOrigin .y , 0 , (int ) velocityY , 0 , 0 , (int ) -(mHourHeight * 24 + mHeaderTextHeight + mHeaderRowPadding * 2 - getHeight ()), 0 );
@@ -222,6 +223,7 @@ public WeekView(Context context, AttributeSet attrs, int defStyleAttr) {
222
223
mDayNameLength = a .getInteger (R .styleable .WeekView_dayNameLength , mDayNameLength );
223
224
mOverlappingEventGap = a .getDimensionPixelSize (R .styleable .WeekView_overlappingEventGap , mOverlappingEventGap );
224
225
mEventMarginVertical = a .getDimensionPixelSize (R .styleable .WeekView_eventMarginVertical , mEventMarginVertical );
226
+ mXScrollingSpeed = a .getFloat (R .styleable .WeekView_xScrollingSpeed , mXScrollingSpeed );
225
227
} finally {
226
228
a .recycle ();
227
229
}
@@ -1124,6 +1126,21 @@ public Calendar getLastVisibleDay() {
1124
1126
return mLastVisibleDay ;
1125
1127
}
1126
1128
1129
+ /**
1130
+ * Get the scrolling speed factor in horizontal direction.
1131
+ * @return The speed factor in horizontal direction.
1132
+ */
1133
+ public float getXScrollingSpeed () {
1134
+ return mXScrollingSpeed ;
1135
+ }
1136
+
1137
+ /**
1138
+ * Sets the speed for horizontal scrolling.
1139
+ * @param xScrollingSpeed The new horizontal scrolling speed.
1140
+ */
1141
+ public void setXScrollingSpeed (float xScrollingSpeed ) {
1142
+ this .mXScrollingSpeed = xScrollingSpeed ;
1143
+ }
1127
1144
/////////////////////////////////////////////////////////////////
1128
1145
//
1129
1146
// Functions related to scrolling.
0 commit comments