[Android] Add patreon settings
This commit is contained in:
parent
59000ff8be
commit
2fa7af2505
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
|
@ -44,8 +44,15 @@
|
||||||
<string name="advanced_screen_title">Advanced</string>
|
<string name="advanced_screen_title">Advanced</string>
|
||||||
<string name="reset_summary">Restore default settings</string>
|
<string name="reset_summary">Restore default settings</string>
|
||||||
<string name="reset_title">Reset</string>
|
<string name="reset_title">Reset</string>
|
||||||
<string name="preferences">Settings</string>
|
<string name="patreon_title">Patreon</string>
|
||||||
|
<string name="patreon_summary">Support Project64 on Patreon</string>
|
||||||
|
<string name="patreon_link_title">Project64 on Patreon</string>
|
||||||
|
<string name="patreon_link_summary">Click here to support Project64 on Patreon</string>
|
||||||
|
<string name="patreon_email_title">Email address on Patreon</string>
|
||||||
|
<string name="patreon_email_summary">What email address using on patreon</string>
|
||||||
|
<string name="patreon_email_dialogTitle">Enter your email address on Patreon</string>
|
||||||
<string name="settings_title">Settings</string>
|
<string name="settings_title">Settings</string>
|
||||||
|
<string name="preferences">preferences</string>
|
||||||
<string name="displayFps_title">Framerate</string>
|
<string name="displayFps_title">Framerate</string>
|
||||||
<string name="displayFps_summary">Display FPS on screen</string>
|
<string name="displayFps_summary">Display FPS on screen</string>
|
||||||
<string name="audioEnabled_title">Enable Audio</string>
|
<string name="audioEnabled_title">Enable Audio</string>
|
||||||
|
@ -160,7 +167,7 @@
|
||||||
<!-- Confirmation Dialogs -->
|
<!-- Confirmation Dialogs -->
|
||||||
<string name="confirmResetGame_title">Reset game?</string>
|
<string name="confirmResetGame_title">Reset game?</string>
|
||||||
<string name="confirmResetGame_message">The game will go back to a clear state, all progress made will be lost.</string>
|
<string name="confirmResetGame_message">The game will go back to a clear state, all progress made will be lost.</string>
|
||||||
<string name="GetSaveSupport_title">Save Support</string>
|
<string name="SupportProject64_title">Save Support</string>
|
||||||
<string name="GetSaveSupport_message">Save support is a one time purchase and the only purchase in Project64.\n\nProject64 may not be perfect and making this as an upgrade it allows you to play and test the emulator before you have to spend any money.\n\nThis is also a good way for you to support and give back to the creation of the emulator..</string>
|
<string name="GetSaveSupport_message">Save support is a one time purchase and the only purchase in Project64.\n\nProject64 may not be perfect and making this as an upgrade it allows you to play and test the emulator before you have to spend any money.\n\nThis is also a good way for you to support and give back to the creation of the emulator..</string>
|
||||||
<string name="GetSaveSupport_OkButton">Purchase</string>
|
<string name="GetSaveSupport_OkButton">Purchase</string>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<Preference android:title="@string/patreon_link_title" android:summary="@string/patreon_link_summary" >
|
||||||
|
<intent android:action="android.intent.action.VIEW"
|
||||||
|
android:data="https://www.patreon.com/bePatron?u=841905" />
|
||||||
|
</Preference>
|
||||||
|
|
||||||
|
<EditTextPreference
|
||||||
|
android:defaultValue=""
|
||||||
|
android:dialogTitle="@string/patreon_email_dialogTitle"
|
||||||
|
android:inputType="textUri"
|
||||||
|
android:key="Patreon_email"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:summary="@string/patreon_email_summary"
|
||||||
|
android:title="@string/patreon_email_title"
|
||||||
|
android:persistent="true" />
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
|
@ -35,6 +35,12 @@
|
||||||
android:key="settings_advanced"
|
android:key="settings_advanced"
|
||||||
android:icon="@drawable/ic_debug"
|
android:icon="@drawable/ic_debug"
|
||||||
/>
|
/>
|
||||||
|
<Preference
|
||||||
|
android:summary="@string/patreon_summary"
|
||||||
|
android:title="@string/patreon_title"
|
||||||
|
android:key="settings_patreon"
|
||||||
|
android:icon="@drawable/ic_patreon"
|
||||||
|
/>
|
||||||
<Preference
|
<Preference
|
||||||
android:summary="@string/reset_summary"
|
android:summary="@string/reset_summary"
|
||||||
android:title="@string/reset_title"
|
android:title="@string/reset_title"
|
||||||
|
|
|
@ -23,6 +23,12 @@
|
||||||
/>
|
/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/Other" >
|
<PreferenceCategory android:title="@string/Other" >
|
||||||
|
<Preference
|
||||||
|
android:summary="@string/patreon_summary"
|
||||||
|
android:title="@string/patreon_title"
|
||||||
|
android:key="settings_patreon"
|
||||||
|
android:icon="@drawable/ic_patreon"
|
||||||
|
/>
|
||||||
<Preference
|
<Preference
|
||||||
android:summary="@string/reset_summary"
|
android:summary="@string/reset_summary"
|
||||||
android:title="@string/reset_title"
|
android:title="@string/reset_title"
|
||||||
|
|
|
@ -101,7 +101,6 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
|
||||||
|
|
||||||
// The IAB helper object
|
// The IAB helper object
|
||||||
IabHelper mIabHelper;
|
IabHelper mIabHelper;
|
||||||
private boolean mHasSaveSupport = false;
|
|
||||||
private boolean mPj64Supporter = false;
|
private boolean mPj64Supporter = false;
|
||||||
|
|
||||||
// Provides purchase notification while this app is running
|
// Provides purchase notification while this app is running
|
||||||
|
@ -165,7 +164,6 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
|
||||||
// Oh noes, there was a problem.
|
// Oh noes, there was a problem.
|
||||||
Log.d("GalleryActivity", "Problem setting up in-app billing: " + result);
|
Log.d("GalleryActivity", "Problem setting up in-app billing: " + result);
|
||||||
// complain("Problem setting up in-app billing: " + result);
|
// complain("Problem setting up in-app billing: " + result);
|
||||||
mHasSaveSupport = true;
|
|
||||||
mPj64Supporter = true;
|
mPj64Supporter = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -357,48 +355,6 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener()
|
|
||||||
{
|
|
||||||
public void onIabPurchaseFinished(IabResult result, Purchase purchase)
|
|
||||||
{
|
|
||||||
Log.d("GalleryActivity", "Purchase finished: " + result + ", purchase: " + purchase);
|
|
||||||
// if we were disposed of in the meantime, quit.
|
|
||||||
if (mIabHelper == null) return;
|
|
||||||
|
|
||||||
if (result.isFailure())
|
|
||||||
{
|
|
||||||
Log.e("GalleryActivity", "**** Purcahse Error: " + result);
|
|
||||||
alert("Save Support Upgrade failed\n\n" + result.getMessage());
|
|
||||||
setWaitScreen(false);
|
|
||||||
ShowSupportWindow();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.d("GalleryActivity", "Purchase successful.");
|
|
||||||
|
|
||||||
if (purchase.getSku().equals(SKU_SAVESUPPORT))
|
|
||||||
{
|
|
||||||
// bought the premium upgrade!
|
|
||||||
Log.d("GalleryActivity", "Purchase is save support. Congratulating user.");
|
|
||||||
alert("Thank you for upgrading to have save support!");
|
|
||||||
mHasSaveSupport = true;
|
|
||||||
setWaitScreen(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (purchase.getSku().equals(SKU_PJ64SUPPORTOR_2) ||
|
|
||||||
purchase.getSku().equals(SKU_PJ64SUPPORTOR_5) ||
|
|
||||||
purchase.getSku().equals(SKU_PJ64SUPPORTOR_8) ||
|
|
||||||
purchase.getSku().equals(SKU_PJ64SUPPORTOR_10))
|
|
||||||
{
|
|
||||||
// bought the premium upgrade!
|
|
||||||
Log.d("GalleryActivity", "Purchase is project64 support. Congratulating user.");
|
|
||||||
alert("Thank you for supporting Project64!");
|
|
||||||
mPj64Supporter = true;
|
|
||||||
setWaitScreen(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void alert(String message)
|
void alert(String message)
|
||||||
{
|
{
|
||||||
AlertDialog.Builder bld = new AlertDialog.Builder(this);
|
AlertDialog.Builder bld = new AlertDialog.Builder(this);
|
||||||
|
@ -817,29 +773,8 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PurcahseProject64Support(Activity activity, String sku)
|
|
||||||
{
|
|
||||||
setWaitScreen(true);
|
|
||||||
//Purchase save support
|
|
||||||
try
|
|
||||||
{
|
|
||||||
String payload = NativeExports.appVersion();
|
|
||||||
mIabHelper.launchPurchaseFlow(activity, sku, RC_REQUEST, mPurchaseFinishedListener, payload);
|
|
||||||
}
|
|
||||||
catch (IabAsyncInProgressException e)
|
|
||||||
{
|
|
||||||
setWaitScreen(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean ShouldShowSupportWindow()
|
private boolean ShouldShowSupportWindow()
|
||||||
{
|
{
|
||||||
Log.d("GalleryActivity", "ShowSupportWindow mHasSaveSupport = " + mHasSaveSupport);
|
|
||||||
if (mHasSaveSupport)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.d("GalleryActivity", "ShowSupportWindow mPj64Supporter = " + mPj64Supporter);
|
Log.d("GalleryActivity", "ShowSupportWindow mPj64Supporter = " + mPj64Supporter);
|
||||||
if (mPj64Supporter)
|
if (mPj64Supporter)
|
||||||
{
|
{
|
||||||
|
@ -875,7 +810,7 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
|
||||||
final Activity activity = this;
|
final Activity activity = this;
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(getText(R.string.GetSaveSupport_title));
|
builder.setTitle(getText(R.string.SupportProject64_title));
|
||||||
builder.setMessage(getText(R.string.GetSaveSupport_message));
|
builder.setMessage(getText(R.string.GetSaveSupport_message));
|
||||||
builder.setNeutralButton("Not now", null);
|
builder.setNeutralButton("Not now", null);
|
||||||
builder.setNegativeButton("Support Project64", null);
|
builder.setNegativeButton("Support Project64", null);
|
||||||
|
@ -897,17 +832,6 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
setWaitScreen(true);
|
|
||||||
//Purchase save support
|
|
||||||
try
|
|
||||||
{
|
|
||||||
String payload = NativeExports.appVersion();
|
|
||||||
mIabHelper.launchPurchaseFlow(activity, SKU_SAVESUPPORT, RC_REQUEST, mPurchaseFinishedListener, payload);
|
|
||||||
}
|
|
||||||
catch (IabAsyncInProgressException e)
|
|
||||||
{
|
|
||||||
setWaitScreen(false);
|
|
||||||
}
|
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,6 +34,7 @@ public enum UISettingID
|
||||||
SupportWindow_AlwaysShow,
|
SupportWindow_AlwaysShow,
|
||||||
SupportWindow_ShowingSupportWindow,
|
SupportWindow_ShowingSupportWindow,
|
||||||
SupportWindow_RunCount,
|
SupportWindow_RunCount,
|
||||||
|
SupportWindow_PatreonEmail,
|
||||||
|
|
||||||
//Game Settings
|
//Game Settings
|
||||||
Game_RunCount,
|
Game_RunCount,
|
||||||
|
|
|
@ -94,6 +94,8 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(Preference preference)
|
public boolean onPreferenceTreeClick(Preference preference)
|
||||||
|
{
|
||||||
|
if (preference.getKey() != null)
|
||||||
{
|
{
|
||||||
if (preference.getKey().equals("settings_input"))
|
if (preference.getKey().equals("settings_input"))
|
||||||
{
|
{
|
||||||
|
@ -121,6 +123,10 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat
|
||||||
{
|
{
|
||||||
loadFragment(new AudioFragment());
|
loadFragment(new AudioFragment());
|
||||||
}
|
}
|
||||||
|
else if (preference.getKey().equals("settings_patreon"))
|
||||||
|
{
|
||||||
|
loadFragment(new PatreonFragment());
|
||||||
|
}
|
||||||
else if (preference.getKey().equals("settings_advanced"))
|
else if (preference.getKey().equals("settings_advanced"))
|
||||||
{
|
{
|
||||||
loadFragment(new AdvancedFragment());
|
loadFragment(new AdvancedFragment());
|
||||||
|
@ -162,6 +168,11 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat
|
||||||
{
|
{
|
||||||
return super.onPreferenceTreeClick(preference);
|
return super.onPreferenceTreeClick(preference);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return super.onPreferenceTreeClick(preference);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* *
|
||||||
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
|
* http://www.pj64-emu.com/ *
|
||||||
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
|
* *
|
||||||
|
* License: *
|
||||||
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
package emu.project64.settings;
|
||||||
|
|
||||||
|
import emu.project64.R;
|
||||||
|
|
||||||
|
public class PatreonFragment extends BaseSettingsFragment
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected int getXml()
|
||||||
|
{
|
||||||
|
return R.xml.setting_patreon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getTitleId()
|
||||||
|
{
|
||||||
|
return R.string.patreon_title;
|
||||||
|
}
|
||||||
|
}
|
|
@ -55,6 +55,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
|
||||||
sharedPrefs.edit().clear()
|
sharedPrefs.edit().clear()
|
||||||
.putInt("touchscreenScale",NativeExports.UISettingsLoadDword(UISettingID.TouchScreen_ButtonScale.getValue()))
|
.putInt("touchscreenScale",NativeExports.UISettingsLoadDword(UISettingID.TouchScreen_ButtonScale.getValue()))
|
||||||
.putString("touchscreenLayout",NativeExports.UISettingsLoadString(UISettingID.TouchScreen_Layout.getValue()))
|
.putString("touchscreenLayout",NativeExports.UISettingsLoadString(UISettingID.TouchScreen_Layout.getValue()))
|
||||||
|
.putString("Patreon_email",NativeExports.UISettingsLoadString(UISettingID.SupportWindow_PatreonEmail.getValue()))
|
||||||
.putBoolean("audio_Enabled",NativeExports.SettingsLoadBool(SettingsID.Plugin_EnableAudio.getValue()))
|
.putBoolean("audio_Enabled",NativeExports.SettingsLoadBool(SettingsID.Plugin_EnableAudio.getValue()))
|
||||||
.putBoolean("PreAllocSyncMem",NativeExports.SettingsLoadBool(SettingsID.Setting_PreAllocSyncMem.getValue()))
|
.putBoolean("PreAllocSyncMem",NativeExports.SettingsLoadBool(SettingsID.Setting_PreAllocSyncMem.getValue()))
|
||||||
.putBoolean("ReducedSyncMem",NativeExports.SettingsLoadBool(SettingsID.Setting_ReducedSyncMem.getValue()))
|
.putBoolean("ReducedSyncMem",NativeExports.SettingsLoadBool(SettingsID.Setting_ReducedSyncMem.getValue()))
|
||||||
|
@ -140,6 +141,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
|
||||||
}
|
}
|
||||||
else if (key.equals("touchscreenScale")) { NativeExports.UISettingsSaveDword(UISettingID.TouchScreen_ButtonScale.getValue(), sharedPreferences.getInt(key, 100)); }
|
else if (key.equals("touchscreenScale")) { NativeExports.UISettingsSaveDword(UISettingID.TouchScreen_ButtonScale.getValue(), sharedPreferences.getInt(key, 100)); }
|
||||||
else if (key.equals("touchscreenLayout")) { NativeExports.UISettingsSaveString(UISettingID.TouchScreen_Layout.getValue(), sharedPreferences.getString(key, "Analog")); }
|
else if (key.equals("touchscreenLayout")) { NativeExports.UISettingsSaveString(UISettingID.TouchScreen_Layout.getValue(), sharedPreferences.getString(key, "Analog")); }
|
||||||
|
else if (key.equals("Patreon_email")) { NativeExports.UISettingsSaveString(UISettingID.SupportWindow_PatreonEmail.getValue(), sharedPreferences.getString(key, "")); }
|
||||||
else if (key.equals("audio_Enabled")) { NativeExports.SettingsSaveBool(SettingsID.Plugin_EnableAudio.getValue(), sharedPreferences.getBoolean(key,false)); }
|
else if (key.equals("audio_Enabled")) { NativeExports.SettingsSaveBool(SettingsID.Plugin_EnableAudio.getValue(), sharedPreferences.getBoolean(key,false)); }
|
||||||
else if (key.equals("Plugin_ForceGfxReset")) { NativeExports.SettingsSaveBool(SettingsID.Plugin_ForceGfxReset.getValue(), sharedPreferences.getBoolean(key,false)); }
|
else if (key.equals("Plugin_ForceGfxReset")) { NativeExports.SettingsSaveBool(SettingsID.Plugin_ForceGfxReset.getValue(), sharedPreferences.getBoolean(key,false)); }
|
||||||
else if (key.equals("PreAllocSyncMem")) { NativeExports.SettingsSaveBool(SettingsID.Setting_PreAllocSyncMem.getValue(), sharedPreferences.getBoolean(key,false)); }
|
else if (key.equals("PreAllocSyncMem")) { NativeExports.SettingsSaveBool(SettingsID.Setting_PreAllocSyncMem.getValue(), sharedPreferences.getBoolean(key,false)); }
|
||||||
|
|
|
@ -31,6 +31,7 @@ void RegisterUISettings(void)
|
||||||
g_Settings->AddHandler((SettingID)(FirstUISettings + SupportWindow_AlwaysShow), new CSettingTypeApplication("Support Project64", "Always Show", false));
|
g_Settings->AddHandler((SettingID)(FirstUISettings + SupportWindow_AlwaysShow), new CSettingTypeApplication("Support Project64", "Always Show", false));
|
||||||
g_Settings->AddHandler((SettingID)(FirstUISettings + SupportWindow_ShowingSupportWindow), new CSettingTypeApplication("Support Project64", "Showing Support Window", false));
|
g_Settings->AddHandler((SettingID)(FirstUISettings + SupportWindow_ShowingSupportWindow), new CSettingTypeApplication("Support Project64", "Showing Support Window", false));
|
||||||
g_Settings->AddHandler((SettingID)(FirstUISettings + SupportWindow_RunCount), new CSettingTypeApplication("Support Project64", "Run Count", (uint32_t)0));
|
g_Settings->AddHandler((SettingID)(FirstUISettings + SupportWindow_RunCount), new CSettingTypeApplication("Support Project64", "Run Count", (uint32_t)0));
|
||||||
|
g_Settings->AddHandler((SettingID)(FirstUISettings + SupportWindow_PatreonEmail), new CSettingTypeApplication("Support Project64", "Patreon Email", ""));
|
||||||
g_Settings->AddHandler((SettingID)(FirstUISettings + Game_RunCount), new CSettingTypeGame("Run Count", (uint32_t)0));
|
g_Settings->AddHandler((SettingID)(FirstUISettings + Game_RunCount), new CSettingTypeGame("Run Count", (uint32_t)0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ enum UISettingID
|
||||||
SupportWindow_AlwaysShow,
|
SupportWindow_AlwaysShow,
|
||||||
SupportWindow_ShowingSupportWindow,
|
SupportWindow_ShowingSupportWindow,
|
||||||
SupportWindow_RunCount,
|
SupportWindow_RunCount,
|
||||||
|
SupportWindow_PatreonEmail,
|
||||||
|
|
||||||
//Game Settings
|
//Game Settings
|
||||||
Game_RunCount,
|
Game_RunCount,
|
||||||
|
|
|
@ -436,6 +436,10 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_ExternalEvent(JNIEnv* env,
|
||||||
{
|
{
|
||||||
g_BaseSystem->ExternalEvent((SystemEvent)Type);
|
g_BaseSystem->ExternalEvent((SystemEvent)Type);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WriteTrace(TraceUserInterface, TraceWarning, "g_BaseSystem == NULL");
|
||||||
|
}
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue