use of com.aviary.android.feather.library.utils.ReflectionUtils.ReflectionException in project mobile-android by photo.
the class AdjustImageViewFreeRotation method initImageView.
/**
* Inits the image view.
*/
private void initImageView() {
mMatrix = new Matrix();
mScaleType = ScaleType.FIT_CENTER;
Context context = getContext();
int highlight_color = context.getResources().getColor(R.color.feather_rotate_highlight_stroke_color);
int highlight_stroke_internal_color = context.getResources().getColor(R.color.feather_rotate_highlight_grid_stroke_color);
int highlight_stroke_internal_width = context.getResources().getInteger(R.integer.feather_rotate_highlight_grid_stroke_width);
int highlight_outside_color = context.getResources().getColor(R.color.feather_rotate_highlight_outside);
int highlight_stroke_width = context.getResources().getInteger(R.integer.feather_rotate_highlight_stroke_width);
mOutlinePaint.setStrokeWidth(highlight_stroke_width);
mOutlinePaint.setStyle(Paint.Style.STROKE);
mOutlinePaint.setAntiAlias(true);
mOutlinePaint.setColor(highlight_color);
mOutlineFill.setStyle(Paint.Style.FILL);
mOutlineFill.setAntiAlias(false);
mOutlineFill.setColor(highlight_outside_color);
mOutlineFill.setDither(false);
try {
ReflectionUtils.invokeMethod(mOutlineFill, "setHinting", new Class<?>[] { int.class }, 0);
} catch (ReflectionException e) {
}
mLinesPaint.setStrokeWidth(highlight_stroke_internal_width);
mLinesPaint.setAntiAlias(false);
mLinesPaint.setDither(false);
mLinesPaint.setStyle(Paint.Style.STROKE);
mLinesPaint.setColor(highlight_stroke_internal_color);
try {
ReflectionUtils.invokeMethod(mLinesPaint, "setHinting", new Class<?>[] { int.class }, 0);
} catch (ReflectionException e) {
}
mLinesPaintShadow.setStrokeWidth(highlight_stroke_internal_width);
mLinesPaintShadow.setAntiAlias(true);
mLinesPaintShadow.setColor(Color.BLACK);
mLinesPaintShadow.setStyle(Paint.Style.STROKE);
mLinesPaintShadow.setMaskFilter(new BlurMaskFilter(2, Blur.NORMAL));
mOutlineFillAlpha = mOutlineFill.getAlpha();
mOutlinePaintAlpha = mOutlinePaint.getAlpha();
mLinesAlpha = mLinesPaint.getAlpha();
mLinesShadowAlpha = mLinesPaintShadow.getAlpha();
mOutlinePaint.setAlpha(0);
mOutlineFill.setAlpha(0);
mLinesPaint.setAlpha(0);
mLinesPaintShadow.setAlpha(0);
android.content.res.Resources resources = getContext().getResources();
mResizeDrawable = resources.getDrawable(R.drawable.feather_highlight_crop_handle);
double w = mResizeDrawable.getIntrinsicWidth();
double h = mResizeDrawable.getIntrinsicHeight();
handleWidth = (int) Math.ceil(w / 2.0);
handleHeight = (int) Math.ceil(h / 2.0);
}
use of com.aviary.android.feather.library.utils.ReflectionUtils.ReflectionException in project mobile-android by photo.
the class AdjustImageView method initImageView.
/**
* Inits the image view.
*/
private void initImageView() {
mMatrix = new Matrix();
mScaleType = ScaleType.FIT_CENTER;
Context context = getContext();
int highlight_color = context.getResources().getColor(R.color.feather_rotate_highlight_stroke_color);
int highlight_stroke_internal_color = context.getResources().getColor(R.color.feather_rotate_highlight_grid_stroke_color);
int highlight_stroke_internal_width = context.getResources().getInteger(R.integer.feather_rotate_highlight_grid_stroke_width);
int highlight_outside_color = context.getResources().getColor(R.color.feather_rotate_highlight_outside);
int highlight_stroke_width = context.getResources().getInteger(R.integer.feather_rotate_highlight_stroke_width);
mOutlinePaint.setStrokeWidth(highlight_stroke_width);
mOutlinePaint.setStyle(Paint.Style.STROKE);
mOutlinePaint.setAntiAlias(true);
mOutlinePaint.setColor(highlight_color);
mOutlineFill.setStyle(Paint.Style.FILL);
mOutlineFill.setAntiAlias(false);
mOutlineFill.setColor(highlight_outside_color);
mOutlineFill.setDither(false);
try {
ReflectionUtils.invokeMethod(mOutlineFill, "setHinting", new Class<?>[] { int.class }, 0);
} catch (ReflectionException e) {
}
mLinesPaint.setStrokeWidth(highlight_stroke_internal_width);
mLinesPaint.setAntiAlias(false);
mLinesPaint.setDither(false);
mLinesPaint.setStyle(Paint.Style.STROKE);
mLinesPaint.setColor(highlight_stroke_internal_color);
try {
ReflectionUtils.invokeMethod(mLinesPaint, "setHinting", new Class<?>[] { int.class }, 0);
} catch (ReflectionException e) {
}
mLinesPaintShadow.setStrokeWidth(highlight_stroke_internal_width);
mLinesPaintShadow.setAntiAlias(true);
mLinesPaintShadow.setColor(Color.BLACK);
mLinesPaintShadow.setStyle(Paint.Style.STROKE);
mLinesPaintShadow.setMaskFilter(new BlurMaskFilter(2, Blur.NORMAL));
mOutlineFillAlpha = mOutlineFill.getAlpha();
mOutlinePaintAlpha = mOutlinePaint.getAlpha();
mLinesAlpha = mLinesPaint.getAlpha();
mLinesShadowAlpha = mLinesPaintShadow.getAlpha();
mOutlinePaint.setAlpha(0);
mOutlineFill.setAlpha(0);
mLinesPaint.setAlpha(0);
mLinesPaintShadow.setAlpha(0);
android.content.res.Resources resources = getContext().getResources();
mStraightenDrawable = resources.getDrawable(R.drawable.feather_straighten_knob);
double w = mStraightenDrawable.getIntrinsicWidth();
double h = mStraightenDrawable.getIntrinsicHeight();
handleWidth = (int) Math.ceil(w / 2.0);
handleHeight = (int) Math.ceil(h / 2.0);
}
use of com.aviary.android.feather.library.utils.ReflectionUtils.ReflectionException 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.library.utils.ReflectionUtils.ReflectionException in project mobile-android by photo.
the class HorizontalFixedListView method initView.
/**
* Inits the view.
*/
private synchronized void initView() {
if (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);
}
mLeftViewIndex = -1;
mRightViewIndex = 0;
mMaxX = 0;
mMinX = 0;
mChildWidth = 0;
mChildHeight = 0;
mRightEdge = 0;
mLeftEdge = 0;
mGesture = new GestureDetector(getContext(), mGestureListener);
mGesture.setIsLongpressEnabled(true);
setFocusable(true);
setFocusableInTouchMode(true);
ViewConfiguration configuration = ViewConfiguration.get(getContext());
mTouchSlop = configuration.getScaledTouchSlop();
mDragTolerance = mTouchSlop;
mOverscrollDistance = 10;
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
}
use of com.aviary.android.feather.library.utils.ReflectionUtils.ReflectionException in project mobile-android by photo.
the class HighlightView method setup.
/**
* Setup.
*
* @param m
* the m
* @param imageRect
* the image rect
* @param cropRect
* the crop rect
* @param maintainAspectRatio
* the maintain aspect ratio
*/
public void setup(Matrix m, Rect imageRect, RectF cropRect, boolean maintainAspectRatio) {
mMatrix = new Matrix(m);
mCropRect = cropRect;
mImageRect = new RectF(imageRect);
mMaintainAspectRatio = maintainAspectRatio;
double ratio = (double) mCropRect.width() / (double) mCropRect.height();
mInitialAspectRatio = Math.round(ratio * 1000.0) / 1000.0;
// Log.i( LOG_TAG, "aspect ratio: " + mInitialAspectRatio );
computeLayout(true, mDrawRect);
mOutlinePaint.setStrokeWidth(stroke_width);
mOutlinePaint.setStyle(Paint.Style.STROKE);
mOutlinePaint.setAntiAlias(false);
try {
ReflectionUtils.invokeMethod(mOutlinePaint, "setHinting", new Class<?>[] { int.class }, 0);
} catch (ReflectionException e) {
}
mOutlinePaint2.setStrokeWidth(internal_stroke_width);
mOutlinePaint2.setStyle(Paint.Style.STROKE);
mOutlinePaint2.setAntiAlias(false);
mOutlinePaint2.setColor(highlight_internal_color);
try {
ReflectionUtils.invokeMethod(mOutlinePaint2, "setHinting", new Class<?>[] { int.class }, 0);
} catch (ReflectionException e) {
}
mOutlineFill.setColor(highlight_outside_color);
mOutlineFill.setStyle(Paint.Style.FILL);
mOutlineFill.setAntiAlias(false);
try {
ReflectionUtils.invokeMethod(mOutlineFill, "setHinting", new Class<?>[] { int.class }, 0);
} catch (ReflectionException e) {
}
mLinesPaintShadow.setStrokeWidth(internal_stroke_width);
mLinesPaintShadow.setAntiAlias(true);
mLinesPaintShadow.setColor(Color.BLACK);
mLinesPaintShadow.setStyle(Paint.Style.STROKE);
mLinesPaintShadow.setMaskFilter(new BlurMaskFilter(2, Blur.NORMAL));
setMode(Mode.None);
init();
}
Aggregations