From 9ca31ac50fbb2b3ce6bbca8595decd082e9d5b0e Mon Sep 17 00:00:00 2001 From: daimajia Date: Sun, 22 Feb 2015 12:07:31 +0800 Subject: [PATCH] prettify the samples. --- .../main/java/com/daimajia/swipedemo/MyActivity.java | 11 +++++++++++ demo/src/main/res/layout/sample1.xml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/demo/src/main/java/com/daimajia/swipedemo/MyActivity.java b/demo/src/main/java/com/daimajia/swipedemo/MyActivity.java index f3b06c9..0db1760 100644 --- a/demo/src/main/java/com/daimajia/swipedemo/MyActivity.java +++ b/demo/src/main/java/com/daimajia/swipedemo/MyActivity.java @@ -59,6 +59,17 @@ public class MyActivity extends Activity { } }); + sample1.addRevealListener(R.id.starbott, new SwipeLayout.OnRevealListener() { + @Override + public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int distance) { + View star = child.findViewById(R.id.star); + float d = child.getHeight() / 2 - star.getHeight() / 2; + ViewHelper.setTranslationY(star, d * fraction); + ViewHelper.setScaleX(star, fraction + 0.6f); + ViewHelper.setScaleY(star, fraction + 0.6f); + } + }); + //sample2 sample2 = (SwipeLayout) findViewById(R.id.sample2); diff --git a/demo/src/main/res/layout/sample1.xml b/demo/src/main/res/layout/sample1.xml index 2632870..1dab32d 100644 --- a/demo/src/main/res/layout/sample1.xml +++ b/demo/src/main/res/layout/sample1.xml @@ -74,7 +74,7 @@ android:layout_height="match_parent">