A library to provide additional functionality for Android MotionLayout.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dynamic-motion Gradle plugin 3.4.0-alpha10 Jan 14, 2019
gradle/wrapper
graphics
sample Version 0.2.0 Jan 22, 2019
.gitignore Initial commit Nov 3, 2018
.travis.yml Update library icon Jan 14, 2019
CNAME
LICENSE
README.md
build.gradle Version 0.2.0 Jan 22, 2019
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

Dynamic Motion

License Build Status

A library to provide additional functionality for MotionLayout on Android 18+ (JellyBean MR2 or above) devices.

It has DynamicMotionLayout which has a built-in ViewPager to create parallax effects which will open a huge set of possibilities for the original MotionLayout.


Contents


Installation

It can be installed by adding the following dependency to your build.gradle file:

dependencies {
    implementation 'com.pranavpandey.android:dynamic-motion:0.2.0'
}

Usage

It is divided into 3 simple steps and whole layout can be configured by just using the xml files.

Replace

First, replace the original MotionLayout with DynamicMotionLayout in xml file.

<com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    ...
    >

    ...
</com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout>

Page count

Set page count for ViewPager to divide the transition between different pages.

<com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:adm_pageCount="4"
    ...
    >

    ...
</com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout>
// At runtime
dynamicMotionLayout.setPageCount(int, @Nullable ViewPager.OnPageChangeListener);

Motion scene

Add a motion scene and use KeyFrameSet and KeyAttribute to animate the views across different pages. Please check the sample for a demo scene.

<com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:layoutDescription="@xml/motion_scene"
    app:adm_pageCount="4"
    ...
    >

    ...
</com.pranavpandey.android.dynamic.motion.widget.DynamicMotionLayout>

License

Copyright 2018 Pranav Pandey

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.