diff options
author | Martijn Coenen <maco@google.com> | 2011-08-15 16:11:43 +0200 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2011-08-15 16:18:58 +0200 |
commit | fb8d1457e8467d50f253cf88cc47fd88d02ea704 (patch) | |
tree | 992ebc1fc7aecf3fb3901fe8f880ebd4c970fd19 /src/com | |
parent | 8a558ba19be56e71e6c2015dea862d150e6d07cb (diff) | |
download | packages_apps_nfc-fb8d1457e8467d50f253cf88cc47fd88d02ea704.zip packages_apps_nfc-fb8d1457e8467d50f253cf88cc47fd88d02ea704.tar.gz packages_apps_nfc-fb8d1457e8467d50f253cf88cc47fd88d02ea704.tar.bz2 |
Prevent rotation in animation activity.
Turns out setting configChanges="orientation" does not
actually prevent the orientation change - it just prevents
the activity from being restarted with a new intent. Restored
old code for locking orientation.
Change-Id: I136888f6424d3caf5081dd0a55087e263ccc88e4
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/nfc/P2pAnimationActivity.java | 16 | ||||
-rw-r--r-- | src/com/android/nfc/P2pEventManager.java | 2 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/com/android/nfc/P2pAnimationActivity.java b/src/com/android/nfc/P2pAnimationActivity.java index fe0edba..36a75ca 100644 --- a/src/com/android/nfc/P2pAnimationActivity.java +++ b/src/com/android/nfc/P2pAnimationActivity.java @@ -34,7 +34,6 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.DisplayMetrics; -import android.util.Log; import android.view.Display; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -64,8 +63,6 @@ public class P2pAnimationActivity extends Activity implements Handler.Callback, private static final int STATE_RECEIVE_SUCCESS = 3; private static final int STATE_FAILURE = 4; - private static final int ARROW_START_ROTATION = 20; - private static final int ARROW_FINISH_ROTATION = -50; private static final int DURATION_MS = 1400; Context mContext; @@ -176,7 +173,6 @@ public class P2pAnimationActivity extends Activity implements Handler.Callback, mArrowStarsAnimator = getFloatAnimation(DURATION_MS, this, null); mArrowStarsAnimator.setRepeatCount(ValueAnimator.INFINITE); - //mArrowAnimator.setStartDelay(250); mStartAnimatorSet = new AnimatorSet(); List<Animator> animList = new ArrayList<Animator>(); animList.add(mStartAnimator); @@ -229,6 +225,7 @@ public class P2pAnimationActivity extends Activity implements Handler.Callback, setContentView(mScreenshotLayout); createAnimators(); + } @Override @@ -240,6 +237,10 @@ public class P2pAnimationActivity extends Activity implements Handler.Callback, protected void onResume() { super.onResume(); + // Lock rotation + final int orientation = getResources().getConfiguration().orientation; + setRequestedOrientation(orientation); + if (sScreenBitmap != null) { mClonedView.setImageBitmap(sScreenBitmap); mClonedView.setVisibility(View.GONE); @@ -332,6 +333,7 @@ public class P2pAnimationActivity extends Activity implements Handler.Callback, private void onStartAnimationUpdate(ValueAnimator animation) { // Just scale the screenshot down float t = ((Float) animation.getAnimatedValue()).floatValue(); + float scale = mDecelerateInterpolator.getInterpolation(t); float scaleT = INITIAL_SCREENSHOT_SCALE + (1f - scale) * (1 - INITIAL_SCREENSHOT_SCALE); @@ -396,12 +398,8 @@ public class P2pAnimationActivity extends Activity implements Handler.Callback, private void onArrowStarsAnimationUpdate(ValueAnimator animation) { float t = ((Float) animation.getAnimatedValue()).floatValue(); - float offset = mDecelerateInterpolator.getInterpolation(t); - - int rotation = (int) ((double)ARROW_START_ROTATION * (1.0 - offset) + - (double) ARROW_FINISH_ROTATION * offset); - float scale = 1.0f + (0.5f * offset); + float scale = 1.0f + (0.5f * t); mStars.setScaleX(scale); mStars.setScaleY(scale); } diff --git a/src/com/android/nfc/P2pEventManager.java b/src/com/android/nfc/P2pEventManager.java index ba1f57c..05fc234 100644 --- a/src/com/android/nfc/P2pEventManager.java +++ b/src/com/android/nfc/P2pEventManager.java @@ -208,7 +208,7 @@ public class P2pEventManager implements P2pEventListener { } /** - * Finish up the animation, if running, and play ending sounds. + * Finish up the animation, if running. * Must be called on the UI thread. */ void finish(boolean sendSuccess, boolean receiveSuccess) { |