billing changes

This commit is contained in:
Sergey Solovyev 2012-02-13 00:10:24 +04:00
parent 691e94f7a3
commit 4bc319a46f
10 changed files with 62 additions and 30 deletions

View File

@ -101,7 +101,7 @@
<activity a:name="com.google.ads.AdActivity" <activity a:name="com.google.ads.AdActivity"
a:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> a:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
<service a:name=".billing.CalculatorBillingService"/> <service a:name="net.robotmedia.billing.BillingService"/>
<receiver a:name="net.robotmedia.billing.BillingReceiver"> <receiver a:name="net.robotmedia.billing.BillingReceiver">
<intent-filter> <intent-filter>
<action a:name="com.android.vending.billing.IN_APP_NOTIFY"/> <action a:name="com.android.vending.billing.IN_APP_NOTIFY"/>

View File

@ -15,6 +15,6 @@
--> -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="#667e22" android:endColor="#667e22"/> <gradient android:startColor="#088e3a" android:endColor="#088e3a"/>
<corners android:radius="1dp" /> <corners android:radius="1dp" />
</shape> </shape>

View File

@ -113,8 +113,8 @@
<string name="c_calc_multiplication_sign_summary">Устанавливает знак произведения</string> <string name="c_calc_multiplication_sign_summary">Устанавливает знак произведения</string>
<string name="c_calc_layout">Раскладка</string> <string name="c_calc_layout">Раскладка</string>
<string name="p_layout_cellphone">Телефон</string> <string name="p_layout_cellphone">Научная (телефон)</string>
<string name="p_layout_calculator">Калькулятор</string> <string name="p_layout_calculator">Научная</string>
<string name="p_layout_simple">Простая</string> <string name="p_layout_simple">Простая</string>
<string name="c_calc_layout_summary">Устанавливает раскладку кнопок</string> <string name="c_calc_layout_summary">Устанавливает раскладку кнопок</string>
@ -172,6 +172,9 @@
<string name="c_calc_use_back_button_as_prev_summary">Устанавливает поведение по нажатию на кнопку Назад</string> <string name="c_calc_use_back_button_as_prev_summary">Устанавливает поведение по нажатию на кнопку Назад</string>
<string name="c_calc_use_back_button_as_prev_title">Использовать кнопку назад как назад по истории</string> <string name="c_calc_use_back_button_as_prev_title">Использовать кнопку назад как назад по истории</string>
<string name="c_clear_billing_info_summary">Информация о покупках будет обновлена с сервера</string>
<string name="c_clear_billing_info_title">Очистить информация о покупках</string>
<string name="c_warning">Внимание</string> <string name="c_warning">Внимание</string>
<string name="c_error">Ошибка</string> <string name="c_error">Ошибка</string>
<string name="c_billing_error">Биллинг не поддерживается: вы должны иметь Google Checkout аккаунт привязанный в вашему Google аккаунту и должны быть подключены к интернету.</string> <string name="c_billing_error">Биллинг не поддерживается: вы должны иметь Google Checkout аккаунт привязанный в вашему Google аккаунту и должны быть подключены к интернету.</string>
@ -181,6 +184,7 @@
<string name="c_calc_already_purchased">Опция уже была куплена!</string> <string name="c_calc_already_purchased">Опция уже была куплена!</string>
<string name="c_calc_purchasing">Покупаем...</string> <string name="c_calc_purchasing">Покупаем...</string>
<string name="c_calc_clearing">Очищаем...</string>
<string name="c_feedback_title">Отзыв</string> <string name="c_feedback_title">Отзыв</string>
<string name="c_feedback_text">Вы используете Калькулятор++ некоторое время\n <string name="c_feedback_text">Вы используете Калькулятор++ некоторое время\n

View File

@ -30,6 +30,8 @@
<string name="p_calc_use_back_button_as_prev_key">org.solovyev.android.calculator.CalculatorActivity_use_back_button_as_prev</string> <string name="p_calc_use_back_button_as_prev_key">org.solovyev.android.calculator.CalculatorActivity_use_back_button_as_prev</string>
<string name="p_calc_use_back_button_as_prev">false</string> <string name="p_calc_use_back_button_as_prev">false</string>
<string name="p_clear_billing_info_key">clear_billing_info</string>
<string name="p_calc_show_release_notes_key">org.solovyev.android.calculator.CalculatorActivity_show_release_notes</string> <string name="p_calc_show_release_notes_key">org.solovyev.android.calculator.CalculatorActivity_show_release_notes</string>
<string name="p_calc_show_release_notes">true</string> <string name="p_calc_show_release_notes">true</string>

View File

