Skip to content

Instantly share code, notes, and snippets.

@lzanita09
lzanita09 / ParallaxViewtransformer.java
Created May 10, 2014 15:08
Custom PageTransformer simulates Yahoo News Digest ViewPager animation.
import android.support.v4.view.ViewPager;
import android.view.View;
/**
* Custom PageTransformer simulates Yahoo News Digest ViewPager animation.
*
*
* Created by zhelu on 2/27/14.
*/
public class ParallaxViewTransformer implements ViewPager.PageTransformer {
@lzanita09
lzanita09 / ResizeImageSpan.java
Created June 19, 2014 19:11
ImageSpan subclass that can resize the image to fit the cantainer's width if possible, and recalculate the Rect to avoid overlay text.
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.style.ImageSpan;
import java.lang.ref.WeakReference;
/**
* Subclass of ImageSpan that resizes images automatically to fit the container's width, and then
* re-calculate the size of the image to let TextView know how much space it needs to display
@lzanita09
lzanita09 / CircleRevealDrawable.java
Last active January 20, 2016 17:05
An animated Drawable that expands and reveals
package com.ifttt.iftttprototype;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;