Add forward button to MediaPreview

Closes #5833
Related to #4906
// FREEBIE
This commit is contained in:
FeuRenard 2016-11-03 00:03:03 +01:00 committed by Moxie Marlinspike
parent 0945b19364
commit a3244de587
3 changed files with 15 additions and 2 deletions

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/media_preview__forward"
android:title="@string/media_preview__forward_title"
android:icon="@drawable/ic_forward_white_24dp"
app:showAsAction="always"/>
<item android:id="@+id/save" <item android:id="@+id/save"
android:title="@string/media_preview__save_title" android:title="@string/media_preview__save_title"
android:icon="@drawable/ic_save_white_24dp" android:icon="@drawable/ic_save_white_24dp"

View File

@ -1237,6 +1237,7 @@
<!-- media_preview --> <!-- media_preview -->
<string name="media_preview__save_title">Save</string> <string name="media_preview__save_title">Save</string>
<string name="media_preview__forward_title">Forward</string>
<!-- media_overview --> <!-- media_overview -->
<string name="media_overview__save_all">Save all</string> <string name="media_overview__save_all">Save all</string>

View File

@ -166,6 +166,13 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity im
image.setImageDrawable(null); image.setImageDrawable(null);
} }
private void forward() {
Intent composeIntent = new Intent(this, ShareActivity.class);
composeIntent.putExtra(Intent.EXTRA_STREAM, mediaUri);
composeIntent.setType(mediaType);
startActivity(composeIntent);
}
private void saveToDisk() { private void saveToDisk() {
SaveAttachmentTask.showWarningDialog(this, new DialogInterface.OnClickListener() { SaveAttachmentTask.showWarningDialog(this, new DialogInterface.OnClickListener() {
@Override @Override
@ -192,6 +199,7 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity im
super.onOptionsItemSelected(item); super.onOptionsItemSelected(item);
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.media_preview__forward: forward(); return true;
case R.id.save: saveToDisk(); return true; case R.id.save: saveToDisk(); return true;
case android.R.id.home: finish(); return true; case android.R.id.home: finish(); return true;
} }