From 34ddb85bfec0691f91fea847610096751b3de960 Mon Sep 17 00:00:00 2001 From: TwistedUmbrella Date: Tue, 21 Jan 2014 20:54:19 -0500 Subject: [PATCH] Add the code to support a rating prompt (currently inactive) This is just the general outline to see how it sounds and such. Currently this code is unreachable during normal use. --- shell/android/res/values/strings.xml | 3 ++ .../src/com/reicast/emulator/FileBrowser.java | 35 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/shell/android/res/values/strings.xml b/shell/android/res/values/strings.xml index d97b4cfed..9ae30c207 100644 --- a/shell/android/res/values/strings.xml +++ b/shell/android/res/values/strings.xml @@ -43,6 +43,9 @@ Press any button on the controller to assign to port This controller is already in use! + Rate reicast + We are hard at work to bring the full Dreamcast experience to your Android device, so why not take a minute and tell us how you like it so far? We appreciate it! + About reicast reicast is a dreamcast emulator\n\nVersion: diff --git a/shell/android/src/com/reicast/emulator/FileBrowser.java b/shell/android/src/com/reicast/emulator/FileBrowser.java index a879c9113..6c97553e6 100644 --- a/shell/android/src/com/reicast/emulator/FileBrowser.java +++ b/shell/android/src/com/reicast/emulator/FileBrowser.java @@ -18,7 +18,10 @@ import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.content.SharedPreferences; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.net.Uri; @@ -155,6 +158,38 @@ public class FileBrowser extends Fragment { if (!ImgBrowse) { navigate(sdcard); } else { + if (0 == 1) { + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( + parentActivity); + alertDialogBuilder.setTitle(getString(R.string.rating_title)); + alertDialogBuilder + .setMessage(getString(R.string.rating_text)) + .setCancelable(false) + .setPositiveButton("Rate It", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, + int id) { + parentActivity.startActivity(new Intent( + Intent.ACTION_VIEW, + Uri.parse("market://details?id=" + + parentActivity + .getPackageName()))); + } + }) + .setNegativeButton("Dismiss", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, + int id) { + + } + }); + + // create alert dialog + AlertDialog alertDialog = alertDialogBuilder.create(); + + // show it + alertDialog.show(); + } LocateGames mLocateGames = new LocateGames(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mLocateGames