From d26a084e5016aea5da056f20f969027a3169d1b6 Mon Sep 17 00:00:00 2001 From: Sergey Solovyev Date: Thu, 5 Jan 2012 13:25:40 +0400 Subject: [PATCH] ads --- res/values-ru/text_strings.xml | 4 +-- res/values/text_strings.xml | 4 +-- .../CalculatorPreferencesActivity.java | 32 +++++++++++-------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/res/values-ru/text_strings.xml b/res/values-ru/text_strings.xml index cca04326..3ba9a5ba 100644 --- a/res/values-ru/text_strings.xml +++ b/res/values-ru/text_strings.xml @@ -165,9 +165,9 @@ Внимание Ошибка - Биллинг не поддерживается! + Биллинг не поддерживается: вы должны иметь Google Checkout аккаунт привязанный в вашему Google аккаунту и должны быть подключены к интернету. - Избавиться от рекламы и поддержать проект + Избавиться от рекламы! Скидка 50% для первых 100 покупателей \ No newline at end of file diff --git a/res/values/text_strings.xml b/res/values/text_strings.xml index f544ea82..88bd117a 100644 --- a/res/values/text_strings.xml +++ b/res/values/text_strings.xml @@ -165,9 +165,9 @@ Warning Error - Billing is not supported! + Billing is not supported: you must have Google Checkout account linked to your Google account and must be connected to the internet. - Get rid of ads and support the project + Get rid of ads! 50% offer for first 100 customers \ No newline at end of file diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorPreferencesActivity.java b/src/main/java/org/solovyev/android/calculator/CalculatorPreferencesActivity.java index d697c36a..90349308 100644 --- a/src/main/java/org/solovyev/android/calculator/CalculatorPreferencesActivity.java +++ b/src/main/java/org/solovyev/android/calculator/CalculatorPreferencesActivity.java @@ -29,23 +29,27 @@ public class CalculatorPreferencesActivity extends PreferenceActivity implements final Preference addFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY); - addFreePreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - public boolean onPreferenceClick(Preference preference) { + if (!CalculatorApplication.isAdFree(this)) { + addFreePreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + public boolean onPreferenceClick(Preference preference) { - // check billing availability - if (BillingController.checkBillingSupported(CalculatorPreferencesActivity.this) != BillingController.BillingStatus.SUPPORTED) { - // warn about not supported billing - new AlertDialog.Builder(CalculatorPreferencesActivity.this).setTitle(R.string.c_error).setMessage(R.string.c_billing_error).create().show(); - } else { - if (!CalculatorApplication.isAdFree(CalculatorPreferencesActivity.this)) { - // not purchased => show purchase window for user - BillingController.requestPurchase(CalculatorPreferencesActivity.this, CalculatorApplication.AD_FREE_PRODUCT_ID, true); + // check billing availability + if (BillingController.checkBillingSupported(CalculatorPreferencesActivity.this) != BillingController.BillingStatus.SUPPORTED) { + // warn about not supported billing + new AlertDialog.Builder(CalculatorPreferencesActivity.this).setTitle(R.string.c_error).setMessage(R.string.c_billing_error).create().show(); + } else { + if (!CalculatorApplication.isAdFree(CalculatorPreferencesActivity.this)) { + // not purchased => show purchase window for user + BillingController.requestPurchase(CalculatorPreferencesActivity.this, CalculatorApplication.AD_FREE_PRODUCT_ID, true); + } } - } - return true; - } - }); + return true; + } + }); + } else { + addFreePreference.setEnabled(false); + } final SharedPreferences preferences = getPreferenceManager().getSharedPreferences(); preferences.registerOnSharedPreferenceChangeListener(this);