Browse Source

Add donate links; via PayPal on full version or refer to website (that has a link) on lite version. Fixes #329.

pull/424/head
Eric Kok 7 years ago
parent
commit
2ecf4c2581
  1. 3
      app/src/full/res/values/strings.xml
  2. 3
      app/src/lite/res/values/strings.xml
  3. 9
      app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java
  4. 4
      app/src/main/res/xml/pref_main.xml

3
app/src/full/res/values/strings.xml

@ -18,4 +18,7 @@
<string name="app_name" translatable="false">Transdroid</string> <string name="app_name" translatable="false">Transdroid</string>
<string name="donate_text">Donate with PayPal</string>
<string name="donate_url">https://paypal.me/erickoknl</string>
</resources> </resources>

3
app/src/lite/res/values/strings.xml

@ -18,4 +18,7 @@
<string name="app_name" translatable="false">Transdrone</string> <string name="app_name" translatable="false">Transdrone</string>
<string name="donate_text">Donate via transdroid.org</string>
<string name="donate_url">https://transdroid.org</string>
</resources> </resources>

9
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.DialogInterface.OnClickListener;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.ListPreference; import android.preference.ListPreference;
@ -113,6 +114,13 @@ public class MainSettingsActivity extends PreferenceCompatActivity {
return true; 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() { private OnServerClickedListener onServerClicked = new OnServerClickedListener() {
@Override @Override
public void onServerClicked(ServerSetting serverSetting) { public void onServerClicked(ServerSetting serverSetting) {
@ -183,6 +191,7 @@ public class MainSettingsActivity extends PreferenceCompatActivity {
findPreference("header_background").setOnPreferenceClickListener(onBackgroundSettings); findPreference("header_background").setOnPreferenceClickListener(onBackgroundSettings);
findPreference("header_system").setOnPreferenceClickListener(onSystemSettings); findPreference("header_system").setOnPreferenceClickListener(onSystemSettings);
findPreference("header_help").setOnPreferenceClickListener(onHelpSettings); findPreference("header_help").setOnPreferenceClickListener(onHelpSettings);
findPreference("header_donate").setOnPreferenceClickListener(onDonate);
// Keep a list of the server codes and names (for default server selection) // Keep a list of the server codes and names (for default server selection)
List<String> serverCodes = new ArrayList<>(); List<String> serverCodes = new ArrayList<>();

4
app/src/main/res/xml/pref_main.xml

@ -72,6 +72,10 @@
android:key="header_help" android:key="header_help"
android:title="@string/pref_help" android:title="@string/pref_help"
android:order="303" /> android:order="303" />
<Preference
android:key="header_donate"
android:title="@string/donate_text"
android:order="304" />
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

Loading…
Cancel
Save