android.graphics.drawable.AnimatedVectorDrawable Java Examples

The following examples show how to use android.graphics.drawable.AnimatedVectorDrawable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchAnimateDecorator.java    From Decor with Apache License 2.0 6 votes vote down vote up
@Override
protected void apply(ImageView view, TypedArray typedArray) {
    boolean shouldAnimate = typedArray.getBoolean(R.styleable.SearchAnimateDecorator_decorAnimateSearch, false);
    if(!shouldAnimate) return;

    mIv = view;
    mSearchToBar = (AnimatedVectorDrawable) view.getContext().getResources().getDrawable(R.drawable.anim_search_to_bar);
    mBarToSearch = (AnimatedVectorDrawable) view.getContext().getResources().getDrawable(R.drawable.anim_bar_to_search);
    mInterp = AnimationUtils.loadInterpolator(view.getContext(), android.R.interpolator.linear_out_slow_in);
    mDuration = view.getContext().getResources().getInteger(R.integer.duration_bar);
    // iv is sized to hold the search+bar so when only showing the search icon, translate the
    // whole view left by half the difference to keep it centered
    mOffset = -71f * (int) view.getContext().getResources().getDisplayMetrics().scaledDensity;
    view.setTranslationX(mOffset);
    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            animate(v);
        }
    });
}
 
Example #2
Source File: MainActivity.java    From journaldev with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    FloatingActionButton fabSync = findViewById(R.id.fabSync);
    FloatingActionButton fabTickCross = findViewById(R.id.fabTickCross);

    tickToCross = (AnimatedVectorDrawable) getDrawable(R.drawable.avd_tick2cross);
    crossToTick = (AnimatedVectorDrawable) getDrawable(R.drawable.avd_cross2tick);


    ImageView imgSettings = findViewById(R.id.imgSettings);
    ImageView imgJD = findViewById(R.id.imgJD);
    imgSettings.setOnClickListener(this);
    imgJD.setOnClickListener(this);

    AnimatedVectorDrawableCompat animatedVectorDrawableCompat = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_sync);
    fabSync.setImageDrawable(animatedVectorDrawableCompat);
    fabSync.setOnClickListener(this);
    fabTickCross.setOnClickListener(this);

}
 
Example #3
Source File: HomeActivity.java    From android-proguards with Apache License 2.0 6 votes vote down vote up
void revealPostingProgress() {
    Animator reveal = ViewAnimationUtils.createCircularReveal(fabPosting,
            (int) fabPosting.getPivotX(),
            (int) fabPosting.getPivotY(),
            0f,
            fabPosting.getWidth() / 2)
            .setDuration(600L);
    reveal.setInterpolator(AnimUtils.getFastOutLinearInInterpolator(this));
    reveal.start();
    AnimatedVectorDrawable uploading =
            (AnimatedVectorDrawable) getDrawable(R.drawable.avd_uploading);
    if (uploading != null) {
        fabPosting.setImageDrawable(uploading);
        uploading.start();
    }
}
 
Example #4
Source File: RecyclerFragment.java    From materialup with Apache License 2.0 6 votes vote down vote up
public void checkEmptyOrConnection() {
    if (!Utils.hasInternet(getActivity())) {
        if (getAdapter().getItemCount() == 0) {
            mEmpty.setVisibility(View.GONE);
            mEmptyImage.setVisibility(View.VISIBLE);
            if (UI.isLollipop()) {
                final AnimatedVectorDrawable avd =
                        (AnimatedVectorDrawable) ContextCompat.getDrawable(getActivity(), R.drawable.avd_no_connection);
                mEmptyImage.setImageDrawable(avd);
                avd.start();
            } else {
                mEmptyImage.setImageResource(R.drawable.no_connection);
            }
        } else {
            Toast.makeText(getActivity(), R.string.check_network, Toast.LENGTH_SHORT).show();
        }
    }
}
 
