diff options
-rw-r--r-- | res/values/colors.xml | 4 | ||||
-rwxr-xr-x | res/values/dimens.xml | 4 | ||||
-rw-r--r-- | src/com/android/settings/Utils.java | 3 | ||||
-rw-r--r-- | src/com/android/settings/drawable/CircleFramedDrawable.java | 59 |
4 files changed, 6 insertions, 64 deletions
diff --git a/res/values/colors.xml b/res/values/colors.xml index 70fc4a0..9e374e6 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -51,10 +51,6 @@ <color name="setup_wizard_wifi_color_dark">#ff00e4ff</color> <color name="setup_wizard_wifi_color_light">#ff0096a6</color> - <color name="circle_avatar_frame_color">#ffffffff</color> - <color name="circle_avatar_frame_shadow_color">#80000000</color> - <color name="circle_avatar_frame_pressed_color">#ffffffff</color> - <color name="lock_pattern_background">#00000000</color> <color name="lock_pattern_view_regular_color">#ff37474f</color> <color name="lock_pattern_view_success_color">@color/theme_accent</color> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 4c4dbda..b4641e9 100755 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -72,9 +72,7 @@ <dimen name="pager_tabs_padding">0dp</dimen> - <dimen name="circle_avatar_size">48dp</dimen> - <dimen name="circle_avatar_frame_stroke_width">1dp</dimen> - <dimen name="circle_avatar_frame_shadow_radius">3dp</dimen> + <dimen name="circle_avatar_size">40dp</dimen> <!-- Minimum width for the popup for updating a user's photo. --> <dimen name="update_user_photo_popup_min_width">300dip</dimen> diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java index 6517ffe..678e05f 100644 --- a/src/com/android/settings/Utils.java +++ b/src/com/android/settings/Utils.java @@ -919,7 +919,8 @@ public final class Utils { return CircleFramedDrawable.getInstance(context, icon); } } - return UserIcons.getDefaultUserIcon(user.id, /* light= */ false); + return CircleFramedDrawable.getInstance(context, UserIcons.convertToBitmap( + UserIcons.getDefaultUserIcon(user.id, /* light= */ false))); } /** diff --git a/src/com/android/settings/drawable/CircleFramedDrawable.java b/src/com/android/settings/drawable/CircleFramedDrawable.java index 97c96a0..31b8922 100644 --- a/src/com/android/settings/drawable/CircleFramedDrawable.java +++ b/src/com/android/settings/drawable/CircleFramedDrawable.java @@ -42,45 +42,22 @@ public class CircleFramedDrawable extends Drawable { private final Bitmap mBitmap; private final int mSize; private final Paint mPaint; - private final float mShadowRadius; - private final float mStrokeWidth; - private final int mFrameColor; - private final int mHighlightColor; - private final int mFrameShadowColor; private float mScale; - private Path mFramePath; private Rect mSrcRect; private RectF mDstRect; - private RectF mFrameRect; - private boolean mPressed; public static CircleFramedDrawable getInstance(Context context, Bitmap icon) { Resources res = context.getResources(); float iconSize = res.getDimension(R.dimen.circle_avatar_size); - float strokeWidth = res.getDimension(R.dimen.circle_avatar_frame_stroke_width); - float shadowRadius = res.getDimension(R.dimen.circle_avatar_frame_shadow_radius); - int frameColor = res.getColor(R.color.circle_avatar_frame_color); - int frameShadowColor = res.getColor(R.color.circle_avatar_frame_shadow_color); - int highlightColor = res.getColor(R.color.circle_avatar_frame_pressed_color); - - CircleFramedDrawable instance = new CircleFramedDrawable(icon, - (int) iconSize, frameColor, strokeWidth, frameShadowColor, shadowRadius, - highlightColor); + + CircleFramedDrawable instance = new CircleFramedDrawable(icon, (int) iconSize); return instance; } - public CircleFramedDrawable(Bitmap icon, int size, - int frameColor, float strokeWidth, - int frameShadowColor, float shadowRadius, - int highlightColor) { + public CircleFramedDrawable(Bitmap icon, int size) { super(); mSize = size; - mShadowRadius = shadowRadius; - mFrameColor = frameColor; - mFrameShadowColor = frameShadowColor; - mStrokeWidth = strokeWidth; - mHighlightColor = highlightColor; mBitmap = Bitmap.createBitmap(mSize, mSize, Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(mBitmap); @@ -91,8 +68,6 @@ public class CircleFramedDrawable extends Drawable { final Rect cropRect = new Rect((width - square) / 2, (height - square) / 2, square, square); final RectF circleRect = new RectF(0f, 0f, mSize, mSize); - circleRect.inset(mStrokeWidth / 2f, mStrokeWidth / 2f); - circleRect.inset(mShadowRadius, mShadowRadius); final Path fillPath = new Path(); fillPath.addArc(circleRect, 0f, 360f); @@ -117,8 +92,6 @@ public class CircleFramedDrawable extends Drawable { mSrcRect = new Rect(0, 0, mSize, mSize); mDstRect = new RectF(0, 0, mSize, mSize); - mFrameRect = new RectF(mDstRect); - mFramePath = new Path(); } @Override @@ -128,28 +101,6 @@ public class CircleFramedDrawable extends Drawable { mDstRect.set(pad, pad, mSize - pad, mSize - pad); canvas.drawBitmap(mBitmap, mSrcRect, mDstRect, null); - - mFrameRect.set(mDstRect); - mFrameRect.inset(mStrokeWidth / 2f, mStrokeWidth / 2f); - mFrameRect.inset(mShadowRadius, mShadowRadius); - - mFramePath.reset(); - mFramePath.addArc(mFrameRect, 0f, 360f); - - // white frame - if (mPressed) { - mPaint.setStyle(Paint.Style.FILL); - mPaint.setColor(Color.argb((int) (0.33f * 255), - Color.red(mHighlightColor), - Color.green(mHighlightColor), - Color.blue(mHighlightColor))); - canvas.drawPath(mFramePath, mPaint); - } - mPaint.setStrokeWidth(mStrokeWidth); - mPaint.setStyle(Paint.Style.STROKE); - mPaint.setColor(mPressed ? mHighlightColor : mFrameColor); - mPaint.setShadowLayer(mShadowRadius, 0f, 0f, mFrameShadowColor); - canvas.drawPath(mFramePath, mPaint); } public void setScale(float scale) { @@ -160,10 +111,6 @@ public class CircleFramedDrawable extends Drawable { return mScale; } - public void setPressed(boolean pressed) { - mPressed = pressed; - } - @Override public int getOpacity() { return PixelFormat.TRANSLUCENT; |