Full Code of lgvalle/Material-Animations for AI

master be755fe9ebe7 cached
57 files
116.4 KB
27.1k tokens
93 symbols
1 requests
Download .txt
Repository: lgvalle/Material-Animations
Branch: master
Commit: be755fe9ebe7
Files: 57
Total size: 116.4 KB

Directory structure:
gitextract_bqdgdqqz/

├── .gitignore
├── LICENSE.md
├── README.md
├── app/
│   ├── .gitignore
│   ├── build.gradle
│   ├── proguard-rules.pro
│   └── src/
│       ├── androidTest/
│       │   └── java/
│       │       └── com/
│       │           └── lgvalle/
│       │               └── material_animations/
│       │                   └── ApplicationTest.java
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── lgvalle/
│           │           └── material_animations/
│           │               ├── AnimationsActivity1.java
│           │               ├── AnimationsActivity2.java
│           │               ├── BaseDetailActivity.java
│           │               ├── MainActivity.java
│           │               ├── RevealActivity.java
│           │               ├── Sample.java
│           │               ├── SamplesRecyclerAdapter.java
│           │               ├── SharedElementActivity.java
│           │               ├── SharedElementFragment1.java
│           │               ├── SharedElementFragment2.java
│           │               ├── TransitionActivity1.java
│           │               ├── TransitionActivity2.java
│           │               ├── TransitionActivity3.java
│           │               └── TransitionHelper.java
│           └── res/
│               ├── drawable/
│               │   ├── circle_24dp.xml
│               │   └── square.xml
│               ├── layout/
│               │   ├── activity_animations1.xml
│               │   ├── activity_animations2.xml
│               │   ├── activity_animations_scene0.xml
│               │   ├── activity_animations_scene1.xml
│               │   ├── activity_animations_scene2.xml
│               │   ├── activity_animations_scene3.xml
│               │   ├── activity_animations_scene4.xml
│               │   ├── activity_main.xml
│               │   ├── activity_reveal.xml
│               │   ├── activity_sharedelement.xml
│               │   ├── activity_sharedelement_fragment1.xml
│               │   ├── activity_sharedelement_fragment2.xml
│               │   ├── activity_transition1.xml
│               │   ├── activity_transition2.xml
│               │   ├── activity_transition3.xml
│               │   ├── row_sample.xml
│               │   └── square.xml
│               ├── menu/
│               │   └── menu_main.xml
│               ├── transition/
│               │   ├── changebounds_with_arcmotion.xml
│               │   ├── explode.xml
│               │   ├── slide_and_changebounds.xml
│               │   ├── slide_and_changebounds_sequential.xml
│               │   ├── slide_and_changebounds_sequential_with_interpolators.xml
│               │   └── slide_from_bottom.xml
│               ├── values/
│               │   ├── colors.xml
│               │   ├── dimens.xml
│               │   ├── strings.xml
│               │   └── styles.xml
│               └── values-w820dp/
│                   └── dimens.xml
├── build.gradle
├── gradle/
│   └── wrapper/
│       └── gradle-wrapper.properties
├── gradlew.bat
└── settings.gradle

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/
gen-external-apklibs/

# Local configuration file (sdk path, etc)
local.properties

# intellij & maven
.classpath
.project
.settings/
.idea/
*.iml
*.iws
.DS_Store
log/
target/
tmp/
out/

# Gradle
.gradle
build/**
libraries/build/**


================================================
FILE: LICENSE.md
================================================
The MIT License (MIT)

Copyright (c) 2015 Luis G. Valle

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
# UNMAINTAINED
No maintainance is intended. 
The content is still valid as a reference but it won't contain the latest new stuff

[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Material--Animations-brightgreen.svg?style=flat)](http://android-arsenal.com/details/3/1880)

[Android Transition Framework][transition-framework] can be used for **three** main things:

1. Animate activity layout content when transitioning from one activity to another.
2. Animate shared elements (Hero views) in transitions between activities.
3. Animate view changes within same activity.


## 1. Transitions between Activities

Animate existing activity layout **content**

![A Start B][transition_a_to_b]

When transitioning from `Activity A` to `Activity B` content layout is animated according to defined transition. There are three predefined transitions available on `android.transition.Transition` you can use: **Explode**, **Slide** and **Fade**. 
All these transitions track changes to the visibility of target views in activity layout and animate those views to follow transition rules.

[Explode][explode_link] | [Slide][slide_link] | [Fade][fade_link]
--- | --- | ---
![transition_explode] | ![transition_slide] | ![transition_fade]


You can define these transitions **declarative** using XML or **programmatically**. For the Fade Transition sample, it would look like this:

### Declarative
Transitions are defined on XML files in `res/transition`

> res/transition/activity_fade.xml

```xml
<?xml version="1.0" encoding="utf-8"?>
<fade xmlns:android="http://schemas.android.com/apk/res/"
    android:duration="1000"/>

```

> res/transition/activity_slide.xml

```xml
<?xml version="1.0" encoding="utf-8"?>
<slide xmlns:android="http://schemas.android.com/apk/res/"
    android:duration="1000"/>

```

To use these transitions you need to inflate them using `TransitionInflater`

> MainActivity.java
 
```java
	@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_transition);
        setupWindowAnimations();
    }

    private void setupWindowAnimations() {
        Slide slide = TransitionInflater.from(this).inflateTransition(R.transition.activity_slide);
        getWindow().setExitTransition(slide);
    }

```

> TransitionActivity.java
 
```java
	@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_transition);
        setupWindowAnimations();
    }

    private void setupWindowAnimations() {
        Fade fade = TransitionInflater.from(this).inflateTransition(R.transition.activity_fade);
        getWindow().setEnterTransition(fade);
    }

```

### Programmatically 

> MainActivity.java
 
```java
	@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_transition);
        setupWindowAnimations();
    }

    private void setupWindowAnimations() {
        Slide slide = new Slide();
        slide.setDuration(1000);
        getWindow().setExitTransition(slide);
    }

```

> TransitionActivity.java
 
```java
	@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_transition);
        setupWindowAnimations();
    }

    private void setupWindowAnimations() {
        Fade fade = new Fade();
        fade.setDuration(1000);
        getWindow().setEnterTransition(fade);
    }

```

#### Any of those produce this result:

![transition_fade]


### What is happening step by step:

1. Activity A starts Activity B

2. Transition Framework finds A Exit Transition (slide) and apply it to all visible views.
3. Transition Framework finds B Enter Transition (fade) and apply it to all visible views.
4. **On Back Pressed** Transition Framework executes Enter and Exit reverse animations respectively (If we had defined output `returnTransition` and `reenterTransition`, these have been executed instead) 

### ReturnTransition & ReenterTransition

Return and Reenter Transitions are the reverse animations for Enter and Exit respectively.

  * EnterTransition <--> ReturnTransition
  * ExitTransition <--> ReenterTransition

If Return or Reenter are not defined, Android will execute a reversed version of Enter and Exit Transitions. But if you do define them, you can have different transitions for entering and exiting an activity.

![b back a][transition_b_to_a]

We can modify previous Fade sample and define a `ReturnTransition` for `TransitionActivity`, in this case, a **Slide** transition. This way, when returning from B to A, instead of seeing a Fade out (reversed Enter Transition) we will see a **Slide out** transition
 
> TransitionActivity.java
 
```java
	@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_transition);
        setupWindowAnimations();
    }

    private void setupWindowAnimations() {
        Fade fade = new Fade();
        fade.setDuration(1000);
        getWindow().setEnterTransition(fade);
        
        Slide slide = new Slide();
        slide.setDuration(1000);
        getWindow().setReturnTransition(slide);        
    }

```


Observe that if no Return Transition is defined then a reversed Enter Transition is executed.
If a Return Transition is defined that one is executed instead. 

Without Return Transition | With Return Transition 
--- | --- 
Enter: `Fade In` | Enter: `Fade In`
Exit: `Fade Out` | Exit: `Slide out`
![transition_fade] | ![transition_fade2] 


## 2. Shared elements between Activities

The idea behind this is having two different views in two different layouts and link them somehow with an animation.

Transition framework will then do _whatever animations it consider necessary_ to show the user a transition from one view to another.

Keep this always in mind: the view **is not really moving** from one layout to another. They are two independent views.


![A Start B with shared][shared_element]


### a) Enable Window Content Transition

This is something you need to set up once on your app `styles.xml`.

> values/styles.xml

```xml
<style name="MaterialAnimations" parent="@style/Theme.AppCompat.Light.NoActionBar">
    ...
    <item name="android:windowContentTransitions">true</item
    ...
</style>
```

Here you can also specify default enter, exit and shared element transitions for the whole app if you want

```xml
<style name="MaterialAnimations" parent="@style/Theme.AppCompat.Light.NoActionBar">
    ...
    <!-- specify enter and exit transitions -->
    <item name="android:windowEnterTransition">@transition/explode</item>
    <item name="android:windowExitTransition">@transition/explode</item>

    <!-- specify shared element transitions -->
    <item name="android:windowSharedElementEnterTransition">@transition/changebounds</item>
    <item name="android:windowSharedElementExitTransition">@transition/changebounds</item>
    ...
</style>
```



### b) Define a common transition name

To make the trick you need to give both, origin and target views, the same **`android:transitionName`**. They may have different ids or properties, but `android:transitionName` must be the same.

> layout/activity_a.xml

```xml
<ImageView
        android:id="@+id/small_blue_icon"
        style="@style/MaterialAnimations.Icon.Small"
        android:src="@drawable/circle"
        android:transitionName="@string/blue_name" />
```

> layout/activity_b.xml

```xml
<ImageView
        android:id="@+id/big_blue_icon"
        style="@style/MaterialAnimations.Icon.Big"
        android:src="@drawable/circle"
        android:transitionName="@string/blue_name" />
```

### c) Start an activity with a shared element 

Use the `ActivityOptions.makeSceneTransitionAnimation()` method to define shared element origin view and transition name.

> MainActivity.java

```java

blueIconImageView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Intent i = new Intent(MainActivity.this, SharedElementActivity.class);

        View sharedView = blueIconImageView;
        String transitionName = getString(R.string.blue_name);

        ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(MainActivity.this, sharedView, transitionName);
        startActivity(i, transitionActivityOptions.toBundle());
    }
});

```


Just that code will produce this beautiful transition animation:

![a to b with shared element][shared_element_anim]

As you can see, Transition framework is creating and executing an animation to create the illusion that views are moving and changing shape from one activity to the other

## Shared elements between fragments

Shared element transition works with Fragments in a very similar way as it does with activities. 

Steps **a)** and **b)** are exactly the **same**. Only **c)** changes			

### a) Enable Window Content Transition

> values/styles.xml

```xml
<style name="MaterialAnimations" parent="@style/Theme.AppCompat.Light.NoActionBar">
    ...
    <item name="android:windowContentTransitions">true</item>
    ...
</style>
```

### b) Define a common transition name

> layout/fragment_a.xml

```xml
<ImageView
        android:id="@+id/small_blue_icon"
        style="@style/MaterialAnimations.Icon.Small"
        android:src="@drawable/circle"
        android:transitionName="@string/blue_name" />
```

> layout/fragment_b.xml

```xml
<ImageView
        android:id="@+id/big_blue_icon"
        style="@style/MaterialAnimations.Icon.Big"
        android:src="@drawable/circle"
        android:transitionName="@string/blue_name" />
```

###  c) Start a fragment with a shared element

To do this you need to include shared element transition information as part of the **`FragmentTransaction`** process.

```java
FragmentB fragmentB = FragmentB.newInstance(sample);

// Defines enter transition for all fragment views
Slide slideTransition = new Slide(Gravity.RIGHT);
slideTransition.setDuration(1000);
sharedElementFragment2.setEnterTransition(slideTransition);

// Defines enter transition only for shared element
ChangeBounds changeBoundsTransition = TransitionInflater.from(this).inflateTransition(R.transition.change_bounds);
fragmentB.setSharedElementEnterTransition(changeBoundsTransition);

getFragmentManager().beginTransaction()
        .replace(R.id.content, fragmentB)
        .addSharedElement(blueView, getString(R.string.blue_name))
        .commit();
```

And this is the final result:

![shared_element_no_overlap]

## Allow Transition Overlap

You can define if enter and exit transitions can overlap each other. 

From [Android documentation](http://developer.android.com/intl/ko/reference/android/app/Fragment.html#getAllowEnterTransitionOverlap()):
> When **true**, the enter transition will start as soon as possible. 
> 
> When **false**, the enter transition will wait until the exit transition completes before starting.

This works for both Fragments and Activities shared element transitions.

```java
FragmentB fragmentB = FragmentB.newInstance(sample);

// Defines enter transition for all fragment views
Slide slideTransition = new Slide(Gravity.RIGHT);
slideTransition.setDuration(1000);
sharedElementFragment2.setEnterTransition(slideTransition);

// Defines enter transition only for shared element
ChangeBounds changeBoundsTransition = TransitionInflater.from(this).inflateTransition(R.transition.change_bounds);
fragmentB.setSharedElementEnterTransition(changeBoundsTransition);

// Prevent transitions for overlapping
fragmentB.setAllowEnterTransitionOverlap(overlap);
fragmentB.setAllowReturnTransitionOverlap(overlap);

getFragmentManager().beginTransaction()
        .replace(R.id.content, fragmentB)
        .addSharedElement(blueView, getString(R.string.blue_name))
        .commit();
```

It is very easy to spot the difference in this example:

Overlap True | Overlap False
--- | --- 
Fragment_2 appears on top of Fragment_1 | Fragment_2 waits until Fragment_1 is gone
![shared_element_overlap] | ![shared_element_no_overlap]
 


## 3. Animate view layout elements

### Scenes
Transition Framework can also be used to animate element changes within current activity layout. 

Transitions happen between scenes. A scene is just a regular layout which **defines a static state of our UI**. You can transition from one scene to another and Transition Framework will animate views in between.

```java
scene1 = Scene.getSceneForLayout(sceneRoot, R.layout.activity_animations_scene1, this);
scene2 = Scene.getSceneForLayout(sceneRoot, R.layout.activity_animations_scene2, this);
scene3 = Scene.getSceneForLayout(sceneRoot, R.layout.activity_animations_scene3, this);
scene4 = Scene.getSceneForLayout(sceneRoot, R.layout.activity_animations_scene4, this);

(...)

@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.button1:
            TransitionManager.go(scene1, new ChangeBounds());
            break;
        case R.id.button2:
            TransitionManager.go(scene2, TransitionInflater.from(this).inflateTransition(R.transition.slide_and_changebounds));
            break;
        case R.id.button3:
            TransitionManager.go(scene3, TransitionInflater.from(this).inflateTransition(R.transition.slide_and_changebounds_sequential));
            break;
        case R.id.button4:
            TransitionManager.go(scene4, TransitionInflater.from(this).inflateTransition(R.transition.slide_and_changebounds_sequential_with_interpolators));
            break;  
    }
}
```

That code would produce transition between four scenes in the same activity. Each transition has a different animation defined. 

Transition Framework will take all visible views in current scene and calculate whatever necessary animations are needed to arrange those views according to next scene.

![scenes_anim]


### Layout changes

Transition Framework can also be used to animate layout property changes in a view. You just need to make whatever changes you want and it will perform necessary animations for you

#### a) Begin Delayed Transition

With just this line of code we are telling the framework we are going to perform some UI changes that it will need to animate.

```java
TransitionManager.beginDelayedTransition(sceneRoot);
```
#### b) Change view layout properties


```java
ViewGroup.LayoutParams params = greenIconView.getLayoutParams();
params.width = 200;
greenIconView.setLayoutParams(params);

```

Changing view width attribute to make it smaller will trigger a `layoutMeasure`. At that point the Transition framework will record start and ending values and will create an animation to transition from one to another.

    
![view layout animation][view_layout_anim]


## 4. (Bonus) Shared elements + Circular Reveal
Circular Reveal is just an animation to show or hide a group of UI elements. It is available since API 21 in `ViewAnimationUtils` class. 


Circular Reveal animation can be used in combination of Shared Element Transition to create meaningful animations that smoothly teach the user what is happening in the app.

![reveal_shared_anim]

What is happening in this example step by step is:

* Orange circle is a shared element transitioning from `MainActivity` to `RevealActivity`.
* On `RevealActivity` there is a listener to listen for shared element transition end. When that happens it does two things:
  * Execute a Circular Reveal animation for the Toolbar
  * Execute a scale up animation on `RevealActivity` views using plain old `ViewPropertyAnimator`


> Listen to shared element enter transition end

```java
Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.changebounds_with_arcmotion);
getWindow().setSharedElementEnterTransition(transition);
transition.addListener(new Transition.TransitionListener() {
    @Override
    public void onTransitionEnd(Transition transition) {
        animateRevealShow(toolbar);
        animateButtonsIn();
    }
    
    (...)

});
        
```

> Reveal Toolbar

```java
private void animateRevealShow(View viewRoot) {
    int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
    int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
    int finalRadius = Math.max(viewRoot.getWidth(), viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, 0, finalRadius);
    viewRoot.setVisibility(View.VISIBLE);
    anim.setDuration(1000);
    anim.setInterpolator(new AccelerateInterpolator());
    anim.start();
}
```  

> Scale up activity layout views

```java
private void animateButtonsIn() {
    for (int i = 0; i < bgViewGroup.getChildCount(); i++) {
        View child = bgViewGroup.getChildAt(i);
        child.animate()
                .setStartDelay(100 + i * DELAY)
                .setInterpolator(interpolator)
                .alpha(1)
                .scaleX(1)
                .scaleY(1);
    }
}
```

### More circular reveal animations

There are many different ways you can create a reveal animation. The important thing is to use the animation to help the user understand what is happening in the app.

#### Circular Reveal from the middle of target view

![reveal_green]

```java
int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
int cy = viewRoot.getTop();
int finalRadius = Math.max(viewRoot.getWidth(), viewRoot.getHeight());

Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, 0, finalRadius);
viewRoot.setBackgroundColor(color);
anim.start();
```        

#### Circular Reveal from top of target view + animations

![reveal_blue]

```java
int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
int finalRadius = Math.max(viewRoot.getWidth(), viewRoot.getHeight());

Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, 0, finalRadius);
viewRoot.setBackgroundColor(color);
anim.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
        animateButtonsIn();
    }
});
anim.start();
``` 


#### Circular Reveal from touch point

![reveal_yellow]

```java
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
    if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
        if (view.getId() == R.id.square_yellow) {
            revealFromCoordinates(motionEvent.getRawX(), motionEvent.getRawY());
        }
    }
    return false;
}
```

```java 
private Animator animateRevealColorFromCoordinates(int x, int y) {
    float finalRadius = (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, x, y, 0, finalRadius);
    viewRoot.setBackgroundColor(color);
    anim.start();
}
```       

#### Animate and Reveal

![reveal_red]

```java
Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.changebounds_with_arcmotion);
transition.addListener(new Transition.TransitionListener() {
    @Override
    public void onTransitionEnd(Transition transition) {
        animateRevealColor(bgViewGroup, R.color.red);
    }
    (...)
   
});
TransitionManager.beginDelayedTransition(bgViewGroup, transition);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
btnRed.setLayoutParams(layoutParams);
```         
  

# Sample source code

**[https://github.com/lgvalle/Material-Animations](https://github.com/lgvalle/Material-Animations/)**


# More information

  * Alex Lockwood posts about Transition Framework. A great in deep into this topic: [http://www.androiddesignpatterns.com/2014/12/activity-fragment-transitions-in-android-lollipop-part1.html](http://www.androiddesignpatterns.com/2014/12/activity-fragment-transitions-in-android-lollipop-part1.html)
  * Amazing repository with lot of Material Design samples by Saul Molinero: [https://github.com/saulmm/Android-Material-Examples](https://github.com/saulmm/Android-Material-Examples)
  * Chet Hasse video explaining Transition framework: [https://www.youtube.com/watch?v=S3H7nJ4QaD8](https://www.youtube.com/watch?v=S3H7nJ4QaD8)



[transition-framework]: https://developer.android.com/training/transitions/overview.html

[explode_link]: https://developer.android.com/reference/android/transition/Explode.html
[fade_link]: https://developer.android.com/reference/android/transition/Fade.html
[slide_link]: https://developer.android.com/reference/android/transition/Slide.html

[transition_explode]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/transition_explode.gif
[transition_slide]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/transition_slide.gif
[transition_fade]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/transition_fade.gif
[transition_fade2]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/transition_fade2.gif
[transition_a_to_b]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/transition_A_to_B.png
[transition_b_to_a]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/transition_B_to_A.png

[shared_element]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/shared_element.png
[shared_element_anim]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/shared_element_anim.gif
[shared_element_no_overlap]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/shared_element_no_overlap.gif
[shared_element_overlap]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/shared_element_overlap.gif

[scenes_anim]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/scenes_anim.gif
[view_layout_anim]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/view_layout_anim.gif

[reveal_blue]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/reveal_blue.gif
[reveal_red]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/reveal_red.gif
[reveal_green]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/reveal_green.gif
[reveal_yellow]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/reveal_yellow.gif
[reveal_shared_anim]: https://raw.githubusercontent.com/lgvalle/Material-Animations/master/screenshots/shared_reveal_anim.gif


================================================
FILE: app/.gitignore
================================================
/build


================================================
FILE: app/build.gradle
================================================
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.lgvalle.material_animations"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
}


================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/lgvalle/Developer/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}


================================================
FILE: app/src/androidTest/java/com/lgvalle/material_animations/ApplicationTest.java
================================================
package com.lgvalle.material_animations;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
 * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
 */
