summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorRay Chen <raychen@google.com>2011-10-11 11:37:18 +0800
committerRay Chen <raychen@google.com>2011-10-11 12:53:13 +0800
commit3539b1c7f4e75846a4950ad54295c36ae5aa7da1 (patch)
treebdb78dfedc28a7aed0d2f84630e4c2c4ea171a05 /src/com/android
parent9d62da7986aef9d89356f6b169fafecd8936d9f6 (diff)
downloadandroid_packages_apps_Snap-3539b1c7f4e75846a4950ad54295c36ae5aa7da1.tar.gz
android_packages_apps_Snap-3539b1c7f4e75846a4950ad54295c36ae5aa7da1.tar.bz2
android_packages_apps_Snap-3539b1c7f4e75846a4950ad54295c36ae5aa7da1.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')
-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();