[Android] Add review menu

This commit is contained in:
zilmar 2019-02-20 11:48:28 +10:30
parent a4e685d7fc
commit eb2b1f0a2c
11 changed files with 53 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -14,6 +14,9 @@
<item
android:id="@+id/menuItem_support"
android:icon="@drawable/ic_support" />
<item
android:id="@+id/menuItem_review"
android:icon="@drawable/ic_review" />
<item
android:id="@+id/menuItem_about"
android:icon="@drawable/ic_about" />

View File

@ -199,6 +199,12 @@
<string name="assetExtractor_permissions_title">Permissions</string>
<string name="assetExtractor_permissions_rationale">Project64 needs to be able to: \nRead your storage to read game files, save states, and configuration.\nWrite to your storage to write configuration and save data.</string>
<!-- Review -->
<string name="review_title">Please rate Project64 5 stars</string>
<string name="review_decription">Please rate Project64 5 stars if you have enjoyed it. Your support and feedback helps makes Project64 better.</string>
<string name="review_cancel">Don\'t Rate</string>
<string name="review_ok">Rate 5 Starts</string>
<!-- Game Directory Dialog -->
<string name="scanning_title">Scanning…</string>
</resources>

View File

@ -51,6 +51,7 @@ import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
@ -147,13 +148,6 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
super.onCreate( savedInstanceState );
mActiveGalleryActivity = this;
String FirstRun = NativeExports.UISettingsLoadString(UISettingID.SupportWindow_FirstRun.getValue());
if (FirstRun.length() == 0)
{
SimpleDateFormat format = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH);
NativeExports.UISettingsSaveString(UISettingID.SupportWindow_FirstRun.getValue(), format.format(new Date()));
}
mIabHelper = new IabHelper(this, "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnfHFIq+X0oIvV+bwcvdqQv5GmpWLL6Bw8xE6MLFzXzUGUIUZBwQS6Cz5IC0UM76ujPDPqQPeGy/8oq/bswB5pHCz2iS4ySGalzFfYfeIDklOe+R1pLEqmHuwsR5o4b8rLePLGmUI7hA0kozOTb0i+epANV3Pj63i5XFZLA7RMi5I+YysoE9Fob6kCx0kb02AATacF0OXI9paE1izvsHhZcOIrT4TRMbGlZjBVE/pcJtoBDh33QKz/JBOXWvwnh+efqhVsq/UfA6jYI+U4Z4tsnWhem8DB6Kqj5EhClC6qCPmkBFiOabyKaqhI/urBtYOwxkW9erwtA6OcDoHm5J/JwIDAQAB");
// enable debug logging (for a production application, you should set this to false).
@ -247,6 +241,15 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
}
});
UpdateLanguage();
int RunCount = NativeExports.UISettingsLoadDword(UISettingID.AppInfo_RunCount.getValue()) + 1;
if (RunCount < 1) { RunCount = 1; }
NativeExports.UISettingsSaveDword(UISettingID.AppInfo_RunCount.getValue(), RunCount);
Log.d("GalleryActivity", "ShowSupportWindow RunCount = " + RunCount);
if (RunCount == 5 || RunCount == 10)
{
ShowReviewOptions();
}
}
void UpdateLanguage()
@ -254,6 +257,7 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
Strings.SetMenuTitle(mDrawerList.getMenu(), R.id.menuItem_settings, LanguageStringID.ANDROID_SETTINGS);
Strings.SetMenuTitle(mDrawerList.getMenu(), R.id.menuItem_discord, LanguageStringID.ANDROID_DISCORD);
Strings.SetMenuTitle(mDrawerList.getMenu(), R.id.menuItem_reportBug, LanguageStringID.ANDROID_REPORT_BUG);
Strings.SetMenuTitle(mDrawerList.getMenu(), R.id.menuItem_review, LanguageStringID.ANDROID_REVIEW_PJ64);
Strings.SetMenuTitle(mDrawerList.getMenu(), R.id.menuItem_support, LanguageStringID.ANDROID_SUPPORT_PJ64);
Strings.SetMenuTitle(mDrawerList.getMenu(), R.id.menuItem_about, LanguageStringID.ANDROID_ABOUT);
}
@ -410,6 +414,9 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
Intent IssueIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/project64/project64/issues"));
startActivity(IssueIntent);
return true;
case R.id.menuItem_review:
ShowReviewOptions();
return true;
case R.id.menuItem_support:
ShowPaymentOptions();
return true;
@ -579,7 +586,6 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
currentFile.delete();
}
SaveDir.delete();
NativeExports.UISettingsSaveDword(UISettingID.Game_RunCount.getValue(), 0);
launchGameActivity(false);
}
})
@ -798,6 +804,30 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
}
}
public void ShowReviewOptions()
{
new AlertDialog.Builder(GalleryActivity.this).setTitle(getString(R.string.review_title))
.setMessage(getString(R.string.review_decription))
.setPositiveButton(getString( R.string.review_ok ), new OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
Intent IssueIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=emu.project64&hl=en"));
startActivity(IssueIntent);
}
})
.setNegativeButton( getString( R.string.review_cancel), new OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
}
})
.setCancelable(false).show();
}
public void ShowPaymentOptions()
{
ArrayList<String> skuList = new ArrayList<String>();

View File

@ -580,6 +580,7 @@ public enum LanguageStringID
ANDROID_ABOUT_PJ64_AUTHORS(3020),
ANDROID_DISCORD(3021),
ANDROID_SUPPORT_PJ64(3022),
ANDROID_REVIEW_PJ64(3023),
//In game menu
ANDROID_MENU_SETTINGS(3100),

View File

@ -29,14 +29,8 @@ public enum UISettingID
Controller_Deadzone,
Controller_Sensitivity,
//Support Window
SupportWindow_FirstRun,
SupportWindow_AlwaysShow,
SupportWindow_ShowingSupportWindow,
SupportWindow_RunCount,
//Game Settings
Game_RunCount,
//App Info
AppInfo_RunCount,
;
private int value;

View File

@ -723,6 +723,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
if (OpCode32->reg_cond.opcode == 0 && OpCode32->reg_cond.opcode1 == 0 && OpCode32->reg_cond.opcode2 == 1 && OpCode32->reg_cond.opcode3 == 0xB)
{
//119330b1 ldrhne r3, [r3, r1]
//11d000b0 ldrhne r0, [r0]
if (!g_MMU->LH_NonMemory(MemAddress, ArmRegisters[OpCode32->reg_cond.rt], false))
{
if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory))

View File

@ -585,6 +585,7 @@ enum LanguageStringID
ANDROID_ABOUT_PJ64_AUTHORS = 3020,
ANDROID_DISCORD = 3021,
ANDROID_SUPPORT_PJ64 = 3022,
ANDROID_REVIEW_PJ64 = 3023,
//In game menu
ANDROID_MENU_SETTINGS = 3100,

View File

@ -551,6 +551,7 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(ANDROID_ABOUT_PJ64_AUTHORS, "Project64 Authors.");
DEF_STR(ANDROID_DISCORD, "Discord");
DEF_STR(ANDROID_SUPPORT_PJ64, "Support Project64");
DEF_STR(ANDROID_REVIEW_PJ64, "Review Project64");
//In game menu
DEF_STR(ANDROID_MENU_SETTINGS, "Settings");