Android Open Source - android-slideshow-widget Base Transition Factory






From Project

Back to project page android-slideshow-widget.

License

The source code is released under:

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions...

If you think the Android project android-slideshow-widget listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.marvinlabs.widget.slideshow.transition;
/* www  .ja  v  a  2s  .c  o  m*/
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;

import com.marvinlabs.widget.slideshow.TransitionFactory;

/**
 * The base implementation for a transition factory. Provides storage for a duration and an
 * interpolator which should be what is required by most transition factories.
 * <p/>
 * Created by Vincent Mimoun-Prat @ MarvinLabs on 02/06/2014.
 */
public abstract class BaseTransitionFactory implements TransitionFactory {

    public static final long DEFAULT_DURATION = 500;
    public static final Interpolator DEFAULT_INTERPOLATOR = new DecelerateInterpolator();

    // Duration for the transition in ms
    private long duration = DEFAULT_DURATION;

    // Interpolator to use for the transition
    private Interpolator interpolator;

    //==============================================================================================
    // GENERAL METHODS
    //==

    /**
     * Default constructor
     */
    public BaseTransitionFactory() {
        this(DEFAULT_DURATION, DEFAULT_INTERPOLATOR);
    }

    /**
     * Constructor
     *
     * @param duration The duration for the transition in ms
     */
    public BaseTransitionFactory(long duration) {
        this(duration, DEFAULT_INTERPOLATOR);
    }

    /**
     * Constructor
     *
     * @param duration     The duration for the transition in ms
     * @param interpolator The kind of interpolator we need
     */
    public BaseTransitionFactory(long duration, Interpolator interpolator) {
        this.interpolator = interpolator;
        this.duration = duration;
    }

    /**
     * Get the transition duration
     *
     * @return duration in ms
     */
    public long getDuration() {
        return duration;
    }

    /**
     * Set the transition duration
     *
     * @param duration duration in ms
     */
    public void setDuration(long duration) {
        this.duration = duration;
    }

    /**
     * Get the interpolator used for the transitions
     *
     * @return the interpolator
     */
    public Interpolator getInterpolator() {
        return interpolator;
    }

    /**
     * Set the interpolator used for the transitions
     *
     * @param interpolator the interpolator
     */
    public void setInterpolator(Interpolator interpolator) {
        this.interpolator = interpolator;
    }
}




Java Source Code List

com.marvinlabs.widget.slideshow.PlayList.java
com.marvinlabs.widget.slideshow.SlideShowAdapter.java
com.marvinlabs.widget.slideshow.SlideShowView.java
com.marvinlabs.widget.slideshow.TransitionFactory.java
com.marvinlabs.widget.slideshow.adapter.BitmapAdapter.java
com.marvinlabs.widget.slideshow.adapter.GenericBitmapAdapter.java
com.marvinlabs.widget.slideshow.adapter.GenericRemoteBitmapAdapter.java
com.marvinlabs.widget.slideshow.adapter.GenericResourceBitmapAdapter.java
com.marvinlabs.widget.slideshow.adapter.RemoteBitmapAdapter.java
com.marvinlabs.widget.slideshow.adapter.ResourceBitmapAdapter.java
com.marvinlabs.widget.slideshow.demo.SlideShowActivity.java
com.marvinlabs.widget.slideshow.picasso.GenericPicassoBitmapAdapter.java
com.marvinlabs.widget.slideshow.picasso.PicassoRemoteBitmapAdapter.java
com.marvinlabs.widget.slideshow.picasso.PicassoResourceBitmapAdapter.java
com.marvinlabs.widget.slideshow.playlist.RandomPlayList.java
com.marvinlabs.widget.slideshow.playlist.SequentialPlayList.java
com.marvinlabs.widget.slideshow.transition.BaseTransitionFactory.java
com.marvinlabs.widget.slideshow.transition.FadeTransitionFactory.java
com.marvinlabs.widget.slideshow.transition.FlipTransitionFactory.java
com.marvinlabs.widget.slideshow.transition.NoTransitionFactory.java
com.marvinlabs.widget.slideshow.transition.RandomTransitionFactory.java
com.marvinlabs.widget.slideshow.transition.SlideAndZoomTransitionFactory.java
com.marvinlabs.widget.slideshow.transition.ZoomTransitionFactory.java