summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2015-01-12 02:40:53 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2015-01-12 02:40:53 -0800
commit8fe224d377b8731dcecc33d88d514445caee22b7 (patch)
tree9a95784b999fc1db577e3001b1ec4f04ef1a576b
parent1a260764f4442a3e6c3277ff9e882f160a10334d (diff)
parent3be69402630daac812f32ee152fd0d536b74e39e (diff)
downloadandroid_packages_apps_Gallery2-8fe224d377b8731dcecc33d88d514445caee22b7.tar.gz
android_packages_apps_Gallery2-8fe224d377b8731dcecc33d88d514445caee22b7.tar.bz2
android_packages_apps_Gallery2-8fe224d377b8731dcecc33d88d514445caee22b7.zip
Merge "Gallery2: Fix force close issue when trim video"
-rw-r--r--res/values/strings.xml1
-rwxr-xr-xsrc/com/android/gallery3d/app/PhotoPage.java12
2 files changed, 11 insertions, 2 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7f347a1d6..7fe8fb2e0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1146,4 +1146,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 fb2b4ae1f..bfd4528e4 100755
--- 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;
@@ -1108,8 +1109,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: {