├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── car.png
│ │ │ │ ├── sea.jpg
│ │ │ │ ├── cat_1.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
│ │ │ │ ├── roard.jpg
│ │ │ │ ├── trees.png
│ │ │ │ ├── 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
│ │ │ │ ├── ml_logo.png
│ │ │ │ ├── mountains.jpg
│ │ │ │ ├── sunset2.jpg
│ │ │ │ ├── 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
│ │ │ │ ├── circle.xml
│ │ │ │ ├── ic_keyboard_arrow_up.xml
│ │ │ │ ├── ic_keyboard_arrow_right.xml
│ │ │ │ ├── shape_circle.xml
│ │ │ │ ├── ic_home_black_24dp.xml
│ │ │ │ ├── ic_dashboard_black_24dp.xml
│ │ │ │ ├── ic_keyboard_arrow_right_black_24dp.xml
│ │ │ │ ├── ic_play_arrow_gray_32dp.xml
│ │ │ │ ├── ic_info_black_24dp.xml
│ │ │ │ ├── ic_clear_gray_32dp.xml
│ │ │ │ ├── ic_notifications_black_24dp.xml
│ │ │ │ ├── ic_add_a_photo_24dp.xml
│ │ │ │ └── wcircle.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── alipay.jpg
│ │ │ │ ├── avatat.jpg
│ │ │ │ ├── wechat.jpg
│ │ │ │ ├── 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
│ │ │ ├── color
│ │ │ │ └── cerulean_blue.xml
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── colors.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ ├── motion_12_drawerlayout_content.xml
│ │ │ │ ├── motion_12_drawerlayout.xml
│ │ │ │ ├── motion_13_drawerlayout.xml
│ │ │ │ ├── motion_23_parallax.xml
│ │ │ │ ├── motion_21_main_fragment.xml
│ │ │ │ ├── motion_16_viewpager_page1.xml
│ │ │ │ ├── motion_16_viewpager_page2.xml
│ │ │ │ ├── motion_16_viewpager_page3.xml
│ │ │ │ ├── content_scrolling.xml
│ │ │ │ ├── motion_09_coordinatorlayout.xml
│ │ │ │ ├── motion_25_keytrigger.xml
│ │ │ │ ├── fragment_example_layout.xml
│ │ │ │ ├── motion_23_viewpager.xml
│ │ │ │ ├── motion_17_coordination.xml
│ │ │ │ ├── motion_22_list_fragment.xml
│ │ │ │ ├── motion_06_keyframe.xml
│ │ │ │ ├── motion_09_coordinatorlayout_header.xml
│ │ │ │ ├── motion_03_custom_attribute.xml
│ │ │ │ ├── motion_05_imagefilter.xml
│ │ │ │ ├── motion_24_recyclerview_expanded_text_header.xml
│ │ │ │ ├── motion_24_recyclerview_expanded_text_description.xml
│ │ │ │ ├── motion_01_cl_end.xml
│ │ │ │ ├── motion_01_cl_start.xml
│ │ │ │ ├── motion_08_cycle.xml
│ │ │ │ ├── motion_19_coordination.xml
│ │ │ │ ├── motion_18_coordination.xml
│ │ │ │ ├── motion_04_imagefilter.xml
│ │ │ │ ├── motion_07_keyframe.xml
│ │ │ │ ├── activity_scrolling.xml
│ │ │ │ ├── motion_01_basic.xml
│ │ │ │ ├── motion_10_coordinatorlayout.xml
│ │ │ │ ├── motion_11_coordinatorlayout.xml
│ │ │ │ ├── motion_02_basic.xml
│ │ │ │ ├── motion_14_side_panel.xml
│ │ │ │ ├── motion_16_viewpager.xml
│ │ │ │ ├── row.xml
│ │ │ │ ├── motion_15_parallax.xml
│ │ │ │ ├── motion_24_recyclerview_expanded_row.xml
│ │ │ │ ├── motion_19_coordination_header.xml
│ │ │ │ ├── motion_10_coordinatorlayout_header.xml
│ │ │ │ ├── item_layout.xml
│ │ │ │ ├── motion_17_coordination_header.xml
│ │ │ │ ├── motion_21_second_fragment.xml
│ │ │ │ ├── motion_20_reveal.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── motion_11_coordinatorlayout_header.xml
│ │ │ ├── xml
│ │ │ │ ├── scene_01.xml
│ │ │ │ ├── list_scene.xml
│ │ │ │ ├── scene_23.xml
│ │ │ │ ├── scene_02.xml
│ │ │ │ ├── scene_12_content.xml
│ │ │ │ ├── scene_05.xml
│ │ │ │ ├── scene_09.xml
│ │ │ │ ├── main_scene.xml
│ │ │ │ ├── scene_04.xml
│ │ │ │ ├── scene_03.xml
│ │ │ │ ├── scene_17.xml
│ │ │ │ ├── scene_21_second_fragment.xml
│ │ │ │ ├── scene_14.xml
│ │ │ │ ├── scene_06.xml
│ │ │ │ ├── scene_07.xml
│ │ │ │ ├── scene_25.xml
│ │ │ │ ├── scene_18.xml
│ │ │ │ ├── scene_19.xml
│ │ │ │ └── scene_08.xml
│ │ │ ├── animator
│ │ │ │ ├── hide.xml
│ │ │ │ └── show.xml
│ │ │ ├── menu
│ │ │ │ └── bottom_nav_menu.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── lsm
│ │ │ │ └── androidx
│ │ │ │ ├── ConstraintLayoutActivityDemo.java
│ │ │ │ ├── fragment
│ │ │ │ ├── User.java
│ │ │ │ ├── MainFragment.java
│ │ │ │ ├── SecondFragment.java
│ │ │ │ ├── ItemFragment.java
│ │ │ │ ├── ListFragment.java
│ │ │ │ ├── FragmentExample2Activity.java
│ │ │ │ └── FragmentExampleActivity.java
│ │ │ │ ├── viewPager
│ │ │ │ ├── Page.java
│ │ │ │ ├── ViewPagerAdapter.java
│ │ │ │ ├── ViewPagerActivity.java
│ │ │ │ └── ViewPagerActivity2.java
│ │ │ │ ├── weight
│ │ │ │ ├── BoundsImageView.java
│ │ │ │ ├── ViewpagerHeader.java
│ │ │ │ ├── DrawerContent.java
│ │ │ │ ├── CollapsibleToolbar.java
│ │ │ │ ├── ExampleFlyinBounceHelper.java
│ │ │ │ └── TouchFrameLayout.java
│ │ │ │ ├── youtubedemo
│ │ │ │ ├── Cats.java
│ │ │ │ ├── YouTubeDemoViewHolder.java
│ │ │ │ ├── YouTubeDemoActivity.java
│ │ │ │ └── FrontPhotosAdapter.java
│ │ │ │ ├── helpers
│ │ │ │ ├── FadeOut.java
│ │ │ │ └── FadeIn.java
│ │ │ │ ├── AdapterItemBean.java
│ │ │ │ ├── DemosAdapter.java
│ │ │ │ └── DemoActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── lsm
│ │ │ └── androidx
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── lsm
│ │ └── androidx
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── .idea
├── dictionaries
│ └── win7.xml
├── runConfigurations.xml
├── gradle.xml
├── misc.xml
└── codeStyles
│ └── Project.xml
├── AndroidXMotionLayoutDemo.zip
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
└── gradlew.bat
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/.idea/dictionaries/win7.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/AndroidXMotionLayoutDemo.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/AndroidXMotionLayoutDemo.zip
--------------------------------------------------------------------------------
/app/src/main/res/drawable/car.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/car.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/sea.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/sea.jpg
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_1.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_2.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_3.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_4.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_5.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_6.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_7.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_7.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_8.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_8.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_9.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_9.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/roard.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/roard.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/trees.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/trees.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_10.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_10.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_11.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_11.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_12.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_12.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_13.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_13.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_14.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_14.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_15.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_15.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_16.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_16.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_17.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_17.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_18.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_18.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cat_19.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/cat_19.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ml_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/ml_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/mountains.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/mountains.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/sunset2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/sunset2.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/alipay.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/alipay.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/avatat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/avatat.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/wechat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/wechat.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/avatar_1_raster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/avatar_1_raster.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/avatar_2_raster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/avatar_2_raster.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/avatar_3_raster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/avatar_3_raster.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/avatar_4_raster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/avatar_4_raster.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/avatar_5_raster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/avatar_5_raster.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/avatar_6_raster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/avatar_6_raster.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/avatar_7_raster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/avatar_7_raster.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/avatar_8_raster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/drawable/avatar_8_raster.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/color/cerulean_blue.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shimingli/AndroidXMotionLayoutDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Apr 01 11:34:28 CST 2019
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.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 30dp
4 | 180dp
5 | 16dp
6 | 22sp
7 | 16sp
8 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_keyboard_arrow_up.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_keyboard_arrow_right.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_home_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_dashboard_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_keyboard_arrow_right_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_play_arrow_gray_32dp.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_info_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_clear_gray_32dp.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/test/java/com/lsm/androidx/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_12_drawerlayout_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_12_drawerlayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_13_drawerlayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_01.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
10 |
11 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_add_a_photo_24dp.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/ConstraintLayoutActivityDemo.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.annotation.Nullable;
6 | import androidx.appcompat.app.AppCompatActivity;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | *
13 | * @author shiming
14 | * @version v1.0
15 | * @since 2019/4/1 16:30
16 | */
17 | public class ConstraintLayoutActivityDemo extends AppCompatActivity {
18 | @Override
19 | protected void onCreate(@Nullable Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.demo_layout);
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_23_parallax.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/fragment/User.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.fragment;
2 |
3 | /**
4 | *
5 | *
6 | *
7 | *
8 | * @author shiming
9 | * @version v1.0
10 | * @since 2019/4/7 11:47
11 | */
12 | public class User {
13 |
14 | private String name;
15 |
16 | public User(String name, String title) {
17 | this.name = name;
18 | this.title = title;
19 | }
20 |
21 | public String getName() {
22 | return name;
23 | }
24 |
25 | public void setName(String name) {
26 | this.name = name;
27 | }
28 |
29 | public String getTitle() {
30 | return title;
31 | }
32 |
33 | public void setTitle(String title) {
34 | this.title = title;
35 | }
36 |
37 | private String title;
38 |
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/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 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 | #00FF95
7 | #003BFF
8 | #FBFF00
9 | #C800FF
10 | #FF6600
11 | #00DB07
12 | #0084DB
13 | #5800DB
14 | #BD24FF
15 | #FF24CC
16 | #FF2491
17 | #FF243D
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | android.enableJetifier=true
10 | android.useAndroidX=true
11 | org.gradle.jvmargs=-Xmx1536m
12 | # When configured, Gradle will run in incubating parallel mode.
13 | # This option should only be used with decoupled projects. More details, visit
14 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
15 | # org.gradle.parallel=true
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/lsm/androidx/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx;
2 |
3 | import android.content.Context;
4 | import androidx.test.InstrumentationRegistry;
5 | import androidx.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.lsm.androidx", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_21_main_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_16_viewpager_page1.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_16_viewpager_page2.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_16_viewpager_page3.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_scrolling.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/hide.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/show.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/wcircle.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
19 |
20 |
22 |
23 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_09_coordinatorlayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_25_keytrigger.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_example_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_23_viewpager.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/viewPager/Page.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.viewPager;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
9 |
10 | import androidx.annotation.NonNull;
11 | import androidx.annotation.Nullable;
12 | import androidx.fragment.app.Fragment;
13 |
14 | /**
15 | *
16 | *
17 | *
18 | *
19 | * @author shiming
20 | * @version v1.0
21 | * @since 2019/4/3 11:32
22 | */
23 | public class Page extends Fragment {
24 |
25 | private int mLayout;
26 |
27 | @Override
28 | public void setArguments(@Nullable Bundle args) {
29 | super.setArguments(args);
30 | //获取布局的id
31 | if (args!=null){
32 | mLayout = args.getInt("layout");
33 | }
34 | }
35 |
36 | @Nullable
37 | @Override
38 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
39 | @Nullable Bundle savedInstanceState) {
40 | return inflater.inflate(mLayout,container,false);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/weight/BoundsImageView.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.weight;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.util.AttributeSet;
7 | import android.widget.ImageView;
8 |
9 | import androidx.annotation.Nullable;
10 |
11 | /**
12 | *
13 | *
14 | *
15 | *
16 | * @author shiming
17 | * @version v1.0
18 | * @since 2019/4/3 19:22
19 | */
20 | public class BoundsImageView extends ImageView {
21 |
22 | Paint mPaint=new Paint();
23 |
24 | public BoundsImageView(Context context) {
25 | this(context,null);
26 | }
27 |
28 | public BoundsImageView(Context context, @Nullable AttributeSet attrs) {
29 | super(context, attrs);
30 | mPaint.setARGB(255,200,0,0);
31 | mPaint.setStrokeWidth(4);
32 | }
33 |
34 | /**
35 | * 当这个View的ondraw的时候 其实就是花了两个对角线
36 | * @param canvas
37 | */
38 | @Override
39 | protected void onDraw(Canvas canvas) {
40 | super.onDraw(canvas);
41 | canvas.drawLine(0f,0f,getWidth(),getHeight(),mPaint);
42 | canvas.drawLine(0f,getHeight(),getWidth(),0f,mPaint);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/weight/ViewpagerHeader.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.weight;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.ViewParent;
6 |
7 | import androidx.constraintlayout.motion.widget.MotionLayout;
8 | import androidx.viewpager.widget.ViewPager;
9 |
10 | /**
11 | *
12 | * 实现 就具有拖拽的能力了
13 | *
14 | *
15 | * @author shiming
16 | * @version v1.0
17 | * @since 2019/4/3 11:08
18 | */
19 | public class ViewpagerHeader extends MotionLayout implements ViewPager.OnPageChangeListener {
20 | public ViewpagerHeader(Context context, AttributeSet attrs) {
21 | super(context, attrs);
22 | }
23 |
24 | public ViewpagerHeader(Context context) {
25 | this(context,null);
26 | }
27 |
28 | @Override
29 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
30 | int numPages=3;
31 | setProgress((position+positionOffset)/(numPages-1));
32 |
33 | }
34 |
35 | @Override
36 | public void onPageSelected(int position) {
37 |
38 | }
39 |
40 | @Override
41 | public void onPageScrollStateChanged(int state) {
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/youtubedemo/Cats.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.youtubedemo;
2 |
3 | import com.lsm.androidx.R;
4 |
5 | import java.util.ArrayList;
6 |
7 |
8 | /**
9 | *
10 | *
11 | *
12 | *
13 | * @author shiming
14 | * @version v1.0
15 | * @since 2019/4/7 14:11
16 | */
17 | public class Cats {
18 | static ArrayList datas= new ArrayList();
19 |
20 |
21 | static {
22 | datas.add(R.drawable.cat_1);
23 | datas.add(R.drawable.cat_2);
24 | datas.add(R.drawable.cat_3);
25 | datas.add(R.drawable.cat_4);
26 | datas.add(R.drawable.cat_5);
27 | datas.add(R.drawable.cat_6);
28 | datas.add(R.drawable.cat_7);
29 | datas.add(R.drawable.cat_8);
30 | datas.add(R.drawable.cat_9);
31 | datas.add(R.drawable.cat_10);
32 | datas.add(R.drawable.cat_11);
33 | datas.add(R.drawable.cat_12);
34 | datas.add(R.drawable.cat_13);
35 | datas.add(R.drawable.cat_14);
36 | datas.add(R.drawable.cat_15);
37 | datas.add(R.drawable.cat_19);
38 | datas.add(R.drawable.cat_16);
39 | datas.add(R.drawable.cat_17);
40 | datas.add(R.drawable.cat_18);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_17_coordination.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/fragment/MainFragment.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.lsm.androidx.R;
9 |
10 | import androidx.annotation.NonNull;
11 | import androidx.annotation.Nullable;
12 | import androidx.fragment.app.Fragment;
13 |
14 | /**
15 | *
16 | *
17 | *
18 | *
19 | * @author shiming
20 | * @version v1.0
21 | * @since 2019/4/3 11:32
22 | */
23 | public class MainFragment extends Fragment {
24 |
25 |
26 | private static MainFragment sFragment;
27 |
28 | public static MainFragment newInstance() {
29 | if (sFragment==null) {
30 | Bundle args = new Bundle();
31 | sFragment = new MainFragment();
32 | sFragment.setArguments(args);
33 | }
34 |
35 | return sFragment;
36 | }
37 | @Nullable
38 | @Override
39 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
40 | @Nullable Bundle savedInstanceState) {
41 | return inflater.inflate(R.layout.motion_21_main_fragment,container,false);
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/list_scene.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/bottom_nav_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_22_list_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
23 |
24 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_06_keyframe.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
22 |
23 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_09_coordinatorlayout_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
20 |
21 |
30 |
31 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.lsm.androidx"
7 | // 如果使用 Lottie 最低版本
8 | minSdkVersion 16
9 | targetSdkVersion 28
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(dir: 'libs', include: ['*.jar'])
24 | //Alpha版本 需要测试的版本
25 | implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
26 |
27 | implementation "androidx.cardview:cardview:1.0.0"
28 | //Alpha版本
29 | implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
30 | // 引入新的特性
31 | implementation 'com.google.android.material:material:1.1.0-alpha05'
32 |
33 |
34 | testImplementation 'junit:junit:4.12'
35 | androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
36 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
37 |
38 | implementation 'com.github.bumptech.glide:glide:4.8.0'
39 | implementation 'com.airbnb.android:lottie:2.5.1'
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_03_custom_attribute.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
23 |
24 |
25 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_05_imagefilter.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
22 |
23 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_24_recyclerview_expanded_text_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_24_recyclerview_expanded_text_description.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_01_cl_end.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
20 |
21 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_01_cl_start.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
20 |
21 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/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.lsm.androidx.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 | /**
26 | * 设置透明度动画
27 | */
28 | public class FadeOut extends MotionHelper {
29 |
30 | public FadeOut(Context context) {
31 | super(context);
32 | }
33 |
34 | public FadeOut(Context context, AttributeSet attrs) {
35 | super(context, attrs);
36 | }
37 |
38 | public FadeOut(Context context, AttributeSet attrs, int defStyleAttr) {
39 | super(context, attrs, defStyleAttr);
40 | }
41 |
42 | @Override
43 | public void setProgress(View view, float progress) {
44 | view.setAlpha(1f - progress);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_08_cycle.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
23 |
24 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_19_coordination.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
22 |
23 |
24 |
25 |
26 |
27 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/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.lsm.androidx.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 | /**
26 | *
27 | *
28 | * 设置透明度的动画一样
29 | */
30 | public class FadeIn extends MotionHelper {
31 |
32 | public FadeIn(Context context) {
33 | super(context);
34 | }
35 |
36 | public FadeIn(Context context, AttributeSet attrs) {
37 | super(context, attrs);
38 | }
39 |
40 | public FadeIn(Context context, AttributeSet attrs, int defStyleAttr) {
41 | super(context, attrs, defStyleAttr);
42 | }
43 |
44 | @Override
45 | public void setProgress(View view, float progress) {
46 | view.setAlpha(progress);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_18_coordination.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/youtubedemo/YouTubeDemoViewHolder.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.youtubedemo;
2 |
3 | import android.view.View;
4 | import android.widget.ImageView;
5 | import android.widget.TextView;
6 |
7 | import com.lsm.androidx.R;
8 |
9 | import org.w3c.dom.Text;
10 |
11 | import androidx.annotation.NonNull;
12 | import androidx.recyclerview.widget.RecyclerView;
13 |
14 | /**
15 | *
16 | *
17 | *
18 | *
19 | * @author shiming
20 | * @version v1.0
21 | * @since 2019/4/7 13:59
22 | */
23 | public class YouTubeDemoViewHolder extends RecyclerView.ViewHolder {
24 | public YouTubeDemoViewHolder(@NonNull View itemView) {
25 | super(itemView);
26 | }
27 |
28 | public static class TextHeaderViewHolder extends YouTubeDemoViewHolder{
29 |
30 | public TextHeaderViewHolder(@NonNull View itemView) {
31 | super(itemView);
32 | }
33 | }
34 |
35 | public static class TextDescriptionViewHolder extends YouTubeDemoViewHolder {
36 | public TextDescriptionViewHolder(View inflate) {
37 | super(inflate);
38 | }
39 | }
40 |
41 | public static class CatRowViewHolder extends YouTubeDemoViewHolder {
42 |
43 | public final ImageView mImageView;
44 | public final TextView mTextView;
45 |
46 | public CatRowViewHolder(View inflate) {
47 | super(inflate);
48 | mImageView = inflate.findViewById(R.id.image_row);
49 | mTextView = inflate.findViewById(R.id.text_row);
50 |
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/AdapterItemBean.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx;
2 |
3 | import androidx.annotation.LayoutRes;
4 |
5 | /**
6 | *
7 | *
8 | *
9 | *
10 | * @author shiming
11 | * @version v1.0
12 | * @since 2019/4/1 14:08
13 | */
14 | public class AdapterItemBean {
15 |
16 |
17 | public Class getClazz() {
18 | return clazz;
19 | }
20 |
21 | public void setClazz(Class clazz) {
22 | this.clazz = clazz;
23 | }
24 |
25 | //指定默认的那个的Activity
26 | private Class clazz=DemoActivity.class;
27 |
28 | public String getTitle() {
29 | return title;
30 | }
31 |
32 | public void setTitle(String title) {
33 | this.title = title;
34 | }
35 |
36 | public String getDes() {
37 | return des;
38 | }
39 |
40 | public void setDes(String des) {
41 | this.des = des;
42 | }
43 |
44 | public int getLayoutID() {
45 | return layoutID;
46 | }
47 |
48 | public void setLayoutID(int layoutID) {
49 | this.layoutID = layoutID;
50 | }
51 |
52 | private String title;
53 | private String des;
54 | private @LayoutRes int layoutID;
55 |
56 | public AdapterItemBean(String title, String des, @LayoutRes int layoutID) {
57 | this.title = title;
58 | this.des = des;
59 | this.layoutID = layoutID;
60 | }
61 |
62 |
63 | public AdapterItemBean(String title, String des, Class clazz) {
64 | this.title = title;
65 | this.des = des;
66 | this.clazz=clazz;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_04_imagefilter.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
23 |
24 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/youtubedemo/YouTubeDemoActivity.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.youtubedemo;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 |
6 | import com.lsm.androidx.R;
7 |
8 | import androidx.annotation.Nullable;
9 | import androidx.appcompat.app.AppCompatActivity;
10 | import androidx.constraintlayout.motion.widget.MotionLayout;
11 | import androidx.recyclerview.widget.LinearLayoutManager;
12 | import androidx.recyclerview.widget.RecyclerView;
13 |
14 | /**
15 | *
16 | *
17 | *
18 | *
19 | * @author shiming
20 | * @version v1.0
21 | * @since 2019/4/7 13:44
22 | */
23 | public class YouTubeDemoActivity extends AppCompatActivity {
24 |
25 | @Override
26 | protected void onCreate(@Nullable Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.motion_24_youtube);
29 |
30 | MotionLayout motionLayout = findViewById(R.id.motionLayout);
31 |
32 |
33 | RecyclerView recyclerView = findViewById(R.id.recyclerview_front);
34 |
35 | recyclerView.setNestedScrollingEnabled(false);
36 | recyclerView.setLayoutManager(new LinearLayoutManager(this));
37 | recyclerView.setAdapter(new FrontPhotosAdapter());
38 |
39 | boolean showPaths = getIntent().getBooleanExtra("showPaths", false);
40 | if (showPaths){
41 | motionLayout.setDebugMode(MotionLayout.DEBUG_SHOW_PATH);
42 | } else {
43 | motionLayout.setDebugMode(MotionLayout.DEBUG_SHOW_NONE);
44 | }
45 |
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_07_keyframe.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
25 |
26 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_scrolling.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
23 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_01_basic.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
24 |
25 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_10_coordinatorlayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
22 |
23 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/fragment/SecondFragment.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.lsm.androidx.R;
9 |
10 | import androidx.annotation.NonNull;
11 | import androidx.annotation.Nullable;
12 | import androidx.constraintlayout.motion.widget.MotionLayout;
13 | import androidx.fragment.app.Fragment;
14 |
15 | /**
16 | *
17 | *
18 | *
19 | *
20 | * @author shiming
21 | * @version v1.0
22 | * @since 2019/4/3 11:32
23 | */
24 | public class SecondFragment extends Fragment {
25 |
26 |
27 | private MotionLayout mMotionLayout;
28 | private static SecondFragment sFragment;
29 |
30 | public static SecondFragment newInstance() {
31 | if (sFragment==null) {
32 | Bundle args = new Bundle();
33 | sFragment = new SecondFragment();
34 | sFragment.setArguments(args);
35 | }
36 | return sFragment;
37 | }
38 | @Nullable
39 | @Override
40 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
41 | @Nullable Bundle savedInstanceState) {
42 | return inflater.inflate(R.layout.motion_21_second_fragment,container,false);
43 | }
44 |
45 | @Override
46 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
47 | super.onViewCreated(view, savedInstanceState);
48 | mMotionLayout = view.findViewById(R.id.main);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_11_coordinatorlayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
23 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_23.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
19 |
20 |
23 |
24 |
25 |
26 |
31 |
32 |
33 |
34 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_02.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
10 |
11 |
15 |
16 |
17 |
18 |
26 |
27 |
28 |
29 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/weight/DrawerContent.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.weight;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 |
7 | import androidx.annotation.NonNull;
8 | import androidx.constraintlayout.motion.widget.MotionLayout;
9 | import androidx.drawerlayout.widget.DrawerLayout;
10 |
11 | /**
12 | *
13 | * 最牛逼的是 这个坚挺的调用的过程 减少代码量
14 | *
15 | *
16 | * @author shiming
17 | * @version v1.0
18 | * @since 2019/4/2 17:14
19 | */
20 | public class DrawerContent extends MotionLayout implements DrawerLayout.DrawerListener {
21 |
22 | public DrawerContent(Context context) {
23 | this(context,null);
24 | }
25 |
26 | public DrawerContent(Context context, AttributeSet attrs) {
27 | super(context, attrs);
28 | }
29 |
30 | /**
31 | * 刚附着到布局上的时候
32 | * Android——自带侧滑菜单DrawerLayout的使用方法
33 | */
34 | @Override
35 | protected void onAttachedToWindow() {
36 | super.onAttachedToWindow();
37 | if (getParent() instanceof DrawerLayout){
38 | ((DrawerLayout) getParent()).addDrawerListener(this);
39 | }
40 | }
41 |
42 | @Override
43 | public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
44 | setProgress(slideOffset);
45 | }
46 |
47 | @Override
48 | public void onDrawerOpened(@NonNull View drawerView) {
49 |
50 | }
51 |
52 | @Override
53 | public void onDrawerClosed(@NonNull View drawerView) {
54 |
55 | }
56 |
57 | @Override
58 | public void onDrawerStateChanged(int newState) {
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_02_basic.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
24 |
25 |
26 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/viewPager/ViewPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.viewPager;
2 |
3 | import android.os.Bundle;
4 |
5 | import java.util.ArrayList;
6 |
7 | import androidx.annotation.NonNull;
8 | import androidx.annotation.Nullable;
9 | import androidx.fragment.app.Fragment;
10 | import androidx.fragment.app.FragmentManager;
11 | import androidx.fragment.app.FragmentPagerAdapter;
12 |
13 | /**
14 | *
15 | *
16 | *
17 | *
18 | * @author shiming
19 | * @version v1.0
20 | * @since 2019/4/3 11:23
21 | */
22 | public class ViewPagerAdapter extends FragmentPagerAdapter {
23 |
24 | ArrayList mFragments= new ArrayList();
25 | ArrayList mStrings= new ArrayList();
26 |
27 | public ViewPagerAdapter(@NonNull FragmentManager fm) {
28 | super(fm);
29 | }
30 |
31 |
32 | public void addFragment(Fragment fragment,String string){
33 | mFragments.add(fragment);
34 | mStrings.add(string);
35 | }
36 | public void addPage(String title,int layout){
37 | Page page = new Page();
38 | Bundle bundle = new Bundle();
39 | bundle.putInt("layout",layout);
40 | page.setArguments(bundle);
41 | addFragment(page,title);
42 | }
43 |
44 | @NonNull
45 | @Override
46 | public Fragment getItem(int position) {
47 | return (Fragment) mFragments.get(position);
48 | }
49 |
50 | @Override
51 | public int getCount() {
52 | return mFragments.size();
53 | }
54 |
55 | @Nullable
56 | @Override
57 | public CharSequence getPageTitle(int position) {
58 | return mStrings.get(position).toString();
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_12_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
13 |
14 |
22 |
23 |
24 |
25 |
26 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_14_side_panel.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
23 |
24 |
25 |
26 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/weight/CollapsibleToolbar.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.weight;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.util.Log;
6 |
7 | import com.google.android.material.appbar.AppBarLayout;
8 |
9 | import androidx.constraintlayout.motion.widget.MotionLayout;
10 |
11 | /**
12 | *
13 | * 自定义MotionLayout和 AppBarLayout互相结合着使用
14 | * 这种自定义空控件的方法很有意思
15 | *
16 | *
17 | * @author shiming
18 | * @version v1.0
19 | * @since 2019/4/1 19:35
20 | */
21 | public class CollapsibleToolbar extends MotionLayout implements AppBarLayout.OnOffsetChangedListener {
22 |
23 | public CollapsibleToolbar(Context context) {
24 | this(context,null);
25 | }
26 |
27 | public CollapsibleToolbar(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 | }
30 |
31 | /**
32 | * 刚附着到窗体上
33 | */
34 | @Override
35 | protected void onAttachedToWindow() {
36 | super.onAttachedToWindow();
37 | //如果判断是在 AppBarLayout中使用的话
38 | if(getParent() instanceof AppBarLayout){
39 | ((AppBarLayout) getParent()).addOnOffsetChangedListener(this);
40 | }
41 | }
42 |
43 | /**
44 | * 接口中的方法
45 | * @param appBarLayout appBarLayout对象
46 | * @param verticalOffset 偏移量,手机屏幕往下滚动的话,这个为负数 在最顶部的时候, verticalOffset为 0
47 | */
48 | @Override
49 | public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
50 | //设置MotionLayout 进度在哪里
51 | setProgress((float)-verticalOffset/appBarLayout.getTotalScrollRange());
52 | Log.d("CollapsibleToolbar","appBarLayout.getTotalScrollRange()="+appBarLayout.getTotalScrollRange());
53 | Log.d("CollapsibleToolbar","verticalOffset="+verticalOffset);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_16_viewpager.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
20 |
21 |
22 |
23 |
28 |
29 |
30 |
31 |
38 |
39 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/row.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
20 |
21 |
38 |
39 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_15_parallax.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
24 |
25 |
32 |
33 |
40 |
41 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_24_recyclerview_expanded_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
26 |
27 |
36 |
37 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_19_coordination_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
24 |
25 |
32 |
33 |
42 |
43 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_10_coordinatorlayout_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
26 |
27 |
34 |
35 |
44 |
45 |
53 |
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/weight/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.lsm.androidx.weight;
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 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_05.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
19 |
20 |
24 |
28 |
29 |
30 |
31 |
32 |
38 |
41 |
42 |
43 |
44 |
45 |
51 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
22 |
23 |
35 |
36 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_09.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
15 |
16 |
17 |
18 |
24 |
33 |
34 |
35 |
36 |
37 |
43 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/viewPager/ViewPagerActivity.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.viewPager;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 |
6 | import com.google.android.material.tabs.TabLayout;
7 | import com.lsm.androidx.R;
8 |
9 | import androidx.annotation.Nullable;
10 | import androidx.appcompat.app.AppCompatActivity;
11 | import androidx.constraintlayout.motion.widget.MotionLayout;
12 | import androidx.fragment.app.FragmentManager;
13 | import androidx.viewpager.widget.ViewPager;
14 |
15 | /**
16 | *
17 | *
18 | *
19 | *
20 | * @author shiming
21 | * @version v1.0
22 | * @since 2019/4/3 11:21
23 | */
24 | public class ViewPagerActivity extends AppCompatActivity {
25 |
26 | private ViewPager mViewPager;
27 | private TabLayout mTabs;
28 | private MotionLayout mMotionLayout;
29 |
30 | @Override
31 | protected void onCreate(@Nullable Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.motion_16_viewpager);
34 | FragmentManager supportFragmentManager = getSupportFragmentManager();
35 |
36 | ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(supportFragmentManager);
37 | viewPagerAdapter.addPage("第一", R.layout.motion_16_viewpager_page1);
38 | viewPagerAdapter.addPage("第二", R.layout.motion_16_viewpager_page2);
39 | viewPagerAdapter.addPage("第三", R.layout.motion_16_viewpager_page3);
40 |
41 |
42 | mViewPager = findViewById(R.id.pager);
43 | //新特性的布局 头部
44 | mTabs = findViewById(R.id.tabs);
45 |
46 |
47 | mViewPager.setAdapter(viewPagerAdapter);
48 | mTabs.setupWithViewPager(mViewPager);
49 |
50 | //我们肯定知道这个id找出来是这个类
51 | mMotionLayout = findViewById(R.id.motionLayout);
52 |
53 | if (mMotionLayout!=null){
54 | //直接回调到我们这个类中去,实现这个监听
55 | if (mMotionLayout instanceof ViewPager.OnPageChangeListener)
56 | mViewPager.addOnPageChangeListener((ViewPager.OnPageChangeListener) mMotionLayout);
57 | }
58 |
59 | boolean showPaths = getIntent().getBooleanExtra("showPaths", false);
60 | if (showPaths){
61 | mMotionLayout.setDebugMode(MotionLayout.DEBUG_SHOW_PATH);
62 | }else {
63 | mMotionLayout.setDebugMode(MotionLayout.DEBUG_SHOW_NONE);
64 | }
65 |
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/viewPager/ViewPagerActivity2.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.viewPager;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.google.android.material.tabs.TabLayout;
6 | import com.lsm.androidx.R;
7 |
8 | import androidx.annotation.Nullable;
9 | import androidx.appcompat.app.AppCompatActivity;
10 | import androidx.constraintlayout.motion.widget.MotionLayout;
11 | import androidx.fragment.app.FragmentManager;
12 | import androidx.viewpager.widget.ViewPager;
13 |
14 | /**
15 | *
16 | * LottieAnimationView 这个动画的结合
17 | *
18 | *
19 | * @author shiming
20 | * @version v1.0
21 | * @since 2019/4/3 11:21
22 | */
23 | public class ViewPagerActivity2 extends AppCompatActivity {
24 |
25 | private ViewPager mViewPager;
26 | private TabLayout mTabs;
27 | private MotionLayout mMotionLayout;
28 |
29 | @Override
30 | protected void onCreate(@Nullable Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.motion_23_viewpager);
33 | FragmentManager supportFragmentManager = getSupportFragmentManager();
34 |
35 | ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(supportFragmentManager);
36 | viewPagerAdapter.addPage("第一", R.layout.motion_16_viewpager_page1);
37 | viewPagerAdapter.addPage("第二", R.layout.motion_16_viewpager_page2);
38 | viewPagerAdapter.addPage("第三", R.layout.motion_16_viewpager_page3);
39 |
40 |
41 | mViewPager = findViewById(R.id.pager);
42 | //新特性的布局 头部
43 | mTabs = findViewById(R.id.tabs);
44 |
45 |
46 | mViewPager.setAdapter(viewPagerAdapter);
47 | mTabs.setupWithViewPager(mViewPager);
48 |
49 | //我们肯定知道这个id找出来是这个类
50 | mMotionLayout = findViewById(R.id.motionLayout);
51 |
52 | if (mMotionLayout!=null){
53 | //直接回调到我们这个类中去,实现这个监听
54 | if (mMotionLayout instanceof ViewPager.OnPageChangeListener)
55 | mViewPager.addOnPageChangeListener((ViewPager.OnPageChangeListener) mMotionLayout);
56 | }
57 |
58 | boolean showPaths = getIntent().getBooleanExtra("showPaths", false);
59 | if (showPaths){
60 | mMotionLayout.setDebugMode(MotionLayout.DEBUG_SHOW_PATH);
61 | }else {
62 | mMotionLayout.setDebugMode(MotionLayout.DEBUG_SHOW_NONE);
63 | }
64 |
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/fragment/ItemFragment.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.TextView;
8 |
9 | import com.lsm.androidx.R;
10 |
11 | import androidx.annotation.NonNull;
12 | import androidx.annotation.Nullable;
13 | import androidx.fragment.app.Fragment;
14 |
15 | /**
16 | *
17 | *
18 | *
19 | *
20 | * @author shiming
21 | * @version v1.0
22 | * @since 2019/4/7 12:02
23 | */
24 | public class ItemFragment extends Fragment {
25 |
26 | private static ItemFragment itemFragment;
27 | private CustomAdapter.ViewHolder mHolder;
28 | private View mView;
29 | private View mContainer;
30 |
31 | public static ItemFragment getInstance() {
32 | if (itemFragment==null){
33 | itemFragment = new ItemFragment();
34 | }
35 | return itemFragment;
36 | }
37 |
38 | @Nullable
39 | @Override
40 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
41 | @Nullable Bundle savedInstanceState) {
42 | return inflater.inflate(R.layout.item_layout,container,false);
43 | }
44 |
45 | @Override
46 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
47 | super.onViewCreated(view, savedInstanceState);
48 | mView = view;
49 | System.out.println("shiming onViewCreated"+mView);
50 | mContainer = mView.findViewById(R.id.container);
51 | }
52 |
53 | /**
54 | * getView 永远为null,是由于那边的没有使用正确
55 | * @param holder
56 | */
57 | public void update(CustomAdapter.ViewHolder holder) {
58 | mHolder = holder;
59 | TextView title = mView.findViewById(R.id.txtTitle);
60 | title.setText(holder.mTxtTitle.getText());
61 | title.setTextColor(getActivity().getResources().getColor(R.color.clr_FF6600));
62 | mContainer.setBackgroundColor(getActivity().getResources().getColor(R.color.clr_FBFF00));
63 | System.out.println("shiming update="+holder.mTxtTitle.getText());
64 | TextView txtName = mView.findViewById(R.id.txtName);
65 | txtName.setText(holder.mTxtName.getText());
66 | }
67 |
68 | @Override
69 | public void onStart() {
70 | super.onStart();
71 | if (mHolder!=null){
72 | update(mHolder);
73 | }
74 |
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/main_scene.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
19 |
20 |
25 |
26 |
30 |
31 |
32 |
33 |
41 |
44 |
45 |
46 |
47 |
48 |
49 |
55 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/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 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
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 Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_04.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 |
23 |
27 |
28 |
29 |
30 |
38 |
39 |
42 |
43 |
44 |
45 |
46 |
54 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_17_coordination_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
24 |
25 |
32 |
33 |
42 |
43 |
51 |
52 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/DemosAdapter.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx;
2 |
3 | import android.view.LayoutInflater;
4 | import android.view.View;
5 | import android.view.ViewGroup;
6 | import android.widget.TextView;
7 |
8 | import java.util.ArrayList;
9 |
10 | import androidx.annotation.NonNull;
11 | import androidx.constraintlayout.widget.ConstraintLayout;
12 | import androidx.recyclerview.widget.RecyclerView;
13 |
14 | /**
15 | *
16 | *
17 | *
18 | *
19 | * @author shiming
20 | * @version v1.0
21 | * @since 2019/4/1 14:01
22 | */
23 | public class DemosAdapter extends RecyclerView.Adapter {
24 |
25 |
26 | private final ArrayList mAdapterItemBeans;
27 |
28 | public DemosAdapter(ArrayList adapterItemBeans) {
29 | mAdapterItemBeans = adapterItemBeans;
30 | }
31 |
32 | @NonNull
33 | @Override
34 | public DemosAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
35 | ConstraintLayout view = (ConstraintLayout) LayoutInflater.from(parent.getContext()).inflate(R.layout.row, parent,
36 | false);
37 | return new ViewHolder(view);
38 | }
39 |
40 | @Override
41 | public void onBindViewHolder(@NonNull DemosAdapter.ViewHolder holder, int position) {
42 | AdapterItemBean adapterItemBean = mAdapterItemBeans.get(position);
43 | holder.layoutFileId=adapterItemBean.getLayoutID();
44 | holder.mTitle.setText(adapterItemBean.getTitle());
45 | holder.mDescription.setText(adapterItemBean.getDes());
46 | holder.clazz=adapterItemBean.getClazz();
47 | }
48 |
49 | @Override
50 | public int getItemCount() {
51 | return mAdapterItemBeans.size();
52 | }
53 |
54 | public class ViewHolder extends RecyclerView.ViewHolder{
55 |
56 | private final TextView mTitle;
57 | private final TextView mDescription;
58 | int layoutFileId = 0;
59 | Class clazz;
60 |
61 | public ViewHolder(@NonNull View itemView) {
62 | super(itemView);
63 | mTitle = itemView.findViewById(R.id.title);
64 | mDescription = itemView.findViewById(R.id.description);
65 | itemView.setOnClickListener(new View.OnClickListener() {
66 | @Override
67 | public void onClick(View v) {
68 | if (v.getContext() instanceof MainActivity){
69 | ((MainActivity)v.getContext()).start(clazz,layoutFileId);
70 | }
71 | }
72 | });
73 |
74 |
75 |
76 | }
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_03.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 |
24 |
28 |
29 |
30 |
31 |
39 |
40 |
43 |
44 |
45 |
46 |
47 |
55 |
56 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_17.xml:
--------------------------------------------------------------------------------
1 |
15 |
17 |
18 |
23 |
24 |
28 |
29 |
30 |
35 |
36 |
42 |
43 |
44 |
45 |
51 |
52 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/fragment/ListFragment.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.airbnb.lottie.L;
9 | import com.lsm.androidx.R;
10 |
11 | import java.util.ArrayList;
12 |
13 | import androidx.annotation.NonNull;
14 | import androidx.annotation.Nullable;
15 | import androidx.fragment.app.Fragment;
16 | import androidx.recyclerview.widget.LinearLayoutManager;
17 | import androidx.recyclerview.widget.RecyclerView;
18 |
19 | /**
20 | *
21 | *
22 | *
23 | *
24 | * @author shiming
25 | * @version v1.0
26 | * @since 2019/4/7 11:43
27 | */
28 | public class ListFragment extends Fragment {
29 |
30 | private RecyclerView mRecyclerView;
31 |
32 |
33 | private static ListFragment sFragment;
34 |
35 | public static ListFragment newInstance() {
36 | if (sFragment==null) {
37 | Bundle args = new Bundle();
38 | sFragment = new ListFragment();
39 | sFragment.setArguments(args);
40 | }
41 |
42 | return sFragment;
43 | }
44 |
45 | @Nullable
46 | @Override
47 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
48 | @Nullable Bundle savedInstanceState) {
49 | return inflater.inflate(R.layout.motion_22_list_fragment,container,false);
50 | }
51 |
52 | @Override
53 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
54 | super.onViewCreated(view, savedInstanceState);
55 | mRecyclerView = view.findViewById(R.id.list);
56 |
57 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(),
58 | RecyclerView.VERTICAL, false);
59 | mRecyclerView.setLayoutManager(linearLayoutManager);
60 | ArrayList users = new ArrayList<>();
61 |
62 | users.add(new User("shiming","好好学习"));
63 | users.add(new User("tongxue","好好学习"));
64 | users.add(new User("Jane","好好学习"));
65 | users.add(new User("John","好好学习"));
66 | users.add(new User("Amy","好好学习"));
67 | users.add(new User("Paul","好好学习"));
68 | users.add(new User("Jane","好好学习"));
69 | users.add(new User("John","好好学习"));
70 | users.add(new User("Amy","好好学习"));
71 | users.add(new User("John","好好学习"));
72 | users.add(new User("tongxue","好好学习"));
73 | users.add(new User("Amy","好好学习"));
74 | users.add(new User("tongxue","好好学习"));
75 | CustomAdapter customAdapter = new CustomAdapter(users);
76 |
77 | mRecyclerView.setAdapter(customAdapter);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_21_second_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 |
24 |
25 |
26 |
33 |
41 |
42 |
43 |
44 |
51 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/DemoActivity.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx;
2 |
3 | import android.media.Image;
4 | import android.os.Build;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.ImageView;
8 |
9 | import androidx.annotation.Nullable;
10 | import androidx.appcompat.app.AppCompatActivity;
11 | import androidx.constraintlayout.motion.widget.MotionLayout;
12 |
13 | /**
14 | *
15 | *
16 | *
17 | *
18 | * @author shiming
19 | * @version v1.0
20 | * @since 2019/4/1 15:37
21 | */
22 | public class DemoActivity extends AppCompatActivity {
23 |
24 | private View mMotionLayout;
25 |
26 | @Override
27 | protected void onCreate(@Nullable Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 |
30 | int layout_file_id = getIntent().getIntExtra("layout_file_id", R.layout.motion_01_basic);
31 |
32 | setContentView(layout_file_id);
33 | //coordinatorlayout示例(3/3) 是这个的Demo
34 | if (layout_file_id==R.layout.motion_11_coordinatorlayout){
35 | // 头像
36 | ImageView icon = findViewById(R.id.icon);
37 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
38 | //通过view.setClipToOutline(true)方法来开启组件的裁剪功能;
39 | icon.setClipToOutline(true);
40 | }
41 | }
42 |
43 | mMotionLayout = findViewById(R.id.motionLayout);
44 | // 是否显示路径
45 | boolean showPaths = getIntent().getBooleanExtra("showPaths", false);
46 | if (mMotionLayout instanceof MotionLayout) {
47 | if (showPaths) {
48 | ((MotionLayout) mMotionLayout).setDebugMode(MotionLayout.DEBUG_SHOW_PATH);
49 | } else {
50 | ((MotionLayout) mMotionLayout).setDebugMode(MotionLayout.DEBUG_SHOW_NONE);
51 | }
52 | }
53 |
54 | View viewById = findViewById(R.id.imageButton2);
55 | // 复杂运动示例(4/4) 这是这个的点击事件
56 | if (viewById!=null){
57 | viewById.setOnClickListener(new View.OnClickListener() {
58 | @Override
59 | public void onClick(View v) {
60 | if (mMotionLayout instanceof MotionLayout){
61 | float progress = ((MotionLayout) mMotionLayout).getProgress();
62 | if (progress>0.5f){
63 | ((MotionLayout) mMotionLayout).transitionToStart();
64 | }else{
65 | ((MotionLayout) mMotionLayout).transitionToEnd();
66 | }
67 | }
68 | }
69 | });
70 | }
71 |
72 | }
73 |
74 |
75 | /**
76 | *
77 | */
78 | public void changeState(){
79 |
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_21_second_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
26 |
27 |
28 |
33 |
34 |
39 |
40 |
51 |
52 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/youtubedemo/FrontPhotosAdapter.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.youtubedemo;
2 |
3 | import android.text.Layout;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.bumptech.glide.Glide;
9 | import com.lsm.androidx.R;
10 |
11 | import androidx.annotation.NonNull;
12 | import androidx.recyclerview.widget.RecyclerView;
13 |
14 | /**
15 | *
16 | *
17 | *
18 | *
19 | * @author shiming
20 | * @version v1.0
21 | * @since 2019/4/7 13:58
22 | */
23 | public class FrontPhotosAdapter extends RecyclerView.Adapter {
24 | @NonNull
25 | @Override
26 | public YouTubeDemoViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
27 | LayoutInflater from = LayoutInflater.from(parent.getContext());
28 | View inflate = null;
29 | switch (viewType) {
30 | case 0:
31 | inflate = from.inflate(R.layout.motion_24_recyclerview_expanded_text_header,
32 | parent, false);
33 | return new YouTubeDemoViewHolder.TextHeaderViewHolder(inflate);
34 | case 1:
35 | inflate = from.inflate(R.layout.motion_24_recyclerview_expanded_text_description,
36 | parent, false);
37 | return new YouTubeDemoViewHolder.TextDescriptionViewHolder(inflate);
38 | case 2:
39 | inflate = from.inflate(R.layout.motion_24_recyclerview_expanded_row,
40 | parent, false);
41 | return new YouTubeDemoViewHolder.CatRowViewHolder(inflate);
42 |
43 | }
44 |
45 | return null;
46 | }
47 |
48 | @Override
49 | public void onBindViewHolder(@NonNull YouTubeDemoViewHolder holder, int position) {
50 | if (holder instanceof YouTubeDemoViewHolder.TextHeaderViewHolder) {
51 |
52 | } else if (holder instanceof YouTubeDemoViewHolder.TextDescriptionViewHolder) {
53 |
54 | } else if (holder instanceof YouTubeDemoViewHolder.CatRowViewHolder) {
55 | String string =
56 | ((YouTubeDemoViewHolder.CatRowViewHolder) holder).mTextView.getResources().getString(R.string.cat, position - 2);
57 |
58 | ((YouTubeDemoViewHolder.CatRowViewHolder) holder).mTextView.setText(string);
59 | Glide.with(((YouTubeDemoViewHolder.CatRowViewHolder) holder).mImageView)
60 | .load(Cats.datas.get(position - 2))
61 | .into(((YouTubeDemoViewHolder.CatRowViewHolder) holder).mImageView);
62 |
63 | }
64 | }
65 |
66 | @Override
67 | public int getItemCount() {
68 | return Cats.datas.size() + 2;
69 | }
70 |
71 | @Override
72 | public int getItemViewType(int position) {
73 | switch (position) {
74 | case 0:
75 |
76 | return 0;
77 |
78 | case 1:
79 |
80 | return 1;
81 | }
82 | return 2;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_14.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
19 |
20 |
25 |
29 |
30 |
31 |
37 |
45 |
46 |
47 |
48 |
54 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_06.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
19 |
20 |
25 |
29 |
30 |
31 |
32 |
37 |
38 |
39 |
40 |
41 |
49 |
50 |
53 |
54 |
55 |
56 |
57 |
65 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/weight/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.lsm.androidx.weight;
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 | /**
29 | *
30 | * MotionLayout 滚动的反馈给了这个布局
31 | */
32 | public class TouchFrameLayout extends FrameLayout implements NestedScrollingParent2 {
33 |
34 |
35 | public TouchFrameLayout(@NonNull Context context) {
36 | super(context);
37 | }
38 |
39 | public TouchFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
40 | super(context, attrs);
41 | }
42 |
43 | public TouchFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
44 | super(context, attrs, defStyleAttr);
45 | }
46 |
47 | public NestedScrollingParent2 getMotionLayout() {
48 | return (NestedScrollingParent2) getParent();
49 | }
50 |
51 | @Override
52 | public boolean onStartNestedScroll(@NonNull View child, @NonNull View target, int axes, int type) {
53 | return getMotionLayout().onStartNestedScroll(child, target, axes, type);
54 | }
55 |
56 | @Override
57 | public void onNestedScrollAccepted(@NonNull View child, @NonNull View target, int axes, int type) {
58 | getMotionLayout().onNestedScrollAccepted(child, target, axes, type);
59 | }
60 |
61 | /**
62 | * https://github.com/googlesamples/android-ConstraintLayoutExamples/issues/75
63 | * 谷歌的错误代码
64 | * @param target
65 | * @param type
66 | */
67 | @Override
68 | public void onStopNestedScroll(@NonNull View target, int type) {
69 | if (getMotionLayout()!=null) {
70 | getMotionLayout().onStopNestedScroll(target, type);
71 | }
72 | }
73 |
74 | @Override
75 | public void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) {
76 | getMotionLayout().onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type);
77 | }
78 |
79 | @Override
80 | public void onNestedPreScroll(@NonNull View target, int dx, int dy, @NonNull int[] consumed, int type) {
81 | getMotionLayout().onNestedPreScroll(target, dx, dy, consumed, type);
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_20_reveal.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
23 |
24 |
33 |
34 |
42 |
43 |
53 |
54 |
62 |
63 |
71 |
72 |
77 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_07.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
19 |
20 |
25 |
29 |
30 |
31 |
40 |
43 |
44 |
45 |
46 |
47 |
56 |
59 |
60 |
61 |
62 |
63 |
64 |
70 |
71 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_25.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 |
24 |
25 |
29 |
30 |
31 |
35 |
39 |
40 |
44 |
48 |
49 |
50 |
51 |
56 |
57 |
63 |
64 |
65 |
66 |
72 |
73 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
27 |
38 |
39 |
49 |
50 |
56 |
57 |
58 |
72 |
73 |
80 |
81 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/motion_11_coordinatorlayout_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
27 |
28 |
44 |
45 |
61 |
62 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/fragment/FragmentExample2Activity.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.fragment;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.lsm.androidx.R;
6 |
7 | import androidx.annotation.Nullable;
8 | import androidx.appcompat.app.AppCompatActivity;
9 | import androidx.constraintlayout.motion.widget.MotionLayout;
10 | import androidx.fragment.app.Fragment;
11 | import androidx.fragment.app.FragmentTransaction;
12 |
13 | /**
14 | *
15 | *
16 | *
17 | *
18 | * @author shiming
19 | * @version v1.0
20 | * @since 2019/4/7 11:40
21 | */
22 | public class FragmentExample2Activity extends AppCompatActivity implements MotionLayout.TransitionListener {
23 |
24 | private MotionLayout mMotionLayout;
25 |
26 | private Fragment mFragment;
27 |
28 | @Override
29 | protected void onCreate(@Nullable Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.fragment_example_layout);
32 | // 蛤蟆皮啊 你这里判断一定要是null啊,走不到if判断中去,那么mFragment永远是null
33 | if (savedInstanceState==null){
34 | mFragment = MainFragment.newInstance();
35 | getSupportFragmentManager().beginTransaction().replace(R.id.container,
36 | mFragment).commitNow();
37 | }
38 | mMotionLayout = findViewById(R.id.motionLayout);
39 | mMotionLayout.setTransitionListener(this);
40 |
41 | }
42 |
43 | @Override
44 | public void onTransitionStarted(MotionLayout motionLayout, int i, int i1) {
45 |
46 | }
47 | private float lastProgress=0f;
48 |
49 |
50 | @Override
51 | public void onTransitionChange(MotionLayout motionLayout, int i, int i1, float v) {
52 | if (v > lastProgress) {
53 | boolean atEnd=Math.abs(v-1f)<0.1f;
54 | //如果mFragment永远是null的 这个判断就不会成立了的嘛 瞎几把乱搞
55 | if (atEnd&& mFragment instanceof MainFragment){
56 | FragmentTransaction fragmentTransaction =
57 | getSupportFragmentManager().beginTransaction();
58 | //animator 和 anim的区别?????? todo
59 | fragmentTransaction.setCustomAnimations(R.animator.show,0);
60 |
61 | // 这是第二个Fragment
62 | mFragment = ListFragment.newInstance();
63 | //animator 和 anim的区别?????? todo
64 | fragmentTransaction.setCustomAnimations(R.animator.show,0);
65 | fragmentTransaction.replace(R.id.container,mFragment).commitNow();
66 |
67 | }
68 |
69 | }else {
70 | if (v<0.9f){
71 | if (mFragment instanceof ListFragment){
72 | FragmentTransaction fragmentTransaction =
73 | getSupportFragmentManager().beginTransaction();
74 | //animator 和 anim的区别?????? todo
75 | fragmentTransaction.setCustomAnimations(0, R.animator.hide);
76 |
77 | mFragment = MainFragment.newInstance();
78 | fragmentTransaction
79 | .replace(R.id.container,mFragment)
80 | .commitNow();
81 | }
82 | }
83 | }
84 |
85 | lastProgress = v;
86 | }
87 |
88 | @Override
89 | public void onTransitionCompleted(MotionLayout motionLayout, int i) {
90 |
91 | }
92 |
93 | @Override
94 | public void onTransitionTrigger(MotionLayout motionLayout, int i, boolean b, float v) {
95 |
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lsm/androidx/fragment/FragmentExampleActivity.java:
--------------------------------------------------------------------------------
1 | package com.lsm.androidx.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 |
6 | import com.lsm.androidx.R;
7 |
8 | import androidx.annotation.Nullable;
9 | import androidx.appcompat.app.AppCompatActivity;
10 | import androidx.constraintlayout.motion.widget.MotionLayout;
11 | import androidx.fragment.app.Fragment;
12 | import androidx.fragment.app.FragmentTransaction;
13 |
14 | /**
15 | *
16 | *
17 | *
18 | *
19 | * @author shiming
20 | * @version v1.0
21 | * @since 2019/4/3 19:55
22 | */
23 | public class FragmentExampleActivity extends AppCompatActivity implements MotionLayout.TransitionListener {
24 |
25 | private MotionLayout mMotionLayout;
26 |
27 | private Fragment mFragment;
28 |
29 | @Override
30 | protected void onCreate(@Nullable Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.fragment_example_layout);
33 | // 蛤蟆皮啊 你这里判断一定要是null啊,走不到if判断中去,那么mFragment永远是null
34 | if (savedInstanceState==null){
35 | mFragment = MainFragment.newInstance();
36 | getSupportFragmentManager().beginTransaction().replace(R.id.container,
37 | mFragment).commitNow();
38 | }
39 | mMotionLayout = findViewById(R.id.motionLayout);
40 | mMotionLayout.setTransitionListener(this);
41 |
42 | }
43 |
44 | @Override
45 | public void onTransitionStarted(MotionLayout motionLayout, int i, int i1) {
46 |
47 | }
48 | private float lastProgress=0f;
49 |
50 |
51 | @Override
52 | public void onTransitionChange(MotionLayout motionLayout, int i, int i1, float v) {
53 | if (v > lastProgress) {
54 | boolean atEnd=Math.abs(v-1f)<0.1f;
55 | //如果mFragment永远是null的 这个判断就不会成立了的嘛 瞎几把乱搞
56 | if (atEnd&& mFragment instanceof MainFragment){
57 | FragmentTransaction fragmentTransaction =
58 | getSupportFragmentManager().beginTransaction();
59 | //animator 和 anim的区别?????? todo
60 | fragmentTransaction.setCustomAnimations(R.animator.show,0);
61 |
62 | // 这是第二个Fragment
63 | mFragment = SecondFragment.newInstance();
64 | //animator 和 anim的区别?????? todo
65 | fragmentTransaction.setCustomAnimations(R.animator.show,0);
66 | fragmentTransaction.replace(R.id.container,mFragment).commitNow();
67 |
68 | }
69 |
70 | }else {
71 | if (v<0.9f){
72 | if (mFragment instanceof SecondFragment){
73 | FragmentTransaction fragmentTransaction =
74 | getSupportFragmentManager().beginTransaction();
75 | //animator 和 anim的区别?????? todo
76 | fragmentTransaction.setCustomAnimations(0,R.animator.hide);
77 |
78 | mFragment = MainFragment.newInstance();
79 | fragmentTransaction
80 | .replace(R.id.container,mFragment)
81 | .commitNow();
82 | }
83 | }
84 | }
85 |
86 | lastProgress = v;
87 | }
88 |
89 | @Override
90 | public void onTransitionCompleted(MotionLayout motionLayout, int i) {
91 |
92 | }
93 |
94 | @Override
95 | public void onTransitionTrigger(MotionLayout motionLayout, int i, boolean b, float v) {
96 |
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_18.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 |
24 |
25 |
29 |
30 |
31 |
36 |
37 |
43 |
44 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_19.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 |
24 |
25 |
29 |
30 |
31 |
36 |
37 |
43 |
44 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_08.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
19 |
20 |
25 |
29 |
30 |
31 |
40 |
43 |
44 |
45 |
46 |
47 |
56 |
59 |
60 |
61 |
62 |
63 |
70 |
77 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------