summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/drawable
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2013-04-19 16:21:24 -0700
committerMichael Kolb <kolby@google.com>2013-04-22 10:23:34 -0700
commitf465110e4b8ed787589e052e5ac746c588c5ac8f (patch)
tree93bd8ff426e419c0f62ea43115ec6da5db3a6ab9 /src/com/android/camera/drawable
parent2429727fc3e751edec61042846ae268ec70ea2e6 (diff)
downloadandroid_packages_apps_Snap-f465110e4b8ed787589e052e5ac746c588c5ac8f.tar.gz
android_packages_apps_Snap-f465110e4b8ed787589e052e5ac746c588c5ac8f.tar.bz2
android_packages_apps_Snap-f465110e4b8ed787589e052e5ac746c588c5ac8f.zip
More menu fixes
Bug: 8660834 Add label dropshadow, reposition fixed menu Adjust dead zone and angle Change-Id: I7d62c03bcdcdec6268ef805f56114327f471b6d7
Diffstat (limited to 'src/com/android/camera/drawable')
-rw-r--r--src/com/android/camera/drawable/TextDrawable.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/com/android/camera/drawable/TextDrawable.java b/src/com/android/camera/drawable/TextDrawable.java
index ac5f1ce92..60d8719c4 100644
--- a/src/com/android/camera/drawable/TextDrawable.java
+++ b/src/com/android/camera/drawable/TextDrawable.java
@@ -21,6 +21,7 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
+import android.graphics.Typeface;
import android.graphics.Paint.Align;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -36,6 +37,7 @@ public class TextDrawable extends Drawable {
private CharSequence mText;
private int mIntrinsicWidth;
private int mIntrinsicHeight;
+ private boolean mUseDropShadow;
public TextDrawable(Resources res) {
this(res, "");
@@ -43,9 +45,7 @@ public class TextDrawable extends Drawable {
public TextDrawable(Resources res, CharSequence text) {
mText = text;
- mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- mPaint.setColor(DEFAULT_COLOR);
- mPaint.setTextAlign(Align.CENTER);
+ updatePaint();
float textSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
DEFAULT_TEXTSIZE, res.getDisplayMetrics());
mPaint.setTextSize(textSize);
@@ -53,6 +53,21 @@ public class TextDrawable extends Drawable {
mIntrinsicHeight = mPaint.getFontMetricsInt(null);
}
+ private void updatePaint() {
+ if (mPaint == null) {
+ mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ }
+ mPaint.setColor(DEFAULT_COLOR);
+ mPaint.setTextAlign(Align.CENTER);
+ if (mUseDropShadow) {
+ mPaint.setTypeface(Typeface.DEFAULT_BOLD);
+ mPaint.setShadowLayer(10, 0, 0, 0xff000000);
+ } else {
+ mPaint.setTypeface(Typeface.DEFAULT);
+ mPaint.setShadowLayer(0, 0, 0, 0);
+ }
+ }
+
public void setText(CharSequence txt) {
mText = txt;
if (txt == null) {
@@ -73,6 +88,11 @@ public class TextDrawable extends Drawable {
}
}
+ public void setDropShadow(boolean shadow) {
+ mUseDropShadow = shadow;
+ updatePaint();
+ }
+
@Override
public int getOpacity() {
return mPaint.getAlpha();