From b4e34db1d2db3b21df785da18126709d90bfc116 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Tue, 25 Aug 2015 01:03:58 +0200 Subject: [PATCH] Faster animation --- .../gadgetbridge/activities/charts/AbstractChartFragment.java | 2 ++ .../activities/charts/ActivitySleepChartFragment.java | 4 ++-- .../gadgetbridge/activities/charts/SleepChartFragment.java | 4 ++-- .../activities/charts/WeekStepsChartFragment.java | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java index 88b04204..5a3c8851 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java @@ -41,6 +41,8 @@ import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils; import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper; public abstract class AbstractChartFragment extends AbstractGBFragment { + protected int ANIM_TIME = 350; + private static final Logger LOG = LoggerFactory.getLogger(ActivitySleepChartFragment.class); private final Set mIntentFilterActions; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ActivitySleepChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ActivitySleepChartFragment.java index c9389883..294af1f4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ActivitySleepChartFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ActivitySleepChartFragment.java @@ -83,7 +83,7 @@ public class ActivitySleepChartFragment extends AbstractChartFragment { yAxisRight.setDrawTopYLabelEntry(false); yAxisRight.setTextColor(CHART_TEXT_COLOR); -// refreshIfVisible(); + // refresh immediately instead of use refreshIfVisible(), for perceived performance refresh(); } @@ -111,7 +111,7 @@ public class ActivitySleepChartFragment extends AbstractChartFragment { } protected void renderCharts() { - mChart.animateX(500, Easing.EasingOption.EaseInOutQuart); + mChart.animateX(ANIM_TIME, Easing.EasingOption.EaseInOutQuart); } protected void setupLegend(Chart chart) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/SleepChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/SleepChartFragment.java index 5ee94bb1..9c40dc7b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/SleepChartFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/SleepChartFragment.java @@ -99,7 +99,7 @@ public class SleepChartFragment extends AbstractChartFragment { setupActivityChart(); setupSleepAmountChart(); -// refreshIfVisible(); + // refresh immediately instead of use refreshIfVisible(), for perceived performance refresh(); return rootView; @@ -177,7 +177,7 @@ public class SleepChartFragment extends AbstractChartFragment { } protected void renderCharts() { - mActivityChart.animateX(500, Easing.EasingOption.EaseInOutQuart); + mActivityChart.animateX(ANIM_TIME, Easing.EasingOption.EaseInOutQuart); mSleepAmountChart.invalidate(); } } \ No newline at end of file diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/WeekStepsChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/WeekStepsChartFragment.java index ccf9a306..d80edbc2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/WeekStepsChartFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/WeekStepsChartFragment.java @@ -137,7 +137,7 @@ public class WeekStepsChartFragment extends AbstractChartFragment { setupWeekStepsChart(); setupTodayStepsChart(); -// refreshIfVisible(); + // refresh immediately instead of use refreshIfVisible(), for perceived performance refresh(); return rootView;