summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiaoqiny <quic_xiaoqiny@codeaurora.org>2014-12-25 13:39:42 +0800
committerxiaoqiny <quic_xiaoqiny@codeaurora.org>2014-12-25 14:48:13 +0800
commit3be69402630daac812f32ee152fd0d536b74e39e (patch)
tree708246d7b6c56068ccf1e425204ebbd568eb1e12
parentc5a7c07ed3c4ff8a08078ab510429d093b90f732 (diff)
downloadandroid_packages_apps_Gallery2-3be69402630daac812f32ee152fd0d536b74e39e.tar.gz
android_packages_apps_Gallery2-3be69402630daac812f32ee152fd0d536b74e39e.tar.bz2
android_packages_apps_Gallery2-3be69402630daac812f32ee152fd0d536b74e39e.zip
Gallery2: Fix force close issue when trim video
- Only mp4 and 3gp file support trim function Change-Id: I6e254ca6d5445d62b0276695667f4bdb07f9a59c CRs-Fixed: 652838
-rw-r--r--Android.mk2
-rw-r--r--proguard.flags4
-rw-r--r--res/values/strings.xml1
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java12
4 files changed, 16 insertions, 3 deletions
diff --git a/Android.mk b/Android.mk
index 3d5663e6b..ef218f735 100644
--- a/Android.mk
+++ b/Android.mk
@@ -31,7 +31,7 @@ LOCAL_PACKAGE_NAME := Gallery2
LOCAL_OVERRIDES_PACKAGES := Gallery Gallery3D GalleryNew3D
-LOCAL_SDK_VERSION := current
+#LOCAL_SDK_VERSION := current
LOCAL_JNI_SHARED_LIBRARIES := libjni_eglfence libjni_filtershow_filters librsjni libjni_jpegstream
diff --git a/proguard.flags b/proguard.flags
index 65104ec1e..fc5aef3b7 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -1,6 +1,10 @@
# Disable the warnings of using dynamic method call in common library.
-dontnote com.android.gallery3d.common.*
+#Avoid the library class dependency error
+-dontwarn android.view.inputmethod.InputMethodManager
+-dontwarn android.content.res.Resources
+
# Keep all classes extended from com.android.gallery3d.common.Entry
# Since we annotate on the fields and use reflection to create SQL
# according to those field.
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e19f95082..fedb64f69 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1121,4 +1121,5 @@ CHAR LIMIT = NONE] -->
<!-- The tips of trimming video -->
<string name="fail_trim">Sorry, this video file can not be trimmed</string>
+ <string name="can_not_trim">Only mp4 and 3gp file can be trimmed</string>
</resources>
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 915fdab5a..2fed32f88 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -25,6 +25,7 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Rect;
+import android.media.MediaFile;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.nfc.NfcAdapter.CreateBeamUrisCallback;
@@ -1057,8 +1058,15 @@ public abstract class PhotoPage extends ActivityState implements
Intent intent = new Intent(mActivity, TrimVideo.class);
intent.setData(manager.getContentUri(path));
// We need the file path to wrap this into a RandomAccessFile.
- intent.putExtra(KEY_MEDIA_ITEM_PATH, current.getFilePath());
- mActivity.startActivityForResult(intent, REQUEST_TRIM);
+ String str = android.media.MediaFile.getMimeTypeForFile(current.getFilePath());
+ if("video/mp4".equals(str) || "video/mpeg4".equals(str)
+ || "video/3gpp".equals(str) || "video/3gpp2".equals(str)) {
+ intent.putExtra(KEY_MEDIA_ITEM_PATH, current.getFilePath());
+ mActivity.startActivityForResult(intent, REQUEST_TRIM);
+ } else {
+ Toast.makeText(mActivity,mActivity.getString(R.string.can_not_trim),
+ Toast.LENGTH_SHORT).show();
+ }
return true;
}
case R.id.action_mute: {