billing changes
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user