use of android.annotation.SuppressLint in project UltimateAndroid by cymcsg.
the class HoloCircularProgressBar method computeInsets.
/**
* Compute insets.
*
* <pre>
* ______________________
* |_________dx/2_________|
* |......| /'''''\|......|
* |-dx/2-|| View ||-dx/2-|
* |______| \_____/|______|
* |________ dx/2_________|
* </pre>
*
* @param dx
* the dx the horizontal unfilled space
* @param dy
* the dy the horizontal unfilled space
*/
@SuppressLint("NewApi")
private void computeInsets(final int dx, final int dy) {
final int layoutDirection;
int absoluteGravity = mGravity;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
layoutDirection = getLayoutDirection();
absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
}
switch(absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
case Gravity.LEFT:
mHorizontalInset = 0;
break;
case Gravity.RIGHT:
mHorizontalInset = dx;
break;
case Gravity.CENTER_HORIZONTAL:
default:
mHorizontalInset = dx / 2;
break;
}
switch(absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK) {
case Gravity.TOP:
mVerticalInset = 0;
break;
case Gravity.BOTTOM:
mVerticalInset = dy;
break;
case Gravity.CENTER_VERTICAL:
default:
mVerticalInset = dy / 2;
break;
}
}
use of android.annotation.SuppressLint in project UltimateAndroid by cymcsg.
the class PullDoorView method setupView.
@SuppressLint("NewApi")
private void setupView() {
// 这个Interpolator你可以设置别的 我这里选择的是有弹跳效果的Interpolator
Interpolator polator = new BounceInterpolator();
mScroller = new Scroller(mContext, polator);
// 获取屏幕分辨率
WindowManager wm = (WindowManager) (mContext.getSystemService(Context.WINDOW_SERVICE));
DisplayMetrics dm = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(dm);
mScreenHeigh = dm.heightPixels;
mScreenWidth = dm.widthPixels;
// 这里你一定要设置成透明背景,不然会影响你看到底层布局
this.setBackgroundColor(Color.argb(0, 0, 0, 0));
mImgView = new ImageView(mContext);
mImgView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
// 填充整个屏幕
mImgView.setScaleType(ImageView.ScaleType.FIT_XY);
// 默认背景
mImgView.setImageResource(R.drawable.test);
addView(mImgView);
}
use of android.annotation.SuppressLint in project UltimateAndroid by cymcsg.
the class PullDoorView method setupView.
@SuppressLint("NewApi")
private void setupView() {
Interpolator polator = new BounceInterpolator();
mScroller = new Scroller(mContext, polator);
WindowManager wm = (WindowManager) (mContext.getSystemService(Context.WINDOW_SERVICE));
DisplayMetrics dm = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(dm);
mScreenHeigh = dm.heightPixels;
mScreenWidth = dm.widthPixels;
this.setBackgroundColor(Color.argb(0, 0, 0, 0));
mImgView = new ImageView(mContext);
mImgView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
mImgView.setScaleType(ImageView.ScaleType.FIT_XY);
mImgView.setImageResource(R.drawable.circle_button_ic_action_tick);
addView(mImgView);
}
use of android.annotation.SuppressLint in project android-betterpickers by code-troopers.
the class MonthAdapter method getView.
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView monthView;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
monthView = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) monthView.getTag();
} else {
monthView = createMonthView(mContext);
monthView.setTheme(mThemeColors);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
monthView.setLayoutParams(params);
monthView.setClickable(true);
monthView.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = (position + mController.getMinDate().month) % MONTHS_IN_YEAR;
final int year = (position + mController.getMinDate().month) / MONTHS_IN_YEAR + mController.getMinDate().year;
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
int rangeMin = -1;
if (isRangeMinInMonth(year, month)) {
rangeMin = mController.getMinDate().day;
}
int rangeMax = -1;
if (isRangeMaxInMonth(year, month)) {
rangeMax = mController.getMaxDate().day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
monthView.reuse();
// Set disabled days if they exist
if (mController.getDisabledDays() != null) {
monthView.setDisabledDays(mController.getDisabledDays());
}
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
drawingParams.put(MonthView.VIEW_PARAMS_RANGE_MIN, rangeMin);
drawingParams.put(MonthView.VIEW_PARAMS_RANGE_MAX, rangeMax);
monthView.setMonthParams(drawingParams);
monthView.invalidate();
return monthView;
}
use of android.annotation.SuppressLint in project superCleanMaster by joyoyao.
the class RippleView method init.
@SuppressLint("Recycle")
private void init(final Context context, final AttributeSet attrs) {
if (isInEditMode())
return;
final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color, getResources().getColor(R.color.white));
rippleType = typedArray.getInt(R.styleable.RippleView_rv_type, 0);
hasToZoom = typedArray.getBoolean(R.styleable.RippleView_rv_zoom, false);
isCentered = typedArray.getBoolean(R.styleable.RippleView_rv_centered, false);
DURATION = typedArray.getInteger(R.styleable.RippleView_rv_rippleDuration, DURATION);
FRAME_RATE = typedArray.getInteger(R.styleable.RippleView_rv_framerate, FRAME_RATE);
PAINT_ALPHA = typedArray.getInteger(R.styleable.RippleView_rv_alpha, PAINT_ALPHA);
ripplePadding = typedArray.getDimensionPixelSize(R.styleable.RippleView_rv_ripplePadding, 0);
canvasHandler = new Handler();
zoomScale = typedArray.getFloat(R.styleable.RippleView_rv_zoomScale, 1.03f);
zoomDuration = typedArray.getInt(R.styleable.RippleView_rv_zoomDuration, 200);
paint = new Paint();
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.FILL);
paint.setColor(rippleColor);
paint.setAlpha(PAINT_ALPHA);
this.setWillNotDraw(false);
gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
return true;
}
@Override
public boolean onSingleTapUp(MotionEvent e) {
return true;
}
});
this.setDrawingCacheEnabled(true);
}
Aggregations