public class ApplicationTest extends ApplicationTestCase<Application> {
    public ApplicationTest() {
        super(Application.class);
    }
}

================================================
FILE: app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.lgvalle.material_animations">

    <application
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/MaterialAnimations">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".TransitionActivity1"
            android:theme="@style/MaterialAnimations.Red" />
        <activity
            android:name=".TransitionActivity2"
            android:theme="@style/MaterialAnimations.Red" />
        <activity
            android:name=".TransitionActivity3"
            android:theme="@style/MaterialAnimations.Red" />
        <activity
            android:name=".SharedElementActivity"
            android:theme="@style/MaterialAnimations.Blue" />

        <activity
            android:name=".AnimationsActivity1"
            android:theme="@style/MaterialAnimations.Green" />

        <activity
            android:name=".AnimationsActivity2"
            android:theme="@style/MaterialAnimations.Green" />

        <activity
            android:name=".RevealActivity"
            android:theme="@style/MaterialAnimations.Yellow" />
    </application>

</manifest>


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/AnimationsActivity1.java
================================================
package com.lgvalle.material_animations;

import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.transition.Fade;
import android.transition.TransitionManager;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.lgvalle.material_animations.databinding.ActivityAnimations1Binding;

public class AnimationsActivity1 extends BaseDetailActivity {
    private ImageView square;
    private ViewGroup viewRoot;
    private boolean sizeChanged;
    private int savedWidth;
    private boolean positionChanged;
    private Sample sample;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bindData();
        setupWindowAnimations();
        setupLayout();
        setupToolbar();
    }

    private void setupWindowAnimations() {
        getWindow().setReenterTransition(new Fade());
    }

    private void bindData() {
        ActivityAnimations1Binding binding = DataBindingUtil.setContentView(this, R.layout.activity_animations1);
        sample = (Sample) getIntent().getExtras().getSerializable(EXTRA_SAMPLE);
        binding.setAnimationsSample(sample);
    }

    private void setupLayout() {
        square = (ImageView) findViewById(R.id.square_green);
        viewRoot = (ViewGroup) findViewById(R.id.sample3_root);
        findViewById(R.id.sample3_button1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                changeLayout();
            }
        });
        findViewById(R.id.sample3_button2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                changePosition();
            }
        });

        findViewById(R.id.sample3_button3).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(AnimationsActivity1.this, AnimationsActivity2.class);
                i.putExtra(EXTRA_SAMPLE, sample);
                transitionTo(i);
            }
        });
    }

    private void changeLayout() {
        TransitionManager.beginDelayedTransition(viewRoot);

        ViewGroup.LayoutParams params = square.getLayoutParams();
        if (sizeChanged) {
            params.width = savedWidth;
        } else {
            savedWidth = params.width;
            params.width = 200;
        }
        sizeChanged = !sizeChanged;
        square.setLayoutParams(params);
    }

    private void changePosition() {
        TransitionManager.beginDelayedTransition(viewRoot);

        LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) square.getLayoutParams();
        if (positionChanged) {
            lp.gravity = Gravity.CENTER;
        } else {
            lp.gravity = Gravity.LEFT;
        }
        positionChanged = !positionChanged;
        square.setLayoutParams(lp);
    }



}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/AnimationsActivity2.java
================================================
package com.lgvalle.material_animations;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.transition.ChangeBounds;
import android.transition.Scene;
import android.transition.Transition;
import android.transition.TransitionInflater;
import android.transition.TransitionManager;
import android.view.View;
import android.view.ViewGroup;

import com.lgvalle.material_animations.databinding.ActivityAnimations2Binding;

import java.util.ArrayList;
import java.util.List;

public class AnimationsActivity2 extends BaseDetailActivity {

