From 0148a203696a262a8902743848828fe38343b3d1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 19 Sep 2012 22:40:27 +0400 Subject: [PATCH] add donation menu item --- res/menu/main_menu.xml | 60 ++++++++++----------------- res/values/strings.xml | 1 + src/org/fox/ttrss/OnlineActivity.java | 34 +++++++++++++++ 3 files changed, 58 insertions(+), 37 deletions(-) diff --git a/res/menu/main_menu.xml b/res/menu/main_menu.xml index 87ebee42..a4d168a5 100644 --- a/res/menu/main_menu.xml +++ b/res/menu/main_menu.xml @@ -1,7 +1,6 @@ - - + android:title="@string/close_feed"/> + --> + - - - - - - - - - - - - - - - - + android:title="@string/close_article"/> + --> + + + - - + Browse headlines Default feed view Which feed view to open by default on smartphones + Donation found, thank you for support! \ No newline at end of file diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 7632b622..de3c0de6 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -15,6 +15,7 @@ import org.fox.ttrss.types.Label; import android.annotation.TargetApi; import android.app.AlertDialog; import android.app.Dialog; +import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; @@ -23,7 +24,9 @@ import android.content.DialogInterface.OnMultiChoiceClickListener; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; +import android.content.pm.PackageInfo; import android.database.Cursor; +import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.Log; @@ -442,6 +445,24 @@ public class OnlineActivity extends CommonActivity { case android.R.id.home: finish(); return true; + case R.id.donate: + if (true) { + try { + Intent intent = new Intent(Intent.ACTION_VIEW, + Uri.parse("market://details?id=org.fox.ttrss.key")); + startActivity(intent); + } catch (ActivityNotFoundException ae) { + try { + Intent intent = new Intent(Intent.ACTION_VIEW, + Uri.parse("https://play.google.com/store/apps/details?id=org.fox.ttrss.key")); + startActivity(intent); + } catch (Exception e) { + e.printStackTrace(); + toast(R.string.error_other_error); + } + } + } + return true; case R.id.logout: logout(); return true; @@ -851,6 +872,19 @@ public class OnlineActivity extends CommonActivity { initMenu(); + List pkgs = getPackageManager() + .getInstalledPackages(0); + + for (PackageInfo p : pkgs) { + if ("org.fox.ttrss.key".equals(p.packageName)) { + Log.d(TAG, "license apk found"); + menu.findItem(R.id.donate).setVisible(false); + toast(R.string.donate_thanks); + break; + } + } + + return true; }