diff --git a/iconloaderlib/src/com/android/uiuios/icons/IconNormalizer.java b/iconloaderlib/src/com/android/uiuios/icons/IconNormalizer.java
index 740b8e3..9a8acd5 100644
--- a/iconloaderlib/src/com/android/uiuios/icons/IconNormalizer.java
+++ b/iconloaderlib/src/com/android/uiuios/icons/IconNormalizer.java
@@ -47,7 +47,7 @@ public class IconNormalizer {
// Ratio of icon visible area to full icon size for a square shaped icon
private static final float MAX_SQUARE_AREA_FACTOR = 375.0f / 576;
// Ratio of icon visible area to full icon size for a circular shaped icon
- private static final float MAX_CIRCLE_AREA_FACTOR = 380.0f / 576;
+ private static final float MAX_CIRCLE_AREA_FACTOR = 300.0f / 576;
private static final float CIRCLE_AREA_BY_RECT = (float) Math.PI / 4;
diff --git a/res/drawable-hdpi/square.png b/res/drawable-hdpi/square.png
new file mode 100644
index 0000000..5ed94a3
Binary files /dev/null and b/res/drawable-hdpi/square.png differ
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 3c8fe1e..7cb92a2 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -37,4 +37,9 @@
#E5E5E5
#9AA0A6
+
+ #ecb012
+ #494949
+
+
diff --git a/src/com/android/uiuios/TTUtils/BitmapUtils.java b/src/com/android/uiuios/TTUtils/BitmapUtils.java
index de1ea0d..3c2b363 100644
--- a/src/com/android/uiuios/TTUtils/BitmapUtils.java
+++ b/src/com/android/uiuios/TTUtils/BitmapUtils.java
@@ -126,8 +126,8 @@ public class BitmapUtils {
return BitmapFactory.decodeResource(context.getResources(), res, options);
}
- private static final int DEFAULT_LONG_DEGREE_LENGTH = 10;
- private static final int DEFAULT_SHORT_DEGREE_LENGTH = 10;
+ private static final int DEFAULT_LONG_DEGREE_LENGTH = 6;
+ private static final int DEFAULT_SHORT_DEGREE_LENGTH = 6;
public static Drawable getDeskClockIcon(Context context) {
final float mDensity = context.getResources().getDisplayMetrics().density;
@@ -150,11 +150,11 @@ public class BitmapUtils {
paintDegree.setAntiAlias(true);
int width = canvas.getWidth();
int hight = canvas.getHeight();
- int margin = 8;//圆盘的边缘
+ int margin = 4;//圆盘的边缘
for (int i = 0; i < 60; i++) {
if (i % 5 == 0) {
- paintDegree.setStrokeWidth(2 * mDensity);
+ paintDegree.setStrokeWidth(1 * mDensity);
degreeLength = DEFAULT_LONG_DEGREE_LENGTH * mDensity;
} else {
paintDegree.setStrokeWidth(1 * mDensity);
@@ -174,9 +174,9 @@ public class BitmapUtils {
//分针的长度
- radius = (int) (32 * mDensity);
- paint.setStrokeWidth(3* mDensity);
- paint.setColor(Color.BLUE);
+ radius = (int) (24 * mDensity);
+ paint.setStrokeWidth(6 * mDensity);
+ paint.setColor(context.getColor(R.color.minute_hand_color));
//分针的角度
int drgeeMin = min * 6 - 90;
if (drgeeMin < 0) {
@@ -188,9 +188,9 @@ public class BitmapUtils {
canvas.drawLine(x1, y1, cx, cy, paint);
// paint.setStrokeWidth(6);
- paint.setColor(Color.RED);
+ paint.setColor(context.getColor(R.color.hour_hand_color));
// 时针的长度
- radius = (int) (24 * mDensity);
+ radius = (int) (18 * mDensity);
//时针的角度,这里是整点的角度。因为0°是从3点开始,所以这里减90°,从9点开始计算角度
int drgeeHour = hour * 30 - 90;
if (drgeeHour < 0) {
@@ -202,10 +202,15 @@ public class BitmapUtils {
int xHour = (int) (cx + radius * Math.cos(drgeeHour * 3.14 / 180));
int yHour = (int) (cy + radius * Math.sin(drgeeHour * 3.14 / 180));
canvas.drawLine(xHour, yHour, cx, cy, paint);
+
+ paint.setStrokeWidth(3 * mDensity);
+ paint.setColor(context.getColor(R.color.minute_hand_color));
+ canvas.drawPoint(cx, cy, paint);
+
return new BitmapDrawable(deskClock);
}
- public static Bitmap drawable2bitmap(Drawable drawable){
+ public static Bitmap drawable2bitmap(Drawable drawable) {
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
} else if (drawable instanceof AdaptiveIconDrawable) {
@@ -214,7 +219,7 @@ public class BitmapUtils {
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
return bitmap;
- }else {
+ } else {
return null;
}
}
diff --git a/src/com/android/uiuios/folder/ClippedFolderIconLayoutRule.java b/src/com/android/uiuios/folder/ClippedFolderIconLayoutRule.java
index 7026465..d1eb2f1 100644
--- a/src/com/android/uiuios/folder/ClippedFolderIconLayoutRule.java
+++ b/src/com/android/uiuios/folder/ClippedFolderIconLayoutRule.java
@@ -1,12 +1,14 @@
package com.android.uiuios.folder;
+import android.util.Log;
+
public class ClippedFolderIconLayoutRule {
// public static final int MAX_NUM_ITEMS_IN_PREVIEW = 4;
static final int MAX_NUM_ITEMS_IN_PREVIEW = Integer.MAX_VALUE;
private static final int MIN_NUM_ITEMS_IN_PREVIEW = 2;
- private static final float MIN_SCALE = 0.15f;
+ private static final float MIN_SCALE = 0.16f;
private static final float MAX_SCALE = 0.58f;
private static final float MAX_RADIUS_DILATION = 0.15f;
private static final float ITEM_RADIUS_SCALE_FACTOR = 1.33f;
@@ -37,28 +39,36 @@ public class ClippedFolderIconLayoutRule {
float transY;
float overlayAlpha = 0;
- if (index == EXIT_INDEX) {
- // 0 1 * <-- Exit position (row 0, col 2)
- // 2 3
- getGridPosition(0, 2, mTmpPoint);
- } else if (index == ENTER_INDEX) {
- // 0 1
- // 2 3 * <-- Enter position (row 1, col 2)
- getGridPosition(1, 2, mTmpPoint);
- } else if (index >= MAX_NUM_ITEMS_IN_PREVIEW) {
- // Items beyond those displayed in the preview are animated to the center
- mTmpPoint[0] = mTmpPoint[1] = mAvailableSpace / 2 - (mIconSize * totalScale) / 2;
- } else {
- getPosition(index, curNumItems, mTmpPoint);
- }
-
- transX = mTmpPoint[0];
- transY = mTmpPoint[1];
- int padl = 15;
- int padt = 15;
- int tempIndex = index % 9;
- transX = padl + mIconSize * MIN_SCALE * getCol(tempIndex) + getCol(tempIndex) * 5;
- transY = padt + mIconSize * MIN_SCALE * (getRow(tempIndex) - 1) + (getRow(tempIndex) - 1) * 5;
+// if (index == EXIT_INDEX) {
+// // 0 1 * <-- Exit position (row 0, col 2)
+// // 2 3
+// getGridPosition(0, 2, mTmpPoint);
+// } else if (index == ENTER_INDEX) {
+// // 0 1
+// // 2 3 * <-- Enter position (row 1, col 2)
+// getGridPosition(1, 2, mTmpPoint);
+// } else if (index >= MAX_NUM_ITEMS_IN_PREVIEW) {
+// // Items beyond those displayed in the preview are animated to the center
+// mTmpPoint[0] = mTmpPoint[1] = mAvailableSpace / 2 - (mIconSize * totalScale) / 2;
+// } else {
+// getPosition(index, curNumItems, mTmpPoint);
+// }
+//
+// transX = mTmpPoint[0];
+// transY = mTmpPoint[1];
+ //图标根据大小居中
+ float x = (mAvailableSpace - mIconSize * 4 * MIN_SCALE - 2) / 2;
+ int tempIndex = index % 16;
+ transX = x + mIconSize * MIN_SCALE * getCol(tempIndex) + getCol(tempIndex) * 2;
+ transY = x + mIconSize * MIN_SCALE * (getRow(tempIndex) - 1) + (getRow(tempIndex) - 1) * 2;
+ Log.e("fht", "transX: "+transX);
+ Log.e("fht", "transX: "+ getCol(tempIndex) * 2);
+ Log.e("fht", "transX: "+(getRow(tempIndex) - 1) * 2);
+ Log.e("fht", "getColX: "+mIconSize * MIN_SCALE * getCol(tempIndex));
+ Log.e("fht", "getRowY: "+mIconSize * MIN_SCALE * (getRow(tempIndex) - 1));
+ Log.e("fht", "transY: "+transY);
+ Log.e("fht", "mIconSize: "+mIconSize);
+ Log.e("fht", "mAvailableSpace: "+mAvailableSpace);
if (params == null) {
params = new PreviewItemDrawingParams(transX, transY, totalScale, overlayAlpha);
diff --git a/src/com/android/uiuios/folder/PreviewBackground.java b/src/com/android/uiuios/folder/PreviewBackground.java
index 1856134..f193060 100644
--- a/src/com/android/uiuios/folder/PreviewBackground.java
+++ b/src/com/android/uiuios/folder/PreviewBackground.java
@@ -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 */
}