/[projects]/android/Side9/src/dk/thoerup/side9/anim/SwapViews.java
ViewVC logotype

Contents of /android/Side9/src/dk/thoerup/side9/anim/SwapViews.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1217 - (show annotations) (download)
Mon Jan 24 22:21:23 2011 UTC (13 years, 3 months ago) by torben
File size: 1228 byte(s)
- Added flip animation of pictures in Picture View
- Marked OVerview activity as a launcher act. so it can be found in the phone's app launcher 
- Default values for "Show caption" and "save to sd" is now true.
- Bump version to 21
1 package dk.thoerup.side9.anim;
2
3 import android.view.View;
4 import android.view.animation.DecelerateInterpolator;
5 import android.widget.ImageView;
6
7 public final class SwapViews implements Runnable {
8 private boolean mIsFirstView;
9 ImageView image1;
10 ImageView image2;
11 boolean forward;
12
13 public SwapViews(boolean isFirstView, boolean forward, ImageView image1, ImageView image2) {
14 mIsFirstView = isFirstView;
15 this.image1 = image1;
16 this.image2 = image2;
17 this.forward = forward;
18 }
19
20 public void run() {
21 final float centerX = image1.getWidth() / 2.0f;
22 final float centerY = image1.getHeight() / 2.0f;
23 Flip3dAnimation rotation;
24
25 if (mIsFirstView) {
26 image1.setVisibility(View.GONE);
27 image2.setVisibility(View.VISIBLE);
28 image2.requestFocus();
29
30
31 } else {
32 image2.setVisibility(View.GONE);
33 image1.setVisibility(View.VISIBLE);
34 image1.requestFocus();
35 }
36
37 int startAngle = forward ? 90 : -90;
38
39 rotation = new Flip3dAnimation(startAngle, 0, centerX, centerY);
40
41 rotation.setDuration(250);
42 rotation.setFillAfter(true);
43 rotation.setInterpolator(new DecelerateInterpolator());
44
45 if (mIsFirstView) {
46 image2.startAnimation(rotation);
47 } else {
48 image1.startAnimation(rotation);
49 }
50 }
51 }

  ViewVC Help
Powered by ViewVC 1.1.20