Material-Intro
Material-Intro copied to clipboard
☯️App intro with Material Motion Animations(No more viewpager transformer or Memory leak)
Material Intro
Sophisticated and cool intro with Material Motion Animations.
Who's using Material Intro?
👉 Check out who's using Material Intro
Include in your project
Gradle
Add the dependency below to your module's build.gradle
file:
dependencies {
implementation("io.github.androidpoet:materialintro:1.0.8")
}
SetUp for Views
<com.androidpoet.materialintro.MaterialIntroView
android:id="@+id/materialintroView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.androidpoet.materialintro.MaterialIntroView>
//add views into list
list.add(R.layout.layout_one)
list.add(R.layout.layout_two)
list.add(R.layout.layout_three)
with(binding.materialintroView) {
setViewsList(list)
nextAnimation = IntroAnimation.Fade
previousAnimation = IntroAnimation.Fade
nextDuration = 500
previousDuration = 500
}
// go next view with animation
binding.nextButton.setOnClickListener {
binding.materialIntroFragment.next()
}
// go previous view with animation
binding.backButton.setOnClickListener {
binding.materialIntroFragment.previous()
}
SetUp for Fragments
<com.androidpoet.materialintro.MaterialIntroFragment
android:id="@+id/materialintroView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.androidpoet.materialintro.MaterialIntroFragment>
//add fragments into list
list.add(FragmentOne())
list.add(FragmentTwo())
list.add(FragmentThree())
binding.materialIntroFragment.apply {
setFragmentsList(list)
enterAnimation = IntroAnimation.SharedAxisXForward
enterDuration = 500
}
// go next view with animation
binding.nextButton.setOnClickListener {
binding.materialintroView.next()
}
// go previous view with animation
binding.backButton.setOnClickListener {
binding.materialintroView.previous()
}
Supported Animations
IntroAnimation.None
IntroAnimation.FadeThrough
IntroAnimation.Fade
IntroAnimation.SharedAxisXForward
IntroAnimation.SharedAxisYForward
IntroAnimation.SharedAxisZForward
IntroAnimation.SharedAxisXBackward
IntroAnimation.SharedAxisYBackward
IntroAnimation.SharedAxisZBackward
IntroAnimation.ElevationScaleGrow
IntroAnimation.ElevationScale
Create using Builder
We can create the MaterialIntro using MaterialIntro.Builder.
val meta = MaterialIntroFragment.Builder(this)
.setFragmentsList(list)
.setEnterAnimation(IntroAnimation.Fade)
.setEnterDuration(300)
.setEnterOverlap(true)
.build()
meta.next()
meta.previous()
```
This is how to create an instance of the MaterialIntro using kotlin dsl.
```kotlin
val meta = materialIntroFragment(this) {
setFragmentsList(list)
setEnterAnimation(IntroAnimation.Fade)
setEnterDuration(300)
setEnterOverlap(true)
build()
}
meta.next()
meta.previous()
```
## MaterialFade
<p align="center">
<img src="https://user-images.githubusercontent.com/13647384/159129150-2b75f746-3982-4ed9-8b4a-f7936dc6a9fb.gif" width="30%"/>
</p> <br>
## Fade
<p align="center">
<img src="https://user-images.githubusercontent.com/13647384/159129501-e7af0b29-ff54-4853-8f2f-566c8132af3b.gif" width="30%"/>
</p> <br>
## SharedAxis
<p align="center">
<img src="https://user-images.githubusercontent.com/13647384/159129757-4706821f-a86d-443b-8db3-5d88f6aee841.gif" width="30%"/>
</p> <br>
<a href="https://www.flaticon.com/free-icons/card" title="card icons">Card icons created by Freepik - Flaticon</a>
## Find this library useful? :heart:
Support it by joining __[stargazers](https://github.com/androidpoet/MaterialIntro/stargazers)__ for this repository. :star:
<a href="https://www.buymeacoffee.com/AndroidPoet" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
# License
```xml
Copyright 2022 AndroidPoet (Ranbir Singh)
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.