Skip to content

Commit

Permalink
[Android] Add review menu
Browse files Browse the repository at this point in the history
  • Loading branch information
project64 committed Feb 20, 2019
1 parent a4e685d commit eb2b1f0
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 16 deletions.
Binary file added Android/res/drawable-hdpi/ic_review.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Android/res/drawable-mdpi/ic_review.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Android/res/drawable-xhdpi/ic_review.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Android/res/menu/gallery_drawer.xml
Expand Up @@ -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" />
Expand Down
6 changes: 6 additions & 0 deletions Android/res/values/strings.xml
Expand Up @@ -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>

This comment has been minimized.

Copy link
@oddMLan

oddMLan Feb 20, 2019

Contributor

Your support and feedback helps makes Project64 better

Shouldn't it be "help to make Project64 better" ?

<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>
46 changes: 38 additions & 8 deletions Android/src/emu/project64/GalleryActivity.java
Expand Up @@ -51,6 +51,7 @@
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;
Expand Down Expand Up @@ -147,13 +148,6 @@ protected void onCreate( Bundle savedInstanceState )
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).
Expand Down Expand Up @@ -247,13 +241,23 @@ public void onClick( MenuItem menuItem )
}
});
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()
{
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);
}
Expand Down Expand Up @@ -410,6 +414,9 @@ public boolean onOptionsItemSelected( MenuItem item )
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;
Expand Down Expand Up @@ -579,7 +586,6 @@ public void onClick(DialogInterface dialog, int id)
currentFile.delete();
}
SaveDir.delete();
NativeExports.UISettingsSaveDword(UISettingID.Game_RunCount.getValue(), 0);
launchGameActivity(false);
}
})
Expand Down Expand Up @@ -798,6 +804,30 @@ public void PurcahseProject64Support(Activity activity, String sku)
}
}

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>();
Expand Down
1 change: 1 addition & 0 deletions Android/src/emu/project64/jni/LanguageStringID.java
Expand Up @@ -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),
Expand Down
10 changes: 2 additions & 8 deletions Android/src/emu/project64/jni/UISettingID.java
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Source/Project64-core/MemoryExceptionFilter.cpp
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions Source/Project64-core/Multilanguage.h
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions Source/Project64-core/Multilanguage/LanguageClass.cpp
Expand Up @@ -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");
Expand Down

0 comments on commit eb2b1f0

Please sign in to comment.