diff options
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 5 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/AlbumSetPage.java | 43 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 4 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java | 10 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/PositionController.java | 4 |
5 files changed, 52 insertions, 14 deletions
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 5328678ab..8e65bc0b9 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -269,10 +269,9 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster } else { // Show pressed-up animation for the single-tap. mAlbumView.setPressedIndex(slotIndex); - mAlbumView.setPressedUp(); - mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PICK_PHOTO, slotIndex, 0), - FadeTexture.DURATION); prepareFadeOutTexture(); + mAlbumView.setPressedIndex(-1); + pickPhoto(slotIndex); } } diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java index a3d7dc430..f0f4354e1 100644 --- a/src/com/android/gallery3d/app/AlbumSetPage.java +++ b/src/com/android/gallery3d/app/AlbumSetPage.java @@ -17,8 +17,12 @@ package com.android.gallery3d.app; import android.app.Activity; +import android.app.AlertDialog; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; +import android.content.DialogInterface.OnCancelListener; +import android.content.DialogInterface.OnClickListener; import android.graphics.Rect; import android.os.Bundle; import android.os.Handler; @@ -299,16 +303,50 @@ public class AlbumSetPage extends ActivityState implements private void clearLoadingBit(int loadingBit) { mLoadingBits &= ~loadingBit; if (mLoadingBits == 0 && mIsActive) { - // Only show toast when there's no album and we are going to finish - // the page. Toast is redundant if we are going to stay on this page. if ((mAlbumSetDataAdapter.size() == 0)) { + // Only show toast when there's no album and we are going to + // finish, otherwise prompt user to add some pictures if (mActivity.getStateManager().getStateCount() > 1) { Toast.makeText(mActivity, R.string.empty_album, Toast.LENGTH_LONG).show(); mActivity.getStateManager().finishState(this); + } else { + emptyGalleryPrompt((Activity) mActivity); } + } else if (mEmptyGalleryPrompt != null) { + mEmptyGalleryPrompt = null; + } + } + } + + private AlertDialog mEmptyGalleryPrompt; + + private void emptyGalleryPrompt(final Context c) { + if (mEmptyGalleryPrompt != null) { + mEmptyGalleryPrompt.show(); + return; + } + + AlertDialog.Builder builder = new AlertDialog.Builder(c); + builder.setTitle(R.string.empty_album); + builder.setNegativeButton(android.R.string.ok, new OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.cancel(); } + }); + if(GalleryUtils.isCameraAvailable(c)) { + builder.setPositiveButton(R.string.switch_to_camera, + new OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.cancel(); + GalleryUtils.startCameraActivity(c); + } + }); } + mEmptyGalleryPrompt = builder.create(); + mEmptyGalleryPrompt.show(); } private void setLoadingBit(int loadingBit) { @@ -317,6 +355,7 @@ public class AlbumSetPage extends ActivityState implements @Override public void onPause() { + if (mEmptyGalleryPrompt != null) mEmptyGalleryPrompt.dismiss(); super.onPause(); mIsActive = false; mActionModeHandler.pause(); diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 2458b9a98..43867bbfe 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -133,7 +133,7 @@ public class PhotoPage extends ActivityState implements private RawTexture mFadeOutTexture; private Rect mOpenAnimationRect; - public static final int ANIM_TIME_OPENING = 300; + public static final int ANIM_TIME_OPENING = 400; // The item that is deleted (but it can still be undeleted before commiting) private Path mDeletePath; @@ -191,7 +191,7 @@ public class PhotoPage extends ActivityState implements view.setAlpha(fadeAlpha); } mFadeOutTexture.draw(view, 0, 0); - view.setAlpha(1f); + view.setAlpha(1f - fadeAlpha); return; } } diff --git a/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java b/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java index a1f2b4c4f..f2b576f5f 100644 --- a/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java +++ b/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java @@ -174,11 +174,13 @@ public class AlbumSetSlotRenderer extends AbstractSlotRenderer { protected int renderLabel( GLCanvas canvas, AlbumSetEntry entry, int width, int height) { Texture content = checkTexture(entry.labelTexture); - if (content != null) { - int b = AlbumLabelMaker.getBorderSize(); - int h = content.getHeight(); - content.draw(canvas, -b, height - h + b, width + b + b, h); + if (content == null) { + content = mWaitLoadingTexture; } + int b = AlbumLabelMaker.getBorderSize(); + int h = mLabelSpec.labelBackgroundHeight; + content.draw(canvas, -b, height - h + b, width + b + b, h); + return 0; } diff --git a/src/com/android/gallery3d/ui/PositionController.java b/src/com/android/gallery3d/ui/PositionController.java index b1b3c37ab..16e9f7ba1 100644 --- a/src/com/android/gallery3d/ui/PositionController.java +++ b/src/com/android/gallery3d/ui/PositionController.java @@ -1417,12 +1417,10 @@ class PositionController { case ANIM_KIND_CAPTURE: progress = 1 - f; // linear break; + case ANIM_KIND_OPENING: case ANIM_KIND_SCALE: progress = 1 - f * f; // quadratic break; - case ANIM_KIND_OPENING: - progress = 1 - f * f * f; // x^3 - break; case ANIM_KIND_SNAPBACK: case ANIM_KIND_ZOOM: case ANIM_KIND_SLIDE: |