diff --git a/app/src/main/java/app/fedilab/fedilabtube/ShowAccountActivity.java b/app/src/main/java/app/fedilab/fedilabtube/ShowAccountActivity.java index f90007b..df19899 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/ShowAccountActivity.java +++ b/app/src/main/java/app/fedilab/fedilabtube/ShowAccountActivity.java @@ -14,6 +14,7 @@ package app.fedilab.fedilabtube; * You should have received a copy of the GNU General Public License along with TubeLab; if not, * see . */ +import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.text.Html; @@ -133,6 +134,17 @@ public class ShowAccountActivity extends AppCompatActivity { }); AlertDialog alertDialog = dialogBuilder.create(); alertDialog.show(); + }else if( item.getItemId() == R.id.action_share && account != null) { + Intent sendIntent = new Intent(Intent.ACTION_SEND); + sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.shared_via)); + String extra_text = account.getUrl(); + sendIntent.putExtra(Intent.EXTRA_TEXT, extra_text); + sendIntent.setType("text/plain"); + try { + startActivity(Intent.createChooser(sendIntent, getString(R.string.share_with))); + } catch (Exception e) { + Toasty.error(ShowAccountActivity.this, getString(R.string.toast_error), Toasty.LENGTH_LONG).show(); + } } return super.onOptionsItemSelected(item); } diff --git a/app/src/main/java/app/fedilab/fedilabtube/ShowChannelActivity.java b/app/src/main/java/app/fedilab/fedilabtube/ShowChannelActivity.java index b765b0a..74c765e 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/ShowChannelActivity.java +++ b/app/src/main/java/app/fedilab/fedilabtube/ShowChannelActivity.java @@ -159,6 +159,17 @@ public class ShowChannelActivity extends AppCompatActivity { }); androidx.appcompat.app.AlertDialog alertDialog = dialogBuilder.create(); alertDialog.show(); + } else if( item.getItemId() == R.id.action_share && channel != null) { + Intent sendIntent = new Intent(Intent.ACTION_SEND); + sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.shared_via)); + String extra_text = channel.getUrl(); + sendIntent.putExtra(Intent.EXTRA_TEXT, extra_text); + sendIntent.setType("text/plain"); + try { + startActivity(Intent.createChooser(sendIntent, getString(R.string.share_with))); + } catch (Exception e) { + Toasty.error(ShowChannelActivity.this, getString(R.string.toast_error), Toasty.LENGTH_LONG).show(); + } } return super.onOptionsItemSelected(item); } diff --git a/app/src/main/res/menu/main_account.xml b/app/src/main/res/menu/main_account.xml index 5067442..46c1057 100644 --- a/app/src/main/res/menu/main_account.xml +++ b/app/src/main/res/menu/main_account.xml @@ -11,4 +11,9 @@ android:icon="@drawable/ic_baseline_report_24" android:title="@string/report" app:showAsAction="never" /> +