From 9e82b64423fa935081a4035b1f6513cf342ace67 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 9 Mar 2017 17:37:24 +0100 Subject: [PATCH] Fix #4 - Toot URLs can be shared --- .../java/com/keylesspalace/tusky/SFragment.java | 9 +++++++-- .../com/keylesspalace/tusky/entity/Account.java | 2 ++ .../com/keylesspalace/tusky/entity/Status.java | 14 ++++++++++++++ app/src/main/res/menu/status_more.xml | 6 +++--- app/src/main/res/values/strings.xml | 2 ++ 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/SFragment.java b/app/src/main/java/com/keylesspalace/tusky/SFragment.java index e95d04cf..15ac7506 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/SFragment.java @@ -193,6 +193,7 @@ public class SFragment extends Fragment { final String accountId = status.getActionableStatus().account.id; final String accountUsename = status.getActionableStatus().account.username; final Spanned content = status.getActionableStatus().content; + final String statusUrl = status.getActionableStatus().url; PopupMenu popup = new PopupMenu(getContext(), view); // Give a different menu depending on whether this is the user's own toot or not. if (loggedInAccountId == null || !loggedInAccountId.equals(accountId)) { @@ -205,8 +206,12 @@ public class SFragment extends Fragment { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { - case R.id.status_follow: { - follow(accountId); + case R.id.status_share: { + 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))); return true; } case R.id.status_block: { diff --git a/app/src/main/java/com/keylesspalace/tusky/entity/Account.java b/app/src/main/java/com/keylesspalace/tusky/entity/Account.java index 6f03b030..d091512e 100644 --- a/app/src/main/java/com/keylesspalace/tusky/entity/Account.java +++ b/app/src/main/java/com/keylesspalace/tusky/entity/Account.java @@ -36,6 +36,8 @@ public class Account { public String header; + public boolean locked; + @SerializedName("followers_count") public String followersCount; diff --git a/app/src/main/java/com/keylesspalace/tusky/entity/Status.java b/app/src/main/java/com/keylesspalace/tusky/entity/Status.java index 72c6682e..39378ee9 100644 --- a/app/src/main/java/com/keylesspalace/tusky/entity/Status.java +++ b/app/src/main/java/com/keylesspalace/tusky/entity/Status.java @@ -24,6 +24,20 @@ import java.util.Date; public class Status { private Status actionableStatus; + public String url; + + @SerializedName("reblogs_count") + public String reblogsCount; + + @SerializedName("favourites_count") + public String favouritesCount; + + @SerializedName("in_reply_to_id") + public String inReplyToId; + + @SerializedName("in_reply_to_account_id") + public String inReplyToAccountId; + public String getActionableId() { return reblog == null ? id : reblog.id; } diff --git a/app/src/main/res/menu/status_more.xml b/app/src/main/res/menu/status_more.xml index 6886ea86..33617c9d 100644 --- a/app/src/main/res/menu/status_more.xml +++ b/app/src/main/res/menu/status_more.xml @@ -1,8 +1,8 @@ - - + Add media Privacy options Welcome back! + Share + Share toot URL to...