    private static final int DELAY = 100;
    private Scene scene0;
    private Scene scene1;
    private Scene scene2;
    private Scene scene3;
    private Scene scene4;
    private final List<View> viewsToAnimate = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bindData();
        setupLayout();
        setupToolbar();
        setupWindowAnimations();
    }

    private void bindData() {
        ActivityAnimations2Binding binding = DataBindingUtil.setContentView(
                this, R.layout.activity_animations2);
        Sample sample = (Sample) getIntent().getExtras().getSerializable(EXTRA_SAMPLE);
        binding.setAnimationsSample(sample);
    }

    private void setupWindowAnimations() {
        getWindow().setEnterTransition(TransitionInflater.from(this).inflateTransition(
                R.transition.slide_from_bottom));
        getWindow().getEnterTransition().addListener(new Transition.TransitionListener() {
            @Override
            public void onTransitionStart(Transition transition) {
            }

            @Override
            public void onTransitionCancel(Transition transition) {
            }

            @Override
            public void onTransitionPause(Transition transition) {
            }

            @Override
            public void onTransitionResume(Transition transition) {
            }

            @Override
            public void onTransitionEnd(Transition transition) {
                getWindow().getEnterTransition().removeListener(this);
                TransitionManager.go(scene0);
            }
        });
    }

    private void setupLayout() {
        final ViewGroup activityRoot = (ViewGroup) findViewById(R.id.buttons_group);
        ViewGroup sceneRoot = (ViewGroup) findViewById(R.id.scene_root);

        scene0 = Scene.getSceneForLayout(sceneRoot, R.layout.activity_animations_scene0, this);
        scene0.setEnterAction(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < viewsToAnimate.size(); i++) {
                    View child = viewsToAnimate.get(i);
                    child.animate()
                            .setStartDelay(i * DELAY)
                            .scaleX(1)
                            .scaleY(1);

                }
            }
        });
        scene0.setExitAction(new Runnable() {
            @Override
            public void run() {
                TransitionManager.beginDelayedTransition(activityRoot);
                View title = scene0.getSceneRoot().findViewById(R.id.scene0_title);
                title.setScaleX(0);
                title.setScaleY(0);
            }
        });


        scene1 = Scene.getSceneForLayout(sceneRoot, R.layout.activity_animations_scene1, this);
        scene2 = Scene.getSceneForLayout(sceneRoot, R.layout.activity_animations_scene2, this);
        scene3 = Scene.getSceneForLayout(sceneRoot, R.layout.activity_animations_scene3, this);
        scene4 = Scene.getSceneForLayout(sceneRoot, R.layout.activity_animations_scene4, this);

        View button1 = findViewById(R.id.sample3_button1);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                TransitionManager.go(scene1, new ChangeBounds());
            }
        });
        View button2 = findViewById(R.id.sample3_button2);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                TransitionManager.go(scene2, TransitionInflater.from(AnimationsActivity2.this).
                        inflateTransition(R.transition.slide_and_changebounds));
            }
        });

        View button3 = findViewById(R.id.sample3_button3);
        button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                TransitionManager.go(scene3, TransitionInflater.from(AnimationsActivity2.this).
                        inflateTransition(R.transition.slide_and_changebounds_sequential));
            }
        });

        View button4 = findViewById(R.id.sample3_button4);
        button4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                TransitionManager.go(scene4, TransitionInflater.from(AnimationsActivity2.this).
                        inflateTransition(R.transition.slide_and_changebounds_sequential_with_interpolators));
            }
        });

        viewsToAnimate.add(button1);
        viewsToAnimate.add(button2);
        viewsToAnimate.add(button3);
        viewsToAnimate.add(button4);
    }
}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/BaseDetailActivity.java
================================================
package com.lgvalle.material_animations;

import android.content.Intent;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.util.Pair;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

/**
 * Created by lgvalle on 12/09/15.
 */
public class BaseDetailActivity extends AppCompatActivity {
    static final String EXTRA_SAMPLE = "sample";
    static final String EXTRA_TYPE = "type";
    static final int TYPE_PROGRAMMATICALLY = 0;
    static final int TYPE_XML = 1;

    void setupToolbar() {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
    }

    @Override
    public boolean onSupportNavigateUp() {
        onBackPressed();
        return true;
    }

    @SuppressWarnings("unchecked") void transitionTo(Intent i) {
        final Pair<View, String>[] pairs = TransitionHelper.createSafeTransitionParticipants(this, true);
        ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(this, pairs);
        startActivity(i, transitionActivityOptions.toBundle());
    }
}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/MainActivity.java
================================================
package com.lgvalle.material_animations;

import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.transition.Slide;
import android.view.Gravity;

import java.util.Arrays;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private List<Sample> samples;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setupWindowAnimations();
        setupSamples();
        setupToolbar();
        setupLayout();
    }

    private void setupWindowAnimations() {
        // Re-enter transition is executed when returning to this activity
        Slide slideTransition = new Slide();
        slideTransition.setSlideEdge(Gravity.LEFT);
        slideTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long));
        getWindow().setReenterTransition(slideTransition);
        getWindow().setExitTransition(slideTransition);
    }

    private void setupSamples() {
        samples = Arrays.asList(
                new Sample(ContextCompat.getColor(this, R.color.sample_red), "Transitions"),
                new Sample(ContextCompat.getColor(this, R.color.sample_blue), "Shared Elements"),
                new Sample(ContextCompat.getColor(this, R.color.sample_green), "View animations"),
                new Sample(ContextCompat.getColor(this, R.color.sample_yellow), "Circular Reveal Animation")
        );
    }

    private void setupToolbar() {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
    }

    private void setupLayout() {
        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.sample_list);
        recyclerView.setHasFixedSize(true);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        SamplesRecyclerAdapter samplesRecyclerAdapter = new SamplesRecyclerAdapter(this, samples);
        recyclerView.setAdapter(samplesRecyclerAdapter);
    }
}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/RevealActivity.java
================================================
package com.lgvalle.material_animations;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.ColorRes;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.Toolbar;
import android.transition.Fade;
import android.transition.Transition;
import android.transition.TransitionInflater;
import android.transition.TransitionManager;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.lgvalle.material_animations.databinding.ActivityRevealBinding;


public class RevealActivity extends BaseDetailActivity implements View.OnTouchListener {
    private static final int DELAY = 100;
    private RelativeLayout bgViewGroup;
    private Toolbar toolbar;
    private Interpolator interpolator;
    private TextView body;
    private View btnRed;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bindData();
        setupWindowAnimations();
        setupLayout();
        setupToolbar();
    }

    private void bindData() {
        ActivityRevealBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_reveal);
        Sample sample = (Sample) getIntent().getExtras().getSerializable(EXTRA_SAMPLE);
        binding.setReveal1Sample(sample);
    }

    private void setupWindowAnimations() {
        interpolator = AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in);
        setupEnterAnimations();
        setupExitAnimations();
    }

    private void setupEnterAnimations() {
        Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.changebounds_with_arcmotion);
        getWindow().setSharedElementEnterTransition(transition);
        transition.addListener(new Transition.TransitionListener() {
            @Override
            public void onTransitionStart(Transition transition) {
            }

            @Override
            public void onTransitionEnd(Transition transition) {
                // Removing listener here is very important because shared element transition is executed again backwards on exit. If we don't remove the listener this code will be triggered again.
                transition.removeListener(this);
                hideTarget();
                animateRevealShow(toolbar);
                animateButtonsIn();
            }

            @Override
            public void onTransitionCancel(Transition transition) {
            }

            @Override
            public void onTransitionPause(Transition transition) {
            }

            @Override
            public void onTransitionResume(Transition transition) {
            }
        });
    }

    private void setupExitAnimations() {
        Fade returnTransition = new Fade();
        getWindow().setReturnTransition(returnTransition);
        returnTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
        returnTransition.setStartDelay(getResources().getInteger(R.integer.anim_duration_medium));
        returnTransition.addListener(new Transition.TransitionListener() {
            @Override
            public void onTransitionStart(Transition transition) {
                transition.removeListener(this);
                animateButtonsOut();
                animateRevealHide(bgViewGroup);
            }

            @Override
            public void onTransitionEnd(Transition transition) {
            }

            @Override
            public void onTransitionCancel(Transition transition) {
            }

            @Override
            public void onTransitionPause(Transition transition) {
            }

            @Override
            public void onTransitionResume(Transition transition) {
            }
        });
    }

    private void setupLayout() {
        bgViewGroup = (RelativeLayout) findViewById(R.id.reveal_root);
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        body = ((TextView) findViewById(R.id.sample_body));
        View btnGreen = findViewById(R.id.square_green);
        btnGreen.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                revealGreen();
            }
        });
        btnRed = findViewById(R.id.square_red);
        btnRed.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                revealRed();
            }
        });
        View btnBlue = findViewById(R.id.square_blue);
        btnBlue.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                revealBlue();
            }
        });
        findViewById(R.id.square_yellow).setOnTouchListener(this);
    }

    private void revealBlue() {
        animateButtonsOut();
        Animator anim = animateRevealColorFromCoordinates(bgViewGroup, R.color.sample_blue, bgViewGroup.getWidth() / 2, 0);
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                animateButtonsIn();
            }
        });
        body.setText(R.string.reveal_body4);
        body.setTextColor(ContextCompat.getColor(this, R.color.theme_blue_background));
    }

    private void revealRed() {
        final ViewGroup.LayoutParams originalParams = btnRed.getLayoutParams();
        Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.changebounds_with_arcmotion);
        transition.addListener(new Transition.TransitionListener() {
            @Override
            public void onTransitionStart(Transition transition) {
            }

            @Override
            public void onTransitionEnd(Transition transition) {
                animateRevealColor(bgViewGroup, R.color.sample_red);
                body.setText(R.string.reveal_body3);
                body.setTextColor(ContextCompat.getColor(RevealActivity.this, R.color.theme_red_background));
                btnRed.setLayoutParams(originalParams);
            }

            @Override
            public void onTransitionCancel(Transition transition) {
            }

            @Override
            public void onTransitionPause(Transition transition) {

            }

            @Override
            public void onTransitionResume(Transition transition) {

            }
        });
        TransitionManager.beginDelayedTransition(bgViewGroup, transition);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
        btnRed.setLayoutParams(layoutParams);
    }

    private void revealYellow(float x, float y) {
        animateRevealColorFromCoordinates(bgViewGroup, R.color.sample_yellow, (int) x, (int) y);
        body.setText(R.string.reveal_body1);
        body.setTextColor(ContextCompat.getColor(this, R.color.theme_yellow_background));
    }

    private void revealGreen() {
        animateRevealColor(bgViewGroup, R.color.sample_green);
        body.setText(R.string.reveal_body2);
        body.setTextColor(ContextCompat.getColor(this, R.color.theme_green_background));
    }

    private void hideTarget() {
        findViewById(R.id.shared_target).setVisibility(View.GONE);
    }

    private void animateButtonsIn() {
        for (int i = 0; i < bgViewGroup.getChildCount(); i++) {
            View child = bgViewGroup.getChildAt(i);
            child.animate()
                    .setStartDelay(100 + i * DELAY)
                    .setInterpolator(interpolator)
                    .alpha(1)
                    .scaleX(1)
                    .scaleY(1);
        }
    }

    private void animateButtonsOut() {
        for (int i = 0; i < bgViewGroup.getChildCount(); i++) {
            View child = bgViewGroup.getChildAt(i);
            child.animate()
                    .setStartDelay(i)
                    .setInterpolator(interpolator)
                    .alpha(0)
                    .scaleX(0f)
                    .scaleY(0f);
        }
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
            if (view.getId() == R.id.square_yellow) {
                revealYellow(motionEvent.getRawX(), motionEvent.getRawY());
            }
        }
        return false;
    }

    private void animateRevealShow(View viewRoot) {
        int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
        int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
        int finalRadius = Math.max(viewRoot.getWidth(), viewRoot.getHeight());

        Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, 0, finalRadius);
        viewRoot.setVisibility(View.VISIBLE);
        anim.setDuration(getResources().getInteger(R.integer.anim_duration_long));
        anim.setInterpolator(new AccelerateInterpolator());
        anim.start();
    }

    private void animateRevealColor(ViewGroup viewRoot, @ColorRes int color) {
        int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
        int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
        animateRevealColorFromCoordinates(viewRoot, color, cx, cy);
    }

    private Animator animateRevealColorFromCoordinates(ViewGroup viewRoot, @ColorRes int color, int x, int y) {
        float finalRadius = (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight());

        Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, x, y, 0, finalRadius);
        viewRoot.setBackgroundColor(ContextCompat.getColor(this, color));
        anim.setDuration(getResources().getInteger(R.integer.anim_duration_long));
        anim.setInterpolator(new AccelerateDecelerateInterpolator());
        anim.start();
        return anim;
    }

    private void animateRevealHide(final View viewRoot) {
        int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
        int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
        int initialRadius = viewRoot.getWidth();

        Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, initialRadius, 0);
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                viewRoot.setVisibility(View.INVISIBLE);
            }
        });
        anim.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
        anim.start();
    }
}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/Sample.java
================================================
package com.lgvalle.material_animations;

import android.databinding.BindingAdapter;
import android.support.annotation.ColorRes;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.widget.ImageView;

import java.io.Serializable;

/**
 * Created by lgvalle on 04/09/15.
 */
public class Sample implements Serializable {

    final int color;
    private final String name;

    public Sample(@ColorRes int color, String name) {
        this.color = color;
        this.name = name;
    }

