├── sample
├── .gitignore
├── src
│ ├── main
│ │ ├── ic_launcher-web.png
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── mlsdev.png
│ │ │ │ ├── background_primary.xml
│ │ │ │ ├── background_primary_accent.xml
│ │ │ │ ├── background_primary_dark.xml
│ │ │ │ └── background_primary_light.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ └── layout
│ │ │ │ ├── layout_list_item.xml
│ │ │ │ ├── activity_sample.xml
│ │ │ │ ├── fragment_list_from_bottom.xml
│ │ │ │ ├── fragment_list_from_bottom_scale.xml
│ │ │ │ ├── fragment_grid_from_bottom.xml
│ │ │ │ ├── fragment_grid_from_bottom_random.xml
│ │ │ │ ├── fragment_grid_from_bottom_random_scale.xml
│ │ │ │ ├── fragment_grid_from_bottom_scale.xml
│ │ │ │ └── fragment_options.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── mlsdev
│ │ │ └── sample
│ │ │ ├── SampleActivity.java
│ │ │ ├── SimpleAdapter.java
│ │ │ └── fragment
│ │ │ ├── SampleFragment.java
│ │ │ └── OptionsFragment.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── mlsdev
│ │ │ └── sample
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── mlsdev
│ │ └── sample
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── library
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ └── attrs.xml
│ │ │ └── anim
│ │ │ │ ├── layout_animation_from_bottom.xml
│ │ │ │ ├── layout_animation_from_scale.xml
│ │ │ │ ├── layout_animation_random_scale.xml
│ │ │ │ ├── layout_animation_from_bottom_random.xml
│ │ │ │ ├── layout_animation_from_bottom_scale.xml
│ │ │ │ ├── item_animation_from_bottom.xml
│ │ │ │ ├── item_animation_from_scale.xml
│ │ │ │ └── item_animation_from_bottom_scale.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── mlsdev
│ │ │ └── animatedrv
│ │ │ └── AnimatedRecyclerView.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── mlsdev
│ │ │ └── animatedrv
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── mlsdev
│ │ └── animatedrv
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── art
└── demo.gif
├── .gitignore
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── CHANGELOG.md
├── .travis.yml
├── gradle.properties
├── LICENSE
├── gradlew.bat
├── README.md
└── gradlew
/sample/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':sample', ':library'
2 |
--------------------------------------------------------------------------------
/art/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/art/demo.gif
--------------------------------------------------------------------------------
/library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | library
3 |
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/sample/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/mlsdev.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/res/drawable/mlsdev.png
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 | ## `2.0.0` - 2019-04-19
3 | - Added the `AndroidX` support
4 |
5 | ## `1.0.1`
6 | - Fixed bugs
7 |
8 | ## `1.0.0`
9 | - Release
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MLSDev/AnimatedRecyclerView/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/background_primary.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/background_primary_accent.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/background_primary_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/background_primary_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Apr 19 14:59:00 EEST 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-5.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/layout_animation_from_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/layout_animation_from_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/layout_animation_random_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/layout_animation_from_bottom_random.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/layout_animation_from_bottom_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #4f65e2
5 | #303F9F
6 | #FF4081
7 |
8 |
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/sample/src/test/java/com/mlsdev/sample/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.mlsdev.sample;
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() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/library/src/test/java/com/mlsdev/animatedrv/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.mlsdev.animatedrv;
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() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/sample/src/main/res/layout/layout_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/item_animation_from_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 | jdk: oraclejdk8
3 | android:
4 | components:
5 | - tools
6 | - platform-tools
7 | - build-tools-28.0.3
8 | - android-28
9 | - extra-google-m2repository
10 | - extra-android-m2repository
11 | licenses:
12 | - android-sdk-preview-license-.+
13 | - android-sdk-license-.+
14 | - google-gdk-license-.+
15 | script:
16 | - ./gradlew build
17 | before_install:
18 | - chmod +x gradlew
--------------------------------------------------------------------------------
/sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AnimatedRecyclerView
3 | list from bottom
4 | list from bottom scale
5 | grid from bottom
6 | grid from bottom scale
7 | grid from bottom random
8 | grid random scale
9 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_sample.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/item_animation_from_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
18 |
19 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/fragment_list_from_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/fragment_list_from_bottom_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/library/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/fragment_grid_from_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/fragment_grid_from_bottom_random.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/fragment_grid_from_bottom_random_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/fragment_grid_from_bottom_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 | android.useAndroidX=true
19 | android.enableJetifier=true
--------------------------------------------------------------------------------
/library/src/main/res/anim/item_animation_from_bottom_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
18 |
19 |
23 |
24 |
--------------------------------------------------------------------------------
/sample/src/androidTest/java/com/mlsdev/sample/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.mlsdev.sample;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.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 | * Instrumentation 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() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.mlsdev.animatedrv", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/library/src/androidTest/java/com/mlsdev/animatedrv/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.mlsdev.animatedrv;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.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 | * Instrumentation 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() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.mlsdev.animatedrv.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/serhii/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/sample/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/serhii/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 | defaultConfig {
7 | applicationId "com.mlsdev.sample"
8 | minSdkVersion 16
9 | targetSdkVersion 28
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 |
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 |
22 | dataBinding {
23 | enabled = true
24 | }
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(include: ['*.jar'], dir: 'libs')
29 | implementation project(':library')
30 | implementation 'androidx.appcompat:appcompat:1.0.2'
31 | implementation 'androidx.recyclerview:recyclerview:1.0.0'
32 | testImplementation 'junit:junit:4.12'
33 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
34 | }
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Sergey Glebov
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/sample/src/main/java/com/mlsdev/sample/SampleActivity.java:
--------------------------------------------------------------------------------
1 | package com.mlsdev.sample;
2 |
3 | import android.os.Bundle;
4 | import android.view.MenuItem;
5 |
6 | import androidx.appcompat.app.AppCompatActivity;
7 | import androidx.databinding.DataBindingUtil;
8 |
9 | import com.mlsdev.sample.databinding.ActivitySampleBinding;
10 | import com.mlsdev.sample.fragment.OptionsFragment;
11 |
12 | public class SampleActivity extends AppCompatActivity {
13 | public static final String TITLE_KEY = "title_key";
14 | public static final String LAYOUT_KEY = "layout_key";
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | ActivitySampleBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_sample);
20 |
21 | getSupportFragmentManager().beginTransaction()
22 | .replace(binding.content.getId(), new OptionsFragment())
23 | .commit();
24 |
25 | }
26 |
27 | @Override
28 | public boolean onOptionsItemSelected(MenuItem item) {
29 | if (item.getItemId() == android.R.id.home)
30 | onBackPressed();
31 |
32 | getSupportActionBar().setDisplayHomeAsUpEnabled(false);
33 | getSupportActionBar().setTitle(R.string.app_name);
34 |
35 | return super.onOptionsItemSelected(item);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/mlsdev/sample/SimpleAdapter.java:
--------------------------------------------------------------------------------
1 | package com.mlsdev.sample;
2 |
3 | import android.view.LayoutInflater;
4 | import android.view.View;
5 | import android.view.ViewGroup;
6 | import android.widget.FrameLayout;
7 |
8 | import androidx.annotation.NonNull;
9 | import androidx.recyclerview.widget.RecyclerView;
10 |
11 | public class SimpleAdapter extends RecyclerView.Adapter {
12 |
13 | private final int itemCount = 50;
14 | private int[] backgrounds = new int[3];
15 |
16 | public SimpleAdapter() {
17 | backgrounds[0] = R.drawable.background_primary_light;
18 | backgrounds[1] = R.drawable.background_primary_dark;
19 | backgrounds[2] = R.drawable.background_primary_accent;
20 | }
21 |
22 | @NonNull
23 | @Override
24 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
25 | int index = (int) (Math.random() * 3);
26 | return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_list_item, parent, false), index);
27 | }
28 |
29 | @Override
30 | public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
31 | holder.view.setBackgroundResource(backgrounds[holder.backgroundIndex]);
32 | }
33 |
34 | @Override
35 | public int getItemCount() {
36 | return itemCount;
37 | }
38 |
39 | class ViewHolder extends RecyclerView.ViewHolder {
40 | private FrameLayout view;
41 | private int backgroundIndex = 0;
42 |
43 | ViewHolder(View itemView, int backgroundIndex) {
44 | super(itemView);
45 | this.backgroundIndex = backgroundIndex;
46 | view = (FrameLayout) itemView.findViewById(R.id.item);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/mlsdev/sample/fragment/SampleFragment.java:
--------------------------------------------------------------------------------
1 | package com.mlsdev.sample.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 androidx.annotation.NonNull;
9 | import androidx.annotation.Nullable;
10 | import androidx.fragment.app.Fragment;
11 | import androidx.recyclerview.widget.RecyclerView;
12 |
13 | import com.mlsdev.animatedrv.AnimatedRecyclerView;
14 | import com.mlsdev.sample.R;
15 | import com.mlsdev.sample.SampleActivity;
16 | import com.mlsdev.sample.SimpleAdapter;
17 |
18 | public class SampleFragment extends Fragment {
19 | private SimpleAdapter adapter = new SimpleAdapter();
20 |
21 | public static Fragment newInstance(@NonNull Bundle args) {
22 | SampleFragment fragment = new SampleFragment();
23 | fragment.setArguments(args);
24 | return fragment;
25 | }
26 |
27 | @Nullable
28 | @Override
29 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
30 | Bundle args = getArguments();
31 | String title = "Sample";
32 | int layout = R.layout.fragment_list_from_bottom;
33 | if (args != null) {
34 | title = args.getString(SampleActivity.TITLE_KEY);
35 | layout = args.getInt(SampleActivity.LAYOUT_KEY);
36 | }
37 |
38 | ((SampleActivity) getActivity()).getSupportActionBar().setTitle(title);
39 |
40 | View view = inflater.inflate(layout, container, false);
41 | RecyclerView recyclerView = (AnimatedRecyclerView) view.findViewById(R.id.recycler_view);
42 | recyclerView.setAdapter(adapter);
43 | adapter.notifyDataSetChanged();
44 | recyclerView.scheduleLayoutAnimation();
45 |
46 | return view;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | }
5 | dependencies {
6 | //noinspection GradleDependency
7 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
8 | //noinspection GradleDependency
9 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
10 | }
11 | }
12 |
13 | apply plugin: 'com.android.library'
14 | apply plugin: 'com.github.dcendents.android-maven'
15 | apply plugin: "com.jfrog.bintray"
16 |
17 | android {
18 | compileSdkVersion 28
19 |
20 | defaultConfig {
21 | minSdkVersion 16
22 | targetSdkVersion 28
23 | versionCode 1
24 | versionName "2.0.0"
25 |
26 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
27 |
28 | }
29 | buildTypes {
30 | release {
31 | minifyEnabled false
32 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33 | }
34 | }
35 | }
36 |
37 | ext {
38 | bintrayRepo = 'AnimatedRecyclerView'
39 | bintrayName = 'AnimatedRecyclerView'
40 |
41 | publishedGroupId = 'com.mlsdev.animatedrv'
42 | libraryName = 'library'
43 | artifact = 'library'
44 |
45 | libraryDescription = 'A RecyclerView with layout animations'
46 |
47 | siteUrl = 'https://github.com/MLSDev/AnimatedRecyclerView'
48 | gitUrl = 'https://github.com/MLSDev/AnimatedRecyclerView.git'
49 |
50 | libraryVersion = '2.0.0'
51 |
52 | developerId = 'mlsdev'
53 | developerName = 'MLSDev'
54 | developerEmail = 'dev@mlsdev.com'
55 |
56 | licenseName = 'The Apache Software License, Version 2.0'
57 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
58 | allLicenses = ["Apache-2.0"]
59 | }
60 |
61 | dependencies {
62 | implementation fileTree(dir: 'libs', include: ['*.jar'])
63 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
64 | implementation 'androidx.appcompat:appcompat:1.0.2'
65 | implementation 'androidx.recyclerview:recyclerview:1.0.0'
66 | testImplementation 'junit:junit:4.12'
67 | }
68 |
69 | repositories {
70 | mavenCentral()
71 | }
72 |
73 | if (project.rootProject.file('local.properties').exists()) {
74 | apply from: 'https://raw.githubusercontent.com/wajahatkarim3/JCenter-Gradle-Scripts/master/install.gradle'
75 | apply from: 'https://raw.githubusercontent.com/wajahatkarim3/JCenter-Gradle-Scripts/master/bintray.gradle'
76 | }
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/mlsdev/sample/fragment/OptionsFragment.java:
--------------------------------------------------------------------------------
1 | package com.mlsdev.sample.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 androidx.annotation.LayoutRes;
9 | import androidx.annotation.Nullable;
10 | import androidx.annotation.StringRes;
11 | import androidx.databinding.DataBindingUtil;
12 | import androidx.fragment.app.Fragment;
13 |
14 | import com.mlsdev.sample.R;
15 | import com.mlsdev.sample.SampleActivity;
16 | import com.mlsdev.sample.databinding.FragmentOptionsBinding;
17 |
18 | public class OptionsFragment extends Fragment {
19 | private FragmentOptionsBinding binding;
20 |
21 | private void replaceFragment(@StringRes int title, @LayoutRes int layout) {
22 | ((SampleActivity) getActivity()).getSupportActionBar().setHomeButtonEnabled(true);
23 | ((SampleActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
24 |
25 | Bundle bundle = new Bundle();
26 | bundle.putString(SampleActivity.TITLE_KEY, getString(title));
27 | bundle.putInt(SampleActivity.LAYOUT_KEY, layout);
28 | Fragment fragment = SampleFragment.newInstance(bundle);
29 | getActivity().getSupportFragmentManager().beginTransaction()
30 | .addToBackStack(fragment.getTag())
31 | .replace(R.id.content, fragment)
32 | .commit();
33 | }
34 |
35 | @Nullable
36 | @Override
37 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
38 | binding = DataBindingUtil.inflate(inflater, R.layout.fragment_options, container, false);
39 |
40 | binding.btnListFromBottom.setOnClickListener(new View.OnClickListener() {
41 | @Override
42 | public void onClick(View v) {
43 | replaceFragment(R.string.btn_list_from_bottom, R.layout.fragment_list_from_bottom);
44 | }
45 | });
46 |
47 | binding.btnListFromBottomScale.setOnClickListener(new View.OnClickListener() {
48 | @Override
49 | public void onClick(View v) {
50 | replaceFragment(R.string.btn_list_from_bottom_scale, R.layout.fragment_list_from_bottom_scale);
51 | }
52 | });
53 |
54 | binding.btnGridFromBottom.setOnClickListener(new View.OnClickListener() {
55 | @Override
56 | public void onClick(View v) {
57 | replaceFragment(R.string.btn_grid_from_bottom, R.layout.fragment_grid_from_bottom);
58 | }
59 | });
60 |
61 | binding.btnGridFromBottomScale.setOnClickListener(new View.OnClickListener() {
62 | @Override
63 | public void onClick(View v) {
64 | replaceFragment(R.string.btn_grid_from_bottom_scale, R.layout.fragment_grid_from_bottom_scale);
65 | }
66 | });
67 |
68 | binding.btnGridFromBottomRandom.setOnClickListener(new View.OnClickListener() {
69 | @Override
70 | public void onClick(View v) {
71 | replaceFragment(R.string.btn_grid_from_bottom_random, R.layout.fragment_grid_from_bottom_random);
72 | }
73 | });
74 |
75 | binding.btnGridRandomScale.setOnClickListener(new View.OnClickListener() {
76 | @Override
77 | public void onClick(View v) {
78 | replaceFragment(R.string.btn_grid_random_scale, R.layout.fragment_grid_from_bottom_random_scale);
79 | }
80 | });
81 |
82 | return binding.getRoot();
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 | [](https://opensource.org/licenses/Apache-2.0)
3 | [](https://bintray.com/spetrosiukmlsdev/AnimatedRecyclerView/AnimatedRecyclerView/_latestVersion)
4 |
5 | # AnimatedRecyclerView
6 | A RecyclerView with layout animations
7 |
8 | ## Demo
9 |
10 |
11 | ## Setup
12 | To use this library your `minSdkVersion` must be >= 16.
13 |
14 | In your build.gradle :
15 | ```gradle
16 | dependencies {
17 | implementation "com.mlsdev.animatedrv:library:1.0.1"
18 | }
19 | ```
20 |
21 | #### AndroidX support
22 | ```gradle
23 | dependencies {
24 | implementation "com.mlsdev.animatedrv:library:2.0.0"
25 | }
26 | ```
27 |
28 | ## Example
29 | ### From the layout
30 | ```xml
31 |
40 | ```
41 | #### You can create any layout animations
42 | ```xml
43 |
47 | ```
48 | ```xml
49 |
51 |
52 |
56 |
57 |
61 |
62 |
63 | ```
64 |
65 | ### From the code
66 | ```java
67 | AnimatedRecyclerView recyclerView = new AnimatedRecyclerView.Builder(this)
68 | .orientation(LinearLayoutManager.VERTICAL)
69 | .layoutManagerType(AnimatedRecyclerView.LayoutManagerType.LINEAR)
70 | .animation(R.anim.layout_animation_from_bottom)
71 | .animationDuration(600)
72 | .reverse(false)
73 | .build();
74 | ```
75 |
76 | ### Start animation
77 | - First option
78 | ```java
79 | adapter.notifyDataSetChanged();
80 | recyclerView.scheduleLayoutAnimation();
81 | ```
82 | - Second option
83 | Your `RecyclerView` must be casted to the `AnimatedRecyclerView` and an adapter must be set.
84 | ```java
85 | recyclerView.notifyDataSetChanged();
86 | ```
87 |
88 | ## Authors
89 | * [Sergey Petrosyuk](mailto:petrosyuk@mlsdev.com), MLSDev
90 |
91 | ## About MLSDev
92 |
93 | [
][mlsdev]
94 |
95 | AnimatedRecyclerView is maintained by MLSDev, Inc. We specialize in providing all-in-one solution in mobile and web development. Our team follows Lean principles and works according to agile methodologies to deliver the best results reducing the budget for development and its timeline.
96 |
97 | Find out more [here][mlsdev] and don't hesitate to [contact us][contact]!
98 |
99 | [mlsdev]: http://mlsdev.com
100 | [contact]: http://mlsdev.com/contact_us
101 | [github-frederikos]: https://github.com/SerhiyPetrosyuk
102 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/fragment_options.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
13 |
14 |
18 |
19 |
26 |
27 |
36 |
37 |
46 |
47 |
56 |
57 |
66 |
67 |
76 |
77 |
86 |
87 |
88 |
89 |
90 |
91 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/library/src/main/java/com/mlsdev/animatedrv/AnimatedRecyclerView.java:
--------------------------------------------------------------------------------
1 | package com.mlsdev.animatedrv;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.content.res.TypedArray;
6 | import android.util.AttributeSet;
7 | import android.view.animation.AnimationUtils;
8 | import android.view.animation.LayoutAnimationController;
9 |
10 | import androidx.annotation.AnimRes;
11 | import androidx.annotation.Nullable;
12 | import androidx.recyclerview.widget.GridLayoutManager;
13 | import androidx.recyclerview.widget.LinearLayoutManager;
14 | import androidx.recyclerview.widget.RecyclerView;
15 |
16 | public class AnimatedRecyclerView extends RecyclerView {
17 | private int orientation = LinearLayoutManager.VERTICAL;
18 | private boolean reverse = false;
19 | private int animationDuration = 600;
20 | private int layoutManagerType = LayoutManagerType.LINEAR;
21 | private int columns = 1;
22 | @AnimRes
23 | private int animation = R.anim.layout_animation_from_bottom;
24 | private LayoutAnimationController animationController;
25 |
26 | public AnimatedRecyclerView(Context context, int orientation, boolean reverse,
27 | int animationDuration, int layoutManagerType, int columns,
28 | int animation, LayoutAnimationController animationController) {
29 | super(context);
30 | this.orientation = orientation;
31 | this.reverse = reverse;
32 | this.animationDuration = animationDuration;
33 | this.layoutManagerType = layoutManagerType;
34 | this.columns = columns;
35 | this.animation = animation;
36 | this.animationController = animationController;
37 | init(context, null);
38 | }
39 |
40 | public AnimatedRecyclerView(Context context) {
41 | super(context);
42 | init(context, null);
43 | }
44 |
45 | public AnimatedRecyclerView(Context context, @Nullable AttributeSet attrs) {
46 | super(context, attrs);
47 | init(context, attrs);
48 | }
49 |
50 | public AnimatedRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
51 | super(context, attrs, defStyle);
52 | init(context, attrs);
53 | }
54 |
55 | @SuppressLint({"Recycle", "WrongConstant"})
56 | private void init(Context context, @Nullable AttributeSet attrs) {
57 | TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.AnimatedRecyclerView, 0, 0);
58 |
59 | orientation = typedArray.getInt(R.styleable.AnimatedRecyclerView_layoutManagerOrientation, orientation);
60 | reverse = typedArray.getBoolean(R.styleable.AnimatedRecyclerView_layoutManagerReverse, reverse);
61 | animationDuration = typedArray.getInt(R.styleable.AnimatedRecyclerView_animationDuration, animationDuration);
62 | layoutManagerType = typedArray.getInt(R.styleable.AnimatedRecyclerView_layoutManagerType, layoutManagerType);
63 | columns = typedArray.getInt(R.styleable.AnimatedRecyclerView_gridLayoutManagerColumns, columns);
64 | animation = typedArray.getResourceId(R.styleable.AnimatedRecyclerView_layoutAnimation, -1);
65 |
66 | if (animationController == null)
67 | animationController = animation != -1
68 | ? AnimationUtils.loadLayoutAnimation(getContext(), animation)
69 | : AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_from_bottom);
70 |
71 | animationController.getAnimation().setDuration(animationDuration);
72 | setLayoutAnimation(animationController);
73 |
74 | if (layoutManagerType == LayoutManagerType.LINEAR)
75 | setLayoutManager(new LinearLayoutManager(context, orientation, reverse));
76 | else if (layoutManagerType == LayoutManagerType.GRID)
77 | setLayoutManager(new GridLayoutManager(context, columns, orientation, reverse));
78 | }
79 |
80 | public static class Builder {
81 | private int orientation = LinearLayoutManager.VERTICAL;
82 | private boolean reverse = false;
83 | private int animationDuration = 600;
84 | private int layoutManagerType = LayoutManagerType.LINEAR;
85 | private int columns = 1;
86 | @AnimRes
87 | private int animation = R.anim.layout_animation_from_bottom;
88 | private LayoutAnimationController animationController;
89 | private Context context;
90 |
91 | public Builder(Context context) {
92 | this.context = context;
93 | }
94 |
95 | public Builder orientation(int orientation) {
96 | this.orientation = orientation;
97 | return this;
98 | }
99 |
100 | public Builder reverse(boolean reverse) {
101 | this.reverse = reverse;
102 | return this;
103 | }
104 |
105 | public Builder animationDuration(int animationDuration) {
106 | this.animationDuration = animationDuration;
107 | return this;
108 | }
109 |
110 | public Builder layoutManagerType(@LayoutManagerType int layoutManagerType) {
111 | this.layoutManagerType = layoutManagerType;
112 | return this;
113 | }
114 |
115 | public Builder columns(int columns) {
116 | this.columns = columns;
117 | return this;
118 | }
119 |
120 | public Builder animation(@AnimRes int animation) {
121 | this.animation = animation;
122 | return this;
123 | }
124 |
125 | public Builder animationController(LayoutAnimationController animationController) {
126 | this.animationController = animationController;
127 | return this;
128 | }
129 |
130 | public AnimatedRecyclerView build() {
131 | return new AnimatedRecyclerView(
132 | context, orientation, reverse, animationDuration, layoutManagerType, columns,
133 | animation, animationController
134 | );
135 | }
136 |
137 | }
138 |
139 | public void notifyDataSetChanged() throws Exception {
140 | if (getAdapter() != null) {
141 | getAdapter().notifyDataSetChanged();
142 | scheduleLayoutAnimation();
143 | } else {
144 | throw new Exception("The adapter must be set");
145 | }
146 | }
147 |
148 | public @interface LayoutManagerType {
149 | int LINEAR = 0;
150 | int GRID = 1;
151 | }
152 | }
153 |
--------------------------------------------------------------------------------