diff options
Diffstat (limited to 'src/com/android')
| -rw-r--r-- | src/com/android/gallery3d/filtershow/category/CategoryView.java | 8 | ||||
| -rw-r--r-- | src/com/android/gallery3d/filtershow/category/IconView.java | 9 |
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) { |
