In app purchase
This commit is contained in:
parent
577fac76f8
commit
ce2507e28e
@ -1,56 +1,56 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="87" android:versionName="1.3.2" package="org.solovyev.android.calculator">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="89" android:versionName="1.3.2" package="org.solovyev.android.calculator">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="com.android.vending.BILLING"/>
|
<uses-permission android:name="com.android.vending.BILLING"/>
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>
|
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>
|
||||||
|
|
||||||
<application android:debuggable="false" android:hardwareAccelerated="false" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/metro_blue_theme">
|
<application android:debuggable="false" android:hardwareAccelerated="false" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/metro_blue_theme">
|
||||||
|
|
||||||
<activity android:label="@string/c_app_name" android:name=".CalculatorActivity" android:windowSoftInputMode="adjustPan">
|
<activity android:label="@string/c_app_name" android:name=".CalculatorActivity" android:windowSoftInputMode="adjustPan">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<!-- settings must use action bar icon-->
|
<!-- settings must use action bar icon-->
|
||||||
<activity android:icon="@drawable/icon_action_bar" android:label="@string/c_app_settings" android:name=".CalculatorPreferencesActivity"/>
|
<activity android:icon="@drawable/icon_action_bar" android:label="@string/c_app_settings" android:name=".CalculatorPreferencesActivity"/>
|
||||||
|
|
||||||
<activity android:label="@string/c_history" android:name=".history.CalculatorHistoryActivity"/>
|
<activity android:label="@string/c_history" android:name=".history.CalculatorHistoryActivity"/>
|
||||||
|
|
||||||
<activity android:label="@string/c_about" android:name=".about.CalculatorAboutActivity"/>
|
<activity android:label="@string/c_about" android:name=".about.CalculatorAboutActivity"/>
|
||||||
|
|
||||||
<activity android:label="@string/c_help" android:name=".help.CalculatorHelpActivity"/>
|
<activity android:label="@string/c_help" android:name=".help.CalculatorHelpActivity"/>
|
||||||
|
|
||||||
<activity android:label="@string/c_functions" android:name=".math.edit.CalculatorFunctionsActivity"/>
|
<activity android:label="@string/c_functions" android:name=".math.edit.CalculatorFunctionsActivity"/>
|
||||||
|
|
||||||
<activity android:label="@string/c_operators" android:name=".math.edit.CalculatorOperatorsActivity"/>
|
<activity android:label="@string/c_operators" android:name=".math.edit.CalculatorOperatorsActivity"/>
|
||||||
|
|
||||||
<activity android:label="@string/c_vars_and_constants" android:name=".math.edit.CalculatorVarsActivity"/>
|
<activity android:label="@string/c_vars_and_constants" android:name=".math.edit.CalculatorVarsActivity"/>
|
||||||
|
|
||||||
<activity android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotActivity"/>
|
<activity android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotActivity"/>
|
||||||
|
|
||||||
<!-- settings must use action bar icon-->
|
<!-- settings must use action bar icon-->
|
||||||
<activity android:icon="@drawable/icon_action_bar" android:label="@string/c_settings" android:name=".plot.CalculatorPlotPreferenceActivity"/>
|
<activity android:icon="@drawable/icon_action_bar" android:label="@string/c_settings" android:name=".plot.CalculatorPlotPreferenceActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.ads.AdActivity"/>
|
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.ads.AdActivity"/>
|
||||||
|
|
||||||
<service android:name="net.robotmedia.billing.BillingService"/>
|
<service android:name="net.robotmedia.billing.BillingService"/>
|
||||||
<receiver android:name="net.robotmedia.billing.BillingReceiver">
|
<receiver android:name="net.robotmedia.billing.BillingReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.android.vending.billing.IN_APP_NOTIFY"/>
|
<action android:name="com.android.vending.billing.IN_APP_NOTIFY"/>
|
||||||
<action android:name="com.android.vending.billing.RESPONSE_CODE"/>
|
<action android:name="com.android.vending.billing.RESPONSE_CODE"/>
|
||||||
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED"/>
|
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<activity android:excludeFromRecents="true" android:finishOnTaskLaunch="true" android:launchMode="singleInstance" android:name="org.acra.CrashReportDialog" android:theme="@style/Theme.Sherlock.Dialog"/>
|
<activity android:excludeFromRecents="true" android:finishOnTaskLaunch="true" android:launchMode="singleInstance" android:name="org.acra.CrashReportDialog" android:theme="@style/Theme.Sherlock.Dialog"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
@ -1,150 +1,156 @@
|
|||||||
package org.solovyev.android.calculator;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import net.robotmedia.billing.BillingController;
|
import net.robotmedia.billing.BillingController;
|
||||||
import org.acra.ACRA;
|
import net.robotmedia.billing.helper.DefaultBillingObserver;
|
||||||
import org.acra.ReportingInteractionMode;
|
import org.acra.ACRA;
|
||||||
import org.acra.annotation.ReportsCrashes;
|
import org.acra.ReportingInteractionMode;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.acra.annotation.ReportsCrashes;
|
||||||
import org.solovyev.android.ads.AdsController;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.calculator.history.AndroidCalculatorHistory;
|
import org.solovyev.android.ads.AdsController;
|
||||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
import org.solovyev.android.calculator.history.AndroidCalculatorHistory;
|
||||||
|
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||||
/**
|
|
||||||
* User: serso
|
/**
|
||||||
* Date: 12/1/11
|
* User: serso
|
||||||
* Time: 1:21 PM
|
* Date: 12/1/11
|
||||||
*/
|
* Time: 1:21 PM
|
||||||
/*@ReportsCrashes(formKey = "dEhDaW1nZU1qcFdsVUpiSnhON0c0ZHc6MQ",
|
*/
|
||||||
mode = ReportingInteractionMode.TOAST)*/
|
/*@ReportsCrashes(formKey = "dEhDaW1nZU1qcFdsVUpiSnhON0c0ZHc6MQ",
|
||||||
@ReportsCrashes(formKey = "",
|
mode = ReportingInteractionMode.TOAST)*/
|
||||||
mailTo = "se.solovyev+programming+calculatorpp+crashes@gmail.com",
|
@ReportsCrashes(formKey = "",
|
||||||
mode = ReportingInteractionMode.DIALOG,
|
mailTo = "se.solovyev+programming+calculatorpp+crashes@gmail.com",
|
||||||
resToastText = R.string.crashed,
|
mode = ReportingInteractionMode.DIALOG,
|
||||||
resDialogTitle = R.string.crash_dialog_title,
|
resToastText = R.string.crashed,
|
||||||
resDialogText = R.string.crash_dialog_text)
|
resDialogTitle = R.string.crash_dialog_title,
|
||||||
public class CalculatorApplication extends android.app.Application {
|
resDialogText = R.string.crash_dialog_text)
|
||||||
|
public class CalculatorApplication extends android.app.Application {
|
||||||
/*
|
|
||||||
**********************************************************************
|
/*
|
||||||
*
|
**********************************************************************
|
||||||
* CONSTANTS
|
*
|
||||||
*
|
* CONSTANTS
|
||||||
**********************************************************************
|
*
|
||||||
*/
|
**********************************************************************
|
||||||
|
*/
|
||||||
public static final String FACEBOOK_APP_URL = "http://www.facebook.com/calculatorpp";
|
|
||||||
|
public static final String FACEBOOK_APP_URL = "http://www.facebook.com/calculatorpp";
|
||||||
public static final String AD_FREE_PRODUCT_ID = "ad_free";
|
|
||||||
public static final String AD_FREE_P_KEY = "org.solovyev.android.calculator_ad_free";
|
public static final String AD_FREE_PRODUCT_ID = "ad_free";
|
||||||
|
public static final String AD_FREE_P_KEY = "org.solovyev.android.calculator_ad_free";
|
||||||
public static final String ADMOB_USER_ID = "a14f02cf9c80cbc";
|
|
||||||
|
public static final String ADMOB_USER_ID = "a14f02cf9c80cbc";
|
||||||
@NotNull
|
|
||||||
private static CalculatorApplication instance;
|
@NotNull
|
||||||
|
private static CalculatorApplication instance;
|
||||||
/*
|
|
||||||
**********************************************************************
|
/*
|
||||||
*
|
**********************************************************************
|
||||||
* CONSTRUCTORS
|
*
|
||||||
*
|
* CONSTRUCTORS
|
||||||
**********************************************************************
|
*
|
||||||
*/
|
**********************************************************************
|
||||||
|
*/
|
||||||
public CalculatorApplication() {
|
|
||||||
instance = this;
|
public CalculatorApplication() {
|
||||||
}
|
instance = this;
|
||||||
|
}
|
||||||
/*
|
|
||||||
**********************************************************************
|
/*
|
||||||
*
|
**********************************************************************
|
||||||
* METHODS
|
*
|
||||||
*
|
* METHODS
|
||||||
**********************************************************************
|
*
|
||||||
*/
|
**********************************************************************
|
||||||
|
*/
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
@Override
|
||||||
ACRA.init(this);
|
public void onCreate() {
|
||||||
|
ACRA.init(this);
|
||||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
CalculatorPreferences.setDefaultValues(preferences);
|
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
CalculatorPreferences.setDefaultValues(preferences);
|
||||||
setTheme(preferences);
|
|
||||||
|
setTheme(preferences);
|
||||||
super.onCreate();
|
|
||||||
|
super.onCreate();
|
||||||
final AndroidCalculator calculator = new AndroidCalculator();
|
|
||||||
|
final AndroidCalculator calculator = new AndroidCalculator();
|
||||||
CalculatorLocatorImpl.getInstance().init(calculator,
|
|
||||||
new AndroidCalculatorEngine(this),
|
CalculatorLocatorImpl.getInstance().init(calculator,
|
||||||
new AndroidCalculatorClipboard(this),
|
new AndroidCalculatorEngine(this),
|
||||||
new AndroidCalculatorNotifier(this),
|
new AndroidCalculatorClipboard(this),
|
||||||
new AndroidCalculatorHistory(this, calculator));
|
new AndroidCalculatorNotifier(this),
|
||||||
|
new AndroidCalculatorHistory(this, calculator));
|
||||||
CalculatorLocatorImpl.getInstance().getCalculator().init();
|
|
||||||
|
CalculatorLocatorImpl.getInstance().getCalculator().init();
|
||||||
AdsController.getInstance().init(ADMOB_USER_ID, AD_FREE_PRODUCT_ID, new BillingController.IConfiguration() {
|
|
||||||
|
AdsController.getInstance().init(ADMOB_USER_ID, AD_FREE_PRODUCT_ID, new BillingController.IConfiguration() {
|
||||||
@Override
|
|
||||||
public byte[] getObfuscationSalt() {
|
@Override
|
||||||
return new byte[]{81, -114, 32, -127, -32, -104, -40, -15, -47, 57, -13, -41, -33, 67, -114, 7, -11, 53, 126, 82};
|
public byte[] getObfuscationSalt() {
|
||||||
}
|
return new byte[]{81, -114, 32, -127, -32, -104, -40, -15, -47, 57, -13, -41, -33, 67, -114, 7, -11, 53, 126, 82};
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public String getPublicKey() {
|
@Override
|
||||||
return CalculatorSecurity.getPK();
|
public String getPublicKey() {
|
||||||
}
|
return CalculatorSecurity.getPK();
|
||||||
});
|
}
|
||||||
|
});
|
||||||
BillingController.registerObserver(new CalculatorBillingObserver(this));
|
|
||||||
|
BillingController.registerObserver(new DefaultBillingObserver(this, null));
|
||||||
// init billing controller
|
|
||||||
BillingController.checkBillingSupported(this);
|
// init billing controller
|
||||||
}
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
private void setTheme(@NotNull SharedPreferences preferences) {
|
public void run() {
|
||||||
final CalculatorPreferences.Gui.Theme theme = CalculatorPreferences.Gui.getTheme(preferences);
|
BillingController.checkBillingSupported(CalculatorApplication.this);
|
||||||
setTheme(theme.getThemeId());
|
}
|
||||||
}
|
}).start();
|
||||||
|
}
|
||||||
@NotNull
|
|
||||||
public CalculatorActivityHelper createActivityHelper(int layoutResId, @NotNull String logTag) {
|
private void setTheme(@NotNull SharedPreferences preferences) {
|
||||||
return new CalculatorActivityHelperImpl(layoutResId, logTag);
|
final CalculatorPreferences.Gui.Theme theme = CalculatorPreferences.Gui.getTheme(preferences);
|
||||||
}
|
setTheme(theme.getThemeId());
|
||||||
|
}
|
||||||
@NotNull
|
|
||||||
public CalculatorFragmentHelper createFragmentHelper(int layoutId) {
|
@NotNull
|
||||||
return new CalculatorFragmentHelperImpl(layoutId);
|
public CalculatorActivityHelper createActivityHelper(int layoutResId, @NotNull String logTag) {
|
||||||
}
|
return new CalculatorActivityHelperImpl(layoutResId, logTag);
|
||||||
|
}
|
||||||
@NotNull
|
|
||||||
public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId) {
|
@NotNull
|
||||||
return new CalculatorFragmentHelperImpl(layoutId, titleResId);
|
public CalculatorFragmentHelper createFragmentHelper(int layoutId) {
|
||||||
}
|
return new CalculatorFragmentHelperImpl(layoutId);
|
||||||
@NotNull
|
}
|
||||||
public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId, boolean listenersOnCreate) {
|
|
||||||
return new CalculatorFragmentHelperImpl(layoutId, titleResId, listenersOnCreate);
|
@NotNull
|
||||||
}
|
public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId) {
|
||||||
|
return new CalculatorFragmentHelperImpl(layoutId, titleResId);
|
||||||
/*
|
}
|
||||||
**********************************************************************
|
@NotNull
|
||||||
*
|
public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId, boolean listenersOnCreate) {
|
||||||
* STATIC
|
return new CalculatorFragmentHelperImpl(layoutId, titleResId, listenersOnCreate);
|
||||||
*
|
}
|
||||||
**********************************************************************
|
|
||||||
*/
|
/*
|
||||||
|
**********************************************************************
|
||||||
@NotNull
|
*
|
||||||
public static CalculatorApplication getInstance() {
|
* STATIC
|
||||||
return instance;
|
*
|
||||||
}
|
**********************************************************************
|
||||||
|
*/
|
||||||
public static void likeButtonPressed(@NotNull final Context context) {
|
|
||||||
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(FACEBOOK_APP_URL)));
|
@NotNull
|
||||||
}
|
public static CalculatorApplication getInstance() {
|
||||||
}
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void likeButtonPressed(@NotNull final Context context) {
|
||||||
|
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(FACEBOOK_APP_URL)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2009-2012. Created by serso aka se.solovyev.
|
|
||||||
* For more information, please, contact se.solovyev@gmail.com
|
|
||||||
* or visit http://se.solovyev.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.solovyev.android.calculator;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import net.robotmedia.billing.ResponseCode;
|
|
||||||
import net.robotmedia.billing.helper.AbstractBillingObserver;
|
|
||||||
import net.robotmedia.billing.model.Transaction;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* User: serso
|
|
||||||
* Date: 1/5/12
|
|
||||||
* Time: 4:51 PM
|
|
||||||
*/
|
|
||||||
public class CalculatorBillingObserver extends AbstractBillingObserver {
|
|
||||||
|
|
||||||
public CalculatorBillingObserver(@NotNull Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCheckBillingSupportedResponse(boolean supported) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPurchaseIntentFailure(@NotNull String s, @NotNull ResponseCode responseCode) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPurchaseStateChanged(@NotNull String itemId, @NotNull Transaction.PurchaseState state) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRequestPurchaseResponse(@NotNull String itemId, @NotNull ResponseCode response) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user