diff --git a/AndroidManifest.xml b/AndroidManifest.xml index f0ceeaad..e3e96c1c 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -101,7 +101,7 @@ - + diff --git a/res/drawable/metro_button_green_shape.xml b/res/drawable/metro_button_green_shape.xml index 2562e0b1..e3049adf 100644 --- a/res/drawable/metro_button_green_shape.xml +++ b/res/drawable/metro_button_green_shape.xml @@ -15,6 +15,6 @@ --> - + \ No newline at end of file diff --git a/res/values-ru/text_strings.xml b/res/values-ru/text_strings.xml index b94f07cd..20388437 100644 --- a/res/values-ru/text_strings.xml +++ b/res/values-ru/text_strings.xml @@ -113,8 +113,8 @@ Устанавливает знак произведения Раскладка - Телефон - Калькулятор + Научная (телефон) + Научная Простая Устанавливает раскладку кнопок @@ -172,6 +172,9 @@ Устанавливает поведение по нажатию на кнопку Назад Использовать кнопку назад как назад по истории + Информация о покупках будет обновлена с сервера + Очистить информация о покупках + Внимание Ошибка Биллинг не поддерживается: вы должны иметь Google Checkout аккаунт привязанный в вашему Google аккаунту и должны быть подключены к интернету. @@ -181,6 +184,7 @@ Опция уже была куплена! Покупаем... + Очищаем... Отзыв Вы используете Калькулятор++ некоторое время\n diff --git a/res/values/preferences.xml b/res/values/preferences.xml index 96e357f0..2d76a425 100644 --- a/res/values/preferences.xml +++ b/res/values/preferences.xml @@ -30,6 +30,8 @@ org.solovyev.android.calculator.CalculatorActivity_use_back_button_as_prev false + clear_billing_info + org.solovyev.android.calculator.CalculatorActivity_show_release_notes true diff --git a/res/values/text_strings.xml b/res/values/text_strings.xml index 41ca065f..960e8342 100644 --- a/res/values/text_strings.xml +++ b/res/values/text_strings.xml @@ -113,8 +113,8 @@ Sets multiplication sign Layout - Cellphone - Calculator + Scientific (cellphone) + Scientific Simple Sets layout of buttons @@ -172,6 +172,9 @@ Defines the behaviour of the Back button Use Back button as history prev + Billing information will be reloaded from the server + Clear billing information + Warning Error Billing is not supported: you must have Google Checkout account linked to your Google account and must be connected to the internet. @@ -181,6 +184,7 @@ Ad free option was already purchased! Purchasing... + Clearing... Feedback You have been using Calculator++ for some time \n diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 4a64e430..ae0b3094 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -10,10 +10,6 @@ a:defaultValue="false" /> - - + + \ No newline at end of file diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java index 032c2f4a..1b661c3b 100644 --- a/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java +++ b/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java @@ -188,8 +188,6 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster, Sh super.onCreate(savedInstanceState); setLayout(preferences); - //adView = AndroidUtils.createAndInflateAdView(this, R.id.ad_parent_view, ADMOB_USER_ID); - if (customTitleSupported) { try { getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.calc_title); @@ -307,6 +305,8 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster, Sh } + //adView = AndroidUtils.createAndInflateAdView(this, R.id.ad_parent_view, ADMOB_USER_ID); + preferences.registerOnSharedPreferenceChangeListener(this); } @@ -580,6 +580,11 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster, Sh } } + if ( savedVersion < 29 ) { + // just in case + CalculatorPreferencesActivity.removeBillingInformation(this, preferences); + } + //Log.d(this.getClass().getName(), "Application was opened " + appOpenedCounter + " time!"); if (!dialogShown) { diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorPreferencesActivity.java b/src/main/java/org/solovyev/android/calculator/CalculatorPreferencesActivity.java index 39abe089..88ee7ab1 100644 --- a/src/main/java/org/solovyev/android/calculator/CalculatorPreferencesActivity.java +++ b/src/main/java/org/solovyev/android/calculator/CalculatorPreferencesActivity.java @@ -7,15 +7,18 @@ package org.solovyev.android.calculator; import android.app.AlertDialog; import android.app.PendingIntent; +import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceActivity; +import android.preference.PreferenceManager; import android.util.Log; import android.widget.Toast; import net.robotmedia.billing.BillingController; import net.robotmedia.billing.IBillingObserver; import net.robotmedia.billing.ResponseCode; +import net.robotmedia.billing.helper.AbstractBillingObserver; import net.robotmedia.billing.model.Transaction; import org.jetbrains.annotations.NotNull; import org.solovyev.android.AndroidUtils; @@ -30,6 +33,8 @@ import org.solovyev.android.view.VibratorContainer; */ public class CalculatorPreferencesActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener, IBillingObserver { + public static final String CLEAR_BILLING_INFO = "clear_billing_info"; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -48,6 +53,29 @@ public class CalculatorPreferencesActivity extends PreferenceActivity implements preferences.registerOnSharedPreferenceChangeListener(this); onSharedPreferenceChanged(preferences, CalculatorEngine.Preferences.roundResult.getKey()); onSharedPreferenceChanged(preferences, VibratorContainer.HAPTIC_FEEDBACK_P_KEY); + + final Preference clearBillingInfoPreference = findPreference(CLEAR_BILLING_INFO); + if (clearBillingInfoPreference != null) { + clearBillingInfoPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + + Toast.makeText(CalculatorPreferencesActivity.this, R.string.c_calc_clearing, Toast.LENGTH_SHORT).show(); + + removeBillingInformation(CalculatorPreferencesActivity.this, PreferenceManager.getDefaultSharedPreferences(CalculatorPreferencesActivity.this)); + + return true; + } + }); + } + } + + public static void removeBillingInformation(@NotNull Context context, @NotNull SharedPreferences preferences) { + final SharedPreferences.Editor editor = preferences.edit(); + editor.putBoolean(AbstractBillingObserver.KEY_TRANSACTIONS_RESTORED, false); + editor.commit(); + + BillingController.dropBillingData(context); } private void setAdFreeAction() { @@ -109,7 +137,7 @@ public class CalculatorPreferencesActivity extends PreferenceActivity implements @Override public void onCheckBillingSupportedResponse(boolean supported) { - if ( supported ) { + if (supported) { setAdFreeAction(); } else { final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY); @@ -160,4 +188,9 @@ public class CalculatorPreferencesActivity extends PreferenceActivity implements public void onTransactionsRestored() { // do nothing } + + @Override + public void onErrorRestoreTransactions(@NotNull ResponseCode responseCode) { + // do nothing + } } diff --git a/src/main/java/org/solovyev/android/calculator/billing/CalculatorBillingService.java b/src/main/java/org/solovyev/android/calculator/billing/CalculatorBillingService.java deleted file mode 100644 index e3ee6fba..00000000 --- a/src/main/java/org/solovyev/android/calculator/billing/CalculatorBillingService.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.solovyev.android.calculator.billing; - -import net.robotmedia.billing.BillingService; -import org.solovyev.android.calculator.CalculatorApplication; - -/** - * User: serso - * Date: 2/12/12 - * Time: 1:45 PM - */ -public class CalculatorBillingService extends BillingService { - @Override - public void onCreate() { - super.onCreate(); - CalculatorApplication.registerOnRemoteStackTrace(); - } -} diff --git a/src/misc/lib/android_billing.jar b/src/misc/lib/android_billing.jar index 5e5a41c5..f0b1072d 100644 Binary files a/src/misc/lib/android_billing.jar and b/src/misc/lib/android_billing.jar differ