@@ -100,23 +100,17 @@ class WeekView @JvmOverloads constructor(
100100
101101 override fun onDraw (canvas : Canvas ) {
102102 super .onDraw(canvas)
103- performPendingScrolls ()
103+ performPendingScroll ()
104104 updateViewState()
105105 refreshEvents()
106106 performRendering(canvas)
107107 }
108108
109- private fun performPendingScrolls () {
110- val pendingDateScroll = viewState.scrollToDate
111- viewState.scrollToDate = null
112- pendingDateScroll?.let { date ->
113- goToDate(date)
114- }
115-
116- val pendingHourScroll = viewState.scrollToHour
117- viewState.scrollToHour = null
118- pendingHourScroll?.let { hour ->
119- goToHour(hour)
109+ private fun performPendingScroll () {
110+ val pendingScroll = viewState.pendingScroll
111+ viewState.pendingScroll = null
112+ pendingScroll?.let { dateTime ->
113+ scrollToDateTime(dateTime)
120114 }
121115 }
122116
@@ -154,7 +148,7 @@ class WeekView @JvmOverloads constructor(
154148 viewState.numberOfVisibleDays = savedState.numberOfVisibleDays
155149 }
156150
157- goToDate (savedState.firstVisibleDate)
151+ scrollToDate (savedState.firstVisibleDate)
158152 }
159153
160154 override fun onSizeChanged (width : Int , height : Int , oldWidth : Int , oldHeight : Int ) {
@@ -212,7 +206,6 @@ class WeekView @JvmOverloads constructor(
212206 val currentFirstVisibleDate = viewState.firstVisibleDate
213207 viewState.numberOfVisibleDays = value
214208
215- dateTimeInterpreter.onSetNumberOfDays(value)
216209 renderers.filterIsInstance(DateFormatterDependent ::class .java).forEach {
217210 it.onDateFormatterChanged(viewState.dateFormatter)
218211 }
@@ -1107,7 +1100,10 @@ class WeekView @JvmOverloads constructor(
11071100 * Returns the scrolling speed factor in horizontal direction.
11081101 */
11091102 @PublicApi
1110- @Deprecated(" This value is no longer being taken into account." )
1103+ @Deprecated(
1104+ message = " This value is no longer being taken into account." ,
1105+ level = DeprecationLevel .ERROR
1106+ )
11111107 var xScrollingSpeed: Float
11121108 get() = viewState.xScrollingSpeed
11131109 set(value) {
@@ -1120,7 +1116,8 @@ class WeekView @JvmOverloads constructor(
11201116 @PublicApi
11211117 @Deprecated(
11221118 message = " Use isHorizontalScrollingEnabled instead." ,
1123- replaceWith = ReplaceWith (" isHorizontalScrollingEnabled" )
1119+ replaceWith = ReplaceWith (" isHorizontalScrollingEnabled" ),
1120+ level = DeprecationLevel .ERROR
11241121 )
11251122 var isHorizontalFlingEnabled: Boolean
11261123 get() = viewState.horizontalFlingEnabled
@@ -1141,7 +1138,10 @@ class WeekView @JvmOverloads constructor(
11411138 /* *
11421139 * Returns whether WeekView can fling vertically.
11431140 */
1144- @Deprecated(" This value is no longer being taken into account." )
1141+ @Deprecated(
1142+ message = " This value is no longer being taken into account." ,
1143+ level = DeprecationLevel .ERROR
1144+ )
11451145 @PublicApi
11461146 var isVerticalFlingEnabled: Boolean
11471147 get() = viewState.verticalFlingEnabled
@@ -1150,7 +1150,10 @@ class WeekView @JvmOverloads constructor(
11501150 }
11511151
11521152 @PublicApi
1153- @Deprecated(" This value is no longer being taken into account." )
1153+ @Deprecated(
1154+ message = " This value is no longer being taken into account." ,
1155+ level = DeprecationLevel .ERROR
1156+ )
11541157 var scrollDuration: Int
11551158 get() = viewState.scrollDuration
11561159 set(value) {
@@ -1220,7 +1223,7 @@ class WeekView @JvmOverloads constructor(
12201223 if (isWaitingToBeLaidOut) {
12211224 // If the view's dimensions have just changed or if it hasn't been laid out yet, we
12221225 // postpone the action until onDraw() is called the next time.
1223- viewState.scrollToHour = hour
1226+ viewState.pendingScroll = viewState.firstVisibleDate.withTime( hour, minute)
12241227 return
12251228 }
12261229
@@ -1251,7 +1254,8 @@ class WeekView @JvmOverloads constructor(
12511254 */
12521255 @Deprecated(
12531256 message = " This method will be removed in a future release. Use scrollToDate() instead." ,
1254- replaceWith = ReplaceWith (expression = " scrollToDate" )
1257+ replaceWith = ReplaceWith (expression = " scrollToDate" ),
1258+ level = DeprecationLevel .ERROR
12551259 )
12561260 @PublicApi
12571261 fun goToToday () {
@@ -1263,7 +1267,8 @@ class WeekView @JvmOverloads constructor(
12631267 */
12641268 @Deprecated(
12651269 message = " This method will be removed in a future release. Use scrollToDateTime() instead." ,
1266- replaceWith = ReplaceWith (expression = " scrollToDateTime" )
1270+ replaceWith = ReplaceWith (expression = " scrollToDateTime" ),
1271+ level = DeprecationLevel .ERROR
12671272 )
12681273 @PublicApi
12691274 fun goToCurrentTime () {
@@ -1281,7 +1286,8 @@ class WeekView @JvmOverloads constructor(
12811286 */
12821287 @Deprecated(
12831288 message = " This method will be removed in a future release. Use scrollToDate() instead." ,
1284- replaceWith = ReplaceWith (expression = " scrollToDate" )
1289+ replaceWith = ReplaceWith (expression = " scrollToDate" ),
1290+ level = DeprecationLevel .ERROR
12851291 )
12861292 @PublicApi
12871293 fun goToDate (date : Calendar ) {
@@ -1300,7 +1306,7 @@ class WeekView @JvmOverloads constructor(
13001306 if (isWaitingToBeLaidOut) {
13011307 // If the view's dimensions have just changed or if it hasn't been laid out yet, we
13021308 // postpone the action until onDraw() is called the next time.
1303- viewState.scrollToDate = adjustedDate
1309+ viewState.pendingScroll = adjustedDate
13041310 return
13051311 }
13061312
@@ -1315,7 +1321,8 @@ class WeekView @JvmOverloads constructor(
13151321 */
13161322 @Deprecated(
13171323 message = " This method will be removed in a future release. Use scrollToTime() instead." ,
1318- replaceWith = ReplaceWith (expression = " scrollToTime" )
1324+ replaceWith = ReplaceWith (expression = " scrollToTime" ),
1325+ level = DeprecationLevel .ERROR
13191326 )
13201327 @PublicApi
13211328 fun goToHour (hour : Int ) {
@@ -1379,7 +1386,10 @@ class WeekView @JvmOverloads constructor(
13791386 }
13801387
13811388 @PublicApi
1382- @Deprecated(" Use setDateFormatter() and setTimeFormatter() instead." )
1389+ @Deprecated(
1390+ message = " Use setDateFormatter() and setTimeFormatter() instead." ,
1391+ level = DeprecationLevel .ERROR
1392+ )
13831393 var dateTimeInterpreter: DateTimeInterpreter
13841394 get() = object : DateTimeInterpreter {
13851395 override fun interpretDate (date : Calendar ): String = viewState.dateFormatter(date)
@@ -1599,7 +1609,8 @@ class WeekView @JvmOverloads constructor(
15991609 @PublicApi
16001610 @Deprecated(
16011611 message = " Use submitList() to submit a list of elements of type T instead. Then, overwrite the adapter's onCreateEntity() method to create a WeekViewEntity." ,
1602- replaceWith = ReplaceWith (expression = " submitList" )
1612+ replaceWith = ReplaceWith (expression = " submitList" ),
1613+ level = DeprecationLevel .ERROR
16031614 )
16041615 fun submit (events : List <WeekViewDisplayable <T >>) {
16051616 val viewState = weekView?.viewState ? : return
@@ -1649,7 +1660,8 @@ class WeekView @JvmOverloads constructor(
16491660 @PublicApi
16501661 @Deprecated(
16511662 message = " Use submitList() to submit a list of elements of type T instead. Then, overwrite the adapter's onCreateEntity() method to create a WeekViewEntity." ,
1652- replaceWith = ReplaceWith (expression = " submitList" )
1663+ replaceWith = ReplaceWith (expression = " submitList" ),
1664+ level = DeprecationLevel .ERROR
16531665 )
16541666 fun submit (events : List <WeekViewDisplayable <T >>) {
16551667 val viewState = weekView?.viewState ? : return
0 commit comments