use of com.aviary.android.feather.graphics.LinearGradientDrawable in project mobile-android by photo.
the class Wheel method init.
/**
* Inits the.
*
* @param context
* the context
* @param attrs
* the attrs
* @param defStyle
* the def style
*/
private void init(Context context, AttributeSet attrs, int defStyle) {
if (android.os.Build.VERSION.SDK_INT > 8) {
try {
mFlingRunnable = (IFlingRunnable) ReflectionUtils.newInstance("com.aviary.android.feather.widget.Fling9Runnable", new Class<?>[] { FlingRunnableView.class, int.class }, this, mAnimationDuration);
} catch (ReflectionException e) {
mFlingRunnable = new Fling8Runnable(this, mAnimationDuration);
}
} else {
mFlingRunnable = new Fling8Runnable(this, mAnimationDuration);
}
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Wheel, defStyle, 0);
mTicksCount = a.getInteger(R.styleable.Wheel_ticks, 18);
mWheelSizeFactor = a.getInteger(R.styleable.Wheel_numRotations, 2);
a.recycle();
mFast = new PaintFlagsDrawFilter(Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG, 0);
mPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
mGestureDetector = new GestureDetector(context, this);
mGestureDetector.setIsLongpressEnabled(false);
setFocusable(true);
setFocusableInTouchMode(true);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
TypedValue.complexToDimensionPixelSize(25, metrics);
try {
mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
} catch (Exception e) {
Log.e(LOG_TAG, e.toString());
}
if (mVibrator != null) {
setVibrationEnabled(true);
}
setBackgroundDrawable(new LinearGradientDrawable(Orientation.LEFT_RIGHT, mBgColors, mBgPositions));
}
use of com.aviary.android.feather.graphics.LinearGradientDrawable in project mobile-android by photo.
the class Wheel method setBackgroundColors.
/**
* Change the background gradient colors. the size of the colors array must be the same as the size of the positions array.
*
* @param colors
* @param positions
*/
public void setBackgroundColors(int[] colors, float[] positions) {
if (colors != null && positions != null && colors.length == positions.length) {
mBgColors = colors;
mBgPositions = positions;
setBackgroundDrawable(new LinearGradientDrawable(Orientation.LEFT_RIGHT, mBgColors, mBgPositions));
}
}
Aggregations