[Adnroid] Remove all mentions of patreon

This commit is contained in:
zilmar 2019-02-13 15:39:47 +10:30
parent 9902b542c3
commit 19328cc7ef
12 changed files with 4 additions and 279 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -44,13 +44,6 @@
<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="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="preferences">preferences</string>
<string name="displayFps_title">Framerate</string> <string name="displayFps_title">Framerate</string>
@ -194,10 +187,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="SupportProject64_title">Project64 needs your help</string>
<string name="SupportProject64_message">Developing a fully functional emulator is a massive time-consuming project. With donations you can show your appreciation for this effort and at the same time support the development.\n\nClick Support Project64 button below to view our patreon page, if you are interested in supporting us!\n\nIf you are a patreon already then &lt;a href=\"#patreon\"&gt;click here to enter your email address&lt;/a&gt; to validate it and Project64 will stop prompting you for support.</string>
<string name="SupportProject64_OkButton">Support Project64</string>
<!-- Asset Extractor --> <!-- Asset Extractor -->
<string name="assetExtractor_startingUp">Starting Up …</string> <string name="assetExtractor_startingUp">Starting Up …</string>
<string name="assetExtractor_version">version</string> <string name="assetExtractor_version">version</string>

View File

@ -1,19 +0,0 @@
<?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>

View File

@ -35,12 +35,6 @@
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"

View File

@ -23,12 +23,6 @@
/> />
</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"

View File