Example #5
Source File: MainActivity.java    From android-samples with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ImageView mFabView = (ImageView) findViewById(R.id.fab_view);

    // animate head to leaf
    final AnimatedVectorDrawable faceAVD = (AnimatedVectorDrawable) ContextCompat.getDrawable(this, R.drawable.face_avd);
    mFabView.setImageDrawable(faceAVD);

    findViewById(R.id.animate_btn).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            faceAVD.start();
        }
    });
}
 
Example #6
Source File: WebXRInterstitialWidget.java    From FirefoxReality with Mozilla Public License 2.0 6 votes vote down vote up
private void initialize() {
    LayoutInflater inflater = LayoutInflater.from(getContext());
    mBinding = DataBindingUtil.inflate(inflater, R.layout.webxr_interstitial, this, true);
    mBinding.setLifecycleOwner((VRBrowserActivity)getContext());
    setHowToVisible(true);

    // AnimatedVectorDrawable doesn't work with a Hardware Accelerated canvas, we disable it for this view.
    setIsHardwareAccelerationEnabled(false);

    mSpinnerAnimation = (AnimatedVectorDrawable) mBinding.webxrSpinner.getDrawable();
    if (DeviceType.isPicoVR()) {
        ViewUtils.forceAnimationOnUI(mSpinnerAnimation);
    }
    mWidgetManager.addWebXRListener(this);

}
 
Example #7
Source File: MainActivity.java    From AnimatedVectorMorphingTool with Apache License 2.0 6 votes vote down vote up
/**
 * Launch the animation on the currentAnimatedVectorDrawable
 */
private void launchAnimBackup(){
    if(!backupRoundTripFirstLaunched) {
        if (backupRoundTrip.getLevel() == 1) {
            //then reverse
            backupRoundTrip.setLevel(0);
        } else {
            //then reverse
            backupRoundTrip.setLevel(1);
        }
    }else{
        backupRoundTripFirstLaunched=false;
    }
    //find the current AnimatedVectorDrawable displayed
    currentBackupDrawable = (AnimatedVectorDrawable) backupRoundTrip.getCurrent();
    //start the animation
    currentBackupDrawable.start();
}
 
Example #8
Source File: MainActivity.java    From AnimatedVectorMorphingTool with Apache License 2.0 6 votes vote down vote up
/**
 * Launch the animation on the currentAnimatedVectorDrawable
 * As the levellist solution (ahead) has a bug, I do it in a simple way
 */
private void launchAnimBackup() {
    //initialize
    if (backupRoundTripFirstLaunched) {
        reverse = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.animated_ic_check_box_black_24dp_reverse, getTheme());
        initial = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.animated_ic_check_box_black_24dp, getTheme());
        //if you want to avoid the color bug (animation not played on color at the second time)
        //comment that line (ok it's memory consumption)
        backupRoundTripFirstLaunched=false;
    }
    //set the drawable depending on the direction (reverse or not)
    if (reverseState) {
        //then reverse
        imageView2.setImageDrawable(reverse);
    } else {
        //then reverse
        imageView2.setImageDrawable(initial);
    }
    reverseState=!reverseState;
    //launch the animation
    ((AnimatedVectorDrawable) imageView2.getDrawable()).start();
}
 
Example #9
Source File: MainActivity.java    From AnimatedVectorMorphingTool with Apache License 2.0 6 votes vote down vote up
/**
 * Launch the animation on the currentAnimatedVectorDrawable
 */
private void launchAnimBackup(){
    if(!backupRoundTripFirstLaunched) {
        if (backupRoundTrip.getLevel() == 1) {
            //then reverse
            backupRoundTrip.setLevel(0);
        } else {
            //then reverse
            backupRoundTrip.setLevel(1);
        }
    }else{
        backupRoundTripFirstLaunched=false;
    }
    //find the current AnimatedVectorDrawable displayed
    currentBackupDrawable = (AnimatedVectorDrawable) backupRoundTrip.getCurrent();
    //start the animation
    currentBackupDrawable.start();
}
 
