Skip to content

Added GIF support on android using android-gif-drawable library #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
12 changes: 12 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,19 @@ android {
}
}

buildscript {
repositories {
mavenCentral()
}
}
allprojects {
repositories {
mavenCentral()
}
}

dependencies {
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.facebook.react:react-native:+'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import java.lang.ref.WeakReference;

import pl.droidsonroids.gif.GifImageView;


public class RCTSplashScreen {

Expand All @@ -23,7 +25,7 @@ public class RCTSplashScreen {
public static final int UIAnimationScale = 2;

private static Dialog dialog;
private static ImageView imageView;
private static GifImageView imageView;

private static WeakReference<Activity> wr_activity;

Expand All @@ -36,10 +38,10 @@ public static void openSplashScreen(Activity activity) {
}

public static void openSplashScreen(Activity activity, boolean isFullScreen) {
openSplashScreen(activity, isFullScreen, ImageView.ScaleType.CENTER_CROP);
openSplashScreen(activity, isFullScreen, GifImageView.ScaleType.CENTER_CROP);
}

public static void openSplashScreen(final Activity activity, final boolean isFullScreen, final ImageView.ScaleType scaleType) {
public static void openSplashScreen(final Activity activity, final boolean isFullScreen, final GifImageView.ScaleType scaleType) {
if (activity == null) return;
wr_activity = new WeakReference<>(activity);
final int drawableId = getImageId();
Expand All @@ -51,7 +53,7 @@ public void run() {

if(!getActivity().isFinishing()) {
Context context = getActivity();
imageView = new ImageView(context);
imageView = new GifImageView(context);

imageView.setImageResource(drawableId);

Expand Down