diff options
author | Chih-Chung Chang <chihchung@google.com> | 2011-09-21 15:38:35 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2011-09-21 15:38:35 +0800 |
commit | 3f0de57839c38f8e4b29b8d353f26325b681aa81 (patch) | |
tree | f42592e9b7418aff77f5da5e3cec6692d50f370f /src/com/android/gallery3d | |
parent | 32a8c908d1ad9e1562d3daab08980b84dffe3cf6 (diff) | |
download | android_packages_apps_Snap-3f0de57839c38f8e4b29b8d353f26325b681aa81.tar.gz android_packages_apps_Snap-3f0de57839c38f8e4b29b8d353f26325b681aa81.tar.bz2 android_packages_apps_Snap-3f0de57839c38f8e4b29b8d353f26325b681aa81.zip |
Fix 5229466: Add "up" button to MovieActivity
Change-Id: I5d71bec7a7b09553c12afdd753cd77a73ace2c44
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r-- | src/com/android/gallery3d/app/MovieActivity.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/app/MovieActivity.java b/src/com/android/gallery3d/app/MovieActivity.java index d0383aa35..6bc6fdc44 100644 --- a/src/com/android/gallery3d/app/MovieActivity.java +++ b/src/com/android/gallery3d/app/MovieActivity.java @@ -27,6 +27,7 @@ import android.media.AudioManager; import android.os.Bundle; import android.provider.MediaStore; import android.provider.MediaStore.Video.VideoColumns; +import android.view.MenuItem; import android.view.View; import android.view.Window; import android.view.WindowManager; @@ -51,7 +52,7 @@ public class MovieActivity extends Activity { setContentView(R.layout.movie_view); View rootView = findViewById(R.id.root); Intent intent = getIntent(); - setVideoTitle(intent); + initializeActionBar(intent); mPlayer = new MoviePlayer(rootView, this, intent.getData(), savedInstanceState) { @Override public void onCompletion() { @@ -75,7 +76,10 @@ public class MovieActivity extends Activity { win.setAttributes(winParams); } - private void setVideoTitle(Intent intent) { + private void initializeActionBar(Intent intent) { + ActionBar actionBar = getActionBar(); + actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, + ActionBar.DISPLAY_HOME_AS_UP); String title = intent.getStringExtra(Intent.EXTRA_TITLE); if (title == null) { Cursor cursor = null; @@ -91,8 +95,16 @@ public class MovieActivity extends Activity { if (cursor != null) cursor.close(); } } - ActionBar actionBar = getActionBar(); - if (title != null && actionBar != null) actionBar.setTitle(title); + if (title != null) actionBar.setTitle(title); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } + return false; } @Override |