summaryrefslogtreecommitdiffstats
path: root/tests/TransitionTests/src/com/android/transitiontests/InstanceTargets.java
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2013-08-26 14:20:16 -0700
committerChet Haase <chet@google.com>2013-09-04 14:46:38 -0700
commitd82c8ac4db7091d2e976af4c89a1734465d20cd2 (patch)
treea3ccb4d7a4325582dfe028030e4ca2d38ba4c2be /tests/TransitionTests/src/com/android/transitiontests/InstanceTargets.java
parent2a59f3f24076d96cbb10e1c00c3264dec43f19b1 (diff)
downloadframeworks_base-d82c8ac4db7091d2e976af4c89a1734465d20cd2.zip
frameworks_base-d82c8ac4db7091d2e976af4c89a1734465d20cd2.tar.gz
frameworks_base-d82c8ac4db7091d2e976af4c89a1734465d20cd2.tar.bz2
Transition API changes from API council recommendations
Issue #10460684 KLP API Review: android.view.transition and android.animation Issue #10570740 Transitions: inflate transition targets from xml Change-Id: I7a3f6d3aece2fcafc5efd555d033f79e86635c98
Diffstat (limited to 'tests/TransitionTests/src/com/android/transitiontests/InstanceTargets.java')
-rw-r--r--tests/TransitionTests/src/com/android/transitiontests/InstanceTargets.java38
1 files changed, 15 insertions, 23 deletions
diff --git a/tests/TransitionTests/src/com/android/transitiontests/InstanceTargets.java b/tests/TransitionTests/src/com/android/transitiontests/InstanceTargets.java
index cf4ea9a..a06ba8f 100644
--- a/tests/TransitionTests/src/com/android/transitiontests/InstanceTargets.java
+++ b/tests/TransitionTests/src/com/android/transitiontests/InstanceTargets.java
@@ -16,16 +16,12 @@
package com.android.transitiontests;
import android.app.Activity;
-import android.content.Context;
import android.os.Bundle;
-import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.view.transition.Move;
-import android.view.transition.Scene;
-import android.view.transition.TransitionManager;
+import android.transition.ChangeBounds;
+import android.transition.TransitionManager;
import android.widget.Button;
-import android.widget.RelativeLayout;
import static android.widget.RelativeLayout.ALIGN_PARENT_LEFT;
import static android.widget.RelativeLayout.ALIGN_PARENT_RIGHT;
@@ -46,23 +42,19 @@ public class InstanceTargets extends Activity {
}
public void sendMessage(final View view) {
- TransitionManager.go(mSceneRoot, new Runnable() {
- @Override
- public void run() {
- for (int i = 0; i < mSceneRoot.getChildCount(); ++i) {
- Button button = (Button) mSceneRoot.getChildAt(i);
- LayoutParams params = (LayoutParams) button.getLayoutParams();
- int rules[] = params.getRules();
- if (rules[ALIGN_PARENT_RIGHT] != 0) {
- params.removeRule(ALIGN_PARENT_RIGHT);
- params.addRule(ALIGN_PARENT_LEFT);
- } else {
- params.removeRule(ALIGN_PARENT_LEFT);
- params.addRule(ALIGN_PARENT_RIGHT);
- }
- button.setLayoutParams(params);
- }
+ TransitionManager.beginDelayedTransition(mSceneRoot, new ChangeBounds().addTarget(view));
+ for (int i = 0; i < mSceneRoot.getChildCount(); ++i) {
+ Button button = (Button) mSceneRoot.getChildAt(i);
+ LayoutParams params = (LayoutParams) button.getLayoutParams();
+ int rules[] = params.getRules();
+ if (rules[ALIGN_PARENT_RIGHT] != 0) {
+ params.removeRule(ALIGN_PARENT_RIGHT);
+ params.addRule(ALIGN_PARENT_LEFT);
+ } else {
+ params.removeRule(ALIGN_PARENT_LEFT);
+ params.addRule(ALIGN_PARENT_RIGHT);
}
- }, new Move().setTargets(view));
+ button.setLayoutParams(params);
+ }
}
}