Android Open Source - my-wallpaper Effects Factory






From Project

Back to project page my-wallpaper.

License

The source code is released under:

MIT License

If you think the Android project my-wallpaper 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.koonen.photostream.effects;
//from w  w  w.  ja  v  a  2 s  .  co m

import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;

public class EffectsFactory {

  private static void setDefaultAnimationSettings(Animation animation,
      int duration) {
    animation.setInterpolator(new AccelerateDecelerateInterpolator());
    animation.setFillAfter(false);
    animation.setDuration(duration);
  }

  public static Animation createTranslateAnimation(Boolean leftToRight) {
    Animation animation = new TranslateAnimation(
        Animation.RELATIVE_TO_SELF, leftToRight ? -1.1f : 1.1f,
        Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
        0.0f, Animation.RELATIVE_TO_SELF, 0.0f);

    setDefaultAnimationSettings(animation, 300);

    return animation;
  }

  public static Animation create3DAnimation(float width, float height) {
    Animation animation = new Rotate3dAnimation(180, 360, width / 2.0f,
        height / 2.0f, 310.0f, false);
    animation.setDuration(500);
    animation.setFillAfter(true);
    animation.setInterpolator(new AccelerateInterpolator());

    return animation;
  }

  public static Animation createScaleAnimation() {
    // float fromX, float toX, float fromY, float toY, float pivotX, float
    // pivotY, int duration
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.setInterpolator(new AccelerateInterpolator());

    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(200);
    animationSet.addAnimation(animation);

    animation = new ScaleAnimation(0.5f, 1.5f, 0.5f, 1.5f,
        ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
        ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(200);
    animationSet.addAnimation(animation);

    animation = new ScaleAnimation(1.5f, 1.0f, 1.5f, 1.0f,
        ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
        ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(200);
    animation.setStartOffset(200);
    animationSet.addAnimation(animation);

    return animationSet;
  }

  public static Animation createAlphaAnimation() {
    Animation animation = new AlphaAnimation(0.0f, 1.0f);

    setDefaultAnimationSettings(animation, 700);

    return animation;
  }
}




Java Source Code List

com.koonen.photostream.ActivityConstants.java
com.koonen.photostream.BootReceiver.java
com.koonen.photostream.CameraPreviewActivity.java
com.koonen.photostream.CategoryActivity.java
com.koonen.photostream.CategoryAdapter.java
com.koonen.photostream.CategoryEditActivity.java
com.koonen.photostream.CropWallpaperTask.java
com.koonen.photostream.Eula.java
com.koonen.photostream.FastBitmapDrawable.java
com.koonen.photostream.FileBrowserActivity.java
com.koonen.photostream.GridLayout.java
com.koonen.photostream.ImageUtilities.java
com.koonen.photostream.PhotostreamActivity.java
com.koonen.photostream.RotationService.java
com.koonen.photostream.ServiceConnector.java
com.koonen.photostream.SetWallpaperTask.java
com.koonen.photostream.UserTask.java
com.koonen.photostream.ViewPhotoActivity.java
com.koonen.photostream.WallPaperExecutor.java
com.koonen.photostream.api.FilePhoto.java
com.koonen.photostream.api.IPhotoService.java
com.koonen.photostream.api.Location.java
com.koonen.photostream.api.PhotoList.java
com.koonen.photostream.api.PhotoSize.java
com.koonen.photostream.api.Photo.java
com.koonen.photostream.api.ResponseHandler.java
com.koonen.photostream.api.ResponseParser.java
com.koonen.photostream.api.ServiceContext.java
com.koonen.photostream.api.ServiceException.java
com.koonen.photostream.api.ServiceManager.java
com.koonen.photostream.api.ServiceNetworkException.java
com.koonen.photostream.api.SourceType.java
com.koonen.photostream.api.Type.java
com.koonen.photostream.api.UserInfo.java
com.koonen.photostream.api.UserNotFoundException.java
com.koonen.photostream.api.User.java
com.koonen.photostream.api.flickr.Auth.java
com.koonen.photostream.api.flickr.FlickrConstants.java
com.koonen.photostream.api.flickr.FlickrService.java
com.koonen.photostream.api.flickr.Perms.java
com.koonen.photostream.dao.CategoryDAO.java
com.koonen.photostream.dao.CategoryList.java
com.koonen.photostream.dao.Category.java
com.koonen.photostream.dao.ImageDAO.java
com.koonen.photostream.dao.PhotoDAO.java
com.koonen.photostream.dao.PhotoUrlListProvider.java
com.koonen.photostream.dao.PhotoUrlList.java
com.koonen.photostream.dao.PhotoUrl.java
com.koonen.photostream.effects.EffectsApplier.java
com.koonen.photostream.effects.EffectsFactory.java
com.koonen.photostream.effects.Rotate3dAnimation.java
com.koonen.photostream.effects.TypeEffect.java
com.koonen.photostream.settings.BackgroundSource.java
com.koonen.photostream.settings.Network.java
com.koonen.photostream.settings.UserPreferences.java
com.koonen.photostream.settings.UserSettingsActivity.java
com.koonen.photostream.settings.WallpaperSettingMode.java
com.koonen.utils.ConfigurationReader.java
com.koonen.utils.DialogUtils.java
com.koonen.utils.Enumeration.java
com.koonen.utils.GroupUtils.java
com.koonen.utils.MailSender.java
com.koonen.utils.StatisticUtils.java
com.koonen.utils.StreamUtils.java