1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 12:56:49 +01:00

Animate on swipe when at end ranges of Sport Activity Detail data

This commit is contained in:
vanous 2020-08-15 12:12:06 +02:00 committed by Gitea
parent 50617ee6f0
commit 7cc4b16852
3 changed files with 38 additions and 8 deletions

View File

@ -75,14 +75,23 @@ public class ActivitySummaryDetail extends AbstractGBActivity {
final ActivitySummaryItems items = new ActivitySummaryItems(this, mGBDevice, filter);
final RelativeLayout layout = findViewById(R.id.activity_summary_detail_relative_layout);
final Animation animFadein;
final Animation animFadeout;
animFadein = AnimationUtils.loadAnimation(
final Animation animFadeRight;
final Animation animFadeLeft;
final Animation animBounceLeft;
final Animation animBounceRight;
animFadeRight = AnimationUtils.loadAnimation(
this,
R.anim.flyright);
animFadeout = AnimationUtils.loadAnimation(
animFadeLeft = AnimationUtils.loadAnimation(
this,
R.anim.flyleft);
animBounceLeft = AnimationUtils.loadAnimation(
this,
R.anim.bounceleft);
animBounceRight = AnimationUtils.loadAnimation(
this,
R.anim.bounceright);
layout.setOnTouchListener(new SwipeEvents(this) {
@Override
@ -91,10 +100,10 @@ public class ActivitySummaryDetail extends AbstractGBActivity {
if (currentItem != null) {
makeSummaryHeader(currentItem);
makeSummaryContent(currentItem);
layout.startAnimation(animFadein);
layout.startAnimation(animFadeRight);
}else{
GB.toast("No more items", Toast.LENGTH_SHORT,0);
layout.startAnimation(animBounceRight);
}
}
@Override
@ -103,9 +112,9 @@ public class ActivitySummaryDetail extends AbstractGBActivity {
if (currentItem != null) {
makeSummaryHeader(currentItem);
makeSummaryContent(currentItem);
layout.startAnimation(animFadeout);
layout.startAnimation(animFadeLeft);
}else{
GB.toast("No more items", Toast.LENGTH_SHORT,0);
layout.startAnimation(animBounceLeft);
}
}
});

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:interpolator="@android:anim/decelerate_interpolator">
<translate
android:fromXDelta="-10%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="200" />
</set>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:interpolator="@android:anim/decelerate_interpolator">
<translate
android:fromXDelta="10%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="200" />
</set>