summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorRay Chen <raychen@google.com>2011-10-12 21:23:32 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-12 21:23:32 -0700
commit6fca4a3fb1b707bfd7c9b7c65cfad086e6bc7868 (patch)
tree0093b7e8fb5b66f169dba15c5321039d7c053844 /src/com/android
parentd077e2524a49ea66e8d003020172b659158358f0 (diff)
parent3539b1c7f4e75846a4950ad54295c36ae5aa7da1 (diff)
downloadandroid_packages_apps_Snap-6fca4a3fb1b707bfd7c9b7c65cfad086e6bc7868.tar.gz
android_packages_apps_Snap-6fca4a3fb1b707bfd7c9b7c65cfad086e6bc7868.tar.bz2
android_packages_apps_Snap-6fca4a3fb1b707bfd7c9b7c65cfad086e6bc7868.zip
Merge "Fix 5434523 No affordance in Gallery to share a video other than long-press in album view"
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/gallery3d/app/MovieActivity.java28
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();