diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2012-11-13 10:39:38 -0800 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2012-11-16 10:09:27 -0800 |
commit | 56f214d21ea696e8b5d721b64fa4958ab1bf6686 (patch) | |
tree | 750fcf7b8b26321152a2645bcfcf733c494639c5 /src | |
parent | 99996e3b7d581a25d12cad8c00740221f2e1d922 (diff) | |
download | android_packages_apps_Snap-56f214d21ea696e8b5d721b64fa4958ab1bf6686.tar.gz android_packages_apps_Snap-56f214d21ea696e8b5d721b64fa4958ab1bf6686.tar.bz2 android_packages_apps_Snap-56f214d21ea696e8b5d721b64fa4958ab1bf6686.zip |
Video: Fix crash in trimming/muting video in GB.
Basically switched to use sherlock actionbar and protect various new methods
with API level check.
bug:7546257
Change-Id: Ic16f75126c619578a9e9c2520fa264687d89a2e6
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/app/MuteVideo.java | 3 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/TrimControllerOverlay.java | 51 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/TrimVideo.java | 10 |
3 files changed, 35 insertions, 29 deletions
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(); |