更换文件夹背景图标,更换指示器为圆,更换文件夹和图标大小一样

This commit is contained in:
2020-12-01 18:24:00 +08:00
parent d3af2efaa7
commit 707093b70d
6 changed files with 69 additions and 39 deletions

View File

@@ -25,6 +25,8 @@ import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
@@ -214,10 +216,18 @@ public class PreviewBackground {
public void drawBackground(Canvas canvas,Context context) {
mPaint.setStyle(Paint.Style.FILL);
mPaint.setColor(getBgColor());
// Bitmap bitmap =BitmapFactory.decodeResource(context.getResources(), R.drawable.square);
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.square);
Bitmap bitmapScale = Bitmap.createScaledBitmap(bitmap, previewSize, previewSize, true);
// float radius = getScaledRadius();
// canvas.drawBitmap(bitmap,0 + getOffsetX(),0 + getOffsetY() ,mPaint);
drawCircle(canvas, 0 /* deltaRadius */);
canvas.drawBitmap(bitmapScale, basePreviewOffsetX, basePreviewOffsetY, mPaint);
// Log.e("fht", "drawCircle: previewSize:" + previewSize );
// Log.e("fht", "drawCircle: basePreviewOffsetX:" + basePreviewOffsetX );
// Log.e("fht", "drawCircle: basePreviewOffsetY:" + basePreviewOffsetY );
// Log.e("fht", "drawCircle: getScaledRadius:" + getScaledRadius() );
// Log.e("fht", "drawCircle: getOffsetX:" + getOffsetX());
// Log.e("fht", "drawCircle: getOffsetY:" + getOffsetY());
// drawCircle(canvas, 0 /* deltaRadius */);
// getShape().drawShape(canvas, getOffsetX(), getOffsetY(), getScaledRadius(), mPaint);
// drawShadow(canvas);
}
@@ -234,7 +244,7 @@ public class PreviewBackground {
// canvas.drawCircle(radius + getOffsetX(), radius + getOffsetY(),
// radius - deltaRadius, mPaint);
mPaint.setAlpha(76);
canvas.drawRoundRect(0 + getOffsetX() + 6, 0 + getOffsetY() + 6 , radius * 2 + getOffsetX() + 2,radius * 2 + getOffsetY() + 2, 30, 30, mPaint);
canvas.drawRoundRect(0 + getOffsetX() + 6, 0 + getOffsetY() + 6 , radius * 2 + getOffsetX() + 2,radius * 2 + getOffsetY() + 2, radius/2, radius/2, mPaint);
/* 20180702 modify end */
}