mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Reset habit strength graph scroll location when switching scale
- Create ScrollableChart.reset() to set x coordinate of scroller - Call reset() from doInBackground() in ScoreCard to reset scroll location
This commit is contained in:
@@ -217,6 +217,13 @@ public abstract class ScrollableChart extends View
|
||||
scrollController = new ScrollController() {};
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
scroller.setFinalX(0);
|
||||
scroller.computeScrollOffset();
|
||||
updateDataOffset();
|
||||
}
|
||||
|
||||
private void updateDataOffset()
|
||||
{
|
||||
int newDataOffset = scroller.getCurrX() / scrollerBucketSize;
|
||||
|
||||
@@ -153,6 +153,7 @@ public class ScoreCard extends HabitCard
|
||||
else scores = scoreList.groupBy(getTruncateField(bucketSize), firstWeekday);
|
||||
|
||||
chart.setScores(scores);
|
||||
chart.reset();
|
||||
chart.setBucketSize(bucketSize);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user