Example #10
Source File: MainActivity.java    From AnimatedVectorMorphingTool with Apache License 2.0 6 votes vote down vote up
/**
 * Launch the animation on the currentAnimatedVectorDrawable
 */
private void launchAnimBackup(){
    if(!backupRoundTripFirstLaunched) {
        if (backupRoundTrip.getLevel() == 1) {
            //then reverse
            backupRoundTrip.setLevel(0);
        } else {
            //then reverse
            backupRoundTrip.setLevel(1);
        }
    }else{
        backupRoundTripFirstLaunched=false;
    }
    //find the current AnimatedVectorDrawable displayed
    currentBackupDrawable = (AnimatedVectorDrawable) backupRoundTrip.getCurrent();
    //start the animation
    currentBackupDrawable.start();
}
 
Example #11
Source File: MainActivity.java    From AnimatedVectorMorphingTool with Apache License 2.0 6 votes vote down vote up
/**
 * Launch the animation on the currentAnimatedVectorDrawable
 */
private void launchAnimBackup(){
    if(!backupRoundTripFirstLaunched) {
        if (backupRoundTrip.getLevel() == 1) {
            //then reverse
            backupRoundTrip.setLevel(0);
        } else {
            //then reverse
            backupRoundTrip.setLevel(1);
        }
    }else{
        backupRoundTripFirstLaunched=false;
    }
    //find the current AnimatedVectorDrawable displayed
    currentBackupDrawable = (AnimatedVectorDrawable) backupRoundTrip.getCurrent();
    //start the animation
    currentBackupDrawable.start();
}
 
Example #12
Source File: EditorActivity.java    From APDE with GNU General Public License v2.0 6 votes vote down vote up
public void changeRunStopIcon(final boolean run) {
	runStopMenuButton.post(() -> {
		if (android.os.Build.VERSION.SDK_INT >= 21) {
			AnimatedVectorDrawable anim = (AnimatedVectorDrawable) getDrawable(run ? R.drawable.run_to_stop : R.drawable.stop_to_run);
			runStopMenuButton.setImageDrawable(anim);
			anim.start();
			runStopMenuButtonAnimating = true;
			
			runStopMenuButton.postDelayed(() -> {
				supportInvalidateOptionsMenu();
				runStopMenuButtonAnimating = false;
			}, getResources().getInteger(R.integer.run_stop_animation_duration));
		} else {
			supportInvalidateOptionsMenu();
		}
	});
}
 
Example #13
Source File: OpenOnPhoneAnimationActivity.java    From wear-os-samples with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_open_on_phone_animation);

    AmbientModeSupport.attach(this);

    mAnimationCallback =
            new AnimationCallback() {
                @Override
                public void onAnimationEnd(Drawable drawable) {
                    super.onAnimationEnd(drawable);
                    // Go back to main Dialogs screen after animation.
                    finish();
                }
            };

    // Play 'swipe left' animation only once.
    ImageView phoneImage = findViewById(R.id.open_on_phone_animation_image);
    mAnimatedVectorDrawablePhone = (AnimatedVectorDrawable) phoneImage.getDrawable();
    mAnimatedVectorDrawablePhone.registerAnimationCallback(mAnimationCallback);
    mAnimatedVectorDrawablePhone.start();
}
 
Example #14
Source File: MainActivity.java    From AnimatedVectorMorphingTool with Apache License 2.0 6 votes vote down vote up
/**
 * Launch the animation on the currentAnimatedVectorDrawable
 * As the levellist solution (ahead) has a bug, I do it in a simple way
 */
