mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-26 00:21:45 +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 ActivitySummaryItems items = new ActivitySummaryItems(this, mGBDevice, filter);
|
||||||
final RelativeLayout layout = findViewById(R.id.activity_summary_detail_relative_layout);
|
final RelativeLayout layout = findViewById(R.id.activity_summary_detail_relative_layout);
|
||||||
|
|
||||||
final Animation animFadein;
|
final Animation animFadeRight;
|
||||||
final Animation animFadeout;
|
final Animation animFadeLeft;
|
||||||
animFadein = AnimationUtils.loadAnimation(
|
final Animation animBounceLeft;
|
||||||
|
final Animation animBounceRight;
|
||||||
|
|
||||||
|
animFadeRight = AnimationUtils.loadAnimation(
|
||||||
this,
|
this,
|
||||||
R.anim.flyright);
|
R.anim.flyright);
|
||||||
animFadeout = AnimationUtils.loadAnimation(
|
animFadeLeft = AnimationUtils.loadAnimation(
|
||||||
this,
|
this,
|
||||||
R.anim.flyleft);
|
R.anim.flyleft);
|
||||||
|
animBounceLeft = AnimationUtils.loadAnimation(
|
||||||
|
this,
|
||||||
|
R.anim.bounceleft);
|
||||||
|
animBounceRight = AnimationUtils.loadAnimation(
|
||||||
|
this,
|
||||||
|
R.anim.bounceright);
|
||||||
|
|
||||||
layout.setOnTouchListener(new SwipeEvents(this) {
|
layout.setOnTouchListener(new SwipeEvents(this) {
|
||||||
@Override
|
@Override
|
||||||
@ -91,10 +100,10 @@ public class ActivitySummaryDetail extends AbstractGBActivity {
|
|||||||
if (currentItem != null) {
|
if (currentItem != null) {
|
||||||
makeSummaryHeader(currentItem);
|
makeSummaryHeader(currentItem);
|
||||||
makeSummaryContent(currentItem);
|
makeSummaryContent(currentItem);
|
||||||
layout.startAnimation(animFadein);
|
layout.startAnimation(animFadeRight);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
GB.toast("No more items", Toast.LENGTH_SHORT,0);
|
layout.startAnimation(animBounceRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@ -103,9 +112,9 @@ public class ActivitySummaryDetail extends AbstractGBActivity {
|
|||||||
if (currentItem != null) {
|
if (currentItem != null) {
|
||||||
makeSummaryHeader(currentItem);
|
makeSummaryHeader(currentItem);
|
||||||
makeSummaryContent(currentItem);
|
makeSummaryContent(currentItem);
|
||||||
layout.startAnimation(animFadeout);
|
layout.startAnimation(animFadeLeft);
|
||||||
}else{
|
}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