summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--[-rwxr-xr-x]res/values/strings.xml1
-rw-r--r--[-rwxr-xr-x]src/com/android/gallery3d/app/PhotoPage.java11
2 files changed, 10 insertions, 2 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ed77dbbe9..d17f4a39b 100755..100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1117,4 +1117,5 @@ CHAR LIMIT = NONE] -->
<!-- The title of the audio effects dialog. -->
<string name="audio_effects_dialog_title">Snapdragon Audio+</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 16f4fa5bb..37a03c984 100755..100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -1069,8 +1069,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 = 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: {