diff options
Diffstat (limited to 'src/com/android/gallery3d/ui')
-rw-r--r-- | src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java | 14 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java | 4 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/AlbumSlidingWindow.java | 13 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/MenuExecutor.java | 31 | ||||
-rwxr-xr-x | src/com/android/gallery3d/ui/PhotoView.java | 28 |
5 files changed, 39 insertions, 51 deletions
diff --git a/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java b/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java index 641115138..8149df4b3 100644 --- a/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java +++ b/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java @@ -24,7 +24,6 @@ import com.android.gallery3d.app.AbstractGalleryActivity; import com.android.gallery3d.app.AlbumSetDataLoader; import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.DataSourceType; -import com.android.gallery3d.data.LocalMediaItem; import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.data.MediaSet; @@ -81,7 +80,6 @@ public class AlbumSetSlidingWindow implements AlbumSetDataLoader.DataListener { public Path setPath; public String title; public int totalCount; - public int mediaType; public int sourceType; public int cacheFlag; public int cacheStatus; @@ -277,18 +275,6 @@ public class AlbumSetSlidingWindow implements AlbumSetDataLoader.DataListener { if (getDataVersion(cover) != entry.coverDataVersion) { entry.coverDataVersion = getDataVersion(cover); entry.rotation = (cover == null) ? 0 : cover.getRotation(); - - if (cover instanceof LocalMediaItem) { - String filePath = ((LocalMediaItem) cover).filePath; - if (filePath != null && (filePath.endsWith(".dcf") || filePath.endsWith(".dm"))) { - if (entry.mediaType == MediaObject.MEDIA_TYPE_IMAGE) { - entry.mediaType = MediaObject.MEDIA_TYPE_DRM_IMAGE; - } else if (entry.mediaType == MediaObject.MEDIA_TYPE_VIDEO) { - entry.mediaType = MediaObject.MEDIA_TYPE_DRM_VIDEO; - } - } - } - 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 37f9b4339..46daf1451 100644 --- a/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java +++ b/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java @@ -183,10 +183,6 @@ public class AlbumSetSlotRenderer extends AbstractSlotRenderer { ((FadeInTexture) content).isAnimating()) { renderRequestFlags |= SlotView.RENDER_MORE_FRAME; } - if ((entry.mediaType == MediaObject.MEDIA_TYPE_DRM_VIDEO) - || (entry.mediaType == MediaObject.MEDIA_TYPE_DRM_IMAGE)) { - drawDrmOverlay(canvas, width, height, entry.mediaType); - } return renderRequestFlags; } diff --git a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java index a534c6add..fec7d1e92 100644 --- a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java +++ b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java @@ -24,7 +24,6 @@ import com.android.gallery3d.app.AlbumDataLoader; import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; -import com.android.gallery3d.data.LocalMediaItem; import com.android.gallery3d.data.MediaObject.PanoramaSupportCallback; import com.android.gallery3d.data.Path; import com.android.gallery3d.glrenderer.Texture; @@ -268,18 +267,6 @@ public class AlbumSlidingWindow implements AlbumDataLoader.DataListener { entry.mediaType = (item == null) ? MediaItem.MEDIA_TYPE_UNKNOWN : entry.item.getMediaType(); - - if (item instanceof LocalMediaItem) { - String filePath = ((LocalMediaItem)item).filePath; - if (filePath != null && (filePath.endsWith(".dcf") || filePath.endsWith(".dm"))) { - if (entry.mediaType == MediaObject.MEDIA_TYPE_IMAGE) { - entry.mediaType = MediaObject.MEDIA_TYPE_DRM_IMAGE; - } else if (entry.mediaType == MediaObject.MEDIA_TYPE_VIDEO) { - entry.mediaType = MediaObject.MEDIA_TYPE_DRM_VIDEO; - } - } - } - entry.path = (item == null) ? null : item.getPath(); entry.rotation = (item == null) ? 0 : item.getRotation(); entry.contentLoader = new ThumbnailLoader(slotIndex, entry.item); diff --git a/src/com/android/gallery3d/ui/MenuExecutor.java b/src/com/android/gallery3d/ui/MenuExecutor.java index 00a1459b0..9b2c3259c 100644 --- a/src/com/android/gallery3d/ui/MenuExecutor.java +++ b/src/com/android/gallery3d/ui/MenuExecutor.java @@ -24,11 +24,10 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; import android.content.Intent; -import android.database.Cursor; +import android.drm.DrmHelper; import android.net.Uri; import android.os.Handler; import android.os.Message; -import android.provider.MediaStore.Video.VideoColumns; import android.support.v4.print.PrintHelper; import android.view.Menu; import android.view.MenuItem; @@ -258,6 +257,14 @@ public class MenuExecutor { Intent intent = getIntentBySingleSelectedPath(Intent.ACTION_ATTACH_DATA) .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.putExtra("mimeType", intent.getType()); + + // DRM files can be set as wallpaper only. Don't show other options + // to set as. + Uri uri = intent.getData(); + if (DrmHelper.isDrmFile(DrmHelper.getFilePath(mActivity, uri))) { + intent.setPackage("com.android.gallery3d"); + } + Activity activity = mActivity; activity.startActivity(Intent.createChooser( intent, activity.getString(R.string.set_as))); @@ -279,30 +286,14 @@ public class MenuExecutor { DataManager manager = mActivity.getDataManager(); Path path = getSingleSelectedPath(); Uri uri = manager.getContentUri(path); - Log.d(TAG, "onMenuClicked:" + uri); String filepath = null; String scheme = uri.getScheme(); if ("file".equals(scheme)) { filepath = uri.getPath(); } else { - Cursor cursor = null; - try { - cursor = mActivity.getAndroidContext().getContentResolver().query(uri, - new String[] {VideoColumns.DATA}, null, null, null); - if (cursor != null && cursor.moveToNext()) { - filepath = cursor.getString(0); - } - } catch (Throwable t) { - Log.w(TAG, "cannot get path from: " + uri); - } finally { - if (cursor != null) cursor.close(); - } + filepath = DrmHelper.getFilePath(mActivity, uri); } - Intent drmintent = new Intent("android.drmservice.intent.action.SHOW_PROPERTIES"); - filepath = filepath.replace("/storage/emulated/0", "/storage/emulated/legacy"); - drmintent.putExtra("DRM_FILE_PATH", filepath); - drmintent.putExtra("DRM_TYPE", "OMAV1"); - mActivity.getAndroidContext().sendBroadcast(drmintent); + DrmHelper.showDrmInfo(mActivity, filepath); title = R.string.drm_license_info; break; default: diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java index c55f84a21..1fff4ea3e 100755 --- a/src/com/android/gallery3d/ui/PhotoView.java +++ b/src/com/android/gallery3d/ui/PhotoView.java @@ -18,6 +18,7 @@ package com.android.gallery3d.ui; import android.content.Context; import android.content.res.Configuration; +import android.drm.DrmHelper; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Rect; @@ -204,6 +205,7 @@ public class PhotoView extends GLView { private EdgeView mEdgeView; private UndoBarView mUndoBar; private Texture mVideoPlayIcon; + private Texture mDrmIcon; private SynchronizedHandler mHandler; @@ -307,6 +309,7 @@ public class PhotoView extends GLView { } }); mVideoPlayIcon = new ResourceTexture(mContext, R.drawable.ic_control_play); + mDrmIcon = new ResourceTexture(mContext, R.drawable.drm_image); for (int i = -SCREEN_NAIL_MAX; i <= SCREEN_NAIL_MAX; i++) { if (i == 0) { mPictures.put(i, new FullPicture()); @@ -741,6 +744,15 @@ public class PhotoView extends GLView { drawLoadingFailMessage(canvas); } + if (getFilmMode()) { + MediaItem item = mModel.getMediaItem(0); + if (item != null) { + if (DrmHelper.isDrmFile(item.getFilePath())) { + drawDrmIcon(canvas, s); + } + } + } + // Draw a debug indicator showing which picture has focus (index == // 0). //canvas.fillRect(-10, -10, 20, 20, 0x80FF00FF); @@ -858,9 +870,18 @@ public class PhotoView extends GLView { if (mModel.isVideo(mIndex) || mModel.isGif(mIndex)) { drawVideoPlayIcon(canvas, s); } + if (mLoadingState == Model.LOADING_FAIL ) { drawLoadingFailMessage(canvas); } + + MediaItem item = mModel.getMediaItem(mIndex); + if (item != null) { + if (DrmHelper.isDrmFile(item.getFilePath())) { + drawDrmIcon(canvas, s); + } + } + canvas.restore(); } @@ -927,6 +948,13 @@ public class PhotoView extends GLView { mVideoPlayIcon.draw(canvas, -s / 2, -s / 2, s, s); } + // Draw the Drm lock icon (in the place where the spinner was) + private void drawDrmIcon(GLCanvas canvas, int side) { + int s = side / ICON_RATIO; + // Draw the Drm lock icon at the center + mDrmIcon.draw(canvas, -s / 2, -s / 2, s, s); + } + // Draw the "no thumbnail" message private void drawLoadingFailMessage(GLCanvas canvas) { StringTexture m = mNoThumbnailText; |