    @BindingAdapter("bind:colorTint")
    public static void setColorTint(ImageView view, @ColorRes int color) {
        DrawableCompat.setTint(view.getDrawable(), color);
        //view.setColorFilter(color, PorterDuff.Mode.SRC_IN);
    }

    public String getName() {
        return name;
    }

    public int getColor() {
        return color;
    }


}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/SamplesRecyclerAdapter.java
================================================
package com.lgvalle.material_animations;

import android.app.Activity;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.util.Pair;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.lgvalle.material_animations.databinding.RowSampleBinding;

import java.util.List;

public class SamplesRecyclerAdapter extends RecyclerView.Adapter<SamplesRecyclerAdapter.SamplesViewHolder> {
    private final Activity activity;
    private final List<Sample> samples;

    public SamplesRecyclerAdapter(Activity activity, List<Sample> samples) {
        this.activity = activity;
        this.samples = samples;
    }

    @Override
    public SamplesViewHolder onCreateViewHolder(ViewGroup parent, int position) {
        RowSampleBinding binding = RowSampleBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
        return new SamplesViewHolder(binding.getRoot());
    }

    @Override
    public void onBindViewHolder(final SamplesViewHolder viewHolder, final int position) {
        final Sample sample = samples.get(viewHolder.getAdapterPosition());
        viewHolder.binding.setSample(sample);
        viewHolder.binding.sampleLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (viewHolder.getAdapterPosition()) {
                    case 0:
                        transitionToActivity(TransitionActivity1.class, sample);
                        break;
                    case 1:
                        transitionToActivity(SharedElementActivity.class, viewHolder, sample);
                        break;
                    case 2:
                        transitionToActivity(AnimationsActivity1.class, sample);
                        break;
                    case 3:
                        transitionToActivity(RevealActivity.class, viewHolder, sample, R.string.transition_reveal1);
                        break;
                }
            }
        });
    }

    private void transitionToActivity(Class target, Sample sample) {
        final Pair<View, String>[] pairs = TransitionHelper.createSafeTransitionParticipants(activity, true);
        startActivity(target, pairs, sample);
    }


    private void transitionToActivity(Class target, SamplesViewHolder viewHolder, Sample sample, int transitionName) {
        final Pair<View, String>[] pairs = TransitionHelper.createSafeTransitionParticipants(activity, false,
                new Pair<>(viewHolder.binding.sampleIcon, activity.getString(transitionName)));
        startActivity(target, pairs, sample);
    }

    private void transitionToActivity(Class target, SamplesViewHolder viewHolder, Sample sample) {
        final Pair<View, String>[] pairs = TransitionHelper.createSafeTransitionParticipants(activity, false,
                new Pair<>(viewHolder.binding.sampleIcon, activity.getString(R.string.square_blue_name)),
                new Pair<>(viewHolder.binding.sampleName, activity.getString(R.string.sample_blue_title)));
        startActivity(target, pairs, sample);
    }

    private void startActivity(Class target, Pair<View, String>[] pairs, Sample sample) {
        Intent i = new Intent(activity, target);
        ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pairs);
        i.putExtra("sample", sample);
        activity.startActivity(i, transitionActivityOptions.toBundle());
    }

    @Override
    public int getItemCount() {
        return samples.size();
    }


    public class SamplesViewHolder extends RecyclerView.ViewHolder {
        final RowSampleBinding binding;

        public SamplesViewHolder(View rootView) {
            super(rootView);
            binding = DataBindingUtil.bind(rootView);

        }
    }
}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/SharedElementActivity.java
================================================
package com.lgvalle.material_animations;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.transition.ChangeBounds;
import android.transition.Slide;
import android.view.Gravity;

import com.lgvalle.material_animations.databinding.ActivitySharedelementBinding;

public class SharedElementActivity extends BaseDetailActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Sample sample = (Sample) getIntent().getExtras().getSerializable(EXTRA_SAMPLE);
        bindData(sample);
        setupWindowAnimations();
        setupLayout(sample);
        setupToolbar();
    }

    private void bindData(Sample sample) {
        ActivitySharedelementBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_sharedelement);
        binding.setSharedSample(sample);
    }

    private void setupWindowAnimations() {
        // We are not interested in defining a new Enter Transition. Instead we change default transition duration
        getWindow().getEnterTransition().setDuration(getResources().getInteger(R.integer.anim_duration_long));
    }

    private void setupLayout(Sample sample) {
        // Transition for fragment1
        Slide slideTransition = new Slide(Gravity.LEFT);
        slideTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long));
        // Create fragment and define some of it transitions
        SharedElementFragment1 sharedElementFragment1 = SharedElementFragment1.newInstance(sample);
        sharedElementFragment1.setReenterTransition(slideTransition);
        sharedElementFragment1.setExitTransition(slideTransition);
        sharedElementFragment1.setSharedElementEnterTransition(new ChangeBounds());

        getSupportFragmentManager().beginTransaction()
                .replace(R.id.sample2_content, sharedElementFragment1)
                .commit();
    }
}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/SharedElementFragment1.java
================================================
package com.lgvalle.material_animations;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.transition.ChangeBounds;
import android.transition.Slide;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

/**
 * Created by lgvalle on 05/09/15.
 */
public class SharedElementFragment1 extends Fragment {

    private static final String EXTRA_SAMPLE = "sample";

    public static SharedElementFragment1 newInstance(Sample sample) {

        Bundle args = new Bundle();

        args.putSerializable(EXTRA_SAMPLE, sample);
        SharedElementFragment1 fragment = new SharedElementFragment1();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_sharedelement_fragment1, container, false);
        final Sample sample = (Sample) getArguments().getSerializable(EXTRA_SAMPLE);

        final ImageView squareBlue = (ImageView) view.findViewById(R.id.square_blue);
        DrawableCompat.setTint(squareBlue.getDrawable(), sample.color);

        view.findViewById(R.id.sample2_button1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                addNextFragment(sample, squareBlue, false);
            }
        });

        view.findViewById(R.id.sample2_button2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                addNextFragment(sample, squareBlue, true);
            }
        });

        return view;
    }

    private void addNextFragment(Sample sample, ImageView squareBlue, boolean overlap) {
        SharedElementFragment2 sharedElementFragment2 = SharedElementFragment2.newInstance(sample);

        Slide slideTransition = new Slide(Gravity.RIGHT);
        slideTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));

        ChangeBounds changeBoundsTransition = new ChangeBounds();
        changeBoundsTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));

        sharedElementFragment2.setEnterTransition(slideTransition);
        sharedElementFragment2.setAllowEnterTransitionOverlap(overlap);
        sharedElementFragment2.setAllowReturnTransitionOverlap(overlap);
        sharedElementFragment2.setSharedElementEnterTransition(changeBoundsTransition);

        getFragmentManager().beginTransaction()
                .replace(R.id.sample2_content, sharedElementFragment2)
                .addToBackStack(null)
                .addSharedElement(squareBlue, getString(R.string.square_blue_name))
                .commit();
    }

}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/SharedElementFragment2.java
================================================
package com.lgvalle.material_animations;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

public class SharedElementFragment2 extends Fragment {
    private static final String EXTRA_SAMPLE = "sample";

    public static SharedElementFragment2 newInstance(Sample sample) {
        Bundle args = new Bundle();
        args.putSerializable(EXTRA_SAMPLE, sample);
        SharedElementFragment2 fragment = new SharedElementFragment2();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_sharedelement_fragment2, container, false);
        Sample sample = (Sample) getArguments().getSerializable(EXTRA_SAMPLE);

        ImageView squareBlue = (ImageView) view.findViewById(R.id.square_blue);
        DrawableCompat.setTint(squareBlue.getDrawable(), sample.color);

        return view;
    }

}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/TransitionActivity1.java
================================================
package com.lgvalle.material_animations;

import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.transition.Fade;
import android.transition.Slide;
import android.transition.Visibility;
import android.view.View;

import com.lgvalle.material_animations.databinding.ActivityTransition1Binding;

public class TransitionActivity1 extends BaseDetailActivity {
    private Sample sample;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bindData();
        setupWindowAnimations();
        setupLayout();
        setupToolbar();
    }

    private void bindData() {
        ActivityTransition1Binding binding = DataBindingUtil.setContentView(this, R.layout.activity_transition1);
        sample = (Sample) getIntent().getExtras().getSerializable(EXTRA_SAMPLE);
        binding.setTransition1Sample(sample);
    }

    private void setupWindowAnimations() {
        Visibility enterTransition = buildEnterTransition();
        getWindow().setEnterTransition(enterTransition);
    }


    private void setupLayout() {
        findViewById(R.id.sample1_button1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(TransitionActivity1.this, TransitionActivity2.class);
                i.putExtra(EXTRA_SAMPLE, sample);
                i.putExtra(EXTRA_TYPE, TYPE_PROGRAMMATICALLY);
                transitionTo(i);
            }
        });

        findViewById(R.id.sample1_button2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(TransitionActivity1.this, TransitionActivity2.class);
                i.putExtra(EXTRA_SAMPLE, sample);
                i.putExtra(EXTRA_TYPE, TYPE_XML);
                transitionTo(i);
            }
        });

        findViewById(R.id.sample1_button3).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(TransitionActivity1.this, TransitionActivity3.class);
                i.putExtra(EXTRA_SAMPLE, sample);
                i.putExtra(EXTRA_TYPE, TYPE_PROGRAMMATICALLY);
                transitionTo(i);
            }
        });

        findViewById(R.id.sample1_button4).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(TransitionActivity1.this, TransitionActivity3.class);
                i.putExtra(EXTRA_SAMPLE, sample);
                i.putExtra(EXTRA_TYPE, TYPE_XML);
                transitionTo(i);
            }
        });

        findViewById(R.id.sample1_button5).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Visibility returnTransition = buildReturnTransition();
                getWindow().setReturnTransition(returnTransition);

                finishAfterTransition();
            }
        });
        findViewById(R.id.sample1_button6).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                /**
                 * If no return transition is defined Android will use reversed enter transition
                 * In this case, return transition will be a reversed Slide (defined in buildEnterTransition)
                 */
                finishAfterTransition();
            }
        });
    }

    private Visibility buildEnterTransition() {
        Fade enterTransition = new Fade();
        enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long));
        // This view will not be affected by enter transition animation
        enterTransition.excludeTarget(R.id.square_red, true);
        return enterTransition;
    }

    private Visibility buildReturnTransition() {
        Visibility enterTransition = new Slide();
        enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long));
        return enterTransition;
    }
}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/TransitionActivity2.java
================================================
package com.lgvalle.material_animations;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.transition.Explode;
import android.transition.Transition;
import android.transition.TransitionInflater;
import android.view.View;

import com.lgvalle.material_animations.databinding.ActivityTransition2Binding;

public class TransitionActivity2 extends BaseDetailActivity {

    private int type;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bindData();
        setupWindowAnimations();
        setupLayout();
        setupToolbar();
    }

    private void bindData() {
        ActivityTransition2Binding binding = DataBindingUtil.setContentView(this, R.layout.activity_transition2);
        Sample sample = (Sample) getIntent().getExtras().getSerializable(EXTRA_SAMPLE);
        type = getIntent().getExtras().getInt(EXTRA_TYPE);
        binding.setTransition2Sample(sample);
    }

    private void setupWindowAnimations() {
        Transition transition;

        if (type == TYPE_PROGRAMMATICALLY) {
            transition = buildEnterTransition();
        }  else {
            transition = TransitionInflater.from(this).inflateTransition(R.transition.explode);
        }
        getWindow().setEnterTransition(transition);
    }

    private void setupLayout() {
        findViewById(R.id.exit_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finishAfterTransition();
            }
        });
    }

    private Transition buildEnterTransition() {
        Explode enterTransition = new Explode();
        enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long));
        return enterTransition;
    }

}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/TransitionActivity3.java
================================================
package com.lgvalle.material_animations;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.transition.Slide;
import android.transition.Transition;
import android.transition.TransitionInflater;
import android.transition.Visibility;
import android.view.Gravity;
import android.view.View;

import com.lgvalle.material_animations.databinding.ActivityTransition3Binding;

public class TransitionActivity3 extends BaseDetailActivity {

    private int type;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bindData();
        setupWindowAnimations();
        setupLayout();
        setupToolbar();
    }

    private void bindData() {
        ActivityTransition3Binding binding = DataBindingUtil.setContentView(this, R.layout.activity_transition3);
        Sample sample = (Sample) getIntent().getExtras().getSerializable(EXTRA_SAMPLE);
        type = getIntent().getExtras().getInt(EXTRA_TYPE);
        binding.setTransition3Sample(sample);
    }

    private void setupWindowAnimations() {
        Transition transition;

        if (type == TYPE_PROGRAMMATICALLY) {
            transition = buildEnterTransition();
        }  else {
            transition = TransitionInflater.from(this).inflateTransition(R.transition.slide_from_bottom);
        }
        getWindow().setEnterTransition(transition);
    }

    private void setupLayout() {
        findViewById(R.id.exit_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finishAfterTransition();
            }
        });
    }

    private Visibility buildEnterTransition() {
        Slide enterTransition = new Slide();
        enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long));
        enterTransition.setSlideEdge(Gravity.RIGHT);
        return enterTransition;
    }

}


