summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2012-08-23 13:05:53 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-08-24 17:12:44 -0700
commit93d87ff509cabdad9f02f379df7eba01a44969c7 (patch)
tree1252bcd153ffff5f94f2b4608872a950c6fb21de /src/com/android/gallery3d/ui
parent0b6bca8513ae49dacbfdbd9c800ba9f542b6b68b (diff)
downloadandroid_packages_apps_Snap-93d87ff509cabdad9f02f379df7eba01a44969c7.tar.gz
android_packages_apps_Snap-93d87ff509cabdad9f02f379df7eba01a44969c7.tar.bz2
android_packages_apps_Snap-93d87ff509cabdad9f02f379df7eba01a44969c7.zip
Ongoing reskin of Gallery app
Bug: 7050303 Moved the majority of color settings from hardcoded to colors.xml in order to allow rapid iteration with UX input. Started changing some colors and layouts to reflect latest UX mocks. Change-Id: I300338e9f75c71f3ed3f36140d16e893387f3184
Diffstat (limited to 'src/com/android/gallery3d/ui')
-rw-r--r--src/com/android/gallery3d/ui/AlbumLabelMaker.java11
-rw-r--r--src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java15
-rw-r--r--src/com/android/gallery3d/ui/AlbumSlotRenderer.java9
-rw-r--r--src/com/android/gallery3d/ui/BitmapScreenNail.java18
-rw-r--r--src/com/android/gallery3d/ui/GLCanvas.java3
-rw-r--r--src/com/android/gallery3d/ui/GLCanvasImpl.java11
-rw-r--r--src/com/android/gallery3d/ui/ManageCacheDrawer.java3
-rw-r--r--src/com/android/gallery3d/ui/PhotoView.java6
-rw-r--r--src/com/android/gallery3d/ui/SlotView.java3
9 files changed, 46 insertions, 33 deletions
diff --git a/src/com/android/gallery3d/ui/AlbumLabelMaker.java b/src/com/android/gallery3d/ui/AlbumLabelMaker.java
index 4a1d545b7..cd6c77861 100644
--- a/src/com/android/gallery3d/ui/AlbumLabelMaker.java
+++ b/src/com/android/gallery3d/ui/AlbumLabelMaker.java
@@ -21,7 +21,6 @@ import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.text.TextPaint;
@@ -34,11 +33,7 @@ import com.android.gallery3d.util.ThreadPool;
import com.android.gallery3d.util.ThreadPool.JobContext;
public class AlbumLabelMaker {
- private static final int FONT_COLOR_TITLE = Color.BLACK;
- private static final int FONT_COLOR_COUNT = 0x80000000;
-
private static final int BORDER_SIZE = 0;
- private static final int BACKGROUND_COLOR = 0xFFFFFFFF;
private final AlbumSetSlotRenderer.LabelSpec mSpec;
private final TextPaint mTitlePaint;
@@ -56,8 +51,8 @@ public class AlbumLabelMaker {
public AlbumLabelMaker(Context context, AlbumSetSlotRenderer.LabelSpec spec) {
mContext = context;
mSpec = spec;
- mTitlePaint = getTextPaint(spec.titleFontSize, FONT_COLOR_TITLE, false);
- mCountPaint = getTextPaint(spec.countFontSize, FONT_COLOR_COUNT, false);
+ mTitlePaint = getTextPaint(spec.titleFontSize, spec.titleColor, false);
+ mCountPaint = getTextPaint(spec.countFontSize, spec.countColor, false);
mLocalSetIcon = new LazyLoadedBitmap(R.drawable.frame_overlay_gallery_folder);
mPicasaIcon = new LazyLoadedBitmap(R.drawable.frame_overlay_gallery_picasa);
@@ -174,7 +169,7 @@ public class AlbumLabelMaker {
canvas.clipRect(BORDER_SIZE, BORDER_SIZE,
bitmap.getWidth() - BORDER_SIZE,
bitmap.getHeight() - BORDER_SIZE);
- canvas.drawColor(BACKGROUND_COLOR, PorterDuff.Mode.SRC);
+ canvas.drawColor(mSpec.backgroundColor, PorterDuff.Mode.SRC);
canvas.translate(BORDER_SIZE, BORDER_SIZE);
diff --git a/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java b/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java
index cee36d969..bdc0e676e 100644
--- a/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java
+++ b/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java
@@ -28,7 +28,7 @@ public class AlbumSetSlotRenderer extends AbstractSlotRenderer {
@SuppressWarnings("unused")
private static final String TAG = "AlbumSetView";
private static final int CACHE_SIZE = 96;
- private static final int PLACEHOLDER_COLOR = 0xFFDDDDDD;
+ private final int mPlaceholderColor;
private final ColorTexture mWaitLoadingTexture;
private final GalleryActivity mActivity;
@@ -52,20 +52,23 @@ public class AlbumSetSlotRenderer extends AbstractSlotRenderer {
public int leftMargin;
public int iconSize;
public int titleRightMargin;
+ public int backgroundColor;
+ public int titleColor;
+ public int countColor;
+ public int borderSize;
}
public AlbumSetSlotRenderer(GalleryActivity activity, SelectionManager selectionManager,
- SlotView slotView, LabelSpec labelSpec) {
+ SlotView slotView, LabelSpec labelSpec, int placeholderColor) {
super ((Context) activity);
mActivity = activity;
mSelectionManager = selectionManager;
mSlotView = slotView;
mLabelSpec = labelSpec;
+ mPlaceholderColor = placeholderColor;
- mWaitLoadingTexture = new ColorTexture(PLACEHOLDER_COLOR);
+ mWaitLoadingTexture = new ColorTexture(mPlaceholderColor);
mWaitLoadingTexture.setSize(1, 1);
-
- Context context = activity.getAndroidContext();
}
public void setPressedIndex(int index) {
@@ -149,7 +152,7 @@ public class AlbumSetSlotRenderer extends AbstractSlotRenderer {
entry.isWaitLoadingDisplayed = true;
} else if (entry.isWaitLoadingDisplayed) {
entry.isWaitLoadingDisplayed = false;
- content = new FadeInTexture(PLACEHOLDER_COLOR, entry.bitmapTexture);
+ content = new FadeInTexture(mPlaceholderColor, entry.bitmapTexture);
entry.content = content;
}
drawContent(canvas, content, width, height, entry.rotation);
diff --git a/src/com/android/gallery3d/ui/AlbumSlotRenderer.java b/src/com/android/gallery3d/ui/AlbumSlotRenderer.java
index dee9a0b11..f6df3b380 100644
--- a/src/com/android/gallery3d/ui/AlbumSlotRenderer.java
+++ b/src/com/android/gallery3d/ui/AlbumSlotRenderer.java
@@ -31,7 +31,7 @@ public class AlbumSlotRenderer extends AbstractSlotRenderer {
public boolean acceptSlot(int index);
}
- private static final int PLACEHOLDER_COLOR = 0xFFDDDDDD;
+ private final int mPlaceholderColor;
private static final int CACHE_SIZE = 96;
private AlbumSlidingWindow mDataWindow;
@@ -48,13 +48,14 @@ public class AlbumSlotRenderer extends AbstractSlotRenderer {
private SlotFilter mSlotFilter;
public AlbumSlotRenderer(GalleryActivity activity, SlotView slotView,
- SelectionManager selectionManager) {
+ SelectionManager selectionManager, int placeholderColor) {
super((Context) activity);
mActivity = activity;
mSlotView = slotView;
mSelectionManager = selectionManager;
+ mPlaceholderColor = placeholderColor;
- mWaitLoadingTexture = new ColorTexture(PLACEHOLDER_COLOR);
+ mWaitLoadingTexture = new ColorTexture(mPlaceholderColor);
mWaitLoadingTexture.setSize(1, 1);
}
@@ -110,7 +111,7 @@ public class AlbumSlotRenderer extends AbstractSlotRenderer {
entry.isWaitDisplayed = true;
} else if (entry.isWaitDisplayed) {
entry.isWaitDisplayed = false;
- content = new FadeInTexture(PLACEHOLDER_COLOR, entry.bitmapTexture);
+ content = new FadeInTexture(mPlaceholderColor, entry.bitmapTexture);
entry.content = content;
}
drawContent(canvas, content, width, height, entry.rotation);
diff --git a/src/com/android/gallery3d/ui/BitmapScreenNail.java b/src/com/android/gallery3d/ui/BitmapScreenNail.java
index 57685e8e5..6fbcf0137 100644
--- a/src/com/android/gallery3d/ui/BitmapScreenNail.java
+++ b/src/com/android/gallery3d/ui/BitmapScreenNail.java
@@ -33,10 +33,9 @@ import com.android.gallery3d.data.MediaItem;
public class BitmapScreenNail implements ScreenNail {
@SuppressWarnings("unused")
private static final String TAG = "BitmapScreenNail";
- private static final int PLACEHOLDER_COLOR = 0xFF222222;
+
// The duration of the fading animation in milliseconds
private static final int DURATION = 180;
- private static boolean mDrawPlaceholder = true;
private static final int MAX_SIDE = 640;
@@ -63,6 +62,15 @@ public class BitmapScreenNail implements ScreenNail {
setSize(width, height);
}
+ // This gets overridden by bitmap_screennail_placeholder
+ // in GalleryUtils.initialize
+ private static int mPlaceholderColor = 0xFF222222;
+ private static boolean mDrawPlaceholder = true;
+
+ public static void setPlaceholderColor(int color) {
+ mPlaceholderColor = color;
+ }
+
private void setSize(int width, int height) {
if (width == 0 || height == 0) {
width = 640;
@@ -155,7 +163,7 @@ public class BitmapScreenNail implements ScreenNail {
mAnimationStartTime = ANIMATION_NEEDED;
}
if(mDrawPlaceholder) {
- canvas.fillRect(x, y, width, height, PLACEHOLDER_COLOR);
+ canvas.fillRect(x, y, width, height, mPlaceholderColor);
}
return;
}
@@ -169,7 +177,7 @@ public class BitmapScreenNail implements ScreenNail {
}
if (isAnimating()) {
- canvas.drawMixed(mTexture, PLACEHOLDER_COLOR, getRatio(), x, y,
+ canvas.drawMixed(mTexture, mPlaceholderColor, getRatio(), x, y,
width, height);
} else {
mTexture.draw(canvas, x, y, width, height);
@@ -180,7 +188,7 @@ public class BitmapScreenNail implements ScreenNail {
public void draw(GLCanvas canvas, RectF source, RectF dest) {
if (mBitmap == null) {
canvas.fillRect(dest.left, dest.top, dest.width(), dest.height(),
- PLACEHOLDER_COLOR);
+ mPlaceholderColor);
return;
}
diff --git a/src/com/android/gallery3d/ui/GLCanvas.java b/src/com/android/gallery3d/ui/GLCanvas.java
index 6d9aa4271..e3a32ef08 100644
--- a/src/com/android/gallery3d/ui/GLCanvas.java
+++ b/src/com/android/gallery3d/ui/GLCanvas.java
@@ -36,6 +36,7 @@ public interface GLCanvas {
// Clear the drawing buffers. This should only be used by GLRoot.
public void clearBuffer();
+ public void clearBuffer(float[] argb);
// Sets and gets the current alpha, alpha must be in [0, 1].
public void setAlpha(float alpha);
@@ -121,6 +122,4 @@ public interface GLCanvas {
public void beginRenderTarget(RawTexture texture);
public void endRenderTarget();
-
- public void clearBuffer(float r, float g, float b, float a);
}
diff --git a/src/com/android/gallery3d/ui/GLCanvasImpl.java b/src/com/android/gallery3d/ui/GLCanvasImpl.java
index a254bcce4..d83daf3e4 100644
--- a/src/com/android/gallery3d/ui/GLCanvasImpl.java
+++ b/src/com/android/gallery3d/ui/GLCanvasImpl.java
@@ -649,15 +649,18 @@ public class GLCanvasImpl implements GLCanvas {
}
@Override
- public void clearBuffer(float r, float g, float b, float a) {
- mGL.glClearColor(r, g, b, a);
+ public void clearBuffer(float[] argb) {
+ if(argb != null && argb.length == 4) {
+ mGL.glClearColor(argb[1], argb[2], argb[3], argb[0]);
+ } else {
+ mGL.glClearColor(0, 0, 0, 1);
+ }
mGL.glClear(GL10.GL_COLOR_BUFFER_BIT);
}
@Override
public void clearBuffer() {
- // TODO: Make this grey background color constant
- clearBuffer(0.93f, 0.93f, 0.93f, 1);
+ clearBuffer(null);
}
private void setTextureCoords(RectF source) {
diff --git a/src/com/android/gallery3d/ui/ManageCacheDrawer.java b/src/com/android/gallery3d/ui/ManageCacheDrawer.java
index ba31fc653..91dc7ac44 100644
--- a/src/com/android/gallery3d/ui/ManageCacheDrawer.java
+++ b/src/com/android/gallery3d/ui/ManageCacheDrawer.java
@@ -38,7 +38,8 @@ public class ManageCacheDrawer extends AlbumSetSlotRenderer {
public ManageCacheDrawer(GalleryActivity activity, SelectionManager selectionManager,
SlotView slotView, LabelSpec labelSpec, int cachePinSize, int cachePinMargin) {
- super(activity, selectionManager, slotView, labelSpec);
+ super(activity, selectionManager, slotView, labelSpec,
+ activity.getResources().getColor(R.color.cache_placeholder));
Context context = (Context) activity;
mCheckedItem = new ResourceTexture(
context, R.drawable.btn_make_offline_normal_on_holo_dark);
diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java
index 0dee1b04b..16d93ca20 100644
--- a/src/com/android/gallery3d/ui/PhotoView.java
+++ b/src/com/android/gallery3d/ui/PhotoView.java
@@ -39,7 +39,7 @@ import com.android.gallery3d.util.RangeArray;
public class PhotoView extends GLView {
@SuppressWarnings("unused")
private static final String TAG = "PhotoView";
- private static final int PLACEHOLDER_COLOR = 0xFF222222;
+ private final int mPlaceholderColor;
public static final int INVALID_SIZE = -1;
public static final long INVALID_DATA_VERSION =
@@ -236,6 +236,8 @@ public class PhotoView extends GLView {
mTileView = new TileImageView(activity);
addComponent(mTileView);
Context context = activity.getAndroidContext();
+ mPlaceholderColor = context.getResources().getColor(
+ R.color.photo_placeholder);
mEdgeView = new EdgeView(context);
addComponent(mEdgeView);
mUndoBar = new UndoBarView(context);
@@ -886,7 +888,7 @@ public class PhotoView extends GLView {
// Draw a gray placeholder in the specified rectangle.
private void drawPlaceHolder(GLCanvas canvas, Rect r) {
- canvas.fillRect(r.left, r.top, r.width(), r.height(), PLACEHOLDER_COLOR);
+ canvas.fillRect(r.left, r.top, r.width(), r.height(), mPlaceholderColor);
}
// Draw the video play icon (in the place where the spinner was)
diff --git a/src/com/android/gallery3d/ui/SlotView.java b/src/com/android/gallery3d/ui/SlotView.java
index 88a2e0d3c..1325aecd6 100644
--- a/src/com/android/gallery3d/ui/SlotView.java
+++ b/src/com/android/gallery3d/ui/SlotView.java
@@ -386,6 +386,7 @@ public class SlotView extends GLView {
public static class Spec {
public int slotWidth = -1;
public int slotHeight = -1;
+ public int slotHeightAdditional = 0;
public int rowsLand = -1;
public int rowsPort = -1;
@@ -501,7 +502,7 @@ public class SlotView extends GLView {
int rows = (mWidth > mHeight) ? mSpec.rowsLand : mSpec.rowsPort;
mSlotGap = mSpec.slotGap;
mSlotHeight = Math.max(1, (mHeight - (rows - 1) * mSlotGap) / rows);
- mSlotWidth = mSlotHeight;
+ mSlotWidth = mSlotHeight - mSpec.slotHeightAdditional;
}
if (mRenderer != null) {