summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/gallery3d/ui/AbstractSlotRenderer.java16
-rw-r--r--src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java5
-rw-r--r--src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java8
-rw-r--r--src/com/android/gallery3d/ui/AlbumSlidingWindow.java21
-rw-r--r--src/com/android/gallery3d/ui/AlbumSlotRenderer.java2
5 files changed, 26 insertions, 26 deletions
diff --git a/src/com/android/gallery3d/ui/AbstractSlotRenderer.java b/src/com/android/gallery3d/ui/AbstractSlotRenderer.java
index c36847d69..10b710d2d 100644
--- a/src/com/android/gallery3d/ui/AbstractSlotRenderer.java
+++ b/src/com/android/gallery3d/ui/AbstractSlotRenderer.java
@@ -25,7 +25,7 @@ public abstract class AbstractSlotRenderer implements SlotView.SlotRenderer {
private final ResourceTexture mVideoOverlay;
private final ResourceTexture mVideoPlayIcon;
- private final NinePatchTexture mPanoramaBorder;
+ private final ResourceTexture mPanoramaIcon;
private final NinePatchTexture mFramePressed;
private final NinePatchTexture mFrameSelected;
private FadeOutTexture mFramePressedUp;
@@ -33,7 +33,7 @@ public abstract class AbstractSlotRenderer implements SlotView.SlotRenderer {
protected AbstractSlotRenderer(Context context) {
mVideoOverlay = new ResourceTexture(context, R.drawable.ic_video_thumb);
mVideoPlayIcon = new ResourceTexture(context, R.drawable.ic_gallery_play);
- mPanoramaBorder = new NinePatchTexture(context, R.drawable.ic_pan_thumb);
+ mPanoramaIcon = new ResourceTexture(context, R.drawable.ic_360pano_holo_light);
mFramePressed = new NinePatchTexture(context, R.drawable.grid_pressed);
mFrameSelected = new NinePatchTexture(context, R.drawable.grid_selected);
}
@@ -74,14 +74,10 @@ public abstract class AbstractSlotRenderer implements SlotView.SlotRenderer {
mVideoPlayIcon.draw(canvas, (width - s) / 2, (height - s) / 2, s, s);
}
- protected void drawPanoramaBorder(GLCanvas canvas, int width, int height) {
- float scale = (float) width / mPanoramaBorder.getWidth();
- int w = Math.round(scale * mPanoramaBorder.getWidth());
- int h = Math.round(scale * mPanoramaBorder.getHeight());
- // draw at the top
- mPanoramaBorder.draw(canvas, 0, 0, w, h);
- // draw at the bottom
- mPanoramaBorder.draw(canvas, 0, height - h, w, h);
+ protected void drawPanoramaIcon(GLCanvas canvas, int width, int height) {
+ int iconSize = Math.min(width, height) / 6;
+ mPanoramaIcon.draw(canvas, (width - iconSize) / 2, (height - iconSize) / 2,
+ iconSize, iconSize);
}
protected boolean isPressedUpFrameFinished() {
diff --git a/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java b/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java
index e32ec5160..d95a523c0 100644
--- a/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java
+++ b/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java
@@ -31,7 +31,6 @@ import com.android.gallery3d.data.MediaSet;
import com.android.gallery3d.data.Path;
import com.android.gallery3d.util.Future;
import com.android.gallery3d.util.FutureListener;
-import com.android.gallery3d.util.GalleryUtils;
import com.android.gallery3d.util.ThreadPool;
public class AlbumSetSlidingWindow implements AlbumSetDataLoader.DataListener {
@@ -80,8 +79,6 @@ public class AlbumSetSlidingWindow implements AlbumSetDataLoader.DataListener {
public int cacheFlag;
public int cacheStatus;
public int rotation;
- public int mediaType;
- public boolean isPanorama;
public boolean isWaitLoadingDisplayed;
public long setDataVersion;
public long coverDataVersion;
@@ -271,9 +268,7 @@ public class AlbumSetSlidingWindow implements AlbumSetDataLoader.DataListener {
entry.coverItem = cover;
if (getDataVersion(cover) != entry.coverDataVersion) {
entry.coverDataVersion = getDataVersion(cover);
- entry.isPanorama = GalleryUtils.isPanorama(cover);
entry.rotation = (cover == null) ? 0 : cover.getRotation();
- entry.mediaType = (cover == null) ? 0 : cover.getMediaType();
if (entry.coverLoader != null) {
entry.coverLoader.recycle();
entry.coverLoader = null;
diff --git a/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java b/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java
index 9b3f29f2b..233a8003d 100644
--- a/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java
+++ b/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java
@@ -170,14 +170,6 @@ public class AlbumSetSlotRenderer extends AbstractSlotRenderer {
renderRequestFlags |= SlotView.RENDER_MORE_FRAME;
}
- if (entry.mediaType == MediaObject.MEDIA_TYPE_VIDEO) {
- drawVideoOverlay(canvas, width, height);
- }
-
- if (entry.isPanorama) {
- drawPanoramaBorder(canvas, width, height);
- }
-
return renderRequestFlags;
}
diff --git a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java
index e4d636a7a..d3ad3048e 100644
--- a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java
+++ b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java
@@ -24,10 +24,11 @@ import com.android.gallery3d.app.AlbumDataLoader;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.data.BitmapPool;
import com.android.gallery3d.data.MediaItem;
+import com.android.gallery3d.data.MediaObject;
import com.android.gallery3d.data.Path;
+import com.android.gallery3d.data.MediaObject.PanoramaSupportCallback;
import com.android.gallery3d.util.Future;
import com.android.gallery3d.util.FutureListener;
-import com.android.gallery3d.util.GalleryUtils;
import com.android.gallery3d.util.JobLimiter;
public class AlbumSlidingWindow implements AlbumDataLoader.DataListener {
@@ -52,6 +53,7 @@ public class AlbumSlidingWindow implements AlbumDataLoader.DataListener {
public BitmapTexture bitmapTexture;
public Texture content;
private BitmapLoader contentLoader;
+ private PanoSupportListener mPanoSupportListener;
}
private final AlbumDataLoader mSource;
@@ -73,6 +75,18 @@ public class AlbumSlidingWindow implements AlbumDataLoader.DataListener {
private int mActiveRequestCount = 0;
private boolean mIsActive = false;
+ private class PanoSupportListener implements PanoramaSupportCallback {
+ public final AlbumEntry mEntry;
+ public PanoSupportListener (AlbumEntry entry) {
+ mEntry = entry;
+ }
+ @Override
+ public void panoramaInfoAvailable(MediaObject mediaObject, boolean isPanorama,
+ boolean isPanorama360) {
+ if (mEntry != null) mEntry.isPanorama = isPanorama;
+ }
+ }
+
public AlbumSlidingWindow(AbstractGalleryActivity activity,
AlbumDataLoader source, int cacheSize) {
source.setDataListener(this);
@@ -213,6 +227,10 @@ public class AlbumSlidingWindow implements AlbumDataLoader.DataListener {
AlbumEntry entry = mData[slotIndex % mData.length];
if (entry.content != null || entry.item == null) return false;
+ // Set up the panorama callback
+ entry.mPanoSupportListener = new PanoSupportListener(entry);
+ entry.item.getPanoramaSupport(entry.mPanoSupportListener);
+
entry.contentLoader.startLoad();
return entry.contentLoader.isRequestInProgress();
}
@@ -245,7 +263,6 @@ public class AlbumSlidingWindow implements AlbumDataLoader.DataListener {
AlbumEntry entry = new AlbumEntry();
MediaItem item = mSource.get(slotIndex); // item could be null;
entry.item = item;
- entry.isPanorama = GalleryUtils.isPanorama(entry.item);
entry.mediaType = (item == null)
? MediaItem.MEDIA_TYPE_UNKNOWN
: entry.item.getMediaType();
diff --git a/src/com/android/gallery3d/ui/AlbumSlotRenderer.java b/src/com/android/gallery3d/ui/AlbumSlotRenderer.java
index d9e3fb7ae..4bf10e7f3 100644
--- a/src/com/android/gallery3d/ui/AlbumSlotRenderer.java
+++ b/src/com/android/gallery3d/ui/AlbumSlotRenderer.java
@@ -123,7 +123,7 @@ public class AlbumSlotRenderer extends AbstractSlotRenderer {
}
if (entry.isPanorama) {
- drawPanoramaBorder(canvas, width, height);
+ drawPanoramaIcon(canvas, width, height);
}
renderRequestFlags |= renderOverlay(canvas, index, entry, width, height);