Skip to content

Commit

Permalink
android: update rive
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed Jul 4, 2023
1 parent 1c702c8 commit 58bbd5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ dependencies {
implementation 'com.airbnb.android:lottie:6.0.0'

// https://github.com/rive-app/rive-android
implementation 'app.rive:rive-android:4.2.2'
implementation 'app.rive:rive-android:4.3.2'
}
2 changes: 1 addition & 1 deletion android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 4.4.3
version: 4.4.4
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86 x86_64
description: ti.animation
Expand Down
21 changes: 10 additions & 11 deletions android/src/ti/animation/AnimationView.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
import static ti.animation.TiAnimationModule.ANIMATION_LOTTIE;
import static ti.animation.TiAnimationModule.ANIMATION_RIVE;

import androidx.annotation.NonNull;
import androidx.startup.AppInitializer;

import android.animation.Animator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
Expand All @@ -22,6 +19,8 @@
import android.view.View;
import android.widget.ImageView.ScaleType;

import androidx.startup.AppInitializer;

import com.airbnb.lottie.LottieAnimationView;
import com.airbnb.lottie.LottieComposition;
import com.airbnb.lottie.LottieCompositionFactory;
Expand All @@ -46,20 +45,15 @@
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

import app.rive.runtime.kotlin.RiveAnimationView;
import app.rive.runtime.kotlin.RiveArtboardRenderer;
import app.rive.runtime.kotlin.RiveInitializer;
import app.rive.runtime.kotlin.core.Alignment;
import app.rive.runtime.kotlin.core.Direction;
import app.rive.runtime.kotlin.core.Fit;
import app.rive.runtime.kotlin.core.LinearAnimationInstance;
import app.rive.runtime.kotlin.core.Loop;
import app.rive.runtime.kotlin.core.PlayableInstance;
import app.rive.runtime.kotlin.core.StateMachineInstance;

public class AnimationView extends TiUIView implements LottieOnCompositionLoadedListener {

Expand Down Expand Up @@ -198,16 +192,21 @@ private void setScaleMode(String smode) {
return;
}

if (lottieView == null) return;

switch (smode) {
case "center":
if (lottieView != null) lottieView.setScaleType(ScaleType.CENTER);
lottieView.setScaleType(ScaleType.CENTER);
break;
case "centerCrop":
if (lottieView != null) lottieView.setScaleType(ScaleType.CENTER_CROP);
lottieView.setScaleType(ScaleType.CENTER_CROP);
break;
case "stretch":
lottieView.setScaleType(ScaleType.FIT_XY);
break;
case "centerInside":
default:
if (lottieView != null) lottieView.setScaleType(ScaleType.CENTER_INSIDE);
lottieView.setScaleType(ScaleType.CENTER_INSIDE);
break;
}
}
Expand Down

0 comments on commit 58bbd5e

Please # to comment.