From 52343b6ab2bacd5034059b52dadf3ed62ca2030e Mon Sep 17 00:00:00 2001 From: Zachary Epps Date: Wed, 12 Apr 2017 16:21:48 -0400 Subject: [PATCH] changed the share button menu to allow for sharing either the link, or the actual content of the post added values into @string file to accommodate for the change added the new share submenu into the status_more layout xml --- .../com/keylesspalace/tusky/SFragment.java | 21 +++++++++++++++---- app/src/main/res/menu/status_more.xml | 11 +++++++++- app/src/main/res/values/strings.xml | 5 ++++- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/SFragment.java b/app/src/main/java/com/keylesspalace/tusky/SFragment.java index f18f07f0..45217324 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/SFragment.java @@ -182,8 +182,8 @@ public class SFragment extends BaseFragment { callList.add(call); } - protected void more(Status status, View view, final AdapterItemRemover adapter, - final int position) { + protected void more(final Status status, View view, final AdapterItemRemover adapter, + final int position) { final String id = status.getActionableId(); final String accountId = status.getActionableStatus().account.id; final String accountUsename = status.getActionableStatus().account.username; @@ -201,12 +201,25 @@ public class SFragment extends BaseFragment { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { - case R.id.status_share: { + case R.id.status_share_content: { + StringBuilder sb = new StringBuilder(); + sb.append(status.account.username); + sb.append(" - "); + sb.append(status.content.toString()); + + Intent sendIntent = new Intent(); + sendIntent.setAction(Intent.ACTION_SEND); + sendIntent.putExtra(Intent.EXTRA_TEXT, sb.toString()); + sendIntent.setType("text/plain"); + startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_status_content_to))); + return true; + } + case R.id.status_share_link: { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, statusUrl); sendIntent.setType("text/plain"); - startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_status_to))); + startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_status_link_to))); return true; } case R.id.status_block: { diff --git a/app/src/main/res/menu/status_more.xml b/app/src/main/res/menu/status_more.xml index 33617c9d..48159d7b 100644 --- a/app/src/main/res/menu/status_more.xml +++ b/app/src/main/res/menu/status_more.xml @@ -2,7 +2,16 @@ + android:title="@string/action_share"> + + + + + NSFW Options - Share toot URL to… + Share toot URL to… + Share toot to… Search accounts… @@ -137,5 +138,7 @@ %d new interactions Locked Account + Share content of toot + Share link to toot