@ -556,25 +556,11 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
{ {
if (item == 0) if (item == 0)
{ {
if (ShouldShowSupportWindow()) launchGameActivity(false);
{
ShowSupportWindow(false);
}
else
{
launchGameActivity(false);
}
} }
else if (item == 1) else if (item == 1)
{ {
if (ShouldShowSupportWindow()) launchGameActivity(true);
{
ShowSupportWindow(true);
}
else
{
launchGameActivity(true);
}
} }
else if (item == 2) else if (item == 2)
{ {
@ -616,14 +602,7 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
File InstantSaveDir = new File(NativeExports.SettingsLoadString(SettingsID.Directory_InstantSave.getValue())); File InstantSaveDir = new File(NativeExports.SettingsLoadString(SettingsID.Directory_InstantSave.getValue()));
File GameSaveDir = new File(InstantSaveDir,NativeExports.SettingsLoadString(SettingsID.Game_UniqueSaveDir.getValue())); File GameSaveDir = new File(InstantSaveDir,NativeExports.SettingsLoadString(SettingsID.Game_UniqueSaveDir.getValue()));
Boolean ResumeGame = HasAutoSave(GameSaveDir); Boolean ResumeGame = HasAutoSave(GameSaveDir);
if (ShouldShowSupportWindow()) launchGameActivity(ResumeGame);
{
ShowSupportWindow(ResumeGame);
}
else
{
launchGameActivity(ResumeGame);
}
} }
public boolean onGalleryItemLongClick( GalleryItem item ) public boolean onGalleryItemLongClick( GalleryItem item )
@ -752,185 +731,6 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
} }
} }
private boolean ShouldShowSupportWindow()
{
Log.d("GalleryActivity", "ShowSupportWindow mPj64Supporter = " + mPj64Supporter);
if (mPj64Supporter)
{
return false;
}
boolean PatreonAccount = ValidPatreonAccount();
Log.d("GalleryActivity", "PatreonAccount = " + PatreonAccount);
if (PatreonAccount)
{
return false;
}
int RunCount = NativeExports.UISettingsLoadDword(UISettingID.SupportWindow_RunCount.getValue());
Log.d("GalleryActivity", "ShowSupportWindow RunCount = " + RunCount);
if (RunCount == -1)
{
return false;
}
RunCount = NativeExports.UISettingsLoadDword(UISettingID.Game_RunCount.getValue());
Log.d("GalleryActivity", "ShowSupportWindow Game_RunCount = " + RunCount);
if (RunCount < 5)
{
return false;
}
return true;
}
private void EnterPatreonEmail(final AlertDialog SupportDialog, final Boolean ResumeGame)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
final View layout = View.inflate( this, R.layout.input_text, null );
builder.setTitle("Patreon Email");
builder.setPositiveButton("OK", null);
builder.setNegativeButton("Cancel", null);
builder.setCancelable(false);
builder.setView(layout);
final AlertDialog dialog = builder.create();
dialog.show();
EditText et = (EditText)dialog.findViewById(R.id.EditText);
et.setText(NativeExports.UISettingsLoadString(UISettingID.SupportWindow_PatreonEmail.getValue()));
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener( new View.OnClickListener()
{
@Override
public void onClick(View v)
{
EditText et = (EditText)dialog.findViewById(R.id.EditText);
String email = et.getText().toString();
NativeExports.UISettingsSaveString(UISettingID.SupportWindow_PatreonEmail.getValue(), email);
dialog.dismiss();
if (ValidPatreonAccount())
{
SupportDialog.dismiss();
launchGameActivity(ResumeGame);
}
}
});
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setOnClickListener( new View.OnClickListener()
{
@Override
public void onClick(View v)
{
dialog.dismiss();
}
});
}
private boolean ValidPatreonAccount()
{
String PatreonEmail = NativeExports.UISettingsLoadString(UISettingID.SupportWindow_PatreonEmail.getValue());
String regex = "^(.+)@(.+)$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(PatreonEmail);
return matcher.matches();
}
public void ShowSupportWindow(final Boolean ResumeGame)
{
((Project64Application) getApplication()).getDefaultTracker().send(new HitBuilders.EventBuilder()
.setCategory("Patreon Window")
.setLabel(NativeExports.appVersion())
.build());
Boolean TimeDelayed = NativeExports.UISettingsLoadDword(UISettingID.Game_RunCount.getValue()) > 15;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getText(R.string.SupportProject64_title));
builder.setMessage(getText(R.string.SupportProject64_message));
builder.setNeutralButton("Not now", null);
builder.setNegativeButton(R.string.SupportProject64_OkButton, null);
builder.setCancelable(false);
final AlertDialog dialog = builder.create();
dialog.show();
CharSequence text = getString(R.string.SupportProject64_message);
SpannableStringBuilder spanTxt = new SpannableStringBuilder();
int start = 0;
for (int i = 0, n = text.length(); i < n; i++)
{
if (text.charAt(i) == '<' && text.charAt(i+1) == 'a')
{
int anchor_stat_end = 0;
for (int a_i = i, a_n = text.length() - 4; a_i < a_n; a_i++)
{
if (text.charAt(a_i) == '>')
{
anchor_stat_end = a_i;
}
if (text.charAt(a_i) == '<' && text.charAt(a_i + 1) == '/' && text.charAt(a_i + 2) == 'a' && text.charAt(a_i + 3) == '>')
{
spanTxt.append(text.subSequence(start, i));
CharSequence anchor_text = text.subSequence(anchor_stat_end + 1, a_i);
spanTxt.append(anchor_text);
spanTxt.setSpan(new ClickableSpan()
{
@Override
public void onClick(View widget)
{
EnterPatreonEmail(dialog, ResumeGame);
}
}, spanTxt.length() - anchor_text.length(), spanTxt.length(), 0);
start = a_i + 4;
i = start;
break;
}
}
}
}
spanTxt.append(text.subSequence(start, text.length()));
TextView view = ((TextView)dialog.findViewById(android.R.id.message));
view.setMovementMethod(LinkMovementMethod.getInstance());
view.setText(spanTxt, BufferType.SPANNABLE);
if (TimeDelayed)
{
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setEnabled(false);
Handler handler = new Handler();
handler.postDelayed(new Runnable()
{
@Override
public void run()
{
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setEnabled(true);
}
}, 20000);
}
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener( new View.OnClickListener()
{
@Override
public void onClick(View v)
{
dialog.dismiss();
launchGameActivity(ResumeGame);
}
});
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setOnClickListener( new View.OnClickListener()
{
@Override
public void onClick(View v)
{
((Project64Application) getApplication()).getDefaultTracker().send(new HitBuilders.EventBuilder()
.setCategory("Patreon page")
.setLabel(NativeExports.appVersion())
.build());
Intent browse = new Intent( Intent.ACTION_VIEW , Uri.parse( "https://www.patreon.com/bePatron?u=841905" ) );
startActivity( browse );
}
});
dialog.setCanceledOnTouchOutside(false);
}
// Enables or disables the "please wait" screen. // Enables or disables the "please wait" screen.
void setWaitScreen(boolean set) void setWaitScreen(boolean set)
{ {

View File

@ -34,7 +34,6 @@ 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,

View File

@ -123,10 +123,6 @@ 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());

View File

@ -1,28 +0,0 @@
/****************************************************************************
* *
* 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;
}
}

View File

@ -36,7 +36,6 @@ enum UISettingID
SupportWindow_AlwaysShow, SupportWindow_AlwaysShow,
SupportWindow_ShowingSupportWindow, SupportWindow_ShowingSupportWindow,
SupportWindow_RunCount, SupportWindow_RunCount,
SupportWindow_PatreonEmail,
//Game Settings //Game Settings
Game_RunCount, Game_RunCount,