================================================
FILE: app/src/main/java/com/lgvalle/material_animations/TransitionHelper.java
================================================
/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.lgvalle.material_animations;

import android.app.Activity;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.Pair;
import android.view.View;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Helper class for creating content transitions used with {@link android.app.ActivityOptions}.
 */
class TransitionHelper {

    /**
     * Create the transition participants required during a activity transition while
     * avoiding glitches with the system UI.
     *
     * @param activity The activity used as start for the transition.
     * @param includeStatusBar If false, the status bar will not be added as the transition
     *        participant.
     * @return All transition participants.
     */
    public static Pair<View, String>[] createSafeTransitionParticipants(@NonNull Activity activity,
                                                          boolean includeStatusBar, @Nullable Pair... otherParticipants) {
        // Avoid system UI glitches as described here:
        // https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb
        View decor = activity.getWindow().getDecorView();
        View statusBar = null;
        if (includeStatusBar) {
            statusBar = decor.findViewById(android.R.id.statusBarBackground);
        }
        View navBar = decor.findViewById(android.R.id.navigationBarBackground);

        // Create pair of transition participants.
        List<Pair> participants = new ArrayList<>(3);
        addNonNullViewToTransitionParticipants(statusBar, participants);
        addNonNullViewToTransitionParticipants(navBar, participants);
        // only add transition participants if there's at least one none-null element
        if (otherParticipants != null && !(otherParticipants.length == 1
                && otherParticipants[0] == null)) {
            participants.addAll(Arrays.asList(otherParticipants));
        }
        return participants.toArray(new Pair[participants.size()]);
    }

    private static void addNonNullViewToTransitionParticipants(View view, List<Pair> participants) {
        if (view == null) {
            return;
        }
        participants.add(new Pair<>(view, view.getTransitionName()));
    }

}


================================================
FILE: app/src/main/res/drawable/circle_24dp.xml
================================================
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
        android:fillColor="#FF000000"
        android:pathData="M12,12m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0"/>
</vector>


================================================
FILE: app/src/main/res/drawable/square.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">


    <padding
        android:left="10dp"
        android:top="10dp"
        android:right="10dp"
        android:bottom="10dp" />
    <solid android:color="@android:color/white" />
    <size
        android:width="3dp"
        android:height="3dp" />
</shape>

================================================
FILE: app/src/main/res/layout/activity_animations1.xml
================================================
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>

        <variable
            name="animationsSample"
            type="com.lgvalle.material_animations.Sample" />
    </data>

    <LinearLayout
        android:id="@+id/sample3_root"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal"
        android:orientation="vertical">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/MaterialAnimations.TextAppearance.Title"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="?android:colorPrimary"
            android:elevation="@dimen/elevation_header">

            <TextView
                android:id="@+id/title"
                style="@style/MaterialAnimations.TextAppearance.Title.Inverse"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical|start"
                android:text="@{animationsSample.name}" />

        </android.support.v7.widget.Toolbar>

        <ImageView
            android:id="@+id/square_green"
            style="@style/MaterialAnimations.Icon.Big"
            android:src="@drawable/circle_24dp"
            app:colorTint="@{animationsSample.color}" />


        <TextView
            android:id="@+id/sample_title"
            style="@style/Base.TextAppearance.AppCompat.Large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Animations" />

        <TextView
            style="@style/MaterialAnimations.Text.Body"
            android:text="Sample Activity demonstrating how to use TransitionManager to animate different view properties" />


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/sample3_button1"
                style="@style/MaterialAnimations.Button"
                android:layout_weight="1"
                android:text="Change size" />

            <Button
                android:id="@+id/sample3_button2"
                style="@style/MaterialAnimations.Button"
                android:layout_weight="1"
                android:text="Change position" />
        </LinearLayout>

        <Button
            android:id="@+id/sample3_button3"
            style="@style/MaterialAnimations.Button"
            android:text="Next (Scenes)" />

    </LinearLayout>
</layout>

================================================
FILE: app/src/main/res/layout/activity_animations2.xml
================================================
<layout xmlns:android="http://schemas.android.com/apk/res/android">

    <data>

        <variable
            name="animationsSample"
            type="com.lgvalle.material_animations.Sample" />
    </data>

    <LinearLayout
        android:id="@+id/sample3_root"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal"
        android:orientation="vertical">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/MaterialAnimations.TextAppearance.Title"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="?android:colorPrimary"
            android:elevation="@dimen/elevation_header">

            <TextView
                android:id="@+id/title"
                style="@style/MaterialAnimations.TextAppearance.Title.Inverse"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical|start"
                android:text="Scenes" />

        </android.support.v7.widget.Toolbar>

        <FrameLayout
            android:id="@+id/scene_root"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <LinearLayout
            android:layout_width="match_parent"
            android:id="@+id/buttons_group"
            android:orientation="vertical"
            android:layout_height="match_parent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <Button
                    android:id="@+id/sample3_button1"
                    style="@style/MaterialAnimations.Button.Scaled"
                    android:layout_weight="1"
                    android:text="Scene one" />

                <Button
                    android:id="@+id/sample3_button2"
                    style="@style/MaterialAnimations.Button.Scaled"
                    android:layout_weight="1"
                    android:text="Scene two" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <Button
                    android:id="@+id/sample3_button3"
                    style="@style/MaterialAnimations.Button.Scaled"
                    android:layout_weight="1"
                    android:text="Scene three" />

                <Button
                    android:id="@+id/sample3_button4"
                    style="@style/MaterialAnimations.Button.Scaled"
                    android:layout_weight="1"
                    android:text="Scene four" />
            </LinearLayout>
        </LinearLayout>

    </LinearLayout>
</layout>

================================================
FILE: app/src/main/res/layout/activity_animations_scene0.xml
================================================
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <TextView
        android:id="@+id/scene0_title"
        style="@style/MaterialAnimations.Text.Body"
        android:text="Scenes store the state of a view hierarchy, including all its views and their property values. The transitions framework can run animations between a starting and an ending scene" />

</LinearLayout>

================================================
FILE: app/src/main/res/layout/activity_animations_scene1.xml
================================================
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <ImageView
        android:id="@+id/square_green"
        style="@style/MaterialAnimations.Icon.Big"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_green" />

    <ImageView
        android:id="@+id/square_red"
        style="@style/MaterialAnimations.Icon.Big"
        android:layout_alignParentRight="true"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_red" />

    <ImageView
        android:id="@+id/square_blue"
        style="@style/MaterialAnimations.Icon.Big"
        android:layout_below="@+id/square_green"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_blue" />

    <ImageView
        android:id="@+id/square_yellow"
        style="@style/MaterialAnimations.Icon.Big"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/square_red"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_yellow" />
</RelativeLayout>

================================================
FILE: app/src/main/res/layout/activity_animations_scene2.xml
================================================
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">


    <ImageView
        android:id="@+id/square_green"
        style="@style/MaterialAnimations.Icon.Big"
        android:src="@drawable/circle_24dp"
        android:layout_alignParentRight="true"
        android:tint="@color/sample_green" />

    <ImageView
        android:id="@+id/square_blue"
        style="@style/MaterialAnimations.Icon.Big"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_blue" />

    <ImageView
        android:id="@+id/square_red"
        style="@style/MaterialAnimations.Icon.Big"
        android:layout_below="@+id/square_green"
        android:layout_alignParentRight="true"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_red" />

    <ImageView
        android:id="@+id/square_yellow"
        style="@style/MaterialAnimations.Icon.Big"
        android:layout_below="@+id/square_blue"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_yellow" />
</RelativeLayout>

================================================
FILE: app/src/main/res/layout/activity_animations_scene3.xml
================================================
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">


    <ImageView
        android:id="@+id/square_green"
        style="@style/MaterialAnimations.Icon.Big"
        android:layout_below="@id/square_blue"
        android:layout_alignParentRight="true"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_green" />

    <ImageView
        android:id="@+id/square_blue"
        style="@style/MaterialAnimations.Icon.Big"
        android:layout_alignParentRight="true"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_blue" />

    <ImageView
        android:id="@+id/square_red"
        style="@style/MaterialAnimations.Icon.Big"
        android:layout_below="@+id/square_yellow"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_red" />

    <ImageView
        android:id="@+id/square_yellow"
        style="@style/MaterialAnimations.Icon.Big"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_yellow" />
</RelativeLayout>

================================================
FILE: app/src/main/res/layout/activity_animations_scene4.xml
================================================
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">


    <ImageView
        android:id="@+id/square_green"
        style="@style/MaterialAnimations.Icon.Big"
        android:layout_below="@id/square_red"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_green" />

    <ImageView
        android:id="@+id/square_blue"
        style="@style/MaterialAnimations.Icon.Big"
        android:layout_alignParentRight="true"
        android:layout_below="@id/square_yellow"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_blue" />

    <ImageView
        android:id="@+id/square_red"
        style="@style/MaterialAnimations.Icon.Big"
        android:src="@drawable/circle_24dp"
        android:tint="@color/sample_red" />

    <ImageView
        android:id="@+id/square_yellow"
        style="@style/MaterialAnimations.Icon.Big"
        android:src="@drawable/circle_24dp"
        android:layout_alignParentRight="true"
        android:tint="@color/sample_yellow" />
</RelativeLayout>

================================================
FILE: app/src/main/res/layout/activity_main.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        style="@style/MaterialAnimations.TextAppearance.Title"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:background="@color/material_animations_primary"
        android:elevation="@dimen/elevation_header">

        <TextView
            android:id="@+id/title"
            style="@style/MaterialAnimations.TextAppearance.Title.Inverse"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|start"
            android:text="@string/app_name" />

    </android.support.v7.widget.Toolbar>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/sample_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical" />

</LinearLayout>

================================================
FILE: app/src/main/res/layout/activity_reveal.xml
================================================
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <variable
            name="reveal1Sample"
            type="com.lgvalle.material_animations.Sample" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/MaterialAnimations.TextAppearance.Title"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="?android:colorPrimary"
            android:elevation="@dimen/elevation_header">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <ImageView
                    android:id="@+id/shared_target"
                    style="@style/MaterialAnimations.Icon.Small"
                    android:layout_centerHorizontal="true"
                    android:src="@drawable/circle_24dp"
                    android:transitionName="@string/transition_reveal1"
                    app:colorTint="@{reveal1Sample.color}" />

                <TextView
                    android:id="@+id/title"
                    style="@style/MaterialAnimations.TextAppearance.Title.Inverse"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_gravity="center_vertical|start"
                    android:text="@{reveal1Sample.name}"
                    tools:text="Title" />
            </RelativeLayout>


        </android.support.v7.widget.Toolbar>


        <RelativeLayout
            android:id="@+id/reveal_root"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center_horizontal"
            android:orientation="vertical">

            <TextView
                android:id="@+id/sample_body"
                style="@style/MaterialAnimations.Text.Body"
                android:text="Sample Activity demonstrating how to create different CirculaReveal animations" />


            <ImageView
                android:id="@+id/square_green"
                style="@style/MaterialAnimations.Icon.Medium.Scaled"
                android:layout_alignParentBottom="true"
                android:src="@drawable/circle_24dp"
                android:tint="@color/sample_green" />

            <ImageView
                android:id="@+id/square_red"
                android:layout_toRightOf="@id/square_green"
                style="@style/MaterialAnimations.Icon.Medium.Scaled"
                android:layout_alignParentBottom="true"
                android:src="@drawable/circle_24dp"
                android:tint="@color/sample_red" />

            <ImageView
                android:id="@+id/square_blue"
                android:layout_toRightOf="@id/square_red"
                style="@style/MaterialAnimations.Icon.Medium.Scaled"
                android:layout_alignParentBottom="true"
                android:src="@drawable/circle_24dp"
                android:tint="@color/sample_blue" />

            <ImageView
                android:id="@+id/square_yellow"
                android:layout_toRightOf="@id/square_blue"
                style="@style/MaterialAnimations.Icon.Medium.Scaled"
                android:layout_alignParentBottom="true"
                android:src="@drawable/circle_24dp"
                android:tint="@color/sample_yellow" />
        </RelativeLayout>

    </LinearLayout>
</layout>

================================================
FILE: app/src/main/res/layout/activity_sharedelement.xml
================================================
<layout xmlns:android="http://schemas.android.com/apk/res/android">

    <data>

        <variable
            name="sharedSample"
            type="com.lgvalle.material_animations.Sample" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal"
        android:orientation="vertical">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/MaterialAnimations.TextAppearance.Title"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="?android:colorPrimary"
            android:elevation="@dimen/elevation_header">

            <TextView
                android:id="@+id/title"
                style="@style/MaterialAnimations.TextAppearance.Title.Inverse"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical|start"
                android:text="@{sharedSample.name}"
                android:transitionName="@string/sample_blue_title" />

        </android.support.v7.widget.Toolbar>

        <TextView
            style="@style/MaterialAnimations.Text.Body"
            android:text="Toolbar title is a shared element between MainActivity and this activity" />

        <FrameLayout
            android:id="@+id/sample2_content"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </LinearLayout>
