diff options
18 files changed, 124 insertions, 42 deletions
diff --git a/src/com/android/gallery3d/app/ActivityState.java b/src/com/android/gallery3d/app/ActivityState.java index 13cd1509a..a86351b66 100644 --- a/src/com/android/gallery3d/app/ActivityState.java +++ b/src/com/android/gallery3d/app/ActivityState.java @@ -33,9 +33,11 @@ import android.view.MenuItem; import android.view.Window; import android.view.WindowManager; +import com.android.gallery3d.R; import com.android.gallery3d.actionbar.ActionBarInterface; import com.android.gallery3d.actionbar.ActionBarUtils; import com.android.gallery3d.ui.GLView; +import com.android.gallery3d.util.GalleryUtils; abstract public class ActivityState { protected static final int FLAG_HIDE_ACTION_BAR = 1; @@ -105,7 +107,19 @@ abstract public class ActivityState { protected void onStateResult(int requestCode, int resultCode, Intent data) { } + protected float[] mBackgroundColor; + + protected int getBackgroundColorId() { + return R.color.default_background; + } + + protected float[] getBackgroundColor() { + return mBackgroundColor; + } + protected void onCreate(Bundle data, Bundle storedState) { + mBackgroundColor = GalleryUtils.intColorToFloatARGBArray( + mActivity.getResources().getColor(getBackgroundColorId())); } protected void clearStateResult() { diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index a39195007..e44dae194 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -136,12 +136,17 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster } }; + @Override + protected int getBackgroundColorId() { + return R.color.album_background; + } + private final GLView mRootPane = new GLView() { private final float mMatrix[] = new float[16]; @Override protected void renderBackground(GLCanvas view) { - view.clearBuffer(); + view.clearBuffer(getBackgroundColor()); } @Override @@ -453,7 +458,8 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster mSelectionManager.setSelectionListener(this); Config.AlbumPage config = Config.AlbumPage.get((Context) mActivity); mSlotView = new SlotView(mActivity, config.slotViewSpec); - mAlbumView = new AlbumSlotRenderer(mActivity, mSlotView, mSelectionManager); + mAlbumView = new AlbumSlotRenderer(mActivity, mSlotView, + mSelectionManager, config.placeholderColor); mSlotView.setSlotRenderer(mAlbumView); mRootPane.addComponent(mSlotView); mSlotView.setListener(new SlotView.SimpleListener() { diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java index 5d7d0850a..a5a24810a 100644 --- a/src/com/android/gallery3d/app/AlbumSetPage.java +++ b/src/com/android/gallery3d/app/AlbumSetPage.java @@ -109,12 +109,17 @@ public class AlbumSetPage extends ActivityState implements private int mLoadingBits = 0; private boolean mInitialSynced = false; + @Override + protected int getBackgroundColorId() { + return R.color.albumset_background; + } + private final GLView mRootPane = new GLView() { private final float mMatrix[] = new float[16]; @Override protected void renderBackground(GLCanvas view) { - view.clearBuffer(); + view.clearBuffer(getBackgroundColor()); } @Override @@ -369,7 +374,8 @@ public class AlbumSetPage extends ActivityState implements mConfig = Config.AlbumSetPage.get((Context) mActivity); mSlotView = new SlotView(mActivity, mConfig.slotViewSpec); mAlbumSetView = new AlbumSetSlotRenderer( - mActivity, mSelectionManager, mSlotView, mConfig.labelSpec); + mActivity, mSelectionManager, mSlotView, mConfig.labelSpec, + mConfig.placeholderColor); mSlotView.setSlotRenderer(mAlbumSetView); mSlotView.setListener(new SlotView.SimpleListener() { @Override diff --git a/src/com/android/gallery3d/app/Config.java b/src/com/android/gallery3d/app/Config.java index 6fb24ec81..04b210e0e 100644 --- a/src/com/android/gallery3d/app/Config.java +++ b/src/com/android/gallery3d/app/Config.java @@ -31,6 +31,7 @@ final class Config { public AlbumSetSlotRenderer.LabelSpec labelSpec; public int paddingTop; public int paddingBottom; + public int placeholderColor; public static synchronized AlbumSetPage get(Context context) { if (sInstance == null) { @@ -42,10 +43,14 @@ final class Config { private AlbumSetPage(Context context) { Resources r = context.getResources(); + placeholderColor = r.getColor(R.color.albumset_placeholder); + slotViewSpec = new SlotView.Spec(); slotViewSpec.rowsLand = r.getInteger(R.integer.albumset_rows_land); slotViewSpec.rowsPort = r.getInteger(R.integer.albumset_rows_port); slotViewSpec.slotGap = r.getDimensionPixelSize(R.dimen.albumset_slot_gap); + slotViewSpec.slotHeightAdditional = r.getDimensionPixelSize( + R.dimen.albumset_label_background_height); paddingTop = r.getDimensionPixelSize(R.dimen.albumset_padding_top); paddingBottom = r.getDimensionPixelSize(R.dimen.albumset_padding_bottom); @@ -67,6 +72,10 @@ final class Config { R.dimen.albumset_title_right_margin); labelSpec.iconSize = r.getDimensionPixelSize( R.dimen.albumset_icon_size); + labelSpec.backgroundColor = r.getColor( + R.color.albumset_label_background); + labelSpec.titleColor = r.getColor(R.color.albumset_label_title); + labelSpec.countColor = r.getColor(R.color.albumset_label_count); } } @@ -74,6 +83,7 @@ final class Config { private static AlbumPage sInstance; public SlotView.Spec slotViewSpec; + public int placeholderColor; public static synchronized AlbumPage get(Context context) { if (sInstance == null) { @@ -85,6 +95,8 @@ final class Config { private AlbumPage(Context context) { Resources r = context.getResources(); + placeholderColor = r.getColor(R.color.album_placeholder); + slotViewSpec = new SlotView.Spec(); slotViewSpec.rowsLand = r.getInteger(R.integer.album_rows_land); slotViewSpec.rowsPort = r.getInteger(R.integer.album_rows_port); diff --git a/src/com/android/gallery3d/app/ManageCachePage.java b/src/com/android/gallery3d/app/ManageCachePage.java index b02d129b0..847adf6e6 100644 --- a/src/com/android/gallery3d/app/ManageCachePage.java +++ b/src/com/android/gallery3d/app/ManageCachePage.java @@ -86,12 +86,17 @@ public class ManageCachePage extends ActivityState implements private Handler mHandler; private boolean mLayoutReady = false; + @Override + protected int getBackgroundColorId() { + return R.color.cache_background; + } + private GLView mRootPane = new GLView() { private float mMatrix[] = new float[16]; @Override protected void renderBackground(GLCanvas view) { - view.clearBuffer(); + view.clearBuffer(getBackgroundColor()); } @Override diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 2774440ba..8b38abbb2 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -168,6 +168,11 @@ public class PhotoPage extends ActivityState implements private final FloatAnimation mBackgroundFade = new BackgroundFadeOut(); + @Override + protected int getBackgroundColorId() { + return R.color.photo_background; + } + private final GLView mRootPane = new GLView() { @Override protected void renderBackground(GLCanvas view) { @@ -180,7 +185,7 @@ public class PhotoPage extends ActivityState implements } else { float fadeAlpha = mBackgroundFade.get(); if(fadeAlpha < 1f) { - view.clearBuffer(0f, 0f, 0f, 1f); + view.clearBuffer(getBackgroundColor()); view.setAlpha(fadeAlpha); } mFadeOutTexture.draw(view, 0, 0); @@ -188,7 +193,7 @@ public class PhotoPage extends ActivityState implements return; } } - view.clearBuffer(0f, 0f, 0f, 1f); + view.clearBuffer(getBackgroundColor()); } @Override diff --git a/src/com/android/gallery3d/app/SlideshowPage.java b/src/com/android/gallery3d/app/SlideshowPage.java index c0e35be26..09a239e25 100644 --- a/src/com/android/gallery3d/app/SlideshowPage.java +++ b/src/com/android/gallery3d/app/SlideshowPage.java @@ -24,6 +24,7 @@ import android.os.Handler; import android.os.Message; import android.view.MotionEvent; +import com.android.gallery3d.R; import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.ContentListener; import com.android.gallery3d.data.MediaItem; @@ -83,6 +84,11 @@ public class SlideshowPage extends ActivityState { private boolean mIsActive = false; private final Intent mResultIntent = new Intent(); + @Override + protected int getBackgroundColorId() { + return R.color.slideshow_background; + } + private final GLView mRootPane = new GLView() { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { @@ -99,7 +105,7 @@ public class SlideshowPage extends ActivityState { @Override protected void renderBackground(GLCanvas canvas) { - canvas.clearBuffer(0f, 0f, 0f, 0f); + canvas.clearBuffer(getBackgroundColor()); } }; 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) { diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java index 3b73d344c..e750e2769 100644 --- a/src/com/android/gallery3d/util/GalleryUtils.java +++ b/src/com/android/gallery3d/util/GalleryUtils.java @@ -24,6 +24,8 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.content.res.Resources; +import android.graphics.Color; import android.net.Uri; import android.os.ConditionVariable; import android.os.Environment; @@ -39,6 +41,7 @@ import com.android.gallery3d.app.PackagesMonitor; import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.data.DataManager; import com.android.gallery3d.data.MediaItem; +import com.android.gallery3d.ui.BitmapScreenNail; import com.android.gallery3d.util.ThreadPool.CancelListener; import com.android.gallery3d.util.ThreadPool.JobContext; @@ -76,6 +79,18 @@ public class GalleryUtils { wm.getDefaultDisplay().getMetrics(metrics); sPixelDensity = metrics.density; } + Resources r = context.getResources(); + BitmapScreenNail.setPlaceholderColor(r.getColor( + R.color.bitmap_screennail_placeholder)); + } + + public static float[] intColorToFloatARGBArray(int from) { + return new float[] { + (float) Color.alpha(from) / 255f, + (float) Color.red(from) / 255f, + (float) Color.green(from) / 255f, + (float) Color.blue(from) / 255f + }; } public static float dpToPixel(float dp) { diff --git a/tests/src/com/android/gallery3d/ui/GLCanvasStub.java b/tests/src/com/android/gallery3d/ui/GLCanvasStub.java index f30b57964..2f2d753e0 100644 --- a/tests/src/com/android/gallery3d/ui/GLCanvasStub.java +++ b/tests/src/com/android/gallery3d/ui/GLCanvasStub.java @@ -23,7 +23,7 @@ import javax.microedition.khronos.opengles.GL11; public class GLCanvasStub implements GLCanvas { public void setSize(int width, int height) {} public void clearBuffer() {} - public void clearBuffer(float r, float g, float b, float a) {} + public void clearBuffer(float[] argb) {} public void setCurrentAnimationTimeMillis(long time) {} public long currentAnimationTimeMillis() { throw new UnsupportedOperationException(); |