private void launchAnimBackup() {
    //initialize
    if (backupRoundTripFirstLaunched) {
        reverse = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.animated_ic_check_box_black_24dp_reverse, getTheme());
        initial = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.animated_ic_check_box_black_24dp, getTheme());
        //if you want to avoid the color bug (animation not played on color at the second time)
        //comment that line (ok it's memory consumption)
        backupRoundTripFirstLaunched=false;
    }
    //set the drawable depending on the direction (reverse or not)
    if (reverseState) {
        //then reverse
        imageView2.setImageDrawable(reverse);
    } else {
        //then reverse
        imageView2.setImageDrawable(initial);
    }
    reverseState=!reverseState;
    //launch the animation
    ((AnimatedVectorDrawable) imageView2.getDrawable()).start();
}
 
Example #15
Source File: DynamicHeaderListFragment.java    From beauty-treatment-android-animations with Apache License 2.0 5 votes vote down vote up
private void triggerAvatarStrokeTransformation(boolean appear) {

        // Scale thin line behind avatar
        int lineScaleX = appear ? 1 : 10;
        topHeaderDividerLine.animate().scaleX(lineScaleX).setDuration(200);

        // Animate avatar stroke vector path
        AnimatedVectorDrawable drawable = appear ? appearingImageStroke : disappearingImageStroke;
        imageStrokeVectorDrawable.setImageDrawable(drawable);
        drawable.start();

        userAvatarStrokeVisible = appear;
    }
 
Example #16
Source File: AnimatedVectorDrawableCompat.java    From Music-Player with Apache License 2.0 5 votes vote down vote up
public static void cancel(AnimatedVectorDrawable drawable) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        drawable.reset();
    }
    sHandler.removeMessages(AnimatedVectorDrawableHandler.MSG_START);
    sHandler.removeMessages(AnimatedVectorDrawableHandler.MSG_STOP);
}
 
Example #17
Source File: AudioView.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
private void togglePauseToPlay() {
  controlToggle.displayQuick(playButton);

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    AnimatedVectorDrawable pauseToPlayDrawable = (AnimatedVectorDrawable)getContext().getDrawable(R.drawable.pause_to_play_animation);
    playButton.setImageDrawable(pauseToPlayDrawable);
    pauseToPlayDrawable.start();
  }
}
 
Example #18
Source File: AudioView.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
private void togglePlayToPause() {
  controlToggle.displayQuick(pauseButton);

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    AnimatedVectorDrawable playToPauseDrawable = (AnimatedVectorDrawable)getContext().getDrawable(R.drawable.play_to_pause_animation);
    pauseButton.setImageDrawable(playToPauseDrawable);
    playToPauseDrawable.start();
  }
}
 
Example #19
Source File: StaticHeaderListFragment.java    From beauty-treatment-android-animations with Apache License 2.0 5 votes vote down vote up
private void initializeSwipeRefreshLayout() {

        int swipeRefreshDimensions = (int) getResources().getDimension(R.dimen.swipe_refresh_height);

        ViewGroup.LayoutParams layoutParams = swipeRefreshAnimationContainer.getLayoutParams();
        layoutParams.height = swipeRefreshDimensions;
        layoutParams.width = swipeRefreshDimensions;

        swipeRefreshDrawables = new AnimatedVectorDrawable[] {
                loadVectorDrawable(R.drawable.branch_minified_grow_branch1),
                loadVectorDrawable(R.drawable.branch_minified_grow_leave1),
                loadVectorDrawable(R.drawable.branch_minified_grow_branch3),
                loadVectorDrawable(R.drawable.branch_minified_grow_leave2),
                loadVectorDrawable(R.drawable.branch_minified_grow_branch2),
                loadVectorDrawable(R.drawable.branch_minified_grow_leave3),
                loadVectorDrawable(R.drawable.branch_minified_grow_leave4),
                loadVectorDrawable(R.drawable.branch_minified_grow_leave5),
                loadVectorDrawable(R.drawable.branch_minified_grow_branch4),
                loadVectorDrawable(R.drawable.branch_minified_grow_leave6),
                loadVectorDrawable(R.drawable.branch_minified_grow_leave7),
                loadVectorDrawable(R.drawable.branch_minified_grow_branch5),
                loadVectorDrawable(R.drawable.branch_minified_grow_leave8),
                loadVectorDrawable(R.drawable.branch_minified_grow_branch6),
                loadVectorDrawable(R.drawable.branch_minified_grow_leave9),
                loadVectorDrawable(R.drawable.branch_minified_grow_source)
        };

        swipeRefreshImageViews = new ImageView[16];
        for (int i = 0; i < 16; i++) {
            swipeRefreshImageViews[i] = new ImageView(getActivity());
            swipeRefreshImageViews[i].setLayoutParams(layoutParams);
            swipeRefreshAnimationContainer.addView(swipeRefreshImageViews[i]);
        }

        swipeRefreshLayout.setOnRefreshListener(refreshListener);
    }
 
