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:
parent
50617ee6f0
commit
7cc4b16852
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
11
app/src/main/res/anim/bounceleft.xml
Normal file
11
app/src/main/res/anim/bounceleft.xml
Normal 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>
|
10
app/src/main/res/anim/bounceright.xml
Normal file
10
app/src/main/res/anim/bounceright.xml
Normal 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>
|
Loading…
Reference in New Issue
Block a user