diff options
author | Ray Chen <raychen@google.com> | 2011-10-11 11:37:18 +0800 |
---|---|---|
committer | Ray Chen <raychen@google.com> | 2011-10-11 12:53:13 +0800 |
commit | e6e4beb069778fafd053552287e36304df5626eb (patch) | |
tree | 3d5bd35eec4eec9b2f186f55d17cbb0dcd34d281 /src/com/android/gallery3d/app/MovieActivity.java | |
parent | b8c9dc320431c08404fdfa7e1e470d9df61b318f (diff) | |
download | android_packages_apps_Gallery2-e6e4beb069778fafd053552287e36304df5626eb.tar.gz android_packages_apps_Gallery2-e6e4beb069778fafd053552287e36304df5626eb.tar.bz2 android_packages_apps_Gallery2-e6e4beb069778fafd053552287e36304df5626eb.zip |
Fix 5434523 No affordance in Gallery to share a video other than long-press in album view
Change-Id: I99361fa209ee5ba4200ccb8c1708f649c04519c2
Diffstat (limited to 'src/com/android/gallery3d/app/MovieActivity.java')
-rw-r--r-- | src/com/android/gallery3d/app/MovieActivity.java | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/app/MovieActivity.java b/src/com/android/gallery3d/app/MovieActivity.java index ef836fe70..58b1b088c 100644 --- a/src/com/android/gallery3d/app/MovieActivity.java +++ b/src/com/android/gallery3d/app/MovieActivity.java @@ -16,21 +16,24 @@ package com.android.gallery3d.app; -import com.android.gallery3d.R; - import android.app.ActionBar; import android.app.Activity; import android.content.Intent; import android.content.pm.ActivityInfo; import android.database.Cursor; import android.media.AudioManager; +import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.provider.MediaStore.Video.VideoColumns; +import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import android.view.WindowManager; +import android.widget.ShareActionProvider; + +import com.android.gallery3d.R; /** * This activity plays a video from a specified URI. @@ -41,6 +44,7 @@ public class MovieActivity extends Activity { private MoviePlayer mPlayer; private boolean mFinishOnCompletion; + private Uri mUri; @Override public void onCreate(Bundle savedInstanceState) { @@ -82,10 +86,11 @@ public class MovieActivity extends Activity { actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP); String title = intent.getStringExtra(Intent.EXTRA_TITLE); + mUri = intent.getData(); if (title == null) { Cursor cursor = null; try { - cursor = getContentResolver().query(intent.getData(), + cursor = getContentResolver().query(mUri, new String[] {VideoColumns.TITLE}, null, null, null); if (cursor != null && cursor.moveToNext()) { title = cursor.getString(0); @@ -100,6 +105,23 @@ public class MovieActivity extends Activity { } @Override + public boolean onCreateOptionsMenu(Menu menu) { + super.onCreateOptionsMenu(menu); + + getMenuInflater().inflate(R.menu.movie, menu); + ShareActionProvider provider = GalleryActionBar.initializeShareActionProvider(menu); + + if (provider != null) { + Intent intent = new Intent(Intent.ACTION_SEND); + intent.setType("video/*"); + intent.putExtra(Intent.EXTRA_STREAM, mUri); + provider.setShareIntent(intent); + } + + return true; + } + + @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { finish(); |