Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.0'
}
}

Expand All @@ -26,13 +26,14 @@ android {

defaultConfig {
minSdkVersion 16
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
targetSdkVersion 28
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
}

dependencies {
implementation 'com.airbnb.android:lottie:2.7.0'
implementation 'com.airbnb.android:lottie:3.0.7'
}
2 changes: 2 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
android.enableJetifier=true
android.useAndroidX=true
16 changes: 9 additions & 7 deletions android/src/main/java/com/example/flutter_lottie/LottieView.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.graphics.Color;
import android.view.View;
import com.airbnb.lottie.LottieAnimationView;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.model.KeyPath;
import com.airbnb.lottie.value.LottieValueCallback;
Expand Down Expand Up @@ -33,6 +34,7 @@ public class LottieView implements PlatformView, MethodChannel.MethodCallHandler
mArgs = args;
mRegistrar = registrar;
animationView = new LottieAnimationView(context);
animationView.enableMergePathsForKitKatAndAbove(true);

Map<String, Object> params = (Map<String, Object>) args;
create(params);
Expand Down Expand Up @@ -79,9 +81,9 @@ public void onCancel(Object o) {
maxFrame = animationView.getMaxFrame();

if(reverse) {
animationView.setRepeatMode(2);
animationView.setRepeatMode(LottieDrawable.REVERSE);
} else {
animationView.setRepeatMode(1);
animationView.setRepeatMode(LottieDrawable.RESTART);
}

if(autoPlay) {
Expand Down Expand Up @@ -165,7 +167,7 @@ public void onMethodCall(MethodCall call, MethodChannel.Result result) {
animationView.cancelAnimation();
animationView.setProgress(0.0f);
final int mode = animationView.getRepeatMode();
animationView.setRepeatMode(1);
animationView.setRepeatMode(LottieDrawable.RESTART);
animationView.setRepeatMode(mode);
break;
case "pause":
Expand All @@ -181,9 +183,9 @@ public void onMethodCall(MethodCall call, MethodChannel.Result result) {
case "setAutoReverseAnimation":
boolean reverse = ((args.get("reverse")) != null) ? Boolean.parseBoolean(args.get("reverse").toString()) : false;
if(reverse) {
animationView.setRepeatMode(2);
animationView.setRepeatMode(LottieDrawable.REVERSE);
} else {
animationView.setRepeatMode(1);
animationView.setRepeatMode(LottieDrawable.RESTART);
}
break;
case "setAnimationProgress":
Expand All @@ -206,10 +208,10 @@ public void onMethodCall(MethodCall call, MethodChannel.Result result) {
result.success((double)animationView.getSpeed());
break;
case "getLoopAnimation":
result.success(animationView.getRepeatCount() == -1 ? true : false);
result.success(animationView.getRepeatCount() == LottieDrawable.INFINITE ? true : false);
break;
case "getAutoReverseAnimation":
result.success(animationView.getRepeatMode() == 2 ? true : false);
result.success(animationView.getRepeatMode() == LottieDrawable.REVERSE ? true : false);
break;
case "setValue":
final String value = args.get("value").toString();
Expand Down
18 changes: 9 additions & 9 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.2.0"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -59,7 +59,7 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.3+1"
version: "0.12.5"
meta:
dependency: transitive
description:
Expand All @@ -80,14 +80,14 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
version: "1.7.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.3"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -99,7 +99,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.4"
version: "1.5.5"
stack_trace:
dependency: transitive
description:
Expand All @@ -113,7 +113,7 @@ packages:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.8"
version: "2.0.0"
string_scanner:
dependency: transitive
description:
Expand All @@ -134,7 +134,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.2"
version: "0.2.5"
typed_data:
dependency: transitive
description:
Expand All @@ -150,4 +150,4 @@ packages:
source: hosted
version: "2.0.8"
sdks:
dart: ">=2.1.0 <3.0.0"
dart: ">=2.2.2 <3.0.0"
11 changes: 10 additions & 1 deletion flutter_lottie.iml
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/build" />
</content>
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart Packages" level="project" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
</component>
Expand Down
18 changes: 9 additions & 9 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.2.0"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -45,7 +45,7 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.3+1"
version: "0.12.5"
meta:
dependency: transitive
description:
Expand All @@ -66,14 +66,14 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
version: "1.7.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.3"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -85,7 +85,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.4"
version: "1.5.5"
stack_trace:
dependency: transitive
description:
Expand All @@ -99,7 +99,7 @@ packages:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.8"
version: "2.0.0"
string_scanner:
dependency: transitive
description:
Expand All @@ -120,7 +120,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.2"
version: "0.2.5"
typed_data:
dependency: transitive
description:
Expand All @@ -136,4 +136,4 @@ packages:
source: hosted
version: "2.0.8"
sdks:
dart: ">=2.1.0 <3.0.0"
dart: ">=2.2.2 <3.0.0"