add an Invite friends button

This commit is contained in:
tibbi 2016-08-21 21:27:23 +02:00
parent 2a5da23ce8
commit f816d79f54
6 changed files with 39 additions and 2 deletions

View File

@ -60,13 +60,24 @@ public class AboutActivity extends SimpleActivity {
} }
} }
@OnClick(R.id.about_invite)
public void inviteFriend() {
final Intent intent = new Intent();
final String text = String.format(getString(R.string.share_text), getString(R.string.app_name), getStoreUrl());
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name));
intent.putExtra(Intent.EXTRA_TEXT, text);
intent.setType("text/plain");
startActivity(Intent.createChooser(intent, getString(R.string.invite_via)));
}
@OnClick(R.id.about_rate_us) @OnClick(R.id.about_rate_us)
public void rateUsClicked() { public void rateUsClicked() {
final Uri uri = Uri.parse("market://details?id=" + getPackageName()); final Uri uri = Uri.parse("market://details?id=" + getPackageName());
try { try {
startActivity(new Intent(Intent.ACTION_VIEW, uri)); startActivity(new Intent(Intent.ACTION_VIEW, uri));
} catch (ActivityNotFoundException ignored) { } catch (ActivityNotFoundException ignored) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + getPackageName()))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getStoreUrl())));
} }
} }
@ -92,4 +103,8 @@ public class AboutActivity extends SimpleActivity {
final String link = "https://plus.google.com/communities/104880861558693868382"; final String link = "https://plus.google.com/communities/104880861558693868382";
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(link))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(link)));
} }
private String getStoreUrl() {
return "https://play.google.com/store/apps/details?id=" + getPackageName();
}
} }

View File

@ -38,12 +38,22 @@
android:text="@string/email"/> android:text="@string/email"/>
<TextView <TextView
android:id="@+id/about_rate_us" android:id="@+id/about_invite"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/about_email" android:layout_below="@+id/about_email"
android:paddingBottom="@dimen/activity_margin" android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:text="@string/invite_friends_underlined"
android:textColor="@color/colorPrimary"/>
<TextView
android:id="@+id/about_rate_us"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/about_invite"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/rate_us_underlined" android:text="@string/rate_us_underlined"
android:textColor="@color/colorPrimary"/> android:textColor="@color/colorPrimary"/>

View File

@ -7,6 +7,9 @@
<string name="website">Altre semplici app e codici sorgenti in:\nhttp://simplemobiletools.com</string> <string name="website">Altre semplici app e codici sorgenti in:\nhttp://simplemobiletools.com</string>
<string name="email_label">Invia la tua opinione o i tuoi suggerimenti a:</string> <string name="email_label">Invia la tua opinione o i tuoi suggerimenti a:</string>
<string name="third_party_licences_underlined"><u>Licenze di terze parti</u></string> <string name="third_party_licences_underlined"><u>Licenze di terze parti</u></string>
<string name="invite_friends_underlined"><u>Invite friends</u></string>
<string name="share_text">Hey, come check out %1$s at %2$s</string>
<string name="invite_via">Invite via</string>
<string name="rate_us_underlined"><u>Dacci un voto sul Play Store</u></string> <string name="rate_us_underlined"><u>Dacci un voto sul Play Store</u></string>
<string name="follow_us">Seguici:</string> <string name="follow_us">Seguici:</string>
<string name="copyright">v %1$s\nCopyright © Simple Mobile Tools %2$d</string> <string name="copyright">v %1$s\nCopyright © Simple Mobile Tools %2$d</string>

View File

@ -7,6 +7,9 @@
<string name="website">もっとシンプルなアプリとソースコードは:\nhttp://simplemobiletools.com</string> <string name="website">もっとシンプルなアプリとソースコードは:\nhttp://simplemobiletools.com</string>
<string name="email_label">ご意見やご提案をお送りください:</string> <string name="email_label">ご意見やご提案をお送りください:</string>
<string name="third_party_licences_underlined"><u>サードパーティー ライセンス</u></string> <string name="third_party_licences_underlined"><u>サードパーティー ライセンス</u></string>
<string name="invite_friends_underlined"><u>Invite friends</u></string>
<string name="share_text">Hey, come check out %1$s at %2$s</string>
<string name="invite_via">Invite via</string>
<string name="rate_us_underlined"><u>Play ストアで評価してください</u></string> <string name="rate_us_underlined"><u>Play ストアで評価してください</u></string>
<string name="follow_us">フォローしてください:</string> <string name="follow_us">フォローしてください:</string>
<string name="copyright">v %1$s\nCopyright © Simple Mobile Tools %2$d</string> <string name="copyright">v %1$s\nCopyright © Simple Mobile Tools %2$d</string>

View File

@ -7,6 +7,9 @@
<string name="website">Fler enkla appar och källkod här:\nhttp://simplemobiletools.com</string> <string name="website">Fler enkla appar och källkod här:\nhttp://simplemobiletools.com</string>
<string name="email_label">Skicka feedback och förslag till:</string> <string name="email_label">Skicka feedback och förslag till:</string>
<string name="third_party_licences_underlined"><u>Tredjepartslicenser</u></string> <string name="third_party_licences_underlined"><u>Tredjepartslicenser</u></string>
<string name="invite_friends_underlined"><u>Invite friends</u></string>
<string name="share_text">Hey, come check out %1$s at %2$s</string>
<string name="invite_via">Invite via</string>
<string name="rate_us_underlined"><u>Betygsätt oss i Play Butiken</u></string> <string name="rate_us_underlined"><u>Betygsätt oss i Play Butiken</u></string>
<string name="follow_us">Följ oss:</string> <string name="follow_us">Följ oss:</string>
<string name="copyright">v %1$s\nCopyright © Simple Mobile Tools %2$d</string> <string name="copyright">v %1$s\nCopyright © Simple Mobile Tools %2$d</string>

View File

@ -8,6 +8,9 @@
<string name="email_label">Send your feedback or suggestions to:</string> <string name="email_label">Send your feedback or suggestions to:</string>
<string name="email" translatable="false">hello@simplemobiletools.com</string> <string name="email" translatable="false">hello@simplemobiletools.com</string>
<string name="third_party_licences_underlined"><u>Third party licences</u></string> <string name="third_party_licences_underlined"><u>Third party licences</u></string>
<string name="invite_friends_underlined"><u>Invite friends</u></string>
<string name="share_text">Hey, come check out %1$s at %2$s</string>
<string name="invite_via">Invite via</string>
<string name="rate_us_underlined"><u>Rate us in the Play Store</u></string> <string name="rate_us_underlined"><u>Rate us in the Play Store</u></string>
<string name="follow_us">Follow us:</string> <string name="follow_us">Follow us:</string>
<string name="copyright">v %1$s\nCopyright © Simple Mobile Tools %2$d</string> <string name="copyright">v %1$s\nCopyright © Simple Mobile Tools %2$d</string>