Merge pull request #143 from theZacAttacks/variedSharing

Share menu now allows for sharing of link/actual post
This commit is contained in:
Vavassor 2017-04-16 18:54:31 -04:00 committed by GitHub
commit fcffea08a3
3 changed files with 31 additions and 6 deletions

View file

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

View file

@ -2,7 +2,16 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/status_share"
android:title="@string/action_share"/>
android:title="@string/action_share">
<menu>
<item
android:id="@+id/status_share_link"
android:title="@string/status_share_link" />
<item
android:id="@+id/status_share_content"
android:title="@string/status_share_content"/>
</menu>
</item>
<item android:title="@string/action_block"
android:id="@+id/status_block" />
<item android:title="@string/action_report"

View file

@ -86,7 +86,8 @@
<string name="action_open_drawer">Open drawer</string>
<string name="action_clear">Clear</string>
<string name="send_status_to">Share toot URL to…</string>
<string name="send_status_link_to">Share toot URL to…</string>
<string name="send_status_content_to">Share toot to…</string>
<string name="search">Search accounts…</string>
@ -140,5 +141,7 @@
<string name="notification_title_summary">%d new interactions</string>
<string name="description_account_locked">Locked Account</string>
<string name="status_share_content">Share content of toot</string>
<string name="status_share_link">Share link to toot</string>
</resources>