Fix #4 - Toot URLs can be shared

This commit is contained in:
Eugen Rochko 2017-03-09 17:37:24 +01:00
parent 636c2f266e
commit 9e82b64423
5 changed files with 28 additions and 5 deletions

View file

@ -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: {

View file

@ -36,6 +36,8 @@ public class Account {
public String header;
public boolean locked;
@SerializedName("followers_count")
public String followersCount;

View file

@ -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;
}

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/status_follow"
android:title="@string/action_follow" />
<item
android:id="@+id/status_share"
android:title="@string/action_share"/>
<item android:title="@string/action_block"
android:id="@+id/status_block" />
<item android:title="@string/action_report"

View file

@ -156,5 +156,7 @@
<string name="action_photo_pick">Add media</string>
<string name="action_compose_options">Privacy options</string>
<string name="login_success">Welcome back!</string>
<string name="action_share">Share</string>
<string name="send_status_to">Share toot URL to...</string>
</resources>