mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-14 04:58:52 -06:00
Limit to ScrollableChart not to go beyond 1970
This commit is contained in:
@@ -123,6 +123,7 @@ class FrequencyChart : ScrollableChart {
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
populateWithRandomData()
|
||||
super.onDraw(canvas)
|
||||
rect!![0f, 0f, nColumns * columnWidth] = columnHeight.toFloat()
|
||||
rect!!.offset(0f, internalPaddingTop.toFloat())
|
||||
|
||||
@@ -31,6 +31,8 @@ import android.widget.Scroller
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import org.isoron.uhabits.core.utils.DateUtils.Companion.getMonthsSince1970
|
||||
import org.isoron.uhabits.core.utils.DateUtils.Companion.getStartOfTodayCalendar
|
||||
|
||||
abstract class ScrollableChart : View, GestureDetector.OnGestureListener, AnimatorUpdateListener {
|
||||
var dataOffset = 0
|
||||
@@ -41,7 +43,7 @@ abstract class ScrollableChart : View, GestureDetector.OnGestureListener, Animat
|
||||
private lateinit var scroller: Scroller
|
||||
private lateinit var scrollAnimator: ValueAnimator
|
||||
private lateinit var scrollController: ScrollController
|
||||
private var maxDataOffset = 10000
|
||||
private var maxDataOffset = getMonthsSince1970(getStartOfTodayCalendar())
|
||||
|
||||
constructor(context: Context?) : super(context) {
|
||||
init(context)
|
||||
|
||||
Reference in New Issue
Block a user