</layout>

================================================
FILE: app/src/main/res/layout/activity_sharedelement_fragment1.xml
================================================
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/square_blue"
        style="@style/MaterialAnimations.Icon.Big"
        android:src="@drawable/circle_24dp"
        android:transitionName="@string/square_blue_name" />

    <TextView
        style="@style/Base.TextAppearance.AppCompat.Large"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Fragment 1" />

    <TextView
        style="@style/MaterialAnimations.Text.Body"
        android:text="Blue circle is a shared element between MainActivity and this fragment." />


    <Button
        android:id="@+id/sample2_button1"
        android:text="Next (Overlap transition = false)"
        style="@style/MaterialAnimations.Button" />

    <Button
        android:id="@+id/sample2_button2"
        android:text="Next (Overlap transition =  true)"
        style="@style/MaterialAnimations.Button" />

</LinearLayout>

================================================
FILE: app/src/main/res/layout/activity_sharedelement_fragment2.xml
================================================
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal|top"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/square_blue"
        style="@style/MaterialAnimations.Icon.Small"
        android:src="@drawable/circle_24dp"
        android:transitionName="@string/square_blue_name" />

    <TextView
        style="@style/Base.TextAppearance.AppCompat.Large"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignBottom="@+id/square_blue"
        android:layout_alignTop="@+id/square_blue"
        android:layout_gravity="center_vertical|center_horizontal"
        android:layout_toEndOf="@+id/square_blue"
        android:gravity="center_horizontal|center_vertical"
        android:text="Fragment 2" />


    <TextView
        android:id="@+id/fragment2_body1"
        style="@style/MaterialAnimations.Text.Body"
        android:layout_below="@+id/square_blue"
        android:layout_centerHorizontal="true"
        android:text="Blue circle is a shared element between two fragments" />

    <TextView
        android:id="@+id/fragment2_title"
        style="@style/MaterialAnimations.Text.Body"
        android:textStyle="bold"
        android:layout_below="@+id/fragment2_body1"
        android:text="Overlap" />

    <TextView
        style="@style/MaterialAnimations.Text.Body"
        android:layout_below="@+id/fragment2_title"
        android:layout_centerHorizontal="true"
        android:text="When true, the enter transition will start as soon as possible. When false, the enter transition will wait until the exit transition completes before starting." />

</RelativeLayout>

================================================
FILE: app/src/main/res/layout/activity_transition1.xml
================================================
<layout xmlns:android="http://schemas.android.com/apk/res/android">

    <data>

        <variable
            name="transition1Sample"
            type="com.lgvalle.material_animations.Sample" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal"
        android:orientation="vertical">


        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/MaterialAnimations.TextAppearance.Title"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="?android:colorPrimary"
            android:elevation="@dimen/elevation_header">

            <TextView
                android:id="@+id/title"
                style="@style/MaterialAnimations.TextAppearance.Title.Inverse"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical|start"
                android:text='@{transition1Sample.name}' />

        </android.support.v7.widget.Toolbar>

        <TextView
            style="@style/MaterialAnimations.Text.Body"
            android:text="This activity defines a Explode Enter Transition programmatically. Transitions can be defined either on code or on xml resource files" />


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <Button
                android:id="@+id/sample1_button1"
                style="@style/MaterialAnimations.Button"
                android:layout_weight="1"
                android:text="Explode (Code)" />

            <Button
                android:id="@+id/sample1_button2"
                style="@style/MaterialAnimations.Button"
                android:layout_weight="1"
                android:text="Explode (XML)" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

            android:orientation="horizontal">

            <Button
                android:id="@+id/sample1_button3"
                style="@style/MaterialAnimations.Button"
                android:layout_weight="1"
                android:text="Slide (Code)" />

            <Button
                android:id="@+id/sample1_button4"
                style="@style/MaterialAnimations.Button"
                android:layout_weight="1"
                android:text="Slide (XML)" />
        </LinearLayout>

        <Button
            android:id="@+id/sample1_button6"
            style="@style/MaterialAnimations.Button"
            android:text="Exit" />

        <Button
            android:id="@+id/sample1_button5"
            style="@style/MaterialAnimations.Button"
            android:text="Exit (overriding return transition)" />

    </LinearLayout>
</layout>

================================================
FILE: app/src/main/res/layout/activity_transition2.xml
================================================
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>

        <variable
            name="transition2Sample"
            type="com.lgvalle.material_animations.Sample" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal"
        android:orientation="vertical">


        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/MaterialAnimations.TextAppearance.Title"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="?android:colorPrimary"
            android:elevation="@dimen/elevation_header">

            <TextView
                android:id="@+id/title"
                style="@style/MaterialAnimations.TextAppearance.Title.Inverse"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical|start"
                android:text="@{transition2Sample.name}" />

        </android.support.v7.widget.Toolbar>

        <ImageView
            android:id="@+id/square_red"
            style="@style/MaterialAnimations.Icon.Big"
            android:src="@drawable/circle_24dp"
            app:colorTint="@{transition2Sample.color}" />

        <TextView
            android:id="@+id/activity_title"
            style="@style/Base.TextAppearance.AppCompat.Large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Explode" />

        <TextView
            style="@style/MaterialAnimations.Text.Body"
            android:text="@string/medium_text" />

        <Button
            android:id="@+id/exit_button"
            style="@style/MaterialAnimations.Button"
            android:text="Exit" />


    </LinearLayout>
</layout>

================================================
FILE: app/src/main/res/layout/activity_transition3.xml
================================================
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>

        <variable
            name="transition3Sample"
            type="com.lgvalle.material_animations.Sample" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal"
        android:orientation="vertical">


        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/MaterialAnimations.TextAppearance.Title"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="?android:colorPrimary"
            android:elevation="@dimen/elevation_header">

            <TextView
                android:id="@+id/title"
                style="@style/MaterialAnimations.TextAppearance.Title.Inverse"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical|start"
                android:text="@{transition3Sample.name}" />

        </android.support.v7.widget.Toolbar>

        <ImageView
            android:id="@+id/square_red"
            style="@style/MaterialAnimations.Icon.Big"
            android:src="@drawable/circle_24dp"
            app:colorTint="@{transition3Sample.color}" />

        <TextView
            android:id="@+id/activity_title"
            style="@style/Base.TextAppearance.AppCompat.Large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Slide" />

        <TextView
            style="@style/MaterialAnimations.Text.Body"
            android:text="@string/medium_text" />

        <Button
            android:id="@+id/exit_button"
            android:text="Exit"
            style="@style/MaterialAnimations.Button" />




    </LinearLayout>
</layout>

================================================
FILE: app/src/main/res/layout/row_sample.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <variable
            name="sample"
            type="com.lgvalle.material_animations.Sample" />
    </data>

    <LinearLayout
        android:id="@+id/sample_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:clipToPadding="false"
        android:orientation="horizontal"
        android:padding="@dimen/spacing_double">

        <ImageView
            android:id="@+id/sample_icon"
            style="@style/MaterialAnimations.Icon.Small"
            android:src="@drawable/circle_24dp"
            app:colorTint="@{sample.color}" />

        <TextView
            android:id="@+id/sample_name"
            style="@style/Base.TextAppearance.AppCompat.Large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@{sample.name}"
            tools:text="View animations sample" />

    </LinearLayout>
</layout>

================================================
FILE: app/src/main/res/layout/square.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<View xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_margin="10dp"
    android:id="@+id/square_green"
    android:layout_width="50dp"
    android:background="@android:color/holo_green_light"
    android:layout_height="50dp" />



================================================
FILE: app/src/main/res/menu/menu_main.xml
================================================
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
    <item android:id="@+id/action_settings" android:title="@string/action_settings"
        android:orderInCategory="100" app:showAsAction="never" />
</menu>


================================================
FILE: app/src/main/res/transition/changebounds_with_arcmotion.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@integer/anim_duration_long"
    android:interpolator="@android:interpolator/decelerate_cubic"
    >
    <changeBounds>
        <!--patternPathMotion android:patternPathData="M0 0 L0 100 L100 0"/-->
        <arcMotion
            android:maximumAngle="90"
            android:minimumHorizontalAngle="90"
            android:minimumVerticalAngle="0" />

    </changeBounds>
</transitionSet>

================================================
FILE: app/src/main/res/transition/explode.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
    <explode
        android:duration="@integer/anim_duration_long"
        android:interpolator="@android:interpolator/bounce" />
</transitionSet>

================================================
FILE: app/src/main/res/transition/slide_and_changebounds.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@integer/anim_duration_long">
    <slide />
    <changeBounds />
</transitionSet>

================================================
FILE: app/src/main/res/transition/slide_and_changebounds_sequential.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@integer/anim_duration_long"
    android:transitionOrdering="sequential">
    <slide />
    <changeBounds />
</transitionSet>

================================================
FILE: app/src/main/res/transition/slide_and_changebounds_sequential_with_interpolators.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@integer/anim_duration_long"
    android:transitionOrdering="sequential">
    <slide android:interpolator="@android:interpolator/decelerate_cubic" />
    <changeBounds android:interpolator="@android:interpolator/bounce" />
</transitionSet>

================================================
FILE: app/src/main/res/transition/slide_from_bottom.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
    <slide
        android:duration="@integer/anim_duration_long"
        android:slideEdge="bottom" />
</transitionSet>

================================================
FILE: app/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright 2015 Google Inc.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<resources>
    <color name="touch_effect">#9ccc</color>

    <color name="material_animations_primary">#039BE5</color>
    <color name="material_animations_primary_dark">#0277BD</color>
    <color name="material_animations_blank">#424242</color>
    <color name="material_animations_accent">#3F51B5</color>

    <color name="text_light">@android:color/white</color>
    <color name="text_dark">#616161</color>

    <color name="sample_red">#ff4444</color>
    <color name="sample_blue">#33b5e5</color>
    <color name="sample_green">#669900</color>
    <color name="sample_yellow">#ff8800</color>


    <!-- theme colors -->
    <color name="theme_blue_background">#84ffff</color>
    <color name="theme_blue_primary">#4FC3F7</color>
    <color name="theme_blue_accent">#ff193a</color>
    <color name="theme_blue_text">@color/text_dark</color>
    <color name="theme_blue_text_inverse">@android:color/black</color>
    <color name="theme_blue_primary_dark">#039BE5</color>

    <color name="theme_green_background">#b9f6ca</color>
    <color name="theme_green_primary">#669900</color>
    <color name="theme_green_accent">#e919ff</color>
    <color name="theme_green_text">@color/text_dark</color>
    <color name="theme_green_primary_dark">#558B2F</color>

    <color name="theme_purple_background">#b388ff</color>
    <color name="theme_purple_primary">#7e57c2</color>
    <color name="theme_purple_accent">#ff9419</color>
    <color name="theme_purple_text">@color/text_light</color>
    <color name="theme_purple_primary_dark">#6c4aa6</color>

    <color name="theme_red_background">#ff8a80</color>
    <color name="theme_red_primary">#ff5252</color>
    <color name="theme_red_accent">#fffc19</color>
    <color name="theme_red_text">@color/text_light</color>
    <color name="theme_red_primary_dark">#e64a4a</color>

    <color name="theme_yellow_background">#ffff8d</color>
    <color name="theme_yellow_primary">#ff8800</color>
    <color name="theme_yellow_accent">#19dcff</color>
    <color name="theme_yellow_text">@color/text_dark</color>
    <color name="theme_yellow_primary_dark">#EF6C00</color>

    <color name="green">#00e676</color>
    <color name="red">#ff5252</color>
    <color name="light_grey">#E0E0E0</color>



</resources>


================================================
FILE: app/src/main/res/values/dimens.xml
================================================
<resources>
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="spacing_micro">4dp</dimen>
    <dimen name="spacing_normal">8dp</dimen>
    <dimen name="spacing_double">16dp</dimen>
    <dimen name="spacing_huge">72dp</dimen>


    <dimen name="elevation_header">4dp</dimen>
    <dimen name="elevation_fab">8dp</dimen>

    <dimen name="size_icon_toolbar">40dp</dimen>

    <integer name="anim_duration_very_long">1500</integer>
    <integer name="anim_duration_long">500</integer>
    <integer name="anim_duration_medium">300</integer>
</resources>


