From 3e654bea0e26616b11166a37bbf7822aef25d2f0 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 12 Apr 2016 18:30:02 +0200 Subject: added share uri button to conference details --- .../ui/ConferenceDetailsActivity.java | 17 ++++++++++ src/main/res/drawable-hdpi/ic_action_share.png | Bin 0 -> 513 bytes src/main/res/drawable-hdpi/ic_share_white_24dp.png | Bin 0 -> 506 bytes src/main/res/drawable-mdpi/ic_action_share.png | Bin 0 -> 383 bytes src/main/res/drawable-mdpi/ic_share_white_24dp.png | Bin 0 -> 361 bytes src/main/res/drawable-xhdpi/ic_action_share.png | Bin 0 -> 666 bytes .../res/drawable-xhdpi/ic_share_white_24dp.png | Bin 0 -> 625 bytes src/main/res/drawable-xxhdpi/ic_action_share.png | Bin 0 -> 969 bytes .../res/drawable-xxhdpi/ic_share_white_24dp.png | Bin 0 -> 857 bytes .../res/drawable-xxxhdpi/ic_share_white_24dp.png | Bin 0 -> 1115 bytes src/main/res/menu/muc_details.xml | 35 ++++++++++++--------- src/main/res/values-v21/themes.xml | 1 + src/main/res/values/attrs.xml | 1 + src/main/res/values/strings.xml | 2 ++ src/main/res/values/themes.xml | 1 + 15 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 src/main/res/drawable-hdpi/ic_action_share.png create mode 100644 src/main/res/drawable-hdpi/ic_share_white_24dp.png create mode 100644 src/main/res/drawable-mdpi/ic_action_share.png create mode 100644 src/main/res/drawable-mdpi/ic_share_white_24dp.png create mode 100644 src/main/res/drawable-xhdpi/ic_action_share.png create mode 100644 src/main/res/drawable-xhdpi/ic_share_white_24dp.png create mode 100644 src/main/res/drawable-xxhdpi/ic_action_share.png create mode 100644 src/main/res/drawable-xxhdpi/ic_share_white_24dp.png create mode 100644 src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index adbb0953..a2757070 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -3,8 +3,10 @@ package eu.siacs.conversations.ui; import android.annotation.TargetApi; import android.app.AlertDialog; import android.app.PendingIntent; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.content.IntentSender.SendIntentException; import android.os.Build; import android.os.Bundle; @@ -281,6 +283,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers quickEdit(mConversation.getName(),this.onSubjectEdited); } break; + case R.id.action_share: + share(); + break; case R.id.action_save_as_bookmark: saveAsBookmark(); break; @@ -308,6 +313,18 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } } + private void share() { + Intent shareIntent = new Intent(); + shareIntent.setAction(Intent.ACTION_SEND); + shareIntent.putExtra(Intent.EXTRA_TEXT, getShareableUri()); + shareIntent.setType("text/plain"); + try { + startActivity(Intent.createChooser(shareIntent, getText(R.string.share_uri_with))); + } catch (ActivityNotFoundException e) { + Toast.makeText(this, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show(); + } + } + @Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem menuItemSaveBookmark = menu.findItem(R.id.action_save_as_bookmark); diff --git a/src/main/res/drawable-hdpi/ic_action_share.png b/src/main/res/drawable-hdpi/ic_action_share.png new file mode 100644 index 00000000..a36464b8 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_action_share.png differ diff --git a/src/main/res/drawable-hdpi/ic_share_white_24dp.png b/src/main/res/drawable-hdpi/ic_share_white_24dp.png new file mode 100644 index 00000000..93b3c219 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_share_white_24dp.png differ diff --git a/src/main/res/drawable-mdpi/ic_action_share.png b/src/main/res/drawable-mdpi/ic_action_share.png new file mode 100644 index 00000000..7362f0d7 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_action_share.png differ diff --git a/src/main/res/drawable-mdpi/ic_share_white_24dp.png b/src/main/res/drawable-mdpi/ic_share_white_24dp.png new file mode 100644 index 00000000..4d019722 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_share_white_24dp.png differ diff --git a/src/main/res/drawable-xhdpi/ic_action_share.png b/src/main/res/drawable-xhdpi/ic_action_share.png new file mode 100644 index 00000000..40771e48 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_action_share.png differ diff --git a/src/main/res/drawable-xhdpi/ic_share_white_24dp.png b/src/main/res/drawable-xhdpi/ic_share_white_24dp.png new file mode 100644 index 00000000..dd536bca Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_share_white_24dp.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_action_share.png b/src/main/res/drawable-xxhdpi/ic_action_share.png new file mode 100644 index 00000000..22ed428f Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_action_share.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_share_white_24dp.png b/src/main/res/drawable-xxhdpi/ic_share_white_24dp.png new file mode 100644 index 00000000..9963c6a0 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_share_white_24dp.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png b/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png new file mode 100644 index 00000000..bb521c14 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png differ diff --git a/src/main/res/menu/muc_details.xml b/src/main/res/menu/muc_details.xml index 51de4e75..ad79f577 100644 --- a/src/main/res/menu/muc_details.xml +++ b/src/main/res/menu/muc_details.xml @@ -1,5 +1,5 @@ - + + + + android:showAsAction="never" + android:title="@string/show_qr_code"/> + android:showAsAction="never" + android:title="@string/save_as_bookmark"/> - + android:showAsAction="never" + android:title="@string/delete_bookmark"/> + @drawable/ic_lock_open_white_24dp @drawable/ic_settings_grey600_24dp @drawable/ic_import_export_white_24dp + @drawable/ic_share_white_24dp diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml index d471e54a..901ea754 100644 --- a/src/main/res/values/attrs.xml +++ b/src/main/res/values/attrs.xml @@ -24,6 +24,7 @@ + \ No newline at end of file diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index e9e99730..97ba18af 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -612,4 +612,6 @@ Select image and crop You have disabled this account Security error: Invalid file access + No application found to share URI + Share URI with… diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index 0f8b95bb..424db4c9 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -30,6 +30,7 @@ @drawable/ic_action_secure @drawable/ic_action_settings @drawable/ic_stat_communication_import_export + @drawable/ic_action_share