Search in sources :

Example 46 with SuppressLint

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;
    }
}
Also used : SuppressLint(android.annotation.SuppressLint) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint)

Example 47 with SuppressLint

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);
}
Also used : BounceInterpolator(android.view.animation.BounceInterpolator) BounceInterpolator(android.view.animation.BounceInterpolator) Interpolator(android.view.animation.Interpolator) Scroller(android.widget.Scroller) ImageView(android.widget.ImageView) DisplayMetrics(android.util.DisplayMetrics) WindowManager(android.view.WindowManager) SuppressLint(android.annotation.SuppressLint)

Example 48 with SuppressLint

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);
}
Also used : BounceInterpolator(android.view.animation.BounceInterpolator) BounceInterpolator(android.view.animation.BounceInterpolator) Interpolator(android.view.animation.Interpolator) Scroller(android.widget.Scroller) ImageView(android.widget.ImageView) DisplayMetrics(android.util.DisplayMetrics) WindowManager(android.view.WindowManager) SuppressLint(android.annotation.SuppressLint)

Example 49 with SuppressLint

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;
}
Also used : LayoutParams(android.widget.AbsListView.LayoutParams) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 50 with SuppressLint

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);
}
Also used : TypedArray(android.content.res.TypedArray) Handler(android.os.Handler) GestureDetector(android.view.GestureDetector) Paint(android.graphics.Paint) MotionEvent(android.view.MotionEvent) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1773 View (android.view.View)369 TextView (android.widget.TextView)243 Intent (android.content.Intent)232 ImageView (android.widget.ImageView)112 Paint (android.graphics.Paint)109 File (java.io.File)102 IOException (java.io.IOException)96 ArrayList (java.util.ArrayList)93 Context (android.content.Context)91 LayoutInflater (android.view.LayoutInflater)89 Uri (android.net.Uri)84 Bundle (android.os.Bundle)83 SharedPreferences (android.content.SharedPreferences)78 Bitmap (android.graphics.Bitmap)78 WebView (android.webkit.WebView)76 PendingIntent (android.app.PendingIntent)72 Method (java.lang.reflect.Method)72 SimpleDateFormat (java.text.SimpleDateFormat)69 ViewGroup (android.view.ViewGroup)66