Example #20
Source File: MainActivity.java    From auid2 with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    final ImageView imageView = (ImageView) v;
    final AnimatedVectorDrawable avd = (AnimatedVectorDrawable) imageView.getDrawable();
    avd.start();

}
 
Example #21
Source File: MainActivity.java    From Android-Animated-Icons with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
    getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu_vector);
    mFloatingActionButton = (FloatingActionButton) findViewById(R.id.fab);
    mMenuDrawable = (AnimatedVectorDrawable) getDrawable(R.drawable.ic_menu_animatable);
    mBackDrawable = (AnimatedVectorDrawable) getDrawable(R.drawable.ic_back_animatable);
    mAddDrawable = (AnimatedVectorDrawable) getDrawable(R.drawable.ic_add_animatable);
    mCheckDrawable = (AnimatedVectorDrawable) getDrawable(R.drawable.ic_check_animatable);
}
 
Example #22
Source File: AudioView.java    From deltachat-android with GNU General Public License v3.0 5 votes vote down vote up
private void togglePauseToPlay() {
  controlToggle.displayQuick(playButton);

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    AnimatedVectorDrawable pauseToPlayDrawable = (AnimatedVectorDrawable)getContext().getDrawable(R.drawable.pause_to_play_animation);
    playButton.setImageDrawable(pauseToPlayDrawable);
    pauseToPlayDrawable.start();
  }
}
 
Example #23
Source File: AudioView.java    From deltachat-android with GNU General Public License v3.0 5 votes vote down vote up
private void togglePlayToPause() {
  controlToggle.displayQuick(pauseButton);

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    AnimatedVectorDrawable playToPauseDrawable = (AnimatedVectorDrawable)getContext().getDrawable(R.drawable.play_to_pause_animation);
    pauseButton.setImageDrawable(playToPauseDrawable);
    playToPauseDrawable.start();
  }
}
 
Example #24
Source File: PlayerSheet.java    From android-proguards with Apache License 2.0 5 votes vote down vote up
private void showDown() {
    if (dismissState == DISMISS_DOWN) return;
    dismissState = DISMISS_DOWN;
    final AnimatedVectorDrawable closeToDown = (AnimatedVectorDrawable)
            ContextCompat.getDrawable(this, R.drawable.avd_close_to_down);
    close.setImageDrawable(closeToDown);
    closeToDown.start();
}
 
Example #25
Source File: CheckInDrawable.java    From cathode with Apache License 2.0 5 votes vote down vote up
public CheckInDrawable(Context context, int animatedCheckInDrawableRes,
    int animatedCancelDrawableRes, int checkInDrawableRes, int cancelDrawableRes) {
  this.context = context;

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    checkInDrawable = context.getDrawable(animatedCheckInDrawableRes);
    cancelDrawable = context.getDrawable(animatedCancelDrawableRes);

    callbacks = new Animatable2.AnimationCallback() {
      @RequiresApi(api = Build.VERSION_CODES.M) @Override
      public void onAnimationEnd(Drawable drawable) {
        ((AnimatedVectorDrawable) checkInDrawable).clearAnimationCallbacks();
        ((AnimatedVectorDrawable) checkInDrawable).reset();
        ((AnimatedVectorDrawable) cancelDrawable).clearAnimationCallbacks();
        ((AnimatedVectorDrawable) cancelDrawable).reset();

        updateWatchingDrawable(watching);
      }
    };
  } else {
    checkInDrawable =
        VectorDrawableCompat.create(context.getResources(), checkInDrawableRes, null);
    cancelDrawable = VectorDrawableCompat.create(context.getResources(), cancelDrawableRes, null);
  }

  checkInDrawable.setCallback(this);
  cancelDrawable.setCallback(this);

  currentDrawable = checkInDrawable;
}
 