================================================
FILE: app/src/main/res/values/strings.xml
================================================
<resources>
    <string name="app_name">Material-Animations</string>

    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>

    <string name="square_red_name">square_red</string>
    <string name="square_blue_name">square_blue</string>
    <string name="square_green_name">square_green</string>
    <string name="transition_reveal1">transition_reveal1</string>

    <string name="sample_blue_title">sample_blue_title</string>
    <string name="long_text">Bacon ipsum dolor amet cupidatat bresaola minim, aliquip beef aute ea porchetta. Meatball brisket do, rump in beef ea ham hock spare ribs mollit qui dolore ipsum voluptate cow. Drumstick prosciutto salami duis jerky jowl. Mollit ball tip short ribs doner fugiat frankfurter leberkas andouille kevin pork loin nostrud ham culpa. Rump pariatur ham hock excepteur picanha pork. Corned beef flank proident shankle rump.</string>
    <string name="medium_text">Porchetta landjaeger tail meatball t-bone spare ribs. Sirloin pork chop bacon pork belly strip steak. Porchetta ham meatball pig salami short ribs jowl spare ribs sirloin tongue jerky cupim chuck.</string>
    <string name="reveal_body1">Circular Reveal Animation starting from the center of target view</string>
    <string name="reveal_body2">Circular Reveal Animation starting from touch coordinates</string>
    <string name="reveal_body3">View layout change animation with Circular Reveal Animation on finish</string>
    <string name="reveal_body4">Circular Reveal Animation from top with nested animations on end</string>
</resources>


================================================
FILE: app/src/main/res/values/styles.xml
================================================
<resources>


    <style name="MaterialAnimations" parent="@style/Theme.AppCompat.Light.NoActionBar">
        <item name="android:colorPrimary">@color/material_animations_primary</item>
        <item name="android:colorPrimaryDark">@color/material_animations_primary_dark</item>
        <item name="android:colorAccent">@color/material_animations_accent</item>
        <item name="android:textColorPrimary">@android:color/black</item>
        <item name="android:textColorPrimaryInverse">@color/text_light</item>
        <item name="android:statusBarColor">@color/material_animations_primary_dark</item>
        <item name="android:textColor">@color/text_dark</item>
        <item name="android:windowContentTransitions">true</item>
        <item name="android:windowAllowEnterTransitionOverlap">false</item>
        <item name="android:windowAllowReturnTransitionOverlap">false</item>
        <item name="android:titleTextAppearance">@style/MaterialAnimations.TextAppearance.Title
        </item>
        <item name="android:windowBackground">@color/light_grey</item>
    </style>

    <style name="MaterialAnimations.Red" parent="MaterialAnimations">
        <item name="android:colorPrimary">@color/theme_red_primary</item>
        <item name="android:colorPrimaryDark">@color/theme_red_primary</item>
        <item name="android:textColorPrimary">@color/theme_red_text</item>
        <item name="android:statusBarColor">@color/theme_red_primary_dark</item>
        <item name="android:windowBackground">@color/theme_red_background</item>
        <item name="android:colorAccent">@color/theme_red_accent</item>
    </style>

    <style name="MaterialAnimations.Blue" parent="MaterialAnimations">
        <item name="android:colorPrimary">@color/theme_blue_primary</item>
        <item name="android:colorPrimaryDark">@color/theme_blue_primary_dark</item>
        <item name="android:textColorPrimary">@color/theme_blue_text</item>
        <item name="android:textColorPrimaryInverse">@color/theme_blue_text_inverse</item>
        <item name="android:statusBarColor">@color/theme_blue_primary_dark</item>
        <item name="android:windowBackground">@color/theme_blue_background</item>
        <item name="android:colorAccent">@color/theme_blue_accent</item>
    </style>

    <style name="MaterialAnimations.Green" parent="MaterialAnimations">
        <item name="android:colorPrimary">@color/theme_green_primary</item>
        <item name="android:colorPrimaryDark">@color/theme_green_primary</item>
        <item name="android:textColorPrimary">@color/theme_green_text</item>
        <item name="android:statusBarColor">@color/theme_green_primary_dark</item>
        <item name="android:windowBackground">@color/theme_green_background</item>
        <item name="android:colorAccent">@color/theme_green_accent</item>
    </style>

    <style name="MaterialAnimations.Yellow" parent="MaterialAnimations">
        <item name="android:colorPrimary">@color/theme_yellow_primary</item>
        <item name="android:colorPrimaryDark">@color/theme_yellow_primary</item>
        <item name="android:textColorPrimary">@color/theme_yellow_text</item>
        <item name="android:statusBarColor">@color/theme_yellow_primary_dark</item>
        <item name="android:windowBackground">@color/theme_yellow_background</item>
        <item name="android:colorAccent">@color/theme_yellow_accent</item>
    </style>

    <style name="MaterialAnimations.TextAppearance.Title" parent="android:TextAppearance.Material.Title">
        <item name="android:textColor">?android:textColorPrimary</item>
    </style>

    <style name="MaterialAnimations.TextAppearance.Title.Inverse" parent="android:TextAppearance.Material.Title">
        <item name="android:textColor">?android:textColorPrimaryInverse</item>
    </style>

    <style name="MaterialAnimations.Text.Body" parent="Base.TextAppearance.AppCompat.Medium">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_margin">@dimen/spacing_normal</item>
        <item name="android:padding">@dimen/spacing_normal</item>
    </style>

    <style name="MaterialAnimations.Text.Section" parent="Base.TextAppearance.AppCompat.Caption">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
    </style>

    <style name="MaterialAnimations.Icon">
        <item name="android:layout_margin">10dp</item>
    </style>

    <style name="MaterialAnimations.Icon.Big">
        <item name="android:layout_width">150dp</item>
        <item name="android:layout_height">150dp</item>
    </style>

    <style name="MaterialAnimations.Icon.Medium">
        <item name="android:layout_width">84dp</item>
        <item name="android:layout_margin">2dp</item>
        <item name="android:layout_height">84dp</item>
    </style>

    <style name="MaterialAnimations.Icon.Medium.Scaled" parent="MaterialAnimations.Icon.Medium">
        <item name="android:alpha">0</item>
        <item name="android:scaleX">0.5</item>
        <item name="android:scaleY">0.5</item>
    </style>

    <style name="MaterialAnimations.Icon.Small">
        <item name="android:layout_width">48dp</item>
        <item name="android:layout_height">48dp</item>
    </style>

    <style name="MaterialAnimations.Button" parent="Base.Widget.AppCompat.Button">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_margin">@dimen/spacing_normal</item>
    </style>

    <style name="MaterialAnimations.Button.Scaled" parent="MaterialAnimations.Button">
        <item name="android:scaleX">0</item>
        <item name="android:scaleY">0</item>
    </style>

</resources>


================================================
FILE: app/src/main/res/values-w820dp/dimens.xml
================================================
<resources>
    <!-- Example customization of dimensions originally defined in res/values/dimens.xml
         (such as screen margins) for screens with more than 820dp of available width. This
         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
    <dimen name="activity_horizontal_margin">64dp</dimen>
</resources>


================================================
FILE: build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}


================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip


================================================
FILE: gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega


================================================
FILE: settings.gradle
================================================
include ':app'
Download .txt
gitextract_bqdgdqqz/

├── .gitignore
├── LICENSE.md
├── README.md
├── app/
│   ├── .gitignore
│   ├── build.gradle
│   ├── proguard-rules.pro
│   └── src/
│       ├── androidTest/
│       │   └── java/
│       │       └── com/
│       │           └── lgvalle/
│       │               └── material_animations/
│       │                   └── ApplicationTest.java
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── lgvalle/
│           │           └── material_animations/
│           │               ├── AnimationsActivity1.java
│           │               ├── AnimationsActivity2.java
│           │               ├── BaseDetailActivity.java
│           │               ├── MainActivity.java
│           │               ├── RevealActivity.java
│           │               ├── Sample.java
│           │               ├── SamplesRecyclerAdapter.java
│           │               ├── SharedElementActivity.java
│           │               ├── SharedElementFragment1.java
│           │               ├── SharedElementFragment2.java
│           │               ├── TransitionActivity1.java
│           │               ├── TransitionActivity2.java
│           │               ├── TransitionActivity3.java
│           │               └── TransitionHelper.java
│           └── res/
│               ├── drawable/
│               │   ├── circle_24dp.xml
│               │   └── square.xml
│               ├── layout/
│               │   ├── activity_animations1.xml
│               │   ├── activity_animations2.xml
│               │   ├── activity_animations_scene0.xml
│               │   ├── activity_animations_scene1.xml
│               │   ├── activity_animations_scene2.xml
│               │   ├── activity_animations_scene3.xml
│               │   ├── activity_animations_scene4.xml
│               │   ├── activity_main.xml
│               │   ├── activity_reveal.xml
│               │   ├── activity_sharedelement.xml
│               │   ├── activity_sharedelement_fragment1.xml
│               │   ├── activity_sharedelement_fragment2.xml
│               │   ├── activity_transition1.xml
│               │   ├── activity_transition2.xml
│               │   ├── activity_transition3.xml
│               │   ├── row_sample.xml
│               │   └── square.xml
│               ├── menu/
│               │   └── menu_main.xml
│               ├── transition/
│               │   ├── changebounds_with_arcmotion.xml
│               │   ├── explode.xml
│               │   ├── slide_and_changebounds.xml
│               │   ├── slide_and_changebounds_sequential.xml
│               │   ├── slide_and_changebounds_sequential_with_interpolators.xml
│               │   └── slide_from_bottom.xml
│               ├── values/
│               │   ├── colors.xml
│               │   ├── dimens.xml
│               │   ├── strings.xml
│               │   └── styles.xml
│               └── values-w820dp/
│                   └── dimens.xml
├── build.gradle
├── gradle/
│   └── wrapper/
│       └── gradle-wrapper.properties
├── gradlew.bat
└── settings.gradle
Download .txt
SYMBOL INDEX (93 symbols across 15 files)

