Added rate button

This commit is contained in:
M66B 2015-11-07 17:51:13 +01:00
parent 932903c56f
commit c267b903e0
14 changed files with 48 additions and 5 deletions

View File

@ -527,6 +527,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
LayoutInflater inflater = LayoutInflater.from(this);
View view = inflater.inflate(R.layout.about, null);
TextView tvVersion = (TextView) view.findViewById(R.id.tvVersion);
Button btnRate = (Button) view.findViewById(R.id.btnRate);
final Button btnDonate = (Button) view.findViewById(R.id.btnDonate);
final TextView tvThanks = (TextView) view.findViewById(R.id.tvThanks);
TextView tvLicense = (TextView) view.findViewById(R.id.tvLicense);
@ -551,6 +552,15 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
}
});
// Handle rate
btnRate.setVisibility(getIntentRate(this).resolveActivity(getPackageManager()) == null ? View.GONE : View.VISIBLE);
btnRate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(getIntentRate(ActivityMain.this));
}
});
// Handle donate
btnDonate.setOnClickListener(new View.OnClickListener() {
@Override
@ -653,6 +663,13 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
.build();
}
private static Intent getIntentRate(Context context) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName()));
if (intent.resolveActivity(context.getPackageManager()) == null)
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + context.getPackageName()));
return intent;
}
private static Intent getIntentSupport() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://forum.xda-developers.com/showthread.php?t=3233012"));

View File

@ -45,14 +45,28 @@
android:text="@string/app_copyright"
android:textAppearance="@android:style/TextAppearance.Material.Small" />
<Button
android:id="@+id/btnDonate"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:text="@string/title_donate"
android:visibility="gone" />
android:orientation="horizontal">
<Button
android:id="@+id/btnDonate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/title_donate"
android:visibility="gone" />
<Button
android:id="@+id/btnRate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/title_rate"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/tvThanks"

View File

@ -36,5 +36,6 @@ Das wird von Fehlern in Android oder in Software vom Hersteller verursacht. Bitt
<string name="title_roaming">Blockiere bei Roaming</string>
<string name="title_launch">Starte App</string>
<string name="title_donate">Spenden</string>
<string name="title_rate">Rate</string>
<string name="title_thanks">Danke für die Spende!</string>
</resources>

View File

@ -37,5 +37,6 @@ Esto es causado por errores en Android, o por el software proporcionado por el f
<string name="title_roaming">Bloquear cuando se esté en roaming</string>
<string name="title_launch">Iniciar aplicación</string>
<string name="title_donate">Donar</string>
<string name="title_rate">Rate</string>
<string name="title_thanks">¡Gracias por tu donación!</string>
</resources>

View File

@ -37,5 +37,6 @@ Ceci est causé par des bugs dans Android, ou dans le logiciel fourni par le con
<string name="title_roaming">Bloquer si roaming</string>
<string name="title_launch">Lancer l\'application</string>
<string name="title_donate">Faire un don</string>
<string name="title_rate">Rate</string>
<string name="title_thanks">Merci pour votre don !</string>
</resources>

View File

@ -38,5 +38,6 @@ Ció è causato da alcuni bug contenuti in Android, o in programmi forniti dal p
<string name="title_roaming">Blocca quando in roaming</string>
<string name="title_launch">Avvia applicazione</string>
<string name="title_donate">Dona</string>
<string name="title_rate">Rate</string>
<string name="title_thanks">Grazie della donazione!</string>
</resources>

View File

@ -37,5 +37,6 @@
<string name="title_roaming">ローミング時にブロック</string>
<string name="title_launch">アプリケーションを開始</string>
<string name="title_donate">寄付する</string>
<string name="title_rate">Rate</string>
<string name="title_thanks">寄付をありがとうございます!</string>
</resources>

View File

@ -37,5 +37,6 @@ These issues are caused by bugs in Android, or in the software provided by the m
<string name="title_roaming">Block when roaming</string>
<string name="title_launch">앱 시작</string>
<string name="title_donate">기부</string>
<string name="title_rate">Rate</string>
<string name="title_thanks">기부해주셔서 감사합니다!</string>
</resources>

View File

@ -37,5 +37,6 @@ These issues are caused by bugs in Android, or in the software provided by the m
<string name="title_roaming">Blokkeer bij roamen</string>
<string name="title_launch">Start applicatie</string>
<string name="title_donate">Doneer</string>
<string name="title_rate">Beoordeel</string>
<string name="title_thanks">Bedankt voor uw donatie!</string>
</resources>

View File

@ -37,5 +37,6 @@ Problemy te są spowodowane błędami w samym Androidzie, lub oprogramowaniu dos
<string name="title_roaming">Blokuj gdy roaming</string>
<string name="title_launch">Start aplikacji</string>
<string name="title_donate">Wspomóż</string>
<string name="title_rate">Rate</string>
<string name="title_thanks">Dziękuję za wsparcie!</string>
</resources>

View File

@ -37,5 +37,6 @@ Acest lucru este cauzat de bug-uri in Android sau in software-ul pus la dispozit
<string name="title_roaming">Blocheaza in roaming</string>
<string name="title_launch">Porneste aplicatia</string>
<string name="title_donate">Doneaza</string>
<string name="title_rate">Rate</string>
<string name="title_thanks">Iti multumesc pentru donatie!</string>
</resources>

View File

@ -37,5 +37,6 @@ Je to spôsobené chybami v Androide alebo v softvéri poskytovanom výrobcom, p
<string name="title_roaming">Blokovať pri roamingu</string>
<string name="title_launch">Spustiť aplikáciu</string>
<string name="title_donate">Prispieť</string>
<string name="title_rate">Rate</string>
<string name="title_thanks">Ďakujeme vám za váš príspevok!</string>
</resources>

View File

@ -37,5 +37,6 @@
<string name="title_roaming">漫游时阻止</string>
<string name="title_launch">启动应用</string>
<string name="title_donate">捐赠</string>
<string name="title_rate">Rate</string>
<string name="title_thanks">感谢您的捐赠!</string>
</resources>

View File

@ -38,6 +38,7 @@ These issues are caused by bugs in Android, or in the software provided by the m
<string name="title_roaming">Block when roaming</string>
<string name="title_launch">Start application</string>
<string name="title_donate">Donate</string>
<string name="title_rate">Rate</string>
<string name="title_thanks">Thank you for your donation!</string>
<string name="fingerprint" translatable="false">ef46f813d2c8a064d72c936b9b96d1cccc989378</string>