diff options
Diffstat (limited to 'src/com/android/gallery3d/app')
-rw-r--r-- | src/com/android/gallery3d/app/ActivityState.java | 14 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 10 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/AlbumSetPage.java | 10 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/Config.java | 12 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/ManageCachePage.java | 7 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 9 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/SlideshowPage.java | 8 |
7 files changed, 62 insertions, 8 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()); } }; |