FILE: app/src/androidTest/java/com/lgvalle/material_animations/ApplicationTest.java
  class ApplicationTest (line 9) | public class ApplicationTest extends ApplicationTestCase<Application> {
    method ApplicationTest (line 10) | public ApplicationTest() {

FILE: app/src/main/java/com/lgvalle/material_animations/AnimationsActivity1.java
  class AnimationsActivity1 (line 16) | public class AnimationsActivity1 extends BaseDetailActivity {
    method onCreate (line 24) | @Override
    method setupWindowAnimations (line 33) | private void setupWindowAnimations() {
    method bindData (line 37) | private void bindData() {
    method setupLayout (line 43) | private void setupLayout() {
    method changeLayout (line 69) | private void changeLayout() {
    method changePosition (line 83) | private void changePosition() {

FILE: app/src/main/java/com/lgvalle/material_animations/AnimationsActivity2.java
  class AnimationsActivity2 (line 18) | public class AnimationsActivity2 extends BaseDetailActivity {
    method onCreate (line 28) | @Override
    method bindData (line 37) | private void bindData() {
    method setupWindowAnimations (line 44) | private void setupWindowAnimations() {
    method setupLayout (line 72) | private void setupLayout() {

FILE: app/src/main/java/com/lgvalle/material_animations/BaseDetailActivity.java
  class BaseDetailActivity (line 13) | public class BaseDetailActivity extends AppCompatActivity {
    method setupToolbar (line 19) | void setupToolbar() {
    method onSupportNavigateUp (line 26) | @Override
    method transitionTo (line 32) | @SuppressWarnings("unchecked") void transitionTo(Intent i) {

FILE: app/src/main/java/com/lgvalle/material_animations/MainActivity.java
  class MainActivity (line 15) | public class MainActivity extends AppCompatActivity {
    method onCreate (line 18) | @Override
    method setupWindowAnimations (line 28) | private void setupWindowAnimations() {
    method setupSamples (line 37) | private void setupSamples() {
    method setupToolbar (line 46) | private void setupToolbar() {
    method setupLayout (line 52) | private void setupLayout() {

FILE: app/src/main/java/com/lgvalle/material_animations/RevealActivity.java
  class RevealActivity (line 28) | public class RevealActivity extends BaseDetailActivity implements View.O...
    method onCreate (line 36) | @Override
    method bindData (line 45) | private void bindData() {
    method setupWindowAnimations (line 51) | private void setupWindowAnimations() {
    method setupEnterAnimations (line 57) | private void setupEnterAnimations() {
    method setupExitAnimations (line 88) | private void setupExitAnimations() {
    method setupLayout (line 119) | private void setupLayout() {
    method revealBlue (line 147) | private void revealBlue() {
    method revealRed (line 160) | private void revealRed() {
    method revealYellow (line 196) | private void revealYellow(float x, float y) {
    method revealGreen (line 202) | private void revealGreen() {
    method hideTarget (line 208) | private void hideTarget() {
    method animateButtonsIn (line 212) | private void animateButtonsIn() {
    method animateButtonsOut (line 224) | private void animateButtonsOut() {
    method onTouch (line 236) | @Override
    method animateRevealShow (line 246) | private void animateRevealShow(View viewRoot) {
    method animateRevealColor (line 258) | private void animateRevealColor(ViewGroup viewRoot, @ColorRes int colo...
    method animateRevealColorFromCoordinates (line 264) | private Animator animateRevealColorFromCoordinates(ViewGroup viewRoot,...
    method animateRevealHide (line 275) | private void animateRevealHide(final View viewRoot) {

FILE: app/src/main/java/com/lgvalle/material_animations/Sample.java
  class Sample (line 13) | public class Sample implements Serializable {
    method Sample (line 18) | public Sample(@ColorRes int color, String name) {
    method setColorTint (line 23) | @BindingAdapter("bind:colorTint")
    method getName (line 29) | public String getName() {
    method getColor (line 33) | public int getColor() {

FILE: app/src/main/java/com/lgvalle/material_animations/SamplesRecyclerAdapter.java
  class SamplesRecyclerAdapter (line 17) | public class SamplesRecyclerAdapter extends RecyclerView.Adapter<Samples...
    method SamplesRecyclerAdapter (line 21) | public SamplesRecyclerAdapter(Activity activity, List<Sample> samples) {
    method onCreateViewHolder (line 26) | @Override
    method onBindViewHolder (line 32) | @Override
    method transitionToActivity (line 57) | private void transitionToActivity(Class target, Sample sample) {
    method transitionToActivity (line 63) | private void transitionToActivity(Class target, SamplesViewHolder view...
    method transitionToActivity (line 69) | private void transitionToActivity(Class target, SamplesViewHolder view...
    method startActivity (line 76) | private void startActivity(Class target, Pair<View, String>[] pairs, S...
    method getItemCount (line 83) | @Override
    class SamplesViewHolder (line 89) | public class SamplesViewHolder extends RecyclerView.ViewHolder {
      method SamplesViewHolder (line 92) | public SamplesViewHolder(View rootView) {

FILE: app/src/main/java/com/lgvalle/material_animations/SharedElementActivity.java
  class SharedElementActivity (line 11) | public class SharedElementActivity extends BaseDetailActivity {
    method onCreate (line 14) | @Override
    method bindData (line 24) | private void bindData(Sample sample) {
    method setupWindowAnimations (line 29) | private void setupWindowAnimations() {
    method setupLayout (line 34) | private void setupLayout(Sample sample) {

FILE: app/src/main/java/com/lgvalle/material_animations/SharedElementFragment1.java
  class SharedElementFragment1 (line 17) | public class SharedElementFragment1 extends Fragment {
    method newInstance (line 21) | public static SharedElementFragment1 newInstance(Sample sample) {
    method onCreateView (line 31) | @Override
    method addNextFragment (line 56) | private void addNextFragment(Sample sample, ImageView squareBlue, bool...

FILE: app/src/main/java/com/lgvalle/material_animations/SharedElementFragment2.java
  class SharedElementFragment2 (line 11) | public class SharedElementFragment2 extends Fragment {
    method newInstance (line 14) | public static SharedElementFragment2 newInstance(Sample sample) {
    method onCreateView (line 22) | @Override

FILE: app/src/main/java/com/lgvalle/material_animations/TransitionActivity1.java
  class TransitionActivity1 (line 13) | public class TransitionActivity1 extends BaseDetailActivity {
    method onCreate (line 16) | @Override
    method bindData (line 25) | private void bindData() {
    method setupWindowAnimations (line 31) | private void setupWindowAnimations() {
    method setupLayout (line 37) | private void setupLayout() {
    method buildEnterTransition (line 99) | private Visibility buildEnterTransition() {
    method buildReturnTransition (line 107) | private Visibility buildReturnTransition() {

FILE: app/src/main/java/com/lgvalle/material_animations/TransitionActivity2.java
  class TransitionActivity2 (line 12) | public class TransitionActivity2 extends BaseDetailActivity {
    method onCreate (line 16) | @Override
    method bindData (line 25) | private void bindData() {
    method setupWindowAnimations (line 32) | private void setupWindowAnimations() {
    method setupLayout (line 43) | private void setupLayout() {
    method buildEnterTransition (line 52) | private Transition buildEnterTransition() {

FILE: app/src/main/java/com/lgvalle/material_animations/TransitionActivity3.java
  class TransitionActivity3 (line 14) | public class TransitionActivity3 extends BaseDetailActivity {
    method onCreate (line 18) | @Override
    method bindData (line 27) | private void bindData() {
    method setupWindowAnimations (line 34) | private void setupWindowAnimations() {
    method setupLayout (line 45) | private void setupLayout() {
    method buildEnterTransition (line 54) | private Visibility buildEnterTransition() {

FILE: app/src/main/java/com/lgvalle/material_animations/TransitionHelper.java
  class TransitionHelper (line 32) | class TransitionHelper {
    method createSafeTransitionParticipants (line 43) | public static Pair<View, String>[] createSafeTransitionParticipants(@N...
    method addNonNullViewToTransitionParticipants (line 66) | private static void addNonNullViewToTransitionParticipants(View view, ...
Condensed preview — 57 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (128K chars).
[
  {
    "path": ".gitignore",
    "chars": 357,
    "preview": "# built application files\n*.apk\n*.ap_\n\n# files for the dex VM\n*.dex\n\n# Java class files\n*.class\n\n# generated files\nbin/\n"
  },
  {
    "path": "LICENSE.md",
    "chars": 1080,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2015 Luis G. Valle\n\nPermission is hereby granted, free of charge, to any person obt"
  },
  {
    "path": "README.md",
    "chars": 22926,
    "preview": "# UNMAINTAINED\nNo maintainance is intended. \nThe content is still valid as a reference but it won't contain the latest n"
  },
  {
    "path": "app/.gitignore",
    "chars": 7,
    "preview": "/build\n"
  },
  {
    "path": "app/build.gradle",
    "chars": 701,
    "preview": "apply plugin: 'com.android.application'\n\nandroid {\n    compileSdkVersion 23\n    buildToolsVersion \"23.0.2\"\n\n    defaultC"
  },
  {
    "path": "app/proguard-rules.pro",
    "chars": 667,
    "preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /U"
  },
  {
    "path": "app/src/androidTest/java/com/lgvalle/material_animations/ApplicationTest.java",
    "chars": 362,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "chars": 1566,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package="
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/AnimationsActivity1.java",
    "chars": 3087,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.content.Intent;\nimport android.databinding.DataBindingUtil;\nimp"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/AnimationsActivity2.java",
    "chars": 5370,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.databinding.DataBindingUtil;\nimport android.os.Bundle;\nimport a"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/BaseDetailActivity.java",
    "chars": 1301,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.content.Intent;\nimport android.support.v4.app.ActivityOptionsCo"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/MainActivity.java",
    "chars": 2301,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.os.Bundle;\nimport android.support.v4.content.ContextCompat;\nimp"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/RevealActivity.java",
    "chars": 11183,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.animation.Animator;\nimport android.animation.AnimatorListenerAd"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/Sample.java",
    "chars": 870,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.databinding.BindingAdapter;\nimport android.support.annotation.C"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/SamplesRecyclerAdapter.java",
    "chars": 4003,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.app.Activity;\nimport android.content.Intent;\nimport android.dat"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/SharedElementActivity.java",
    "chars": 1947,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.databinding.DataBindingUtil;\nimport android.os.Bundle;\nimport a"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/SharedElementFragment1.java",
    "chars": 2932,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.os.Bundle;\nimport android.support.v4.app.Fragment;\nimport andro"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/SharedElementFragment2.java",
    "chars": 1187,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.os.Bundle;\nimport android.support.v4.app.Fragment;\nimport andro"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/TransitionActivity1.java",
    "chars": 4227,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.content.Intent;\nimport android.databinding.DataBindingUtil;\nimp"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/TransitionActivity2.java",
    "chars": 1832,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.databinding.DataBindingUtil;\nimport android.os.Bundle;\nimport a"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/TransitionActivity3.java",
    "chars": 1956,
    "preview": "package com.lgvalle.material_animations;\n\nimport android.databinding.DataBindingUtil;\nimport android.os.Bundle;\nimport a"
  },
  {
    "path": "app/src/main/java/com/lgvalle/material_animations/TransitionHelper.java",
    "chars": 2897,
    "preview": "/*\n * Copyright 2015 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not us"
  },
  {
    "path": "app/src/main/res/drawable/circle_24dp.xml",
    "chars": 337,
    "preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\""
  },
  {
    "path": "app/src/main/res/drawable/square.xml",
    "chars": 367,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n\n    <padding"
  },
  {
    "path": "app/src/main/res/layout/activity_animations1.xml",
    "chars": 2743,
    "preview": "<layout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-aut"
  },
  {
    "path": "app/src/main/res/layout/activity_animations2.xml",
    "chars": 2923,
    "preview": "<layout xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <data>\n\n        <variable\n            name=\"ani"
  },
  {
    "path": "app/src/main/res/layout/activity_animations_scene0.xml",
    "chars": 518,
    "preview": "<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    and"
  },
  {
    "path": "app/src/main/res/layout/activity_animations_scene1.xml",
    "chars": 1180,
    "preview": "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    a"
  },
  {
    "path": "app/src/main/res/layout/activity_animations_scene2.xml",
    "chars": 1181,
    "preview": "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    a"
  },
  {
    "path": "app/src/main/res/layout/activity_animations_scene3.xml",
    "chars": 1181,
    "preview": "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    a"
  },
  {
    "path": "app/src/main/res/layout/activity_animations_scene4.xml",
    "chars": 1179,
    "preview": "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    a"
  },
  {
    "path": "app/src/main/res/layout/activity_main.xml",
    "chars": 1192,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    and"
  },
  {
    "path": "app/src/main/res/layout/activity_reveal.xml",
    "chars": 3866,
    "preview": "<layout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-aut"
  },
  {
    "path": "app/src/main/res/layout/activity_sharedelement.xml",
    "chars": 1623,
    "preview": "<layout xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <data>\n\n        <variable\n            name=\"sha"
  },
  {
    "path": "app/src/main/res/layout/activity_sharedelement_fragment1.xml",
    "chars": 1150,
    "preview": "<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    and"
  },
  {
    "path": "app/src/main/res/layout/activity_sharedelement_fragment2.xml",
    "chars": 1813,
    "preview": "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    a"
  },
  {
    "path": "app/src/main/res/layout/activity_transition1.xml",
    "chars": 3046,
    "preview": "<layout xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <data>\n\n        <variable\n            name=\"tra"
  },
  {
    "path": "app/src/main/res/layout/activity_transition2.xml",
    "chars": 2034,
    "preview": "<layout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-aut"
  },
  {
    "path": "app/src/main/res/layout/activity_transition3.xml",
    "chars": 2034,
    "preview": "<layout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-aut"
  },
  {
    "path": "app/src/main/res/layout/row_sample.xml",
    "chars": 1220,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app="
  },
  {
    "path": "app/src/main/res/layout/square.xml",
    "chars": 299,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<View xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:lay"
  },
  {
    "path": "app/src/main/res/menu/menu_main.xml",
    "chars": 361,
    "preview": "<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\""
  },
  {
    "path": "app/src/main/res/transition/changebounds_with_arcmotion.xml",
    "chars": 524,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<transitionSet xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    and"
  },
  {
    "path": "app/src/main/res/transition/explode.xml",
    "chars": 261,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<transitionSet xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <e"
  },
  {
    "path": "app/src/main/res/transition/slide_and_changebounds.xml",
    "chars": 216,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<transitionSet xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    and"
  },
  {
    "path": "app/src/main/res/transition/slide_and_changebounds_sequential.xml",
    "chars": 260,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<transitionSet xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    and"
  },
  {
    "path": "app/src/main/res/transition/slide_and_changebounds_sequential_with_interpolators.xml",
    "chars": 374,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<transitionSet xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    and"
  },
  {
    "path": "app/src/main/res/transition/slide_from_bottom.xml",
    "chars": 234,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<transitionSet xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <s"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "chars": 2905,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Google Inc.\n  ~\n  ~ Licensed under the Apache License, Ve"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "chars": 587,
    "preview": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"spacing_micro\">4dp<"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "chars": 1606,
    "preview": "<resources>\n    <string name=\"app_name\">Material-Animations</string>\n\n    <string name=\"hello_world\">Hello world!</strin"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "chars": 5838,
    "preview": "<resources>\n\n\n    <style name=\"MaterialAnimations\" parent=\"@style/Theme.AppCompat.Light.NoActionBar\">\n        <item name"
  },
  {
    "path": "app/src/main/res/values-w820dp/dimens.xml",
    "chars": 358,
    "preview": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as s"
  },
  {
    "path": "build.gradle",
    "chars": 436,
    "preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    r"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "chars": 231,
    "preview": "#Wed Apr 10 15:27:10 PDT 2013\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
  },
  {
    "path": "gradlew.bat",
    "chars": 2314,
    "preview": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem "
  },
  {
    "path": "settings.gradle",
    "chars": 15,
    "preview": "include ':app'\n"
  }
]

About this extraction

This page contains the full source code of the lgvalle/Material-Animations GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 57 files (116.4 KB), approximately 27.1k tokens, and a symbol index with 93 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!