@@ -60,13 +60,24 @@ private void setupRateUs() {
6060 }
6161 }
6262
63+ @ OnClick (R .id .about_invite )
64+ public void inviteFriend () {
65+ final Intent intent = new Intent ();
66+ final String text = String .format (getString (R .string .share_text ), getString (R .string .app_name ), getStoreUrl ());
67+ intent .setAction (Intent .ACTION_SEND );
68+ intent .putExtra (Intent .EXTRA_SUBJECT , getString (R .string .app_name ));
69+ intent .putExtra (Intent .EXTRA_TEXT , text );
70+ intent .setType ("text/plain" );
71+ startActivity (Intent .createChooser (intent , getString (R .string .invite_via )));
72+ }
73+
6374 @ OnClick (R .id .about_rate_us )
6475 public void rateUsClicked () {
6576 final Uri uri = Uri .parse ("market://details?id=" + getPackageName ());
6677 try {
6778 startActivity (new Intent (Intent .ACTION_VIEW , uri ));
6879 } catch (ActivityNotFoundException ignored ) {
69- startActivity (new Intent (Intent .ACTION_VIEW , Uri .parse ("http://play.google.com/store/apps/details?id=" + getPackageName ())));
80+ startActivity (new Intent (Intent .ACTION_VIEW , Uri .parse (getStoreUrl ())));
7081 }
7182 }
7283
@@ -92,4 +103,8 @@ public void googlePlusClicked() {
92103 final String link = "https://plus.google.com/communities/104880861558693868382" ;
93104 startActivity (new Intent (Intent .ACTION_VIEW , Uri .parse (link )));
94105 }
106+
107+ private String getStoreUrl () {
108+ return "https://play.google.com/store/apps/details?id=" + getPackageName ();
109+ }
95110}
0 commit comments