├── .gitignore ├── CONTRIBUTING.md ├── CycleEditor └── src │ └── com │ └── google │ └── androidstudio │ └── motionlayoutcycles │ ├── AnimationPanel.java │ ├── CycleEdit.java │ ├── CycleModel.java │ ├── CycleSetModel.java │ ├── CycleView.java │ ├── Easing.java │ ├── HyperSpline.java │ ├── Interpolator.java │ ├── KeyCycleExamples.java │ ├── LinearInterpolator.java │ ├── MainPanel.java │ ├── MonotoneSpline.java │ └── Oscillator.java ├── LICENSE ├── README.md ├── build.gradle ├── constraintlayout ├── .gitignore ├── build.gradle └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── android │ │ │ └── constraintlayoutexamples │ │ │ ├── ConstraintSetExampleActivity.java │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable │ │ ├── ic_android_black_24dp.xml │ │ └── lake.jpg │ │ ├── layout-land │ │ ├── constraint_example_5.xml │ │ └── constraintset_example_big.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── constraint_example_1.xml │ │ ├── constraint_example_2.xml │ │ ├── constraint_example_3.xml │ │ ├── constraint_example_4.xml │ │ ├── constraint_example_5.xml │ │ ├── constraint_example_6.xml │ │ ├── constraint_example_x1.xml │ │ ├── constraintset_example_big.xml │ │ └── constraintset_example_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── example │ └── android │ └── constraintlayoutexamples │ └── ExampleUnitTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── motionlayout ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── google │ │ └── androidstudio │ │ └── motionlayoutexample │ │ ├── DemoActivity.kt │ │ ├── DemosAdapter.kt │ │ ├── MainActivity.kt │ │ ├── fragmentsdemo │ │ ├── CustomAdapter.kt │ │ ├── FragmentExample2Activity.kt │ │ ├── FragmentExampleActivity.kt │ │ ├── ItemFragment.kt │ │ ├── ListFragment.kt │ │ ├── MainFragment.kt │ │ ├── SecondFragment.kt │ │ └── User.kt │ │ ├── helpers │ │ ├── ExampleFlyinBounceHelper.java │ │ ├── FadeIn.java │ │ └── FadeOut.java │ │ ├── utils │ │ ├── BoundsImageView.kt │ │ ├── CollapsibleToolbar.kt │ │ ├── DrawerContent.kt │ │ ├── TouchFrameLayout.java │ │ └── ViewpagerHeader.kt │ │ ├── viewpagerdemo │ │ ├── Page.kt │ │ ├── ViewPagerActivity.kt │ │ ├── ViewPagerActivity2.kt │ │ └── ViewPagerAdapter.kt │ │ └── youtubedemo │ │ ├── Cats.kt │ │ ├── PhotosAdapter.kt │ │ └── YouTubeDemoActivity.kt │ └── res │ ├── animator │ ├── hide.xml │ └── show.xml │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ ├── avatar_1_raster.png │ ├── avatar_2_raster.png │ ├── avatar_3_raster.png │ ├── avatar_4_raster.png │ ├── avatar_5_raster.png │ ├── avatar_6_raster.png │ ├── avatar_7_raster.png │ ├── avatar_8_raster.png │ ├── car.png │ ├── cat_1.jpeg │ ├── cat_10.jpeg │ ├── cat_11.jpeg │ ├── cat_12.jpeg │ ├── cat_13.jpeg │ ├── cat_14.jpeg │ ├── cat_15.jpeg │ ├── cat_16.jpeg │ ├── cat_17.jpeg │ ├── cat_18.jpeg │ ├── cat_19.jpeg │ ├── cat_2.jpeg │ ├── cat_3.jpeg │ ├── cat_4.jpeg │ ├── cat_5.jpeg │ ├── cat_6.jpeg │ ├── cat_7.jpeg │ ├── cat_8.jpeg │ ├── cat_9.jpeg │ ├── circle.xml │ ├── hoford.jpg │ ├── ic_add_a_photo_24dp.xml │ ├── ic_clear_gray_32dp.xml │ ├── ic_dashboard_black_24dp.xml │ ├── ic_home_black_24dp.xml │ ├── ic_info_black_24dp.xml │ ├── ic_keyboard_arrow_right.xml │ ├── ic_keyboard_arrow_right_black_24dp.xml │ ├── ic_keyboard_arrow_up.xml │ ├── ic_launcher_background.xml │ ├── ic_notifications_black_24dp.xml │ ├── ic_play_arrow_gray_32dp.xml │ ├── ml_icon.png │ ├── ml_logo.png │ ├── monterey.jpg │ ├── monterey_small.jpg │ ├── mountains.jpg │ ├── roard.jpg │ ├── sea.jpg │ ├── sunset2.jpg │ ├── trees.png │ └── wcircle.xml │ ├── layout │ ├── activity_main.xml │ ├── activity_scrolling.xml │ ├── content_scrolling.xml │ ├── item_layout.xml │ ├── main_activity.xml │ ├── motion_01_basic.xml │ ├── motion_01_cl_end.xml │ ├── motion_01_cl_start.xml │ ├── motion_02_basic.xml │ ├── motion_02_basic_autocomplete_false.xml │ ├── motion_03_custom_attribute.xml │ ├── motion_04_imagefilter.xml │ ├── motion_05_imagefilter.xml │ ├── motion_06_keyframe.xml │ ├── motion_07_keyframe.xml │ ├── motion_08_cycle.xml │ ├── motion_09_coordinatorlayout.xml │ ├── motion_09_coordinatorlayout_header.xml │ ├── motion_10_coordinatorlayout.xml │ ├── motion_10_coordinatorlayout_header.xml │ ├── motion_11_coordinatorlayout.xml │ ├── motion_11_coordinatorlayout_header.xml │ ├── motion_12_drawerlayout.xml │ ├── motion_12_drawerlayout_content.xml │ ├── motion_12_drawerlayout_menu.xml │ ├── motion_13_drawerlayout.xml │ ├── motion_13_drawerlayout_menu.xml │ ├── motion_14_side_panel.xml │ ├── motion_15_parallax.xml │ ├── motion_16_viewpager.xml │ ├── motion_16_viewpager_page1.xml │ ├── motion_16_viewpager_page2.xml │ ├── motion_16_viewpager_page3.xml │ ├── motion_17_coordination.xml │ ├── motion_17_coordination_header.xml │ ├── motion_18_coordination.xml │ ├── motion_19_coordination.xml │ ├── motion_19_coordination_header.xml │ ├── motion_20_reveal.xml │ ├── motion_21_main_fragment.xml │ ├── motion_21_second_fragment.xml │ ├── motion_22_list_fragment.xml │ ├── motion_23_parallax.xml │ ├── motion_23_viewpager.xml │ ├── motion_24_recyclerview_expanded_row.xml │ ├── motion_24_recyclerview_expanded_text_description.xml │ ├── motion_24_recyclerview_expanded_text_header.xml │ ├── motion_24_youtube.xml │ ├── motion_25_keytrigger.xml │ ├── motion_26_multistate.xml │ └── row.xml │ ├── menu │ ├── bottom_nav_menu.xml │ └── menu_scrolling.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── raw │ └── walkthrough.json │ ├── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml │ └── xml │ ├── list_scene.xml │ ├── main_scene.xml │ ├── rv_scene.xml │ ├── scene_01.xml │ ├── scene_02.xml │ ├── scene_02_autocomplete_false.xml │ ├── scene_03.xml │ ├── scene_04.xml │ ├── scene_05.xml │ ├── scene_06.xml │ ├── scene_07.xml │ ├── scene_08.xml │ ├── scene_09.xml │ ├── scene_10_header.xml │ ├── scene_11_header.xml │ ├── scene_12_content.xml │ ├── scene_13_menu.xml │ ├── scene_14.xml │ ├── scene_15.xml │ ├── scene_17.xml │ ├── scene_17_header.xml │ ├── scene_18.xml │ ├── scene_19.xml │ ├── scene_19_header.xml │ ├── scene_20.xml │ ├── scene_21_second_fragment.xml │ ├── scene_23.xml │ ├── scene_24.xml │ ├── scene_25.xml │ └── scene_26.xml ├── screenshots ├── advanced_chains.png └── constraint_set_example.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | .idea/ 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | We'd love to accept your patches and contributions to this project. There are 4 | just a few small guidelines you need to follow. 5 | 6 | ## Contributor License Agreement 7 | 8 | Contributions to this project must be accompanied by a Contributor License 9 | Agreement. You (or your employer) retain the copyright to your contribution, 10 | this simply gives us permission to use and redistribute your contributions as 11 | part of the project. Head over to to see 12 | your current agreements on file or to sign a new one. 13 | 14 | You generally only need to submit a CLA once, so if you've already submitted one 15 | (even if it was for a different project), you probably don't need to do it 16 | again. 17 | 18 | ## Code reviews 19 | 20 | All submissions, including submissions by project members, require review. We 21 | use GitHub pull requests for this purpose. Consult [GitHub Help] for more 22 | information on using pull requests. 23 | 24 | [GitHub Help]: https://help.github.com/articles/about-pull-requests/ 25 | 26 | -------------------------------------------------------------------------------- /CycleEditor/src/com/google/androidstudio/motionlayoutcycles/Interpolator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.google.androidstudio.motionlayoutcycles; 17 | 18 | /** 19 | * Base class for interpolator 20 | */ 21 | 22 | abstract class Interpolator { 23 | 24 | static final int SPLINE = 0; 25 | static final int LINEAR = 1; 26 | 27 | public static Interpolator get(int type, double[] time, double[][] y) { 28 | if (type == SPLINE) { 29 | return new MonotoneSpline(time, y); 30 | } 31 | return new LinearInterpolator(time, y); 32 | 33 | } 34 | 35 | abstract void getPos(double t, double[] v); 36 | 37 | abstract void getPos(double t, float[] v); 38 | 39 | abstract double getPos(double t, int j); 40 | 41 | abstract void getSlope(double t, double[] v); 42 | 43 | abstract double getSlope(double t, int j); 44 | 45 | abstract double[] getTimePoints(); 46 | } 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MotionLayout / Constraint Layout Samples 2 | ======================================== 3 | This sample has been migrated into the [github.com/android/views-widgets][1] repo. Please check that repo for future updates. Thank you! 4 | 5 | [1]: https://github.com/android/views-widgets-samples/tree/master/ConstraintLayoutExamples 6 | 7 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 18 | 19 | buildscript { 20 | repositories { 21 | google() 22 | jcenter() 23 | } 24 | 25 | ext { 26 | compileSdkVersion = 28 27 | targetSdkVersion = 28 28 | 29 | appCompatVersion = '1.1.0-alpha03' 30 | constraintLayoutVersion = '2.0.0-beta1' 31 | glideVersion = '4.8.0' 32 | kotlinVersion = '1.3.11' 33 | lifeCycleVersion = '2.0.0' 34 | lottieVersion = '2.5.1' 35 | materialVersion = '1.1.0-alpha05' 36 | junitVersion = '4.12' 37 | } 38 | 39 | dependencies { 40 | classpath 'com.android.tools.build:gradle:3.3.2' 41 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" 42 | 43 | // NOTE: Do not place your application dependencies here; they belong 44 | // in the individual module build.gradle files 45 | } 46 | } 47 | 48 | allprojects { 49 | repositories { 50 | google() 51 | jcenter() 52 | } 53 | } 54 | 55 | task clean(type: Delete) { 56 | delete rootProject.buildDir 57 | } 58 | -------------------------------------------------------------------------------- /constraintlayout/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /constraintlayout/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.application' 18 | 19 | android { 20 | compileSdkVersion rootProject.compileSdkVersion 21 | defaultConfig { 22 | applicationId "com.example.android.constraintlayoutexamples" 23 | minSdkVersion 19 24 | targetSdkVersion rootProject.targetSdkVersion 25 | versionCode 1 26 | versionName "1.0" 27 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 28 | vectorDrawables.useSupportLibrary = true 29 | } 30 | } 31 | 32 | dependencies { 33 | implementation fileTree(dir: 'libs', include: ['*.jar']) 34 | implementation "androidx.appcompat:appcompat:$rootProject.appCompatVersion" 35 | implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion" 36 | implementation "com.google.android.material:material:$rootProject.materialVersion" 37 | testImplementation "junit:junit:$rootProject.junitVersion" 38 | } 39 | -------------------------------------------------------------------------------- /constraintlayout/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 17 | 18 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /constraintlayout/src/main/java/com/example/android/constraintlayoutexamples/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.android.constraintlayoutexamples; 18 | 19 | import android.content.Intent; 20 | import android.content.res.Configuration; 21 | import android.os.Bundle; 22 | import android.view.View; 23 | 24 | import androidx.appcompat.app.AppCompatActivity; 25 | 26 | public class MainActivity extends AppCompatActivity { 27 | private String mTag = "activity_main"; 28 | 29 | @Override 30 | protected void onCreate(Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | setContentView(mTag); 33 | } 34 | 35 | @Override 36 | public void onConfigurationChanged(Configuration newConfig) { 37 | super.onConfigurationChanged(newConfig); 38 | setContentView(mTag); 39 | } 40 | 41 | public void show(View v) { 42 | mTag = (String) v.getTag(); 43 | setContentView(mTag); 44 | } 45 | 46 | @Override 47 | public void onBackPressed() { 48 | if (!mTag.equals("activity_main")) { 49 | mTag = "activity_main"; 50 | setContentView(mTag); 51 | } else { 52 | super.onBackPressed(); 53 | } 54 | } 55 | 56 | public void showConstraintSetExample(View view) { 57 | startActivity(new Intent(this, ConstraintSetExampleActivity.class)); 58 | } 59 | 60 | private void setContentView(String tag) { 61 | int id = getResources().getIdentifier(tag, "layout", getPackageName()); 62 | setContentView(id); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /constraintlayout/src/main/res/drawable/ic_android_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 13 | 18 | 21 | 22 | -------------------------------------------------------------------------------- /constraintlayout/src/main/res/drawable/lake.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/constraintlayout/src/main/res/drawable/lake.jpg -------------------------------------------------------------------------------- /constraintlayout/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/constraintlayout/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /constraintlayout/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/constraintlayout/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /constraintlayout/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/constraintlayout/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /constraintlayout/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/constraintlayout/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /constraintlayout/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/constraintlayout/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /constraintlayout/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | #3F51B5 16 | #303F9F 17 | #FF4081 18 | 19 | -------------------------------------------------------------------------------- /constraintlayout/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16dp 16 | 16dp 17 | 18 | -------------------------------------------------------------------------------- /constraintlayout/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /constraintlayout/src/test/java/com/example/android/constraintlayoutexamples/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.android.constraintlayoutexamples; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.junit.Assert.*; 22 | 23 | /** 24 | * Example local unit test, which will execute on the development machine (host). 25 | * 26 | * @see Testing documentation 27 | */ 28 | public class ExampleUnitTest { 29 | @Test 30 | public void addition_isCorrect() throws Exception { 31 | assertEquals(4, 2 + 2); 32 | } 33 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | android.enableJetifier=true 13 | android.useAndroidX=true 14 | org.gradle.jvmargs=-Xmx1536m 15 | 16 | # When configured, Gradle will run in incubating parallel mode. 17 | # This option should only be used with decoupled projects. More details, visit 18 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 19 | # org.gradle.parallel=true 20 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Nov 16 15:14:01 JST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /motionlayout/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /motionlayout/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.application' 18 | 19 | apply plugin: 'kotlin-android' 20 | 21 | apply plugin: 'kotlin-android-extensions' 22 | 23 | android { 24 | compileSdkVersion rootProject.compileSdkVersion 25 | defaultConfig { 26 | applicationId "com.google.androidstudio.motionlayoutexample" 27 | minSdkVersion 18 28 | targetSdkVersion rootProject.targetSdkVersion 29 | versionCode 1 30 | versionName "1.0" 31 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 32 | } 33 | buildTypes { 34 | release { 35 | minifyEnabled false 36 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 37 | } 38 | } 39 | } 40 | 41 | dependencies { 42 | implementation fileTree(dir: 'libs', include: ['*.jar']) 43 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlinVersion" 44 | implementation "androidx.appcompat:appcompat:$rootProject.appCompatVersion" 45 | 46 | implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion" 47 | implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifeCycleVersion" 48 | implementation "com.google.android.material:material:$rootProject.materialVersion" 49 | implementation "com.airbnb.android:lottie:$rootProject.lottieVersion" 50 | implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion" 51 | annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.glideVersion" 52 | testImplementation "junit:junit:$rootProject.junitVersion" 53 | } 54 | -------------------------------------------------------------------------------- /motionlayout/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /motionlayout/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/DemoActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample 18 | 19 | import android.os.Build 20 | import android.os.Bundle 21 | import android.view.View 22 | import android.widget.ImageView 23 | import androidx.annotation.RequiresApi 24 | import androidx.appcompat.app.AppCompatActivity 25 | import androidx.constraintlayout.motion.widget.MotionLayout 26 | 27 | @RequiresApi(Build.VERSION_CODES.LOLLIPOP) // for View#clipToOutline 28 | class DemoActivity : AppCompatActivity() { 29 | 30 | private lateinit var container: View 31 | 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | val layout = intent.getIntExtra("layout_file_id", R.layout.motion_01_basic) 35 | setContentView(layout) 36 | container = findViewById(R.id.motionLayout) 37 | 38 | if (layout == R.layout.motion_11_coordinatorlayout) { 39 | val icon = findViewById(R.id.icon) 40 | icon?.clipToOutline = true 41 | } 42 | 43 | val debugMode = if (intent.getBooleanExtra("showPaths", false)) { 44 | MotionLayout.DEBUG_SHOW_PATH 45 | } else { 46 | MotionLayout.DEBUG_SHOW_NONE 47 | } 48 | (container as? MotionLayout)?.setDebugMode(debugMode) 49 | } 50 | 51 | fun changeState(v: View?) { 52 | val motionLayout = container as? MotionLayout ?: return 53 | if (motionLayout.progress > 0.5f) { 54 | motionLayout.transitionToStart() 55 | } else { 56 | motionLayout.transitionToEnd() 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/DemosAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample 18 | 19 | import android.view.LayoutInflater 20 | import android.view.ViewGroup 21 | import android.widget.TextView 22 | import androidx.constraintlayout.widget.ConstraintLayout 23 | import androidx.recyclerview.widget.RecyclerView 24 | 25 | class DemosAdapter(private val dataset: Array) : 26 | RecyclerView.Adapter() { 27 | 28 | data class Demo(val title: String, val description : String, val layout : Int = 0, val activity : Class<*> = DemoActivity::class.java) { 29 | constructor(title: String, description: String, activity : Class<*> = DemoActivity::class.java) : this(title, description, 0, activity) 30 | } 31 | 32 | class ViewHolder(val layout: ConstraintLayout) : RecyclerView.ViewHolder(layout) { 33 | var title = layout.findViewById(R.id.title) as TextView 34 | var description = layout.findViewById(R.id.description) as TextView 35 | var layoutFileId = 0 36 | var activity : Class<*>? = null 37 | 38 | init { 39 | layout.setOnClickListener { 40 | val context = it?.context as MainActivity 41 | activity?.let { 42 | context.start(it, layoutFileId) 43 | } 44 | } 45 | } 46 | } 47 | 48 | 49 | override fun onCreateViewHolder(parent: ViewGroup, 50 | viewType: Int): DemosAdapter.ViewHolder { 51 | val row = LayoutInflater.from(parent.context) 52 | .inflate(R.layout.row, parent, false) as ConstraintLayout 53 | return ViewHolder(row) 54 | } 55 | 56 | override fun onBindViewHolder(holder: ViewHolder, position: Int) { 57 | holder.title.text = dataset[position].title 58 | holder.description.text = dataset[position].description 59 | holder.layoutFileId = dataset[position].layout 60 | holder.activity = dataset[position].activity 61 | } 62 | 63 | override fun getItemCount() = dataset.size 64 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/fragmentsdemo/CustomAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.fragmentsdemo 18 | 19 | import android.graphics.Rect 20 | import android.view.LayoutInflater 21 | import android.view.View 22 | import android.view.ViewGroup 23 | import android.widget.TextView 24 | import androidx.appcompat.app.AppCompatActivity 25 | import androidx.constraintlayout.motion.widget.MotionLayout 26 | import androidx.recyclerview.widget.RecyclerView 27 | import com.google.androidstudio.motionlayoutexample.R 28 | 29 | class CustomAdapter(private val userList: ArrayList): RecyclerView.Adapter() { 30 | 31 | override fun onBindViewHolder(holder: ViewHolder, position: Int) { 32 | holder.txtName.text = userList[position].name 33 | holder.txtTitle.text = userList[position].title 34 | holder.itemView.setOnClickListener { 35 | val parent = it?.parent?.parent?.parent?.parent 36 | if (parent is MotionLayout) { 37 | val offsetViewBounds = Rect() 38 | it.getDrawingRect(offsetViewBounds) 39 | parent.offsetDescendantRectToMyCoords(it, offsetViewBounds) 40 | val transaction = (it.context as AppCompatActivity).supportFragmentManager.beginTransaction() 41 | val fragment = ItemFragment.newInstance() 42 | fragment.update(holder) 43 | transaction.replace(R.id.container, fragment) 44 | transaction.commitNow() 45 | parent.transitionToEnd() 46 | } 47 | } 48 | } 49 | 50 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { 51 | val v = LayoutInflater.from(parent.context).inflate(R.layout.item_layout, parent, false) 52 | return ViewHolder(v) 53 | } 54 | 55 | override fun getItemCount(): Int { 56 | return userList.size 57 | } 58 | 59 | class ViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){ 60 | val txtName = itemView.findViewById(R.id.txtName) as TextView 61 | val txtTitle = itemView.findViewById(R.id.txtTitle) as TextView 62 | } 63 | 64 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/fragmentsdemo/ItemFragment.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.fragmentsdemo 18 | 19 | import android.os.Bundle 20 | import android.view.LayoutInflater 21 | import android.view.View 22 | import android.view.ViewGroup 23 | import android.widget.TextView 24 | import androidx.fragment.app.Fragment 25 | import com.google.androidstudio.motionlayoutexample.R 26 | 27 | class ItemFragment : Fragment() { 28 | 29 | companion object { 30 | fun newInstance() = ItemFragment() 31 | } 32 | 33 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, 34 | savedInstanceState: Bundle?): View { 35 | return inflater.inflate(R.layout.item_layout, container, false) 36 | } 37 | 38 | private lateinit var myHolder: CustomAdapter.ViewHolder 39 | 40 | fun update(holder: CustomAdapter.ViewHolder) { 41 | myHolder = holder 42 | view?.findViewById(R.id.txtTitle)?.text = holder.txtTitle.text 43 | view?.findViewById(R.id.txtName)?.text = holder.txtName.text 44 | } 45 | 46 | override fun onStart() { 47 | super.onStart() 48 | if (this::myHolder.isInitialized) { 49 | update(myHolder) 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/fragmentsdemo/ListFragment.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.fragmentsdemo 18 | 19 | import android.os.Bundle 20 | import android.util.Log 21 | import android.view.LayoutInflater 22 | import android.view.View 23 | import android.view.ViewGroup 24 | import androidx.fragment.app.Fragment 25 | import androidx.recyclerview.widget.LinearLayoutManager 26 | import androidx.recyclerview.widget.RecyclerView 27 | import com.google.androidstudio.motionlayoutexample.R 28 | 29 | class ListFragment : Fragment() { 30 | 31 | private lateinit var recyclerView: RecyclerView 32 | 33 | companion object { 34 | fun newInstance() = ListFragment() 35 | } 36 | 37 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, 38 | savedInstanceState: Bundle?): View { 39 | Log.i(ListFragment::class.java.simpleName, "onCreateView, container is $container") 40 | return inflater.inflate(R.layout.motion_22_list_fragment, container, false) 41 | } 42 | 43 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 44 | recyclerView = view.findViewById(R.id.list) 45 | 46 | recyclerView.layoutManager = LinearLayoutManager( 47 | context, RecyclerView.VERTICAL, false) 48 | val users = ArrayList() 49 | users.add(User("Paul", "Mr")) 50 | users.add(User("Jane", "Miss")) 51 | users.add(User("John", "Dr")) 52 | users.add(User("Amy", "Mrs")) 53 | users.add(User("Paul", "Mr")) 54 | users.add(User("Jane", "Miss")) 55 | users.add(User("John", "Dr")) 56 | users.add(User("Amy", "Mrs")) 57 | users.add(User("Paul", "Mr")) 58 | users.add(User("Jane", "Miss")) 59 | users.add(User("John", "Dr")) 60 | users.add(User("Amy", "Mrs")) 61 | users.add(User("Paul", "Mr")) 62 | users.add(User("Jane", "Miss")) 63 | users.add(User("John", "Dr")) 64 | users.add(User("Amy", "Mrs")) 65 | 66 | val adapter = CustomAdapter(users) 67 | recyclerView.adapter = adapter 68 | 69 | super.onViewCreated(view, savedInstanceState) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/fragmentsdemo/MainFragment.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.fragmentsdemo 18 | 19 | import android.os.Bundle 20 | import android.view.LayoutInflater 21 | import android.view.View 22 | import android.view.ViewGroup 23 | import androidx.fragment.app.Fragment 24 | import com.google.androidstudio.motionlayoutexample.R 25 | 26 | class MainFragment : Fragment() { 27 | 28 | companion object { 29 | fun newInstance() = MainFragment() 30 | } 31 | 32 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, 33 | savedInstanceState: Bundle?): View { 34 | return inflater.inflate(R.layout.motion_21_main_fragment, container, false) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/fragmentsdemo/SecondFragment.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.fragmentsdemo 18 | 19 | import android.os.Bundle 20 | import android.util.Log 21 | import android.view.LayoutInflater 22 | import android.view.View 23 | import android.view.ViewGroup 24 | import androidx.constraintlayout.motion.widget.MotionLayout 25 | import androidx.fragment.app.Fragment 26 | import com.google.androidstudio.motionlayoutexample.R 27 | 28 | class SecondFragment : Fragment() { 29 | 30 | private lateinit var motionLayout: MotionLayout 31 | 32 | companion object { 33 | fun newInstance() = SecondFragment() 34 | } 35 | 36 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, 37 | savedInstanceState: Bundle?): View { 38 | return inflater.inflate(R.layout.motion_21_second_fragment, container, false) 39 | } 40 | 41 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 42 | motionLayout = view.findViewById(R.id.main) 43 | super.onViewCreated(view, savedInstanceState) 44 | } 45 | 46 | override fun onStart() { 47 | super.onStart() 48 | Log.i(SecondFragment::class.java.simpleName, "onStart of fragment...") 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/fragmentsdemo/User.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.fragmentsdemo 18 | 19 | data class User(val name: String, val title: String) -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/helpers/ExampleFlyinBounceHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.helpers; 18 | 19 | import android.animation.ObjectAnimator; 20 | import android.content.Context; 21 | import android.util.AttributeSet; 22 | import android.view.View; 23 | import android.view.animation.BounceInterpolator; 24 | 25 | import androidx.constraintlayout.widget.ConstraintHelper; 26 | import androidx.constraintlayout.widget.ConstraintLayout; 27 | 28 | public class ExampleFlyinBounceHelper extends ConstraintHelper { 29 | protected ConstraintLayout mContainer; 30 | 31 | public ExampleFlyinBounceHelper(Context context) { 32 | super(context); 33 | } 34 | 35 | public ExampleFlyinBounceHelper(Context context, AttributeSet attrs) { 36 | super(context, attrs); 37 | } 38 | 39 | public ExampleFlyinBounceHelper(Context context, AttributeSet attrs, int defStyleAttr) { 40 | super(context, attrs, defStyleAttr); 41 | } 42 | 43 | /** 44 | * @param container 45 | * @hide 46 | */ 47 | @Override 48 | public void updatePreLayout(ConstraintLayout container) { 49 | if (mContainer!=container) { 50 | View[] views = getViews(container); 51 | for (int i = 0; i < mCount; i++) { 52 | View view = views[i]; 53 | ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", - 2000, 0).setDuration(1000); 54 | animator.setInterpolator(new BounceInterpolator()); 55 | animator.start(); 56 | } 57 | } 58 | mContainer = container; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/helpers/FadeIn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.helpers; 18 | 19 | import android.content.Context; 20 | import android.util.AttributeSet; 21 | import android.view.View; 22 | 23 | import androidx.constraintlayout.motion.widget.MotionHelper; 24 | 25 | public class FadeIn extends MotionHelper { 26 | 27 | public FadeIn(Context context) { 28 | super(context); 29 | } 30 | 31 | public FadeIn(Context context, AttributeSet attrs) { 32 | super(context, attrs); 33 | } 34 | 35 | public FadeIn(Context context, AttributeSet attrs, int defStyleAttr) { 36 | super(context, attrs, defStyleAttr); 37 | } 38 | 39 | @Override 40 | public void setProgress(View view, float progress) { 41 | view.setAlpha(progress); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/helpers/FadeOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.helpers; 18 | 19 | import android.content.Context; 20 | import android.util.AttributeSet; 21 | import android.view.View; 22 | 23 | import androidx.constraintlayout.motion.widget.MotionHelper; 24 | 25 | public class FadeOut extends MotionHelper { 26 | 27 | public FadeOut(Context context) { 28 | super(context); 29 | } 30 | 31 | public FadeOut(Context context, AttributeSet attrs) { 32 | super(context, attrs); 33 | } 34 | 35 | public FadeOut(Context context, AttributeSet attrs, int defStyleAttr) { 36 | super(context, attrs, defStyleAttr); 37 | } 38 | 39 | @Override 40 | public void setProgress(View view, float progress) { 41 | view.setAlpha(1f - progress); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/utils/BoundsImageView.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.utils 18 | 19 | import android.content.Context 20 | import android.graphics.Canvas 21 | import android.graphics.Paint 22 | import android.util.AttributeSet 23 | import android.widget.ImageView 24 | 25 | class BoundsImageView @JvmOverloads constructor( 26 | context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 27 | ) : ImageView(context, attrs, defStyleAttr) { 28 | 29 | private var paint = Paint() 30 | 31 | init { 32 | paint.setARGB(255, 200, 0, 0) 33 | paint.strokeWidth = 4f 34 | } 35 | 36 | 37 | override fun onDraw(canvas: Canvas?) { 38 | super.onDraw(canvas) 39 | canvas?.drawLine(0f, 0f, width.toFloat(), height.toFloat(), paint) 40 | canvas?.drawLine(0f, height.toFloat(), width.toFloat(), 0f, paint) 41 | } 42 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/utils/CollapsibleToolbar.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.utils 18 | 19 | import android.content.Context 20 | import android.util.AttributeSet 21 | import androidx.constraintlayout.motion.widget.MotionLayout 22 | import com.google.android.material.appbar.AppBarLayout 23 | 24 | class CollapsibleToolbar @JvmOverloads constructor( 25 | context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 26 | ) : MotionLayout(context, attrs, defStyleAttr), AppBarLayout.OnOffsetChangedListener { 27 | 28 | override fun onOffsetChanged(appBarLayout: AppBarLayout?, verticalOffset: Int) { 29 | progress = -verticalOffset / appBarLayout?.totalScrollRange?.toFloat()!! 30 | } 31 | 32 | override fun onAttachedToWindow() { 33 | super.onAttachedToWindow() 34 | (parent as? AppBarLayout)?.addOnOffsetChangedListener(this) 35 | } 36 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/utils/DrawerContent.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.utils 18 | 19 | import android.content.Context 20 | import android.util.AttributeSet 21 | import android.view.View 22 | import androidx.constraintlayout.motion.widget.MotionLayout 23 | import androidx.drawerlayout.widget.DrawerLayout 24 | 25 | class DrawerContent @JvmOverloads constructor( 26 | context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 27 | ) : MotionLayout(context, attrs, defStyleAttr), DrawerLayout.DrawerListener { 28 | override fun onDrawerStateChanged(newState: Int) { 29 | } 30 | 31 | override fun onDrawerSlide(drawerView: View, slideOffset: Float) { 32 | progress = slideOffset 33 | } 34 | 35 | override fun onDrawerClosed(drawerView: View) { 36 | } 37 | 38 | override fun onDrawerOpened(drawerView: View) { 39 | } 40 | 41 | override fun onAttachedToWindow() { 42 | super.onAttachedToWindow() 43 | (parent as? DrawerLayout)?.addDrawerListener(this) 44 | } 45 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/utils/TouchFrameLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.utils; 18 | 19 | import android.content.Context; 20 | import android.util.AttributeSet; 21 | import android.view.View; 22 | import android.widget.FrameLayout; 23 | 24 | import androidx.annotation.NonNull; 25 | import androidx.annotation.Nullable; 26 | import androidx.core.view.NestedScrollingParent2; 27 | 28 | public class TouchFrameLayout extends FrameLayout implements NestedScrollingParent2 { 29 | 30 | 31 | public TouchFrameLayout(@NonNull Context context) { 32 | super(context); 33 | } 34 | 35 | public TouchFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) { 36 | super(context, attrs); 37 | } 38 | 39 | public TouchFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 40 | super(context, attrs, defStyleAttr); 41 | } 42 | 43 | public NestedScrollingParent2 getMotionLayout() { 44 | return (NestedScrollingParent2) getParent(); 45 | } 46 | 47 | @Override 48 | public boolean onStartNestedScroll(@NonNull View child, @NonNull View target, int axes, int type) { 49 | return getMotionLayout().onStartNestedScroll(child, target, axes, type); 50 | } 51 | 52 | @Override 53 | public void onNestedScrollAccepted(@NonNull View child, @NonNull View target, int axes, int type) { 54 | getMotionLayout().onNestedScrollAccepted(child, target, axes, type); 55 | } 56 | 57 | @Override 58 | public void onStopNestedScroll(@NonNull View target, int type) { 59 | getMotionLayout().onStopNestedScroll(target, type); 60 | } 61 | 62 | @Override 63 | public void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) { 64 | getMotionLayout().onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type); 65 | } 66 | 67 | @Override 68 | public void onNestedPreScroll(@NonNull View target, int dx, int dy, @NonNull int[] consumed, int type) { 69 | getMotionLayout().onNestedPreScroll(target, dx, dy, consumed, type); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/utils/ViewpagerHeader.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.utils 18 | 19 | import android.content.Context 20 | import android.util.AttributeSet 21 | import androidx.constraintlayout.motion.widget.MotionLayout 22 | import androidx.viewpager.widget.ViewPager 23 | 24 | class ViewpagerHeader @JvmOverloads constructor( 25 | context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 26 | ) : MotionLayout(context, attrs, defStyleAttr), ViewPager.OnPageChangeListener { 27 | 28 | override fun onPageScrollStateChanged(state: Int) { 29 | } 30 | 31 | override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) { 32 | val numPages = 3 33 | progress = (position + positionOffset) / (numPages - 1) 34 | } 35 | 36 | override fun onPageSelected(position: Int) { 37 | } 38 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/viewpagerdemo/Page.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.viewpagerdemo 18 | 19 | import android.os.Bundle 20 | import android.view.LayoutInflater 21 | import android.view.View 22 | import android.view.ViewGroup 23 | import androidx.fragment.app.Fragment 24 | 25 | class Page : Fragment() { 26 | 27 | private var layoutId = 0 28 | 29 | override fun setArguments(args: Bundle?) { 30 | super.setArguments(args) 31 | if (args != null) { 32 | layoutId = args.getInt("layout") 33 | } 34 | } 35 | 36 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, 37 | savedInstanceState: Bundle?): View? { 38 | // Inflate the layout for this fragment 39 | return inflater.inflate(layoutId, container, false) 40 | } 41 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/viewpagerdemo/ViewPagerActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.viewpagerdemo 18 | 19 | import android.os.Bundle 20 | import androidx.appcompat.app.AppCompatActivity 21 | import androidx.constraintlayout.motion.widget.MotionLayout 22 | import androidx.viewpager.widget.ViewPager 23 | import com.google.androidstudio.motionlayoutexample.R 24 | import kotlinx.android.synthetic.main.motion_16_viewpager.* 25 | 26 | class ViewPagerActivity : AppCompatActivity() { 27 | 28 | override fun onCreate(savedInstanceState: Bundle?) { 29 | super.onCreate(savedInstanceState) 30 | val layout = R.layout.motion_16_viewpager 31 | setContentView(layout) 32 | val motionLayout = findViewById(R.id.motionLayout) 33 | 34 | val adapter = ViewPagerAdapter(supportFragmentManager) 35 | adapter.addPage("Page 1", R.layout.motion_16_viewpager_page1) 36 | adapter.addPage("Page 2", R.layout.motion_16_viewpager_page2) 37 | adapter.addPage("Page 3", R.layout.motion_16_viewpager_page3) 38 | pager.adapter = adapter 39 | tabs.setupWithViewPager(pager) 40 | if (motionLayout != null) { 41 | pager.addOnPageChangeListener(motionLayout as ViewPager.OnPageChangeListener) 42 | } 43 | 44 | val debugMode = if (intent.getBooleanExtra("showPaths", false)) { 45 | MotionLayout.DEBUG_SHOW_PATH 46 | } else { 47 | MotionLayout.DEBUG_SHOW_NONE 48 | } 49 | motionLayout.setDebugMode(debugMode) 50 | } 51 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/viewpagerdemo/ViewPagerActivity2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.viewpagerdemo 18 | 19 | import android.os.Bundle 20 | import androidx.appcompat.app.AppCompatActivity 21 | import androidx.constraintlayout.motion.widget.MotionLayout 22 | import androidx.viewpager.widget.ViewPager 23 | import com.google.androidstudio.motionlayoutexample.R 24 | import kotlinx.android.synthetic.main.motion_16_viewpager.* 25 | 26 | class ViewPagerActivity2 : AppCompatActivity() { 27 | 28 | override fun onCreate(savedInstanceState: Bundle?) { 29 | super.onCreate(savedInstanceState) 30 | val layout = R.layout.motion_23_viewpager 31 | setContentView(layout) 32 | val motionLayout = findViewById(R.id.motionLayout) 33 | 34 | val adapter = ViewPagerAdapter(supportFragmentManager) 35 | adapter.addPage("Page 1", R.layout.motion_16_viewpager_page1) 36 | adapter.addPage("Page 2", R.layout.motion_16_viewpager_page2) 37 | adapter.addPage("Page 3", R.layout.motion_16_viewpager_page3) 38 | pager.adapter = adapter 39 | tabs.setupWithViewPager(pager) 40 | if (motionLayout != null) { 41 | pager.addOnPageChangeListener(motionLayout as ViewPager.OnPageChangeListener) 42 | } 43 | 44 | val debugMode = if (intent.getBooleanExtra("showPaths", false)) { 45 | MotionLayout.DEBUG_SHOW_PATH 46 | } else { 47 | MotionLayout.DEBUG_SHOW_NONE 48 | } 49 | motionLayout.setDebugMode(debugMode) 50 | } 51 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/viewpagerdemo/ViewPagerAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.viewpagerdemo 18 | 19 | import android.os.Bundle 20 | import androidx.fragment.app.Fragment 21 | import androidx.fragment.app.FragmentManager 22 | import androidx.fragment.app.FragmentPagerAdapter 23 | 24 | class ViewPagerAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm) { 25 | 26 | private val fragmentList = ArrayList() 27 | private val fragmentTitleList = ArrayList() 28 | 29 | override fun getItem(position: Int): Fragment { 30 | return fragmentList[position] 31 | } 32 | 33 | override fun getCount(): Int { 34 | return fragmentList.size 35 | } 36 | 37 | private fun addFragment(fragment: Fragment, title: String) { 38 | fragmentList.add(fragment) 39 | fragmentTitleList.add(title) 40 | } 41 | 42 | override fun getPageTitle(position: Int): CharSequence? { 43 | return fragmentTitleList[position] 44 | } 45 | 46 | fun addPage(s: String, layout: Int) { 47 | val page = Page() 48 | val arg = Bundle() 49 | arg.putInt("layout", layout) 50 | page.arguments = arg 51 | addFragment(page, s) 52 | } 53 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/youtubedemo/Cats.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.youtubedemo 18 | 19 | import com.google.androidstudio.motionlayoutexample.R 20 | 21 | object Cats { 22 | 23 | val catImages = intArrayOf( 24 | R.drawable.cat_1, 25 | R.drawable.cat_2, 26 | R.drawable.cat_3, 27 | R.drawable.cat_4, 28 | R.drawable.cat_5, 29 | R.drawable.cat_6, 30 | R.drawable.cat_7, 31 | R.drawable.cat_8, 32 | R.drawable.cat_9, 33 | R.drawable.cat_10, 34 | R.drawable.cat_11, 35 | R.drawable.cat_12, 36 | R.drawable.cat_13, 37 | R.drawable.cat_14, 38 | R.drawable.cat_15, 39 | R.drawable.cat_16, 40 | R.drawable.cat_17, 41 | R.drawable.cat_18, 42 | R.drawable.cat_19 43 | ) 44 | } -------------------------------------------------------------------------------- /motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample/youtubedemo/YouTubeDemoActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.androidstudio.motionlayoutexample.youtubedemo 18 | 19 | import android.os.Bundle 20 | import androidx.appcompat.app.AppCompatActivity 21 | import androidx.constraintlayout.motion.widget.MotionLayout 22 | import androidx.recyclerview.widget.LinearLayoutManager 23 | import androidx.recyclerview.widget.RecyclerView 24 | import com.google.androidstudio.motionlayoutexample.R 25 | 26 | class YouTubeDemoActivity : AppCompatActivity() { 27 | 28 | override fun onCreate(savedInstanceState: Bundle?) { 29 | super.onCreate(savedInstanceState) 30 | setContentView(R.layout.motion_24_youtube) 31 | val motionLayout = findViewById(R.id.motionLayout).apply { 32 | savedInstanceState 33 | } 34 | findViewById(R.id.recyclerview_front).apply { 35 | adapter = FrontPhotosAdapter() 36 | isNestedScrollingEnabled = false 37 | layoutManager = LinearLayoutManager(this@YouTubeDemoActivity) 38 | } 39 | val debugMode = if (intent.getBooleanExtra("showPaths", false)) { 40 | MotionLayout.DEBUG_SHOW_PATH 41 | } else { 42 | MotionLayout.DEBUG_SHOW_NONE 43 | } 44 | motionLayout.setDebugMode(debugMode) 45 | } 46 | } -------------------------------------------------------------------------------- /motionlayout/src/main/res/animator/hide.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/animator/show.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 15 | 21 | 26 | 27 | 33 | 36 | 39 | 40 | 41 | 42 | 48 | 49 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/avatar_1_raster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/avatar_1_raster.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/avatar_2_raster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/avatar_2_raster.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/avatar_3_raster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/avatar_3_raster.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/avatar_4_raster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/avatar_4_raster.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/avatar_5_raster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/avatar_5_raster.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/avatar_6_raster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/avatar_6_raster.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/avatar_7_raster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/avatar_7_raster.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/avatar_8_raster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/avatar_8_raster.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/car.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_1.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_10.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_10.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_11.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_11.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_12.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_12.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_13.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_13.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_14.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_14.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_15.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_15.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_16.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_16.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_17.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_17.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_18.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_18.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_19.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_19.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_2.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_3.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_4.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_5.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_6.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_7.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_7.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_8.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_8.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/cat_9.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/cat_9.jpeg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/hoford.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/hoford.jpg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ic_add_a_photo_24dp.xml: -------------------------------------------------------------------------------- 1 | 15 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ic_clear_gray_32dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ic_dashboard_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ic_home_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ic_info_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 15 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ic_keyboard_arrow_right.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ic_keyboard_arrow_right_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 15 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ic_keyboard_arrow_up.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ic_notifications_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ic_play_arrow_gray_32dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ml_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/ml_icon.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/ml_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/ml_logo.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/monterey.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/monterey.jpg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/monterey_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/monterey_small.jpg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/mountains.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/mountains.jpg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/roard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/roard.jpg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/sea.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/sea.jpg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/sunset2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/sunset2.jpg -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/trees.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/drawable/trees.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/drawable/wcircle.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 19 | 20 | 22 | 23 | 26 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/activity_scrolling.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/content_scrolling.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 24 | 25 | 30 | 31 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/item_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 21 | 22 | 32 | 33 | 45 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/main_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 25 | 26 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_01_basic.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 24 | 25 | 33 | 34 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_01_cl_end.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 20 | 21 | 30 | 31 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_01_cl_start.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 20 | 21 | 30 | 31 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_02_basic.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 24 | 25 | 33 | 34 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_02_basic_autocomplete_false.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 24 | 25 | 33 | 34 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_03_custom_attribute.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 23 | 24 | 29 | 30 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_04_imagefilter.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 23 | 24 | 31 | 32 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_05_imagefilter.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 29 | 30 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_06_keyframe.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 28 | 29 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_07_keyframe.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 25 | 26 | 34 | 35 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_08_cycle.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 23 | 24 | 32 | 33 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_09_coordinatorlayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_09_coordinatorlayout_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 25 | 26 | 33 | 34 | 43 | 44 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_10_coordinatorlayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_10_coordinatorlayout_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 25 | 26 | 33 | 34 | 43 | 44 | 52 | 53 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_11_coordinatorlayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_12_drawerlayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_12_drawerlayout_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_13_drawerlayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_14_side_panel.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 23 | 24 | 25 | 26 | 33 | 34 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_15_parallax.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 23 | 24 | 30 | 31 | 38 | 39 | 46 | 47 | 54 | 55 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_16_viewpager.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 20 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 38 | 39 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_16_viewpager_page1.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 20 | 21 | 32 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_16_viewpager_page2.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 20 | 21 | 32 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_16_viewpager_page3.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 20 | 21 | 32 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_17_coordination.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_17_coordination_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 24 | 25 | 32 | 33 | 42 | 43 | 51 | 52 | 58 | 59 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_18_coordination.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_19_coordination.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 24 | 25 | 26 | 27 | 32 | 33 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_19_coordination_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 24 | 25 | 32 | 33 | 42 | 43 | 51 | 52 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_21_main_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 21 | 22 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_21_second_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 24 | 25 | 30 | 31 | 36 | 37 | 46 | 47 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_22_list_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 25 | 26 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_23_parallax.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_23_viewpager.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 14 | 15 | 16 | 17 | 24 | 25 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_24_recyclerview_expanded_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 26 | 27 | 36 | 37 | 47 | 48 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_24_recyclerview_expanded_text_description.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 32 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_24_recyclerview_expanded_text_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/motion_25_keytrigger.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 24 | 25 | 26 | 27 | 36 | 37 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/layout/row.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 21 | 22 | 34 | 35 | 52 | 53 | 58 | 59 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/menu/bottom_nav_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 22 | 23 | 27 | 28 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/menu/menu_scrolling.xml: -------------------------------------------------------------------------------- 1 | 15 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlearchive/android-ConstraintLayoutExamples/584dde12c5defe53e266a4d3e23868dfd6c76f39/motionlayout/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /motionlayout/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | #FFF 18 | #3f70d7 19 | #122345 20 | #D81B60 21 | #41000000 22 | #ffffff 23 | #49A9DF 24 | #137AE2 25 | #643A07 26 | 27 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 180dp 17 | 16dp 18 | 16dp 19 | 20 | -------------------------------------------------------------------------------- /motionlayout/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 24 | 25 | 30 | 31 |