summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-08-14 11:36:46 -0700
committernicolasroard <nicolasroard@google.com>2013-08-14 11:36:46 -0700
commit3130144bcd9403153b9385f9b91d4262d626a113 (patch)
tree5d3d73036428ee94693e2fb77201338122132dec /src/com
parent89c60a9d0be113585799dd903fc005b315251314 (diff)
downloadandroid_packages_apps_Gallery2-3130144bcd9403153b9385f9b91d4262d626a113.tar.gz
android_packages_apps_Gallery2-3130144bcd9403153b9385f9b91d4262d626a113.tar.bz2
android_packages_apps_Gallery2-3130144bcd9403153b9385f9b91d4262d626a113.zip
Center add button text in landscape
Change-Id: I33a66ce0607cb3832d6373e64e92204e8dc52d92
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/gallery3d/filtershow/category/CategoryView.java8
-rw-r--r--src/com/android/gallery3d/filtershow/category/IconView.java9
2 files changed, 16 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/filtershow/category/CategoryView.java b/src/com/android/gallery3d/filtershow/category/CategoryView.java
index 1addbde30..6759afbcc 100644
--- a/src/com/android/gallery3d/filtershow/category/CategoryView.java
+++ b/src/com/android/gallery3d/filtershow/category/CategoryView.java
@@ -95,6 +95,14 @@ public class CategoryView extends IconView
}
}
+ @Override
+ public boolean needsCenterText() {
+ if (mAction != null && mAction.getType() == Action.ADD_ACTION) {
+ return true;
+ }
+ return super.needsCenterText();
+ }
+
public void onDraw(Canvas canvas) {
if (mAction != null) {
if (mAction.getType() == Action.SPACER) {
diff --git a/src/com/android/gallery3d/filtershow/category/IconView.java b/src/com/android/gallery3d/filtershow/category/IconView.java
index 0d9f6da4a..0443823c9 100644
--- a/src/com/android/gallery3d/filtershow/category/IconView.java
+++ b/src/com/android/gallery3d/filtershow/category/IconView.java
@@ -87,13 +87,20 @@ public class IconView extends View {
mPaint.getTextBounds(text, 0, text.length(), mTextBounds);
}
+ public boolean needsCenterText() {
+ if (mOrientation == HORIZONTAL) {
+ return true;
+ }
+ return false;
+ }
+
protected void drawText(Canvas canvas, String text) {
if (text == null) {
return;
}
float textWidth = mPaint.measureText(text);
int x = (int) (canvas.getWidth() - textWidth - 2*mMargin);
- if (mOrientation == HORIZONTAL) {
+ if (needsCenterText()) {
x = (int) ((canvas.getWidth() - textWidth) / 2.0f);
}
if (x < 0) {