Example #26
Source File: CheckInDrawable.java    From cathode with Apache License 2.0 5 votes vote down vote up
private void resetImageDrawables() {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    ((AnimatedVectorDrawable) checkInDrawable).clearAnimationCallbacks();
    ((AnimatedVectorDrawable) cancelDrawable).clearAnimationCallbacks();
    ((AnimatedVectorDrawable) checkInDrawable).stop();
    ((AnimatedVectorDrawable) cancelDrawable).stop();
    ((AnimatedVectorDrawable) checkInDrawable).reset();
    ((AnimatedVectorDrawable) cancelDrawable).reset();
  }
}
 
Example #27
Source File: PlayerSheet.java    From android-proguards with Apache License 2.0 5 votes vote down vote up
private void showClose() {
    if (dismissState == DISMISS_CLOSE) return;
    dismissState = DISMISS_CLOSE;
    final AnimatedVectorDrawable downToClose = (AnimatedVectorDrawable)
            ContextCompat.getDrawable(this, R.drawable.avd_down_to_close);
    close.setImageDrawable(downToClose);
    downToClose.start();
}
 
Example #28
Source File: PlayerActivity.java    From android-proguards with Apache License 2.0 5 votes vote down vote up
@OnClick({R.id.shot_count, R.id.followers_count, R.id.likes_count})
void playerActionClick(TextView view) {
    ((AnimatedVectorDrawable) view.getCompoundDrawables()[1]).start();
    switch (view.getId()) {
        case R.id.followers_count:
            PlayerSheet.start(PlayerActivity.this, player);
            break;
    }
}
 
Example #29
Source File: DynamicHeaderListFragment.java    From beauty-treatment-android-animations with Apache License 2.0 5 votes vote down vote up
private void initVectorDrawables() {

        userAvatarStrokeVisible = true;
        topHeaderBackgroundVisible = false;

        appearingImageStroke = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable
                .circle_stroke_animated_show);
        disappearingImageStroke = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable
                .circle_stroke_animated_hide);
    }
 
Example #30
Source File: ImagesActivity.java    From wear-os-samples with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_images);

    AmbientModeSupport.attach(this);

    // Used to repeat animation from the beginning.
    mAnimationCallback =
            new AnimationCallback() {
                @Override
                public void onAnimationEnd(Drawable drawable) {
                    super.onAnimationEnd(drawable);
                    ((AnimatedVectorDrawable) drawable).start();
                }
            };

    // Play 'swipe left' animation on loop.
    ImageView mSwipeLeftImage = findViewById(R.id.swipe_left_image);
    mAnimatedVectorDrawableSwipe = (AnimatedVectorDrawable) mSwipeLeftImage.getDrawable();
    mAnimatedVectorDrawableSwipe.start();
    mAnimatedVectorDrawableSwipe.registerAnimationCallback(mAnimationCallback);

    // Play 'tap' animation on loop.
    ImageView mTapImage = findViewById(R.id.tap_image);
    mAnimatedVectorDrawableTap = (AnimatedVectorDrawable) mTapImage.getDrawable();
    mAnimatedVectorDrawableTap.start();
    mAnimatedVectorDrawableTap.registerAnimationCallback(mAnimationCallback);
}