Android Open Source - WheelView Scaling Item Transformer






From Project

Back to project page WheelView.

License

The source code is released under:

Apache License

If you think the Android project WheelView 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.lukedeighton.wheelview.transformer;
//w w w  .  j a va  2s.  c  om
import android.graphics.Rect;

import com.lukedeighton.wheelview.Circle;
import com.lukedeighton.wheelview.WheelView;

public class ScalingItemTransformer implements WheelItemTransformer {
    @Override
    public void transform(WheelView.ItemState itemState, Rect itemBounds) {
        float scale = itemState.getAngleFromSelection() * 0.014f;
        scale = Math.min(1.12f, 1.15f - Math.min(0.25f, Math.abs(scale)));
        Circle bounds = itemState.getBounds();
        float radius = bounds.getRadius() * scale;
        float x = bounds.getCenterX();
        float y = bounds.getCenterY();
        itemBounds.set(Math.round(x - radius), Math.round(y - radius), Math.round(x + radius), Math.round(y + radius));
    }
}




Java Source Code List

com.lukedeighton.wheelsample.MainActivity.java
com.lukedeighton.wheelsample.MaterialColor.java
com.lukedeighton.wheelsample.TextDrawable.java
com.lukedeighton.wheelview.Circle.java
com.lukedeighton.wheelview.WheelView.java
com.lukedeighton.wheelview.adapter.WheelAdapter.java
com.lukedeighton.wheelview.adapter.WheelArrayAdapter.java
com.lukedeighton.wheelview.transformer.FadingSelectionTransformer.java
com.lukedeighton.wheelview.transformer.ScalingItemTransformer.java
com.lukedeighton.wheelview.transformer.SimpleItemTransformer.java
com.lukedeighton.wheelview.transformer.WheelItemTransformer.java
com.lukedeighton.wheelview.transformer.WheelSelectionTransformer.java