summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui/PhotoView.java
diff options
context:
space:
mode:
authorParamananda <parama@codeaurora.org>2015-03-24 17:51:29 +0530
committerRicardo Cerqueira <ricardo@cyngn.com>2015-09-15 21:31:49 +0100
commit01f5f347cf33813b51bd0865dc620d001c8d8735 (patch)
treef4176c8179058a09fe95700f03273c676e593103 /src/com/android/gallery3d/ui/PhotoView.java
parent43044da1965c1b687695f3f4e1d44d3636496978 (diff)
downloadandroid_packages_apps_Gallery2-01f5f347cf33813b51bd0865dc620d001c8d8735.tar.gz
android_packages_apps_Gallery2-01f5f347cf33813b51bd0865dc620d001c8d8735.tar.bz2
android_packages_apps_Gallery2-01f5f347cf33813b51bd0865dc620d001c8d8735.zip
Gallery2 : Uses internal Drm image decoder api in Gallery app
- Remove all previous drm implementation which is basically uses base bitmap decode apis to decode drm image files. - Introduced new hidden apis on BitmapFactory and BitmapRegionDecoder specific to DRM content which is more practical to DRM framework. - Uses DrmHelper a utility drm api library to code reusability. - This approch will fix the issue on sharing images from Third party application. CRs-fixed : 804191 Change-Id: I2e9489800c57df4fdeeb21f1548fbccc6dfbd3f9
Diffstat (limited to 'src/com/android/gallery3d/ui/PhotoView.java')
-rwxr-xr-xsrc/com/android/gallery3d/ui/PhotoView.java28
1 files changed, 28 insertions, 0 deletions
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;