├── .gitignore
├── .idea
├── gradle.xml
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── hcy
│ │ └── huchengyang
│ │ └── transitionnote
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── hcy
│ │ │ └── huchengyang
│ │ │ └── transitionnote
│ │ │ ├── MainActivity.java
│ │ │ ├── custom
│ │ │ ├── ChangeColor.java
│ │ │ └── ChangeSceneColor.java
│ │ │ └── fragment
│ │ │ ├── AutoTransitionFragment.java
│ │ │ ├── ChangeBoundsFragment.java
│ │ │ ├── ChangeClipBoundsFragment.java
│ │ │ ├── ChangeImageTransformFragment.java
│ │ │ ├── ChangeScrollFragment.java
│ │ │ ├── ChangeTransformFragment.java
│ │ │ ├── CustomTransitionWithSceneFragment.java
│ │ │ ├── CustomTransitionWithoutSceneFragment.java
│ │ │ ├── ExplodeFadeSlideFragment.java
│ │ │ ├── MainFragment.java
│ │ │ ├── PathMotionFragment.java
│ │ │ ├── SceneFragment.java
│ │ │ └── TransitionSetFragment.java
│ └── res
│ │ ├── drawable-nodpi
│ │ └── photo.jpg
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── custom0.xml
│ │ ├── custom1.xml
│ │ ├── custom2.xml
│ │ ├── fragment_auto_transition.xml
│ │ ├── fragment_change_bounds.xml
│ │ ├── fragment_change_clip_bounds.xml
│ │ ├── fragment_change_image_transform.xml
│ │ ├── fragment_change_scroll.xml
│ │ ├── fragment_change_transform.xml
│ │ ├── fragment_custom_transition_with_scene.xml
│ │ ├── fragment_custom_transition_without_scene.xml
│ │ ├── fragment_explode.xml
│ │ ├── fragment_path_motion.xml
│ │ ├── fragment_scene.xml
│ │ ├── fragment_transition_set.xml
│ │ ├── red_square.xml
│ │ ├── scene0.xml
│ │ └── scene1.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── transition
│ │ └── transition.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── hcy
│ └── huchengyang
│ └── transitionnote
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | Android
36 |
37 |
38 | CorrectnessLintAndroid
39 |
40 |
41 | LintAndroid
42 |
43 |
44 | PerformanceLintAndroid
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## TransitionNote
2 | Android transition api demo
3 | ## Describe
4 | This demo is used to learn the Transition framework and commonly used apis,[Blog address](http://rkhcy.github.io/2017/09/21/TransitionNote/)
5 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | buildToolsVersion "26.0.1"
6 | defaultConfig {
7 | applicationId "com.hcy.huchengyang.transitionnote"
8 | minSdkVersion 21
9 | targetSdkVersion 26
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(dir: 'libs', include: ['*.jar'])
24 | implementation 'com.android.support:appcompat-v7:26.1.0'
25 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
26 | testImplementation 'junit:junit:4.12'
27 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
28 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
29 | compile 'com.jakewharton:butterknife:8.8.1'
30 | annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
31 | }
32 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/huchengyang/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/hcy/huchengyang/transitionnote/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.hcy.huchengyang.transitionnote", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 |
7 | import com.hcy.huchengyang.transitionnote.fragment.CustomTransitionWithSceneFragment;
8 | import com.hcy.huchengyang.transitionnote.fragment.CustomTransitionWithoutSceneFragment;
9 | import com.hcy.huchengyang.transitionnote.fragment.AutoTransitionFragment;
10 | import com.hcy.huchengyang.transitionnote.fragment.ChangeBoundsFragment;
11 | import com.hcy.huchengyang.transitionnote.fragment.ChangeClipBoundsFragment;
12 | import com.hcy.huchengyang.transitionnote.fragment.ChangeImageTransformFragment;
13 | import com.hcy.huchengyang.transitionnote.fragment.ChangeScrollFragment;
14 | import com.hcy.huchengyang.transitionnote.fragment.ChangeTransformFragment;
15 | import com.hcy.huchengyang.transitionnote.fragment.ExplodeFadeSlideFragment;
16 | import com.hcy.huchengyang.transitionnote.fragment.MainFragment;
17 | import com.hcy.huchengyang.transitionnote.fragment.PathMotionFragment;
18 | import com.hcy.huchengyang.transitionnote.fragment.SceneFragment;
19 | import com.hcy.huchengyang.transitionnote.fragment.TransitionSetFragment;
20 |
21 | public class MainActivity extends AppCompatActivity implements MainFragment.OnListItemClickListener{
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_main);
27 | if (savedInstanceState == null) {
28 | MainFragment mainFragment = new MainFragment();
29 | getSupportFragmentManager().beginTransaction()
30 | .add(R.id.content, mainFragment)
31 | .commit();
32 | }
33 | }
34 |
35 | @Override
36 | public void onListItemClick(int position) {
37 | Fragment fragment = null;
38 | switch (position) {
39 | case 0:
40 | fragment = new AutoTransitionFragment();
41 | break;
42 | case 1:
43 | fragment = new ChangeBoundsFragment();
44 | break;
45 | case 2:
46 | fragment = new ChangeClipBoundsFragment();
47 | break;
48 | case 3:
49 | fragment = new ChangeImageTransformFragment();
50 | break;
51 | case 4:
52 | fragment = new ChangeScrollFragment();
53 | break;
54 | case 5:
55 | fragment = new ChangeTransformFragment();
56 | break;
57 | case 6:
58 | fragment = new ExplodeFadeSlideFragment();
59 | break;
60 | case 7:
61 | fragment = new TransitionSetFragment();
62 | break;
63 | case 8:
64 | fragment = new PathMotionFragment();
65 | break;
66 | case 9:
67 | fragment = new CustomTransitionWithoutSceneFragment();
68 | break;
69 | case 10:
70 | fragment = new SceneFragment();
71 | break;
72 | case 11:
73 | fragment = new CustomTransitionWithSceneFragment();
74 | break;
75 | default:
76 | break;
77 | }
78 | getSupportFragmentManager().beginTransaction()
79 | .replace(R.id.content, fragment)
80 | .addToBackStack(null)
81 | .commit();
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/custom/ChangeColor.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.custom;
2 |
3 | /**
4 | * Created by huchengyang on 2017/9/19.
5 | */
6 |
7 | import android.animation.Animator;
8 | import android.animation.ArgbEvaluator;
9 | import android.animation.ValueAnimator;
10 | import android.graphics.drawable.ColorDrawable;
11 | import android.graphics.drawable.Drawable;
12 | import android.support.annotation.NonNull;
13 | import android.support.annotation.Nullable;
14 | import android.transition.Transition;
15 | import android.transition.TransitionValues;
16 | import android.view.View;
17 | import android.view.ViewGroup;
18 |
19 | /**
20 | * A sample implementation of support {@link Transition}.
21 | */
22 | public class ChangeColor extends Transition {
23 |
24 | /** Key to store a color value in TransitionValues object */
25 | private static final String PROPNAME_BACKGROUND = "com.hcy.huchengyang.transitionnote:change_color:background";
26 |
27 | /**
28 | * Convenience method: Add the background Drawable property value
29 | * to the TransitionsValues.value Map for a target.
30 | */
31 | private void captureValues(TransitionValues transitionValues) {
32 | // Capture the property values of views for later use
33 | transitionValues.values.put(PROPNAME_BACKGROUND, ((ColorDrawable) transitionValues.view.getBackground()).getColor());
34 | }
35 |
36 | @Override
37 | public void captureEndValues(@NonNull TransitionValues transitionValues) {
38 | if (transitionValues.view.getBackground() instanceof ColorDrawable) {
39 | captureValues(transitionValues);
40 | }
41 | }
42 |
43 | @Override
44 | public void captureStartValues(@NonNull TransitionValues transitionValues) {
45 | if (transitionValues.view.getBackground() instanceof ColorDrawable) {
46 | captureValues(transitionValues);
47 | }
48 | }
49 |
50 | // Create an animation for each target that is in both the starting and ending Scene. For each
51 | // pair of targets, if their background property value is a color (rather than a graphic),
52 | // create a ValueAnimator based on an ArgbEvaluator that interpolates between the starting and
53 | // ending color. Also create an update listener that sets the View background color for each
54 | // animation frame
55 | @Override
56 | public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
57 | if (null == startValues || null == endValues) {
58 | return null;
59 | }
60 | final View view = endValues.view;
61 | int startBackground = (Integer) startValues.values.get(PROPNAME_BACKGROUND);
62 | int endBackground = (Integer) endValues.values.get(PROPNAME_BACKGROUND);
63 |
64 | if (startBackground != endBackground) {
65 | ValueAnimator animator = ValueAnimator.ofObject(new ArgbEvaluator(),
66 | startBackground, endBackground);
67 | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
68 | @Override
69 | public void onAnimationUpdate(ValueAnimator animation) {
70 | Object value = animation.getAnimatedValue();
71 | if (null != value) {
72 | view.setBackgroundColor((Integer) value);
73 | }
74 | }
75 | });
76 | return animator;
77 | }
78 | return null;
79 | }
80 |
81 | @Override
82 | public String[] getTransitionProperties() {
83 | return new String[]{
84 | PROPNAME_BACKGROUND
85 | };
86 |
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/custom/ChangeSceneColor.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.custom;
2 |
3 |
4 | import android.animation.Animator;
5 | import android.animation.ArgbEvaluator;
6 | import android.animation.ValueAnimator;
7 | import android.graphics.drawable.ColorDrawable;
8 | import android.graphics.drawable.Drawable;
9 | import android.support.annotation.NonNull;
10 | import android.support.annotation.Nullable;
11 | import android.transition.Transition;
12 | import android.transition.TransitionValues;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 |
16 | /**
17 | * A sample implementation of support {@link Transition}.
18 | */
19 | public class ChangeSceneColor extends Transition {
20 |
21 | /** Key to store a color value in TransitionValues object */
22 | private static final String PROPNAME_BACKGROUND = "transitionnote:change_color:background";
23 |
24 | /**
25 | * Convenience method: Add the background Drawable property value
26 | * to the TransitionsValues.value Map for a target.
27 | */
28 | private void captureValues(TransitionValues values) {
29 | // Capture the property values of views for later use
30 | values.values.put(PROPNAME_BACKGROUND, values.view.getBackground());
31 | }
32 |
33 | @Override
34 | public void captureEndValues(@NonNull TransitionValues transitionValues) {
35 | captureValues(transitionValues);
36 | }
37 |
38 | @Override
39 | public void captureStartValues(@NonNull TransitionValues transitionValues) {
40 | captureValues(transitionValues);
41 | }
42 |
43 | // Create an animation for each target that is in both the starting and ending Scene. For each
44 | // pair of targets, if their background property value is a color (rather than a graphic),
45 | // create a ValueAnimator based on an ArgbEvaluator that interpolates between the starting and
46 | // ending color. Also create an update listener that sets the View background color for each
47 | // animation frame
48 | @Nullable
49 | @Override
50 | public Animator createAnimator(@NonNull ViewGroup sceneRoot,
51 | @Nullable TransitionValues startValues,
52 | @Nullable TransitionValues endValues) {
53 | // This transition can only be applied to views that are on both starting and ending scenes.
54 | if (null == startValues || null == endValues) {
55 | return null;
56 | }
57 | // Store a convenient reference to the target. Both the starting and ending layout have the
58 | // same target.
59 | final View view = endValues.view;
60 | // Store the object containing the background property for both the starting and ending
61 | // layouts.
62 | Drawable startBackground = (Drawable) startValues.values.get(PROPNAME_BACKGROUND);
63 | Drawable endBackground = (Drawable) endValues.values.get(PROPNAME_BACKGROUND);
64 | // This transition changes background colors for a target. It doesn't animate any other
65 | // background changes. If the property isn't a ColorDrawable, ignore the target.
66 | if (startBackground instanceof ColorDrawable && endBackground instanceof ColorDrawable) {
67 | ColorDrawable startColor = (ColorDrawable) startBackground;
68 | ColorDrawable endColor = (ColorDrawable) endBackground;
69 | // If the background color for the target in the starting and ending layouts is
70 | // different, create an animation.
71 | if (startColor.getColor() != endColor.getColor()) {
72 | // Create a new Animator object to apply to the targets as the transitions framework
73 | // changes from the starting to the ending layout. Use the class ValueAnimator,
74 | // which provides a timing pulse to change property values provided to it. The
75 | // animation runs on the UI thread. The Evaluator controls what type of
76 | // interpolation is done. In this case, an ArgbEvaluator interpolates between two
77 | // #argb values, which are specified as the 2nd and 3rd input arguments.
78 | ValueAnimator animator = ValueAnimator.ofObject(new ArgbEvaluator(),
79 | startColor.getColor(), endColor.getColor());
80 | // Add an update listener to the Animator object.
81 | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
82 | @Override
83 | public void onAnimationUpdate(ValueAnimator animation) {
84 | Object value = animation.getAnimatedValue();
85 | // Each time the ValueAnimator produces a new frame in the animation, change
86 | // the background color of the target. Ensure that the value isn't null.
87 | if (null != value) {
88 | view.setBackgroundColor((Integer) value);
89 | }
90 | }
91 | });
92 | // Return the Animator object to the transitions framework. As the framework changes
93 | // between the starting and ending layouts, it applies the animation you've created.
94 | return animator;
95 | }
96 | }
97 | // For non-ColorDrawable backgrounds, we just return null, and no animation will take place.
98 | return null;
99 | }
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/AutoTransitionFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.transition.AutoTransition;
7 | import android.transition.Transition;
8 | import android.transition.TransitionManager;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.Button;
13 | import android.widget.LinearLayout;
14 | import android.widget.TextView;
15 |
16 | import com.hcy.huchengyang.transitionnote.R;
17 |
18 | /**
19 | * Created by huchengyang on 2017/9/21.
20 | */
21 |
22 | public class AutoTransitionFragment extends Fragment {
23 | private Button mButton;
24 | private TextView mTextView;
25 | private LinearLayout mRoot;
26 | private Transition mTransition;
27 | @Nullable
28 | @Override
29 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
30 | View view = inflater.inflate(R.layout.fragment_auto_transition, container, false);
31 | mButton = view.findViewById(R.id.button);
32 | mTextView = view.findViewById(R.id.message);
33 | mRoot = view.findViewById(R.id.root);
34 | mTransition = new AutoTransition();
35 | mButton.setOnClickListener(new View.OnClickListener() {
36 | @Override
37 | public void onClick(View view) {
38 | toggle();
39 | }
40 | });
41 | return view;
42 | }
43 |
44 | private void toggle() {
45 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
46 | if (mTextView.getVisibility() != View.VISIBLE) {
47 | mTextView.setVisibility(View.VISIBLE);
48 | } else {
49 | mTextView.setVisibility(View.GONE);
50 | }
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/ChangeBoundsFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.transition.ChangeBounds;
7 | import android.transition.Transition;
8 | import android.transition.TransitionManager;
9 | import android.view.Gravity;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.Button;
14 | import android.widget.FrameLayout;
15 |
16 | import com.hcy.huchengyang.transitionnote.R;
17 |
18 | /**
19 | * Created by huchengyang on 2017/9/21.
20 | */
21 |
22 | public class ChangeBoundsFragment extends Fragment {
23 | private Button mButton;
24 | private FrameLayout mRoot;
25 | private View mTarget;
26 | private Transition mTransition;
27 | @Nullable
28 | @Override
29 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
30 | View view = inflater.inflate(R.layout.fragment_change_bounds, container, false);
31 | mRoot = view.findViewById(R.id.root);
32 | mTarget = view.findViewById(R.id.target);
33 | mButton = view.findViewById(R.id.move);
34 | mTransition = new ChangeBounds();
35 | mButton.setOnClickListener(new View.OnClickListener() {
36 | @Override
37 | public void onClick(View view) {
38 | move();
39 | }
40 | });
41 | return view;
42 | }
43 |
44 | private void move() {
45 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
46 | FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mTarget.getLayoutParams();
47 | if ((lp.gravity & Gravity.START) == Gravity.START) {
48 | lp.gravity = Gravity.BOTTOM | Gravity.END;
49 | } else {
50 | lp.gravity = Gravity.TOP | Gravity.START;
51 | }
52 | mTarget.setLayoutParams(lp);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/ChangeClipBoundsFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.graphics.Rect;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.support.v4.view.ViewCompat;
8 | import android.transition.ChangeClipBounds;
9 | import android.transition.Transition;
10 | import android.transition.TransitionManager;
11 | import android.util.Log;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.ImageView;
16 | import android.widget.LinearLayout;
17 |
18 | import com.hcy.huchengyang.transitionnote.R;
19 |
20 | import butterknife.BindView;
21 | import butterknife.ButterKnife;
22 | import butterknife.OnClick;
23 |
24 | /**
25 | * Created by huchengyang on 2017/9/21.
26 | */
27 |
28 | public class ChangeClipBoundsFragment extends Fragment {
29 | @BindView(R.id.root)
30 | LinearLayout mRoot;
31 | @BindView(R.id.photo)
32 | ImageView mImageView;
33 | private Transition mTransition;
34 | private static final Rect BOUNDS = new Rect(20, 20, 100, 100);
35 |
36 | @Nullable
37 | @Override
38 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
39 | View view = inflater.inflate(R.layout.fragment_change_clip_bounds, container, false);
40 | ButterKnife.bind(this, view);
41 | mTransition = new ChangeClipBounds();
42 | return view;
43 | }
44 | @OnClick(R.id.toggle)
45 | void toggle(){
46 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
47 | if (BOUNDS.equals(ViewCompat.getClipBounds(mImageView))) {
48 | ViewCompat.setClipBounds(mImageView, null);
49 | } else {
50 | ViewCompat.setClipBounds(mImageView, BOUNDS);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/ChangeImageTransformFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.graphics.Matrix;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.transition.ChangeImageTransform;
8 | import android.transition.Transition;
9 | import android.transition.TransitionManager;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.ImageView;
14 | import android.widget.LinearLayout;
15 |
16 | import com.hcy.huchengyang.transitionnote.R;
17 |
18 | import butterknife.BindView;
19 | import butterknife.ButterKnife;
20 | import butterknife.OnClick;
21 |
22 | /**
23 | * Created by huchengyang on 2017/9/21.
24 | */
25 |
26 | public class ChangeImageTransformFragment extends Fragment {
27 | @BindView(R.id.container)
28 | LinearLayout mRoot;
29 | @BindView(R.id.photo)
30 | ImageView mImageView;
31 | private Transition mTransition;
32 | @Nullable
33 | @Override
34 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
35 | View view = inflater.inflate(R.layout.fragment_change_image_transform, container, false);
36 | ButterKnife.bind(this, view);
37 | mTransition = new ChangeImageTransform();
38 | return view;
39 | }
40 | @OnClick(R.id.fit_xy)
41 | void fitXY(){
42 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
43 | mImageView.setScaleType(ImageView.ScaleType.FIT_XY);
44 | }
45 | @OnClick(R.id.center)
46 | void center(){
47 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
48 | mImageView.setScaleType(ImageView.ScaleType.CENTER);
49 | }
50 | @OnClick(R.id.center_crop)
51 | void centerCrop(){
52 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
53 | mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
54 | }
55 | @OnClick(R.id.fit_start)
56 | void fitStart(){
57 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
58 | mImageView.setScaleType(ImageView.ScaleType.FIT_START);
59 | }
60 | @OnClick(R.id.fit_end)
61 | void firEnd(){
62 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
63 | mImageView.setScaleType(ImageView.ScaleType.FIT_END);
64 | }
65 | @OnClick(R.id.matrix)
66 | void matrix(){
67 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
68 | mImageView.setScaleType(ImageView.ScaleType.MATRIX);
69 | final Matrix matrix = new Matrix();
70 | matrix.setRotate(45.f);
71 | matrix.postTranslate(200, 10);
72 | mImageView.setImageMatrix(matrix);
73 |
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/ChangeScrollFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.annotation.TargetApi;
4 | import android.os.Build;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.support.v4.app.Fragment;
8 | import android.transition.ChangeScroll;
9 | import android.transition.Transition;
10 | import android.transition.TransitionManager;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.widget.FrameLayout;
15 |
16 | import com.hcy.huchengyang.transitionnote.R;
17 |
18 | import butterknife.BindView;
19 | import butterknife.ButterKnife;
20 | import butterknife.OnClick;
21 |
22 | /**
23 | * Created by huchengyang on 2017/9/21.
24 | */
25 |
26 | public class ChangeScrollFragment extends Fragment {
27 |
28 | @BindView(R.id.root)
29 | FrameLayout mRoot;
30 | @BindView(R.id.target)
31 | View mTarget;
32 | private Transition mTransition;
33 | @TargetApi(Build.VERSION_CODES.M)
34 | @Nullable
35 | @Override
36 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
37 | View view = inflater.inflate(R.layout.fragment_change_scroll, container, false);
38 | ButterKnife.bind(this, view);
39 | mTransition = new ChangeScroll();
40 | return view;
41 | }
42 | @OnClick(R.id.move)
43 | void move(){
44 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
45 | mTarget.scrollBy(-100, -100);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/ChangeTransformFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.transition.ChangeTransform;
7 | import android.transition.Transition;
8 | import android.transition.TransitionManager;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.FrameLayout;
13 | import android.widget.LinearLayout;
14 |
15 | import com.hcy.huchengyang.transitionnote.R;
16 |
17 | import butterknife.BindView;
18 | import butterknife.ButterKnife;
19 | import butterknife.OnClick;
20 |
21 | /**
22 | * Created by huchengyang on 2017/9/21.
23 | */
24 |
25 | public class ChangeTransformFragment extends Fragment {
26 | @BindView(R.id.root)
27 | LinearLayout mRoot;
28 | @BindView(R.id.container_1)
29 | FrameLayout mContainer1;
30 | @BindView(R.id.container_2)
31 | FrameLayout mContainer2;
32 | private Transition mTransition;
33 | @Nullable
34 | @Override
35 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
36 | View view = inflater.inflate(R.layout.fragment_change_transform, container, false);
37 | ButterKnife.bind(this, view);
38 | mTransition = new ChangeTransform();
39 | showRedSquare(mContainer1);
40 | return view;
41 | }
42 | @OnClick(R.id.toggle)
43 | void toggle(){
44 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
45 | if (mContainer2.getChildCount() > 0) {
46 | mContainer2.removeAllViews();
47 | showRedSquare(mContainer1);
48 | } else {
49 | mContainer1.removeAllViews();
50 | showRedSquare(mContainer2);
51 | mContainer2.getChildAt(0).setRotation(45);
52 | }
53 | }
54 |
55 | private void showRedSquare(FrameLayout container) {
56 | final View view = LayoutInflater.from(getContext())
57 | .inflate(R.layout.red_square, container, false);
58 | container.addView(view);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/CustomTransitionWithSceneFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.transition.Scene;
7 | import android.transition.Transition;
8 | import android.transition.TransitionManager;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.FrameLayout;
13 |
14 | import com.hcy.huchengyang.transitionnote.R;
15 | import com.hcy.huchengyang.transitionnote.custom.ChangeSceneColor;
16 |
17 | import butterknife.BindView;
18 | import butterknife.ButterKnife;
19 | import butterknife.OnClick;
20 |
21 | /**
22 | * Created by huchengyang on 2017/9/21.
23 | */
24 |
25 | public class CustomTransitionWithSceneFragment extends Fragment {
26 | @BindView(R.id.root)
27 | FrameLayout mRoot;
28 | private Scene[] mScenes;
29 | private int mCurrentScene;
30 | private Transition mTransition;
31 | @Nullable
32 | @Override
33 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
34 | View view = inflater.inflate(R.layout.fragment_custom_transition_with_scene, container, false);
35 | ButterKnife.bind(this, view);
36 | mScenes = new Scene[]{
37 | Scene.getSceneForLayout(mRoot, R.layout.custom0, getActivity()),
38 | Scene.getSceneForLayout(mRoot, R.layout.custom1, getActivity()),
39 | Scene.getSceneForLayout(mRoot, R.layout.custom2, getActivity())
40 | };
41 | mTransition = new ChangeSceneColor();
42 | TransitionManager.go(mScenes[0], mTransition);
43 | return view;
44 | }
45 |
46 | @OnClick(R.id.root)
47 | void toggle(){
48 | mCurrentScene = (mCurrentScene + 1) % mScenes.length;
49 | TransitionManager.go(mScenes[mCurrentScene], mTransition);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/CustomTransitionWithoutSceneFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.transition.Transition;
8 | import android.transition.TransitionManager;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.LinearLayout;
13 |
14 | import com.hcy.huchengyang.transitionnote.custom.ChangeColor;
15 | import com.hcy.huchengyang.transitionnote.R;
16 |
17 | import butterknife.BindView;
18 | import butterknife.ButterKnife;
19 | import butterknife.OnClick;
20 |
21 | /**
22 | * Created by huchengyang on 2017/9/21.
23 | */
24 |
25 | public class CustomTransitionWithoutSceneFragment extends Fragment {
26 | @BindView(R.id.container)
27 | LinearLayout mRoot;
28 | @BindView(R.id.view_1)
29 | View mView1;
30 | @BindView(R.id.view_2)
31 | View mView2;
32 | @BindView(R.id.view_3)
33 | View mView3;
34 | private Transition mTransition;
35 |
36 | @Nullable
37 | @Override
38 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
39 | View view = inflater.inflate(R.layout.fragment_custom_transition_without_scene, container, false);
40 | ButterKnife.bind(this, view);
41 | mTransition = new ChangeColor();
42 | mTransition.setDuration(1000);
43 | return view;
44 | }
45 |
46 | @OnClick(R.id.container)
47 | void changeColor(){
48 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
49 | mView1.setBackgroundColor(Color.GREEN);
50 | mView2.setBackgroundColor(Color.BLUE);
51 | mView3.setBackgroundColor(Color.RED);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/ExplodeFadeSlideFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.transition.Explode;
7 | import android.transition.Fade;
8 | import android.transition.Slide;
9 | import android.transition.Transition;
10 | import android.transition.TransitionManager;
11 | import android.transition.TransitionSet;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.FrameLayout;
16 |
17 | import com.hcy.huchengyang.transitionnote.R;
18 |
19 | import java.util.ArrayList;
20 |
21 | import butterknife.BindView;
22 | import butterknife.ButterKnife;
23 | import butterknife.OnClick;
24 |
25 | /**
26 | * Created by huchengyang on 2017/9/21.
27 | */
28 |
29 | public class ExplodeFadeSlideFragment extends Fragment {
30 |
31 | @BindView(R.id.root)
32 | FrameLayout mRoot;
33 | @BindView(R.id.view_1)
34 | View view1;
35 | @BindView(R.id.view_2)
36 | View view2;
37 | @BindView(R.id.view_3)
38 | View view3;
39 | @BindView(R.id.view_4)
40 | View view4;
41 | private ArrayList mViews = new ArrayList<>();
42 | private Transition mTransition;
43 | @Nullable
44 | @Override
45 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
46 | View view = inflater.inflate(R.layout.fragment_explode, container, false);
47 | ButterKnife.bind(this, view);
48 | if (mViews.isEmpty()){
49 | mViews.add(view1);
50 | mViews.add(view2);
51 | mViews.add(view3);
52 | mViews.add(view4);
53 | }
54 | // mTransition = new Explode();
55 | //mTransition = new Fade();
56 | mTransition = new Slide();
57 | return view;
58 | }
59 |
60 | @OnClick(R.id.toggle)
61 | void toggle(){
62 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
63 | int vis = mViews.get(0).getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE;
64 | for (View view : mViews) {
65 | view.setVisibility(vis);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/MainFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.ListFragment;
7 | import android.view.View;
8 | import android.widget.ArrayAdapter;
9 | import android.widget.ListView;
10 |
11 | import com.hcy.huchengyang.transitionnote.R;
12 |
13 | /**
14 | * Created by huchengyang on 2017/9/20.
15 | */
16 | public class MainFragment extends ListFragment {
17 | private OnListItemClickListener onListItemClickListener;
18 |
19 | public interface OnListItemClickListener{
20 | void onListItemClick(int position);
21 | }
22 |
23 | public MainFragment(){}
24 |
25 | @Override
26 | public void onAttach(Context context) {
27 | super.onAttach(context);
28 | onListItemClickListener = (OnListItemClickListener) context;
29 | }
30 |
31 | @Override
32 | public void onActivityCreated(@Nullable Bundle savedInstanceState) {
33 | super.onActivityCreated(savedInstanceState);
34 | String listData[] = getResources().getStringArray(R.array.list_name);
35 | ArrayAdapter adapter = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, listData);
36 | setListAdapter(adapter);
37 | }
38 |
39 | @Override
40 | public void onListItemClick(ListView l, View v, int position, long id) {
41 | onListItemClickListener.onListItemClick(position);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/PathMotionFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.transition.ArcMotion;
6 | import android.transition.AutoTransition;
7 | import android.transition.ChangeBounds;
8 | import android.transition.PatternPathMotion;
9 | import android.transition.Transition;
10 | import android.transition.TransitionManager;
11 | import android.view.Gravity;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.FrameLayout;
16 | import android.widget.TextView;
17 |
18 | import com.hcy.huchengyang.transitionnote.R;
19 |
20 | import butterknife.BindView;
21 | import butterknife.ButterKnife;
22 | import butterknife.OnClick;
23 |
24 |
25 | /**
26 | * Created by huchengyang on 2017/9/20.
27 | */
28 |
29 | public class PathMotionFragment extends Fragment {
30 | @BindView(R.id.root)
31 | FrameLayout mRoot;
32 | @BindView(R.id.target)
33 | TextView mTarget;
34 | private Transition mTransition;
35 | @Override
36 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
37 | View view = inflater.inflate(R.layout.fragment_path_motion, container, false);
38 | ButterKnife.bind(this, view);
39 | mTransition = new AutoTransition();
40 | mTransition.setPathMotion(new ArcMotion());
41 | //mTransition.setPathMotion(new PatternPathMotion());
42 | mTransition.setDuration(1000);
43 | return view;
44 | }
45 |
46 | @OnClick(R.id.move)
47 | void toggle(){
48 | TransitionManager.beginDelayedTransition(mRoot, mTransition);
49 | FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mTarget.getLayoutParams();
50 | if ((lp.gravity & Gravity.START) == Gravity.START) {
51 | lp.gravity = Gravity.END | Gravity.BOTTOM;
52 | } else {
53 | lp.gravity = Gravity.START | Gravity.TOP;
54 | }
55 | mTarget.setLayoutParams(lp);
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/SceneFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.transition.Fade;
7 | import android.transition.Scene;
8 | import android.transition.Transition;
9 | import android.transition.TransitionManager;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.Button;
14 | import android.widget.FrameLayout;
15 |
16 | import com.hcy.huchengyang.transitionnote.R;
17 |
18 | /**
19 | * Created by huchengyang on 2017/9/20.
20 | */
21 |
22 | public class SceneFragment extends Fragment {
23 | private FrameLayout mSceneRoot;
24 | private Scene[] mScenes;
25 | private Scene mScene0;
26 | private Scene mScene1;
27 | private Transition mTransition;
28 | private Button mButton;
29 | private int mCurrentScene;
30 | @Nullable
31 | @Override
32 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
33 | View view = inflater.inflate(R.layout.fragment_scene, container, false);
34 | mButton = view.findViewById(R.id.toggle);
35 | mSceneRoot = view.findViewById(R.id.root);
36 | /*View view0 = inflater.inflate(R.layout.scene0, container, false);
37 | View view1 = inflater.inflate(R.layout.scene1, container, false);
38 | mScene0 = new Scene(mSceneRoot, view0);
39 | mScene1 = new Scene(mSceneRoot, view1);*/
40 | mScene0 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene0, getContext());
41 | mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene1, getContext());
42 | mScenes = new Scene[]{mScene0, mScene1};
43 | mTransition = new Fade();
44 | TransitionManager.go(mScenes[0]);
45 | mButton.setOnClickListener(new View.OnClickListener() {
46 | @Override
47 | public void onClick(View view) {
48 | mCurrentScene = (mCurrentScene + 1) % mScenes.length;
49 | TransitionManager.go(mScenes[mCurrentScene]);
50 | }
51 | });
52 |
53 | return view;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hcy/huchengyang/transitionnote/fragment/TransitionSetFragment.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.transition.ChangeImageTransform;
7 | import android.transition.ChangeTransform;
8 | import android.transition.TransitionInflater;
9 | import android.transition.TransitionManager;
10 | import android.transition.TransitionSet;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.widget.FrameLayout;
15 | import android.widget.ImageView;
16 |
17 | import com.hcy.huchengyang.transitionnote.R;
18 |
19 | import butterknife.BindView;
20 | import butterknife.ButterKnife;
21 | import butterknife.OnClick;
22 |
23 | /**
24 | * Created by huchengyang on 2017/9/21.
25 | */
26 |
27 | public class TransitionSetFragment extends Fragment {
28 | @BindView(R.id.outer_frame)
29 | FrameLayout mOuterFrame;
30 | @BindView(R.id.inner_frame)
31 | FrameLayout mInnerFrame;
32 | private TransitionSet mTransition;
33 | int mPhotoSize;
34 | @Nullable
35 | @Override
36 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
37 | View view = inflater.inflate(R.layout.fragment_transition_set, container, false);
38 | ButterKnife.bind(this, view);
39 | mPhotoSize = getResources().getDimensionPixelSize(R.dimen.photo_size);
40 | mTransition = new TransitionSet();
41 | mTransition.addTransition(new ChangeImageTransform());
42 | mTransition.addTransition(new ChangeTransform());
43 | //mTransition = (TransitionSet) TransitionInflater.from(getContext()).inflateTransition(R.transition.transition);
44 | addImageView(mOuterFrame, ImageView.ScaleType.CENTER_CROP, mPhotoSize);
45 | return view;
46 | }
47 |
48 | private void addImageView(FrameLayout parent, ImageView.ScaleType scaleType, int size) {
49 | final ImageView photo = new ImageView(getContext());
50 | photo.setImageResource(R.drawable.photo);
51 | photo.setId(R.id.photo);
52 | photo.setScaleType(scaleType);
53 | FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(size, size);
54 | parent.addView(photo, lp);
55 | }
56 |
57 | @OnClick(R.id.toggle)
58 | void toggle(){
59 | TransitionManager.beginDelayedTransition(mOuterFrame, mTransition);
60 | if (mInnerFrame.getChildCount() > 0) {
61 | mInnerFrame.removeAllViews();
62 | addImageView(mOuterFrame, ImageView.ScaleType.CENTER_CROP, mPhotoSize);
63 | } else {
64 | mOuterFrame.removeViewAt(1);
65 | addImageView(mInnerFrame, ImageView.ScaleType.FIT_XY,
66 | FrameLayout.LayoutParams.MATCH_PARENT);
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/photo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/drawable-nodpi/photo.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
12 |
17 |
22 |
27 |
32 |
37 |
42 |
47 |
52 |
57 |
62 |
67 |
72 |
77 |
82 |
87 |
92 |
97 |
102 |
107 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/custom0.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
30 |
31 |
37 |
38 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/custom1.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
30 |
31 |
37 |
38 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/custom2.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
30 |
31 |
37 |
38 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_auto_transition.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
21 |
22 |
29 |
30 |
37 |
38 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_change_bounds.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
29 |
30 |
36 |
37 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_change_clip_bounds.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
29 |
30 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_change_image_transform.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
30 |
35 |
40 |
45 |
46 |
47 |
55 |
60 |
65 |
70 |
71 |
72 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_change_scroll.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
29 |
30 |
35 |
36 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_change_transform.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
30 |
31 |
39 |
40 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_custom_transition_with_scene.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_custom_transition_without_scene.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
30 |
31 |
37 |
38 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_explode.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
22 |
23 |
30 |
31 |
38 |
39 |
46 |
47 |
54 |
55 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_path_motion.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
29 |
30 |
36 |
37 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_scene.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_transition_set.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
22 |
23 |
29 |
30 |
36 |
37 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/red_square.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/scene0.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
30 |
31 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/scene1.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
30 |
31 |
36 |
37 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/transition/transition.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #FF0000
7 | #00FF00
8 | #0000FF
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 96dp
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TransitionNote
3 | move
4 | toggle
5 | hello world
6 | begin
7 | fit_xy
8 | center
9 | center_crop
10 | fit_start
11 | fit_end
12 | matrix
13 | photo
14 |
15 | - AutoTransition
16 | - ChangeBounds
17 | - ChangeClipBounds
18 | - ChangeImageTransform
19 | - ChangeScroll
20 | - ChangeTransform
21 | - Explode/Fade/Slide
22 | - TransitionSet
23 | - PathMotion
24 | - CustomTransitionWithoutScene
25 | - Scene
26 | - CustomTransitionWithScene
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/hcy/huchengyang/transitionnote/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.hcy.huchengyang.transitionnote;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.0-alpha8'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rkhcy/TransitionNote/2eaabcec9e97c3248e198e754296243b171ae225/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Sep 20 14:55:40 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------