@ -113,8 +113,8 @@
<string name="c_calc_multiplication_sign_summary">Sets multiplication sign</string> <string name="c_calc_multiplication_sign_summary">Sets multiplication sign</string>
<string name="c_calc_layout">Layout</string> <string name="c_calc_layout">Layout</string>
<string name="p_layout_cellphone">Cellphone</string> <string name="p_layout_cellphone">Scientific (cellphone)</string>
<string name="p_layout_calculator">Calculator</string> <string name="p_layout_calculator">Scientific</string>
<string name="p_layout_simple">Simple</string> <string name="p_layout_simple">Simple</string>
<string name="c_calc_layout_summary">Sets layout of buttons</string> <string name="c_calc_layout_summary">Sets layout of buttons</string>
@ -172,6 +172,9 @@
<string name="c_calc_use_back_button_as_prev_summary">Defines the behaviour of the Back button</string> <string name="c_calc_use_back_button_as_prev_summary">Defines the behaviour of the Back button</string>
<string name="c_calc_use_back_button_as_prev_title">Use Back button as history prev</string> <string name="c_calc_use_back_button_as_prev_title">Use Back button as history prev</string>
<string name="c_clear_billing_info_summary">Billing information will be reloaded from the server</string>
<string name="c_clear_billing_info_title">Clear billing information</string>
<string name="c_warning">Warning</string> <string name="c_warning">Warning</string>
<string name="c_error">Error</string> <string name="c_error">Error</string>
<string name="c_billing_error">Billing is not supported: you must have Google Checkout account linked to your Google account and must be connected to the internet.</string> <string name="c_billing_error">Billing is not supported: you must have Google Checkout account linked to your Google account and must be connected to the internet.</string>
@ -181,6 +184,7 @@
<string name="c_calc_already_purchased">Ad free option was already purchased!</string> <string name="c_calc_already_purchased">Ad free option was already purchased!</string>
<string name="c_calc_purchasing">Purchasing...</string> <string name="c_calc_purchasing">Purchasing...</string>
<string name="c_calc_clearing">Clearing...</string>
<string name="c_feedback_title">Feedback</string> <string name="c_feedback_title">Feedback</string>
<string name="c_feedback_text">You have been using Calculator++ for some time \n <string name="c_feedback_text">You have been using Calculator++ for some time \n

View File

@ -10,10 +10,6 @@
a:defaultValue="false" a:defaultValue="false"
/> />
<org.solovyev.android.ads.AdViewPreference
a:key="admob_01"
a:layout="@layout/admob_pref"/>
<PreferenceScreen a:title="@string/c_prefs_calculations_category"> <PreferenceScreen a:title="@string/c_prefs_calculations_category">
<android.preference.CheckBoxPreference <android.preference.CheckBoxPreference
@ -143,6 +139,11 @@
a:title="@string/c_calc_use_back_button_as_prev_title" a:title="@string/c_calc_use_back_button_as_prev_title"
a:defaultValue="false"/> a:defaultValue="false"/>
<Preference
a:key="@string/p_clear_billing_info_key"
a:summary="@string/c_clear_billing_info_summary"
a:title="@string/c_clear_billing_info_title"/>
</PreferenceScreen> </PreferenceScreen>
</PreferenceScreen> </PreferenceScreen>

View File

@ -188,8 +188,6 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster, Sh
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setLayout(preferences); setLayout(preferences);
//adView = AndroidUtils.createAndInflateAdView(this, R.id.ad_parent_view, ADMOB_USER_ID);
if (customTitleSupported) { if (customTitleSupported) {
try { try {
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.calc_title); 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); 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!"); //Log.d(this.getClass().getName(), "Application was opened " + appOpenedCounter + " time!");
if (!dialogShown) { if (!dialogShown) {

View File

@ -7,15 +7,18 @@ package org.solovyev.android.calculator;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import net.robotmedia.billing.BillingController; import net.robotmedia.billing.BillingController;
import net.robotmedia.billing.IBillingObserver; import net.robotmedia.billing.IBillingObserver;
import net.robotmedia.billing.ResponseCode; import net.robotmedia.billing.ResponseCode;
import net.robotmedia.billing.helper.AbstractBillingObserver;
import net.robotmedia.billing.model.Transaction; import net.robotmedia.billing.model.Transaction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.solovyev.android.AndroidUtils; 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 class CalculatorPreferencesActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener, IBillingObserver {
public static final String CLEAR_BILLING_INFO = "clear_billing_info";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -48,6 +53,29 @@ public class CalculatorPreferencesActivity extends PreferenceActivity implements
preferences.registerOnSharedPreferenceChangeListener(this); preferences.registerOnSharedPreferenceChangeListener(this);
onSharedPreferenceChanged(preferences, CalculatorEngine.Preferences.roundResult.getKey()); onSharedPreferenceChanged(preferences, CalculatorEngine.Preferences.roundResult.getKey());
onSharedPreferenceChanged(preferences, VibratorContainer.HAPTIC_FEEDBACK_P_KEY); 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() { private void setAdFreeAction() {
@ -160,4 +188,9 @@ public class CalculatorPreferencesActivity extends PreferenceActivity implements
public void onTransactionsRestored() { public void onTransactionsRestored() {
// do nothing // do nothing
} }
@Override
public void onErrorRestoreTransactions(@NotNull ResponseCode responseCode) {
// do nothing
}
} }

View File

@ -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.