public void setup(AttributeSet attrs) {
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Style.FILL);
paint.setStrokeCap(Cap.ROUND);
springSystem = SpringSystem.create();
spring = springSystem.createSpring();
spring.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(50, 7));
this.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
toggle();
}
});
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.ToggleButton);
offBorderColor = typedArray.getColor(R.styleable.ToggleButton_offBorderColor, offBorderColor);
onColor = typedArray.getColor(R.styleable.ToggleButton_onColor, onColor);
spotColor = typedArray.getColor(R.styleable.ToggleButton_spotColor, spotColor);
offColor = typedArray.getColor(R.styleable.ToggleButton_offColor, offColor);
borderWidth = typedArray.getDimensionPixelSize(R.styleable.ToggleButton_borderWidthTB, borderWidth);
typedArray.recycle();
}
java类android.graphics.Paint.Cap的实例源码
ToggleButton.java 文件源码
项目:yuedong-app
阅读 30
收藏 0
点赞 0
评论 0
RoundProgressBarWidthNumber.java 文件源码
项目:quickmark
阅读 54
收藏 0
点赞 0
评论 0
public RoundProgressBarWidthNumber(Context context, AttributeSet attrs)
{
super(context, attrs);
mReachedProgressBarHeight = (int) (mUnReachedProgressBarHeight * 2.5f);
TypedArray ta = context.obtainStyledAttributes(attrs,
R.styleable.RoundProgressBarWidthNumber);
mRadius = (int) ta.getDimension(
R.styleable.RoundProgressBarWidthNumber_radius, mRadius);
ta.recycle();
mPaint.setStyle(Style.STROKE);
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setStrokeCap(Cap.ROUND);
}
RoundProgressBarWidthNumber.java 文件源码
项目:Android-ProgressBarWidthNumber
阅读 39
收藏 0
点赞 0
评论 0
public RoundProgressBarWidthNumber(Context context, AttributeSet attrs)
{
super(context, attrs);
mReachedProgressBarHeight = (int) (mUnReachedProgressBarHeight * 2.5f);
TypedArray ta = context.obtainStyledAttributes(attrs,
R.styleable.RoundProgressBarWidthNumber);
mRadius = (int) ta.getDimension(
R.styleable.RoundProgressBarWidthNumber_radius, mRadius);
ta.recycle();
mPaint.setStyle(Style.STROKE);
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setStrokeCap(Cap.ROUND);
}
CircularProgress.java 文件源码
项目:iLocker
阅读 26
收藏 0
点赞 0
评论 0
public CircularProgress(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
float density = context.getResources().getDisplayMetrics().density;
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircularProgress, defStyleAttr, 0);
mBorderWidth = a.getDimension(R.styleable.CircularProgress_borderWidth, DEFAULT_BORDER_WIDTH * density);
a.recycle();
mColors = new int[4];
mColors[0] = context.getResources().getColor(R.color.progress_red);
mColors[1] = context.getResources().getColor(R.color.progress_yellow);
mColors[2] = context.getResources().getColor(R.color.progress_green);
mColors[3] = context.getResources().getColor(R.color.progress_blue);
mCurrentColorIndex = 0;
mNextColorIndex = 1;
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeCap(Cap.ROUND);
mPaint.setStrokeWidth(mBorderWidth);
mPaint.setColor(mColors[mCurrentColorIndex]);
setupAnimations();
}
CircularProgress.java 文件源码
项目:iLocker
阅读 25
收藏 0
点赞 0
评论 0
public CircularProgress(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
float density = context.getResources().getDisplayMetrics().density;
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircularProgress, defStyleAttr, 0);
mBorderWidth = a.getDimension(R.styleable.CircularProgress_borderWidth,
DEFAULT_BORDER_WIDTH * density);
a.recycle();
mColors = new int[4];
mColors[0] = context.getResources().getColor(R.color.progress_red);
mColors[1] = context.getResources().getColor(R.color.progress_yellow);
mColors[2] = context.getResources().getColor(R.color.progress_green);
mColors[3] = context.getResources().getColor(R.color.progress_blue);
mCurrentColorIndex = 0;
mNextColorIndex = 1;
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeCap(Cap.ROUND);
mPaint.setStrokeWidth(mBorderWidth);
mPaint.setColor(mColors[mCurrentColorIndex]);
setupAnimations();
}
AttitudeIndicator.java 文件源码
项目:DroidPlanner-Tower
阅读 26
收藏 0
点赞 0
评论 0
private void initialize() {
Paint fillPaint = new Paint();
fillPaint.setAntiAlias(true);
fillPaint.setStyle(Style.FILL);
yawPaint = new Paint(fillPaint);
yawPaint.setColor(Color.WHITE);
skyPaint = new Paint(fillPaint);
groundPaint = new Paint(fillPaint);
planePaint = new Paint(fillPaint);
planePaint.setColor(Color.WHITE);
planePaint.setStrokeWidth(PLANE_WING_WIDTH);
planePaint.setStrokeCap(Cap.ROUND);
planeCenterPaint = new Paint(planePaint);
planeCenterPaint.setColor(Color.RED);
planeFinPaint = new Paint(planePaint);
planeFinPaint.setStrokeWidth(PLANE_WING_WIDTH / 2f);
tickPaint = new Paint(fillPaint);
tickPaint.setColor(Color.parseColor("#44ffffff"));
tickPaint.setStrokeWidth(2);
}
AttitudeIndicator.java 文件源码
项目:Gprs_droidplanner
阅读 23
收藏 0
点赞 0
评论 0
private void initialize() {
Paint fillPaint = new Paint();
fillPaint.setAntiAlias(true);
fillPaint.setStyle(Style.FILL);
yawPaint = new Paint(fillPaint);
yawPaint.setColor(Color.WHITE);
skyPaint = new Paint(fillPaint);
groundPaint = new Paint(fillPaint);
planePaint = new Paint(fillPaint);
planePaint.setColor(Color.WHITE);
planePaint.setStrokeWidth(PLANE_WING_WIDTH);
planePaint.setStrokeCap(Cap.ROUND);
planeCenterPaint = new Paint(planePaint);
planeCenterPaint.setColor(Color.RED);
planeFinPaint = new Paint(planePaint);
planeFinPaint.setStrokeWidth(PLANE_WING_WIDTH / 2f);
tickPaint = new Paint(fillPaint);
tickPaint.setColor(Color.parseColor("#44ffffff"));
tickPaint.setStrokeWidth(2);
}
BarItem.java 文件源码
项目:Play2
阅读 28
收藏 0
点赞 0
评论 0
@SuppressLint("DrawAllocation")
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(lineColor);
paint.setStrokeWidth(lineWidth);
paint.setStrokeCap(Cap.ROUND);
paint.setStrokeJoin(Join.ROUND);
paint.setStyle(Style.STROKE);
Path path = new Path();
path.moveTo(startPoint.x, startPoint.y);
path.lineTo(endPoint.x, endPoint.y);
canvas.setMatrix(mMatrix);
canvas.drawPath(path, paint);
}
PainterThreadControl.java 文件源码
项目:whiteboard
阅读 91
收藏 0
点赞 0
评论 0
/**
* @param surfaceHolder
* @param painterCanvas
*/
public PainterThreadControl(SurfaceHolder surfaceHolder,
PainterCanvasControl painterCanvas) {
// base data
mHolder = surfaceHolder;
this.mPainterCanvas = painterCanvas;
// defaults brush settings
mBrushSize = 2;
mBrush = new Paint();
mBrush.setAntiAlias(true);
mBrush.setColor(Color.rgb(0, 0, 0));
mBrush.setStrokeWidth(mBrushSize);
mBrush.setStrokeCap(Cap.ROUND);
Commons.currentColor = Color.rgb(0, 0, 0);
Commons.currentSize = 2;
// default canvas settings
mCanvasBgColor = Color.WHITE;
// set negative coordinates for reset last point
mLastBrushPointX = -1;
mLastBrushPointY = -1;
}
ToggleButton.java 文件源码
项目:oschina-app
阅读 29
收藏 0
点赞 0
评论 0
public void setup(AttributeSet attrs) {
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Style.FILL);
paint.setStrokeCap(Cap.ROUND);
springSystem = SpringSystem.create();
spring = springSystem.createSpring();
spring.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(50, 7));
this.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
toggle();
}
});
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.ToggleButton);
offBorderColor = typedArray.getColor(R.styleable.ToggleButton_offBorderColor, offBorderColor);
onColor = typedArray.getColor(R.styleable.ToggleButton_onColor, onColor);
spotColor = typedArray.getColor(R.styleable.ToggleButton_spotColor, spotColor);
offColor = typedArray.getColor(R.styleable.ToggleButton_offColor, offColor);
borderWidth = typedArray.getDimensionPixelSize(R.styleable.ToggleButton_borderWidth, borderWidth);
typedArray.recycle();
}