From 2ecf4c25813cb136f40560742fd0f2244feee33e Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Mon, 19 Feb 2018 20:46:02 +0100 Subject: [PATCH] Add donate links; via PayPal on full version or refer to website (that has a link) on lite version. Fixes #329. --- app/src/full/res/values/strings.xml | 3 +++ app/src/lite/res/values/strings.xml | 3 +++ .../core/gui/settings/MainSettingsActivity.java | 9 +++++++++ app/src/main/res/values/strings.xml | 2 +- app/src/main/res/xml/pref_main.xml | 4 ++++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/src/full/res/values/strings.xml b/app/src/full/res/values/strings.xml index 526ff754..df8296ec 100644 --- a/app/src/full/res/values/strings.xml +++ b/app/src/full/res/values/strings.xml @@ -18,4 +18,7 @@ Transdroid + Donate with PayPal + https://paypal.me/erickoknl + diff --git a/app/src/lite/res/values/strings.xml b/app/src/lite/res/values/strings.xml index 59d4806e..aee1391e 100644 --- a/app/src/lite/res/values/strings.xml +++ b/app/src/lite/res/values/strings.xml @@ -18,4 +18,7 @@ Transdrone + Donate via transdroid.org + https://transdroid.org + diff --git a/app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java b/app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java index 81f0aec9..d0b8f1ad 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java @@ -23,6 +23,7 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.SharedPreferences; +import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.preference.ListPreference; @@ -113,6 +114,13 @@ public class MainSettingsActivity extends PreferenceCompatActivity { return true; } }; + private OnPreferenceClickListener onDonate = new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.donate_url)))); + return true; + } + }; private OnServerClickedListener onServerClicked = new OnServerClickedListener() { @Override public void onServerClicked(ServerSetting serverSetting) { @@ -183,6 +191,7 @@ public class MainSettingsActivity extends PreferenceCompatActivity { findPreference("header_background").setOnPreferenceClickListener(onBackgroundSettings); findPreference("header_system").setOnPreferenceClickListener(onSystemSettings); findPreference("header_help").setOnPreferenceClickListener(onHelpSettings); + findPreference("header_donate").setOnPreferenceClickListener(onDonate); // Keep a list of the server codes and names (for default server selection) List serverCodes = new ArrayList<>(); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 485d306a..795b7bbf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -354,7 +354,7 @@ Available at transdroid.org/download Recent changes About %1$s - + Add %1$s seedbox Torrent client Client to connect to diff --git a/app/src/main/res/xml/pref_main.xml b/app/src/main/res/xml/pref_main.xml index 3555ea98..e7c8bb4c 100644 --- a/app/src/main/res/xml/pref_main.xml +++ b/app/src/main/res/xml/pref_main.xml @@ -72,6 +72,10 @@ android:key="header_help" android:title="@string/pref_help" android:order="303" /> +