summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/ApiHelper.java3
-rw-r--r--src/com/android/gallery3d/app/MuteVideo.java3
-rw-r--r--src/com/android/gallery3d/app/TrimControllerOverlay.java51
-rw-r--r--src/com/android/gallery3d/app/TrimVideo.java10
4 files changed, 38 insertions, 29 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
index c13e81e64..e0432749e 100644
--- a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
+++ b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
@@ -173,6 +173,9 @@ public class ApiHelper {
public static final boolean HAS_ANNOUNCE_FOR_ACCESSIBILITY =
Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN;
+ public static final boolean HAS_OBJECT_ANIMATION =
+ Build.VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB;
+
public static int getIntFieldIfExists(Class<?> klass, String fieldName,
Class<?> obj, int defaultVal) {
try {
diff --git a/src/com/android/gallery3d/app/MuteVideo.java b/src/com/android/gallery3d/app/MuteVideo.java
index fbb1804fb..012b682ef 100644
--- a/src/com/android/gallery3d/app/MuteVideo.java
+++ b/src/com/android/gallery3d/app/MuteVideo.java
@@ -83,8 +83,7 @@ public class MuteVideo {
// Show the result only when the activity not
// stopped.
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
- intent.setDataAndTypeAndNormalize(
- Uri.fromFile(mDstFileInfo.mFile), "video/*");
+ intent.setDataAndType(Uri.fromFile(mDstFileInfo.mFile), "video/*");
intent.putExtra(MediaStore.EXTRA_FINISH_ON_COMPLETION, false);
mActivity.startActivity(intent);
}
diff --git a/src/com/android/gallery3d/app/TrimControllerOverlay.java b/src/com/android/gallery3d/app/TrimControllerOverlay.java
index 9127ad159..cae016626 100644
--- a/src/com/android/gallery3d/app/TrimControllerOverlay.java
+++ b/src/com/android/gallery3d/app/TrimControllerOverlay.java
@@ -23,6 +23,8 @@ import android.content.Context;
import android.view.MotionEvent;
import android.view.View;
+import com.android.gallery3d.common.ApiHelper;
+
/**
* The controller for the Trimming Video.
*/
@@ -41,36 +43,41 @@ public class TrimControllerOverlay extends CommonControllerOverlay {
if (mState == State.PLAYING) {
mPlayPauseReplayView.setVisibility(View.INVISIBLE);
}
- mPlayPauseReplayView.setAlpha(1f);
+ if (ApiHelper.HAS_OBJECT_ANIMATION) {
+ mPlayPauseReplayView.setAlpha(1f);
+ }
}
@Override
public void showPlaying() {
super.showPlaying();
+ if (ApiHelper.HAS_OBJECT_ANIMATION) {
+ // Add animation to hide the play button while playing.
+ ObjectAnimator anim = ObjectAnimator.ofFloat(mPlayPauseReplayView, "alpha", 1f, 0f);
+ anim.setDuration(200);
+ anim.start();
+ anim.addListener(new AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ }
- // Add animation to hide the play button while playing.
- ObjectAnimator anim = ObjectAnimator.ofFloat(mPlayPauseReplayView, "alpha", 1f, 0f);
- anim.setDuration(200);
- anim.start();
- anim.addListener(new AnimatorListener() {
- @Override
- public void onAnimationStart(Animator animation) {
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
- hidePlayButtonIfPlaying();
- }
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ hidePlayButtonIfPlaying();
+ }
- @Override
- public void onAnimationCancel(Animator animation) {
- hidePlayButtonIfPlaying();
- }
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ hidePlayButtonIfPlaying();
+ }
- @Override
- public void onAnimationRepeat(Animator animation) {
- }
- });
+ @Override
+ public void onAnimationRepeat(Animator animation) {
+ }
+ });
+ } else {
+ hidePlayButtonIfPlaying();
+ }
}
@Override
diff --git a/src/com/android/gallery3d/app/TrimVideo.java b/src/com/android/gallery3d/app/TrimVideo.java
index 9187ee80c..7a76be5dc 100644
--- a/src/com/android/gallery3d/app/TrimVideo.java
+++ b/src/com/android/gallery3d/app/TrimVideo.java
@@ -16,8 +16,6 @@
package com.android.gallery3d.app;
-import android.app.ActionBar;
-import android.app.Activity;
import android.app.ProgressDialog;
import android.content.ContentResolver;
import android.content.ContentValues;
@@ -39,6 +37,8 @@ import android.widget.TextView;
import android.widget.Toast;
import android.widget.VideoView;
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.SherlockActivity;
import com.android.gallery3d.R;
import com.android.gallery3d.util.BucketNames;
import com.android.gallery3d.util.SaveVideoFileInfo;
@@ -49,7 +49,7 @@ import java.io.IOException;
import java.sql.Date;
import java.text.SimpleDateFormat;
-public class TrimVideo extends Activity implements
+public class TrimVideo extends SherlockActivity implements
MediaPlayer.OnErrorListener,
MediaPlayer.OnCompletionListener,
ControllerOverlay.Listener {
@@ -84,7 +84,7 @@ public class TrimVideo extends Activity implements
requestWindowFeature(Window.FEATURE_ACTION_BAR);
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
- ActionBar actionBar = getActionBar();
+ ActionBar actionBar = getSupportActionBar();
int displayOptions = ActionBar.DISPLAY_SHOW_HOME;
actionBar.setDisplayOptions(0, displayOptions);
displayOptions = ActionBar.DISPLAY_SHOW_CUSTOM;
@@ -268,7 +268,7 @@ public class TrimVideo extends Activity implements
mProgress = null;
// Show the result only when the activity not stopped.
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
- intent.setDataAndTypeAndNormalize(Uri.fromFile(mDstFileInfo.mFile), "video/*");
+ intent.setDataAndType(Uri.fromFile(mDstFileInfo.mFile), "video/*");
intent.putExtra(MediaStore.EXTRA_FINISH_ON_COMPLETION, false);
startActivity(intent);
finish();