Admob version update + checkout library instead of old billing
This commit is contained in:
parent
9ab677af81
commit
d5e5c9b6ac
@ -2,7 +2,11 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
|
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
|
||||||
<file url="file://$PROJECT_DIR$/android-app-core-tests/build.gradle" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/android-app-core-tests/build.gradle" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/android-app-core/src/main/java/org/solovyev/android/calculator/App.java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/android-app-core/src/main/java/org/solovyev/android/calculator/ServiceLocator.java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/android-app-tests/build.gradle" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/android-app-tests/build.gradle" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/android-app-tests/src/test/java/org/solovyev/android/CalculatorTestRunner.java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/android-app-tests/src/test/java/org/solovyev/android/CalculatorTestRunner.java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/android-app/src/main/java/android/preference/AdPreference.java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/android-app/src/main/res/layout/ad_pref.xml" charset="UTF-8" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -37,6 +37,30 @@
|
|||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
<component name="NullableNotNullManager">
|
||||||
|
<option name="myDefaultNullable" value="javax.annotation.Nullable" />
|
||||||
|
<option name="myDefaultNotNull" value="javax.annotation.Nonnull" />
|
||||||
|
<option name="myNullables">
|
||||||
|
<value>
|
||||||
|
<list size="4">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myNotNulls">
|
||||||
|
<value>
|
||||||
|
<list size="4">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||||
<OptionsSetting value="true" id="Add" />
|
<OptionsSetting value="true" id="Add" />
|
||||||
<OptionsSetting value="true" id="Remove" />
|
<OptionsSetting value="true" id="Remove" />
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<option name="DEPLOY" value="true" />
|
<option name="DEPLOY" value="true" />
|
||||||
<option name="ARTIFACT_NAME" value="" />
|
<option name="ARTIFACT_NAME" value="" />
|
||||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||||
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
|
<option name="USE_LAST_SELECTED_DEVICE" value="true" />
|
||||||
<option name="PREFERRED_AVD" value="" />
|
<option name="PREFERRED_AVD" value="" />
|
||||||
<option name="USE_COMMAND_LINE" value="true" />
|
<option name="USE_COMMAND_LINE" value="true" />
|
||||||
<option name="COMMAND_LINE" value="" />
|
<option name="COMMAND_LINE" value="" />
|
||||||
|
26
.idea/runConfigurations/Debug.xml
Normal file
26
.idea/runConfigurations/Debug.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Debug" type="AndroidRunConfigurationType" factoryName="Android Application">
|
||||||
|
<module name="android-app" />
|
||||||
|
<option name="ACTIVITY_CLASS" value="" />
|
||||||
|
<option name="MODE" value="do_nothing" />
|
||||||
|
<option name="DEPLOY" value="false" />
|
||||||
|
<option name="ARTIFACT_NAME" value="" />
|
||||||
|
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||||
|
<option name="USE_LAST_SELECTED_DEVICE" value="true" />
|
||||||
|
<option name="PREFERRED_AVD" value="" />
|
||||||
|
<option name="USE_COMMAND_LINE" value="true" />
|
||||||
|
<option name="COMMAND_LINE" value="" />
|
||||||
|
<option name="WIPE_USER_DATA" value="false" />
|
||||||
|
<option name="DISABLE_BOOT_ANIMATION" value="false" />
|
||||||
|
<option name="NETWORK_SPEED" value="full" />
|
||||||
|
<option name="NETWORK_LATENCY" value="none" />
|
||||||
|
<option name="CLEAR_LOGCAT" value="false" />
|
||||||
|
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||||
|
<option name="FILTER_LOGCAT_AUTOMATICALLY" value="true" />
|
||||||
|
<RunnerSettings RunnerId="AndroidDebugRunner" />
|
||||||
|
<ConfigurationWrapper RunnerId="AndroidDebugRunner" />
|
||||||
|
<method>
|
||||||
|
<option name="Make" enabled="false" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
24
.idea/runConfigurations/Run.xml
Normal file
24
.idea/runConfigurations/Run.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Run" type="AndroidRunConfigurationType" factoryName="Android Application">
|
||||||
|
<module name="android-app" />
|
||||||
|
<option name="ACTIVITY_CLASS" value="" />
|
||||||
|
<option name="MODE" value="default_activity" />
|
||||||
|
<option name="DEPLOY" value="true" />
|
||||||
|
<option name="ARTIFACT_NAME" value="" />
|
||||||
|
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||||
|
<option name="USE_LAST_SELECTED_DEVICE" value="true" />
|
||||||
|
<option name="PREFERRED_AVD" value="" />
|
||||||
|
<option name="USE_COMMAND_LINE" value="true" />
|
||||||
|
<option name="COMMAND_LINE" value="" />
|
||||||
|
<option name="WIPE_USER_DATA" value="false" />
|
||||||
|
<option name="DISABLE_BOOT_ANIMATION" value="false" />
|
||||||
|
<option name="NETWORK_SPEED" value="full" />
|
||||||
|
<option name="NETWORK_LATENCY" value="none" />
|
||||||
|
<option name="CLEAR_LOGCAT" value="false" />
|
||||||
|
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||||
|
<option name="FILTER_LOGCAT_AUTOMATICALLY" value="true" />
|
||||||
|
<RunnerSettings RunnerId="AndroidDebugRunner" />
|
||||||
|
<ConfigurationWrapper RunnerId="AndroidDebugRunner" />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
@ -71,42 +71,40 @@
|
|||||||
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="core" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="core" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="internal_impl-21.0.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="admob-6.4.1-r11.0.0" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="internal_impl-21.0.3" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -84,10 +84,10 @@
|
|||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" exported="" name="android-common-app-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="play-services-6.5.87" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" name="admob-6.4.1-r11.0.0" level="project" />
|
<orderEntry type="library" exported="" name="checkout-0.6.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
|
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
||||||
@ -98,8 +98,8 @@
|
|||||||
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
|
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
||||||
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
||||||
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
||||||
|
@ -48,13 +48,13 @@ dependencies {
|
|||||||
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-app:1.1.18@aar'
|
|
||||||
compile('org.solovyev:jscl:1.0.8') {
|
compile('org.solovyev:jscl:1.0.8') {
|
||||||
exclude(module: 'xercesImpl')
|
exclude(module: 'xercesImpl')
|
||||||
}
|
}
|
||||||
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
||||||
compile 'com.google.android.admob:admob:6.4.1-r11.0.0'
|
|
||||||
compile 'com.android.support:support-v4:21.0.3'
|
compile 'com.android.support:support-v4:21.0.3'
|
||||||
|
compile 'org.solovyev.android:checkout:0.6.0@aar'
|
||||||
|
compile 'com.google.android.gms:play-services:6.5.87@aar'
|
||||||
//testCompile group: 'org.robolectric', name: 'robolectric', version: '2.1.1'
|
//testCompile group: 'org.robolectric', name: 'robolectric', version: '2.1.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,4 +8,8 @@
|
|||||||
android:minSdkVersion="4"
|
android:minSdkVersion="4"
|
||||||
android:targetSdkVersion="17"/>
|
android:targetSdkVersion="17"/>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.android.gms.version"
|
||||||
|
android:value="@integer/google_play_services_version" />
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -0,0 +1,166 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 serso aka se.solovyev
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
* Contact details
|
||||||
|
*
|
||||||
|
* Email: se.solovyev@gmail.com
|
||||||
|
* Site: http://se.solovyev.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import org.solovyev.android.UiThreadExecutor;
|
||||||
|
import org.solovyev.common.listeners.JEvent;
|
||||||
|
import org.solovyev.common.listeners.JEventListener;
|
||||||
|
import org.solovyev.common.listeners.JEventListeners;
|
||||||
|
import org.solovyev.common.listeners.Listeners;
|
||||||
|
import org.solovyev.common.threads.DelayedExecutor;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: serso
|
||||||
|
* Date: 12/1/12
|
||||||
|
* Time: 3:58 PM
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class aggregates several useful in any Android application interfaces and provides access to {@link android.app.Application} object from a static context.
|
||||||
|
* NOTE: use this class only if you don't use and dependency injection library (if you use any you can directly set interfaces through it). <br/>
|
||||||
|
* <p/>
|
||||||
|
* Before first usage this class must be initialized by calling {@link App#init(android.app.Application)} method (for example, from {@link android.app.Application#onCreate()})
|
||||||
|
*/
|
||||||
|
public final class App {
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* FIELDS
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private static volatile Application application;
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private static volatile ServiceLocator locator;
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private static volatile DelayedExecutor uiThreadExecutor;
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private static volatile JEventListeners<JEventListener<? extends JEvent>, JEvent> eventBus;
|
||||||
|
|
||||||
|
private static volatile boolean initialized;
|
||||||
|
|
||||||
|
private App() {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* METHODS
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static <A extends Application & ServiceLocator> void init(@Nonnull A application) {
|
||||||
|
init(application, new UiThreadExecutor(), Listeners.newEventBus(), application);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(@Nonnull Application application, @Nullable ServiceLocator serviceLocator) {
|
||||||
|
init(application, new UiThreadExecutor(), Listeners.newEventBus(), serviceLocator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(@Nonnull Application application,
|
||||||
|
@Nonnull UiThreadExecutor uiThreadExecutor,
|
||||||
|
@Nonnull JEventListeners<JEventListener<? extends JEvent>, JEvent> eventBus,
|
||||||
|
@Nullable ServiceLocator serviceLocator) {
|
||||||
|
if (!initialized) {
|
||||||
|
App.application = application;
|
||||||
|
App.uiThreadExecutor = uiThreadExecutor;
|
||||||
|
App.eventBus = eventBus;
|
||||||
|
if (serviceLocator != null) {
|
||||||
|
App.locator = serviceLocator;
|
||||||
|
} else {
|
||||||
|
// empty service locator
|
||||||
|
App.locator = new ServiceLocator() {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
App.initialized = true;
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Already initialized!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void checkInit() {
|
||||||
|
if (!initialized) {
|
||||||
|
throw new IllegalStateException("App should be initialized!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return if App has already been initialized, false otherwise
|
||||||
|
*/
|
||||||
|
public static boolean isInitialized() {
|
||||||
|
return initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param <A> real type of application
|
||||||
|
* @return application instance which was provided in {@link App#init(android.app.Application)} method
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public static <A extends Application> A getApplication() {
|
||||||
|
checkInit();
|
||||||
|
return (A) application;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param <L> real type of service locator
|
||||||
|
* @return instance of service locator user in application
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public static <L extends ServiceLocator> L getLocator() {
|
||||||
|
checkInit();
|
||||||
|
return (L) locator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method returns executor which runs on Main Application's thread. It's safe to do all UI work on this executor
|
||||||
|
*
|
||||||
|
* @return UI thread executor
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public static DelayedExecutor getUiThreadExecutor() {
|
||||||
|
checkInit();
|
||||||
|
return uiThreadExecutor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return application's event bus
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public static JEventListeners<JEventListener<? extends JEvent>, JEvent> getEventBus() {
|
||||||
|
checkInit();
|
||||||
|
return eventBus;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marker interface for service locator
|
||||||
|
*/
|
||||||
|
public interface ServiceLocator {
|
||||||
|
}
|
@ -27,17 +27,15 @@ import android.content.Context;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import org.simpleframework.xml.Serializer;
|
import org.simpleframework.xml.Serializer;
|
||||||
import org.simpleframework.xml.core.Persister;
|
import org.simpleframework.xml.core.Persister;
|
||||||
import org.solovyev.android.App;
|
import org.solovyev.android.calculator.App;
|
||||||
import org.solovyev.android.calculator.MathEntityDao;
|
import org.solovyev.android.calculator.MathEntityDao;
|
||||||
import org.solovyev.android.calculator.MathEntityPersistenceContainer;
|
import org.solovyev.android.calculator.MathEntityPersistenceContainer;
|
||||||
import org.solovyev.android.calculator.MathPersistenceEntity;
|
import org.solovyev.android.calculator.MathPersistenceEntity;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
4
android-app-core/src/main/res/values/admob.xml
Normal file
4
android-app-core/src/main/res/values/admob.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="admob" translatable="false">ca-app-pub-2228934497384784/2916398892</string>
|
||||||
|
</resources>
|
@ -84,10 +84,8 @@
|
|||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" exported="" name="android-common-app-1.1.18" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" name="admob-6.4.1-r11.0.0" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
|
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
||||||
@ -98,8 +96,8 @@
|
|||||||
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
|
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
||||||
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
||||||
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
||||||
|
@ -48,12 +48,10 @@ dependencies {
|
|||||||
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-app:1.1.18@aar'
|
|
||||||
compile('org.solovyev:jscl:1.0.8') {
|
compile('org.solovyev:jscl:1.0.8') {
|
||||||
exclude(module: 'xercesImpl')
|
exclude(module: 'xercesImpl')
|
||||||
}
|
}
|
||||||
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
||||||
compile 'com.google.android.admob:admob:6.4.1-r11.0.0'
|
|
||||||
compile 'com.android.support:support-v4:21.0.3'
|
compile 'com.android.support:support-v4:21.0.3'
|
||||||
//testCompile group: 'org.robolectric', name: 'robolectric', version: '2.1.1'
|
//testCompile group: 'org.robolectric', name: 'robolectric', version: '2.1.1'
|
||||||
}
|
}
|
||||||
|
@ -23,22 +23,7 @@
|
|||||||
package org.solovyev.android.calculator.onscreen;
|
package org.solovyev.android.calculator.onscreen;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import org.solovyev.android.Android;
|
|
||||||
import org.solovyev.android.App;
|
|
||||||
import org.solovyev.android.calculator.AbstractFixableError;
|
|
||||||
import org.solovyev.android.calculator.CalculatorPreferences;
|
|
||||||
import org.solovyev.android.calculator.FixableMessage;
|
|
||||||
import org.solovyev.android.calculator.FixableMessagesDialog;
|
|
||||||
import org.solovyev.common.msg.MessageType;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class CalculatorOnscreenStartActivity extends Activity {
|
public class CalculatorOnscreenStartActivity extends Activity {
|
||||||
|
|
||||||
|
@ -71,42 +71,40 @@
|
|||||||
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="core" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="core" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="internal_impl-21.0.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="admob-6.4.1-r11.0.0" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="internal_impl-21.0.3" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -84,10 +84,8 @@
|
|||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" exported="" name="android-common-app-1.1.18" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" name="admob-6.4.1-r11.0.0" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
|
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
||||||
@ -98,8 +96,8 @@
|
|||||||
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
|
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
||||||
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
||||||
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
||||||
|
@ -48,12 +48,10 @@ dependencies {
|
|||||||
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-app:1.1.18@aar'
|
|
||||||
compile('org.solovyev:jscl:1.0.8') {
|
compile('org.solovyev:jscl:1.0.8') {
|
||||||
exclude(module: 'xercesImpl')
|
exclude(module: 'xercesImpl')
|
||||||
}
|
}
|
||||||
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
||||||
compile 'com.google.android.admob:admob:6.4.1-r11.0.0'
|
|
||||||
compile 'com.android.support:support-v4:21.0.3'
|
compile 'com.android.support:support-v4:21.0.3'
|
||||||
//testCompile group: 'org.robolectric', name: 'robolectric', version: '2.1.1'
|
//testCompile group: 'org.robolectric', name: 'robolectric', version: '2.1.1'
|
||||||
}
|
}
|
||||||
|
@ -86,10 +86,9 @@
|
|||||||
<orderEntry type="library" exported="" name="android-common-db-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-db-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" name="admob-6.4.1-r11.0.0" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="acra-4.5.0" level="project" />
|
<orderEntry type="library" exported="" name="acra-4.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="checkout-0.6.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-billing-1.1.18" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="android-common-security-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-security-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-other-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-other-1.1.18" level="project" />
|
||||||
@ -97,7 +96,6 @@
|
|||||||
<orderEntry type="library" exported="" name="common-core-1.0.7" level="project" />
|
<orderEntry type="library" exported="" name="common-core-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" name="common-msg-1.0.5" level="project" />
|
<orderEntry type="library" exported="" name="common-msg-1.0.5" level="project" />
|
||||||
<orderEntry type="library" exported="" name="common-listeners-1.0.7" level="project" />
|
<orderEntry type="library" exported="" name="common-listeners-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-ads-1.1.18" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="common-text-1.0.7" level="project" />
|
<orderEntry type="library" exported="" name="common-text-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||||
|
@ -51,8 +51,6 @@ dependencies {
|
|||||||
compile ('ch.acra:acra:4.5.0') {
|
compile ('ch.acra:acra:4.5.0') {
|
||||||
exclude group: 'org.json'
|
exclude group: 'org.json'
|
||||||
}
|
}
|
||||||
compile 'org.solovyev.android:android-common-ads:1.1.18@aar'
|
|
||||||
compile 'org.solovyev.android:android-common-billing:1.1.18@aar'
|
|
||||||
compile 'org.solovyev.android:android-common-sherlock:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-sherlock:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-lists:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-lists:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-wizard:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-wizard:1.1.18@aar'
|
||||||
@ -60,6 +58,7 @@ dependencies {
|
|||||||
compile 'org.solovyev.android:android-common-other:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-other:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-db:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-db:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-security:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-security:1.1.18@aar'
|
||||||
|
compile 'org.solovyev.android:checkout:0.6.0@aar'
|
||||||
compile project(':android-app-core')
|
compile project(':android-app-core')
|
||||||
compile project(':android-app-widget')
|
compile project(':android-app-widget')
|
||||||
compile project(':android-app-onscreen')
|
compile project(':android-app-onscreen')
|
||||||
|
@ -20,7 +20,11 @@
|
|||||||
<supports-screens android:xlargeScreens="true"/>
|
<supports-screens android:xlargeScreens="true"/>
|
||||||
<supports-screens android:anyDensity="true"/>
|
<supports-screens android:anyDensity="true"/>
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17"/>
|
<meta-data
|
||||||
|
android:name="com.google.android.gms.version"
|
||||||
|
android:value="@integer/google_play_services_version" />
|
||||||
|
|
||||||
|
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17"/>
|
||||||
|
|
||||||
<application android:allowBackup="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/cpp_metro_blue_theme">
|
<application android:allowBackup="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/cpp_metro_blue_theme">
|
||||||
|
|
||||||
@ -42,7 +46,7 @@
|
|||||||
<activity android:clearTaskOnLaunch="true" android:label="@string/c_app_name" android:launchMode="singleTop" android:name=".CalculatorActivityMobile" android:windowSoftInputMode="adjustPan"/>
|
<activity android:clearTaskOnLaunch="true" android:label="@string/c_app_name" android:launchMode="singleTop" android:name=".CalculatorActivityMobile" android:windowSoftInputMode="adjustPan"/>
|
||||||
|
|
||||||
<!-- settings must use action bar icon-->
|
<!-- settings must use action bar icon-->
|
||||||
<activity android:icon="@drawable/ab_icon" android:label="@string/c_app_settings" android:name=".preferences.CalculatorPreferencesActivity"/>
|
<activity android:icon="@drawable/ab_icon" android:label="@string/c_app_settings" android:name=".preferences.PreferencesActivity"/>
|
||||||
|
|
||||||
<activity android:label="@string/c_history" android:name=".history.CalculatorHistoryActivity"/>
|
<activity android:label="@string/c_history" android:name=".history.CalculatorHistoryActivity"/>
|
||||||
|
|
||||||
@ -85,7 +89,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<!-- settings must use action bar icon-->
|
<!-- settings must use action bar icon-->
|
||||||
<activity android:icon="@drawable/ab_icon" android:label="@string/c_settings" android:name=".plot.CalculatorPlotPreferenceActivity"/>
|
<activity android:icon="@drawable/ab_icon" android:label="@string/c_settings" android:name=".plot.PlotPreferenceActivity"/>
|
||||||
|
|
||||||
<!-- ONSCREEN CONFIG -->
|
<!-- ONSCREEN CONFIG -->
|
||||||
|
|
||||||
@ -167,18 +171,12 @@
|
|||||||
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget_info_4x5"/>
|
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget_info_4x5"/>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<!-- ADMOB + BILLING CONFIG -->
|
<!-- ADMOB -->
|
||||||
|
|
||||||
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.ads.AdActivity"/>
|
<activity
|
||||||
|
android:name="com.google.android.gms.ads.AdActivity"
|
||||||
<service android:name="net.robotmedia.billing.BillingService"/>
|
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
|
||||||
<receiver android:name="net.robotmedia.billing.BillingReceiver">
|
android:theme="@android:style/Theme.Translucent" />
|
||||||
<intent-filter>
|
|
||||||
<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.PURCHASE_STATE_CHANGED"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<!-- ACRA CONFIG -->
|
<!-- ACRA CONFIG -->
|
||||||
|
|
||||||
|
@ -0,0 +1,90 @@
|
|||||||
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import com.google.android.gms.ads.AdListener;
|
||||||
|
import com.google.android.gms.ads.AdRequest;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class AdView extends FrameLayout {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private com.google.android.gms.ads.AdView admobView;
|
||||||
|
|
||||||
|
public AdView(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroy() {
|
||||||
|
if (admobView != null) {
|
||||||
|
admobView.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pause() {
|
||||||
|
if (admobView != null) {
|
||||||
|
admobView.pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resume() {
|
||||||
|
if (admobView != null) {
|
||||||
|
admobView.resume();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show() {
|
||||||
|
if (admobView != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setVisibility(VISIBLE);
|
||||||
|
|
||||||
|
LayoutInflater.from(getContext()).inflate(R.layout.admob, this);
|
||||||
|
admobView = (com.google.android.gms.ads.AdView) findViewById(R.id.admob);
|
||||||
|
admobView.setVisibility(View.VISIBLE);
|
||||||
|
admobView.setAdListener(new AdListener() {
|
||||||
|
@Override
|
||||||
|
public void onAdFailedToLoad(int errorCode) {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdLoaded() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final AdRequest.Builder b = new AdRequest.Builder();
|
||||||
|
b.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
// LG Nexus 5
|
||||||
|
b.addTestDevice("B80E676D60CE6FDBE1B84A55464E3FE1");
|
||||||
|
}
|
||||||
|
admobView.loadAd(b.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hide() {
|
||||||
|
if(admobView == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setVisibility(GONE);
|
||||||
|
|
||||||
|
admobView.setVisibility(View.GONE);
|
||||||
|
admobView.pause();
|
||||||
|
admobView.destroy();
|
||||||
|
admobView = null;
|
||||||
|
}
|
||||||
|
}
|
@ -32,13 +32,9 @@ import android.preference.PreferenceManager;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
|
|
||||||
import jscl.math.Generic;
|
import jscl.math.Generic;
|
||||||
|
|
||||||
import org.solovyev.android.Android;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.App;
|
|
||||||
import org.solovyev.android.calculator.about.CalculatorAboutActivity;
|
import org.solovyev.android.calculator.about.CalculatorAboutActivity;
|
||||||
import org.solovyev.android.calculator.function.FunctionEditDialogFragment;
|
import org.solovyev.android.calculator.function.FunctionEditDialogFragment;
|
||||||
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
|
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
|
||||||
@ -46,14 +42,13 @@ import org.solovyev.android.calculator.math.edit.*;
|
|||||||
import org.solovyev.android.calculator.matrix.CalculatorMatrixActivity;
|
import org.solovyev.android.calculator.matrix.CalculatorMatrixActivity;
|
||||||
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
|
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
|
||||||
import org.solovyev.android.calculator.plot.CalculatorPlotter;
|
import org.solovyev.android.calculator.plot.CalculatorPlotter;
|
||||||
import org.solovyev.android.calculator.preferences.CalculatorPreferencesActivity;
|
import org.solovyev.android.calculator.preferences.PreferencesActivity;
|
||||||
import org.solovyev.common.msg.Message;
|
import org.solovyev.common.msg.Message;
|
||||||
import org.solovyev.common.msg.MessageType;
|
import org.solovyev.common.msg.MessageType;
|
||||||
import org.solovyev.common.text.Strings;
|
import org.solovyev.common.text.Strings;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,7 +76,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void showSettings(@Nonnull final Context context, boolean detached) {
|
public static void showSettings(@Nonnull final Context context, boolean detached) {
|
||||||
final Intent intent = new Intent(context, CalculatorPreferencesActivity.class);
|
final Intent intent = new Intent(context, PreferencesActivity.class);
|
||||||
Android.addIntentFlags(intent, detached, context);
|
Android.addIntentFlags(intent, detached, context);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
@ -29,16 +29,10 @@ import android.graphics.Typeface;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import net.robotmedia.billing.BillingController;
|
|
||||||
import net.robotmedia.billing.helper.DefaultBillingObserver;
|
|
||||||
import net.robotmedia.billing.model.BillingDB;
|
|
||||||
import org.acra.ACRA;
|
import org.acra.ACRA;
|
||||||
import org.acra.ReportingInteractionMode;
|
import org.acra.ReportingInteractionMode;
|
||||||
import org.acra.annotation.ReportsCrashes;
|
import org.acra.annotation.ReportsCrashes;
|
||||||
import org.solovyev.android.Android;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.App;
|
|
||||||
import org.solovyev.android.ServiceLocator;
|
|
||||||
import org.solovyev.android.ads.AdsController;
|
|
||||||
import org.solovyev.android.calculator.history.AndroidCalculatorHistory;
|
import org.solovyev.android.calculator.history.AndroidCalculatorHistory;
|
||||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||||
import org.solovyev.android.calculator.onscreen.CalculatorOnscreenStartActivity;
|
import org.solovyev.android.calculator.onscreen.CalculatorOnscreenStartActivity;
|
||||||
@ -46,12 +40,15 @@ import org.solovyev.android.calculator.plot.AndroidCalculatorPlotter;
|
|||||||
import org.solovyev.android.calculator.plot.CalculatorPlotterImpl;
|
import org.solovyev.android.calculator.plot.CalculatorPlotterImpl;
|
||||||
import org.solovyev.android.calculator.view.EditorTextProcessor;
|
import org.solovyev.android.calculator.view.EditorTextProcessor;
|
||||||
import org.solovyev.android.calculator.wizard.CalculatorWizards;
|
import org.solovyev.android.calculator.wizard.CalculatorWizards;
|
||||||
|
import org.solovyev.android.checkout.*;
|
||||||
import org.solovyev.android.wizard.Wizards;
|
import org.solovyev.android.wizard.Wizards;
|
||||||
import org.solovyev.common.msg.MessageType;
|
import org.solovyev.common.msg.MessageType;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
@ -74,12 +71,14 @@ public class CalculatorApplication extends android.app.Application implements Sh
|
|||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
static final String MAIL = "se.solovyev@gmail.com";
|
||||||
|
|
||||||
private static final String TAG = "Calculator++ Application";
|
private static final String TAG = "Calculator++ Application";
|
||||||
|
|
||||||
public static final String AD_FREE_PRODUCT_ID = "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 AD_FREE_P_KEY = "org.solovyev.android.calculator_ad_free";
|
||||||
|
public static final String ADMOB = "ca-app-pub-2228934497384784/2916398892";
|
||||||
public static final String ADMOB_USER_ID = "a14f02cf9c80cbc";
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private static CalculatorApplication instance;
|
private static CalculatorApplication instance;
|
||||||
@ -109,6 +108,25 @@ public class CalculatorApplication extends android.app.Application implements Sh
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
private Typeface typeFace;
|
private Typeface typeFace;
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final Billing billing = new Billing(this, new Billing.DefaultConfiguration() {
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public String getPublicKey() {
|
||||||
|
return CalculatorSecurity.getPK();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Inventory getFallbackInventory(@Nonnull Checkout checkout, @Nonnull Executor onLoadExecutor) {
|
||||||
|
if (RobotmediaDatabase.exists(billing.getContext())) {
|
||||||
|
return new RobotmediaInventory(checkout, onLoadExecutor);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*
|
*
|
||||||
@ -137,7 +155,9 @@ public class CalculatorApplication extends android.app.Application implements Sh
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
ACRA.init(this);
|
if (!BuildConfig.DEBUG) {
|
||||||
|
ACRA.init(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (!App.isInitialized()) {
|
if (!App.isInitialized()) {
|
||||||
App.init(this);
|
App.init(this);
|
||||||
@ -178,32 +198,11 @@ public class CalculatorApplication extends android.app.Application implements Sh
|
|||||||
|
|
||||||
Locator.getInstance().getCalculator().init();
|
Locator.getInstance().getCalculator().init();
|
||||||
|
|
||||||
BillingDB.init(CalculatorApplication.this);
|
billing.connect();
|
||||||
|
|
||||||
if (withAds) {
|
|
||||||
AdsController.getInstance().init(this, ADMOB_USER_ID, AD_FREE_PRODUCT_ID, new BillingController.IConfiguration() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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() {
|
|
||||||
return CalculatorSecurity.getPK();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
BillingController.registerObserver(new DefaultBillingObserver(this, null));
|
|
||||||
|
|
||||||
// init billing controller
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
BillingController.checkBillingSupported(CalculatorApplication.this);
|
|
||||||
AdsController.getInstance().isAdFree(CalculatorApplication.this);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// prepare engine
|
// prepare engine
|
||||||
Locator.getInstance().getEngine().getMathEngine0().evaluate("1+1");
|
Locator.getInstance().getEngine().getMathEngine0().evaluate("1+1");
|
||||||
@ -261,6 +260,11 @@ public class CalculatorApplication extends android.app.Application implements Sh
|
|||||||
return typeFace;
|
return typeFace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
public Billing getBilling() {
|
||||||
|
return billing;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*
|
*
|
||||||
|
@ -23,17 +23,17 @@
|
|||||||
package org.solovyev.android.calculator;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import org.solovyev.android.checkout.*;
|
||||||
import com.google.ads.AdView;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.solovyev.android.ads.AdsController;
|
import static java.util.Arrays.asList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
@ -42,6 +42,8 @@ import org.solovyev.android.ads.AdsController;
|
|||||||
*/
|
*/
|
||||||
public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper implements CalculatorFragmentHelper {
|
public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper implements CalculatorFragmentHelper {
|
||||||
|
|
||||||
|
private ActivityCheckout checkout;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private AdView adView;
|
private AdView adView;
|
||||||
|
|
||||||
@ -51,6 +53,9 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
|
|||||||
|
|
||||||
private boolean listenersOnCreate = true;
|
private boolean listenersOnCreate = true;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private Boolean adFree = null;
|
||||||
|
|
||||||
public CalculatorFragmentHelperImpl(int layoutId) {
|
public CalculatorFragmentHelperImpl(int layoutId) {
|
||||||
this.layoutId = layoutId;
|
this.layoutId = layoutId;
|
||||||
}
|
}
|
||||||
@ -84,26 +89,57 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nonnull Fragment fragment) {
|
public void onCreate(@Nonnull Fragment fragment) {
|
||||||
super.onCreate(fragment.getActivity());
|
final FragmentActivity activity = fragment.getActivity();
|
||||||
|
super.onCreate(activity);
|
||||||
|
checkout = Checkout.forActivity(activity, CalculatorApplication.getInstance().getBilling(), Products.create().add(ProductTypes.IN_APP, asList("ad_free")));
|
||||||
|
|
||||||
if (listenersOnCreate) {
|
if (listenersOnCreate) {
|
||||||
if (fragment instanceof CalculatorEventListener) {
|
if (fragment instanceof CalculatorEventListener) {
|
||||||
Locator.getInstance().getCalculator().addCalculatorEventListener((CalculatorEventListener) fragment);
|
Locator.getInstance().getCalculator().addCalculatorEventListener((CalculatorEventListener) fragment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkout.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume(@Nonnull Fragment fragment) {
|
public void onResume(@Nonnull Fragment fragment) {
|
||||||
|
if (adView != null) {
|
||||||
|
adView.resume();
|
||||||
|
}
|
||||||
if (!listenersOnCreate) {
|
if (!listenersOnCreate) {
|
||||||
if (fragment instanceof CalculatorEventListener) {
|
if (fragment instanceof CalculatorEventListener) {
|
||||||
Locator.getInstance().getCalculator().addCalculatorEventListener((CalculatorEventListener) fragment);
|
Locator.getInstance().getCalculator().addCalculatorEventListener((CalculatorEventListener) fragment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkout.loadInventory().whenLoaded(new Inventory.Listener() {
|
||||||
|
@Override
|
||||||
|
public void onLoaded(@Nonnull Inventory.Products products) {
|
||||||
|
adFree = products.get(ProductTypes.IN_APP).isPurchased("ad_free");
|
||||||
|
updateAdViewState();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateAdViewState() {
|
||||||
|
if(adFree == null || adView == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adFree) {
|
||||||
|
adView.hide();
|
||||||
|
} else {
|
||||||
|
adView.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause(@Nonnull Fragment fragment) {
|
public void onPause(@Nonnull Fragment fragment) {
|
||||||
|
adFree = null;
|
||||||
|
if (adView != null) {
|
||||||
|
adView.pause();
|
||||||
|
}
|
||||||
if (!listenersOnCreate) {
|
if (!listenersOnCreate) {
|
||||||
if (fragment instanceof CalculatorEventListener) {
|
if (fragment instanceof CalculatorEventListener) {
|
||||||
Locator.getInstance().getCalculator().removeCalculatorEventListener((CalculatorEventListener) fragment);
|
Locator.getInstance().getCalculator().removeCalculatorEventListener((CalculatorEventListener) fragment);
|
||||||
@ -113,16 +149,15 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@Nonnull Fragment fragment, @Nonnull View root) {
|
public void onViewCreated(@Nonnull Fragment fragment, @Nonnull View root) {
|
||||||
final ViewGroup adParentView = (ViewGroup) root.findViewById(R.id.ad_parent_view);
|
adView = (AdView) root.findViewById(R.id.ad);
|
||||||
final ViewGroup mainFragmentLayout = (ViewGroup) root.findViewById(R.id.main_fragment_layout);
|
final ViewGroup mainFragmentLayout = (ViewGroup) root.findViewById(R.id.main_fragment_layout);
|
||||||
|
|
||||||
if (fragment instanceof CalculatorDisplayFragment || fragment instanceof CalculatorEditorFragment || fragment instanceof CalculatorKeyboardFragment) {
|
if (fragment instanceof CalculatorDisplayFragment || fragment instanceof CalculatorEditorFragment || fragment instanceof CalculatorKeyboardFragment) {
|
||||||
// no ads in those fragments
|
// no ads in those fragments
|
||||||
} else {
|
} else {
|
||||||
if (adParentView != null) {
|
if (adView != null) {
|
||||||
adView = AdsController.getInstance().inflateAd(fragment.getActivity(), adParentView, R.id.ad_parent_view);
|
updateAdViewState();
|
||||||
} else if (mainFragmentLayout != null) {
|
} else if (mainFragmentLayout != null) {
|
||||||
adView = AdsController.getInstance().inflateAd(fragment.getActivity(), mainFragmentLayout, R.id.main_fragment_layout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +170,10 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy(@Nonnull Fragment fragment) {
|
public void onDestroy(@Nonnull Fragment fragment) {
|
||||||
super.onDestroy(fragment.getActivity());
|
if (adView != null) {
|
||||||
|
adView.destroy();
|
||||||
|
adView = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (listenersOnCreate) {
|
if (listenersOnCreate) {
|
||||||
if (fragment instanceof CalculatorEventListener) {
|
if (fragment instanceof CalculatorEventListener) {
|
||||||
@ -143,9 +181,9 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.adView != null) {
|
checkout.stop();
|
||||||
this.adView.destroy();
|
|
||||||
}
|
super.onDestroy(fragment.getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -417,7 +417,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
preferences(R.id.menu_plot_settings) {
|
preferences(R.id.menu_plot_settings) {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
|
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
|
||||||
context.startActivity(new Intent(context, CalculatorPlotPreferenceActivity.class));
|
context.startActivity(new Intent(context, PlotPreferenceActivity.class));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,17 +23,10 @@
|
|||||||
package org.solovyev.android.calculator.plot;
|
package org.solovyev.android.calculator.plot;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockPreferenceActivity;
|
|
||||||
|
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
|
import org.solovyev.android.calculator.preferences.BasePreferencesActivity;
|
||||||
|
|
||||||
/**
|
public class PlotPreferenceActivity extends BasePreferencesActivity {
|
||||||
* User: serso
|
|
||||||
* Date: 10/4/12
|
|
||||||
* Time: 9:01 PM
|
|
||||||
*/
|
|
||||||
public class CalculatorPlotPreferenceActivity extends SherlockPreferenceActivity {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
@ -0,0 +1,92 @@
|
|||||||
|
package org.solovyev.android.calculator.preferences;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import com.actionbarsherlock.app.SherlockPreferenceActivity;
|
||||||
|
import org.solovyev.android.calculator.AdView;
|
||||||
|
import org.solovyev.android.calculator.CalculatorApplication;
|
||||||
|
import org.solovyev.android.calculator.R;
|
||||||
|
import org.solovyev.android.checkout.*;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import static java.util.Arrays.asList;
|
||||||
|
|
||||||
|
public abstract class BasePreferencesActivity extends SherlockPreferenceActivity {
|
||||||
|
|
||||||
|
private final ActivityCheckout checkout = Checkout.forActivity(this, CalculatorApplication.getInstance().getBilling(), Products.create().add(ProductTypes.IN_APP, asList("ad_free")));
|
||||||
|
private Inventory inventory;
|
||||||
|
private AdView adView;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
checkout.start();
|
||||||
|
inventory = checkout.loadInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class InventoryListener implements Inventory.Listener {
|
||||||
|
@Override
|
||||||
|
public void onLoaded(@Nonnull Inventory.Products products) {
|
||||||
|
final Inventory.Product product = products.get(ProductTypes.IN_APP);
|
||||||
|
final boolean adFree = product.isPurchased("ad_free");
|
||||||
|
onShowAd(!adFree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onShowAd(boolean show) {
|
||||||
|
if (show) {
|
||||||
|
if (adView != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
adView = (AdView) LayoutInflater.from(this).inflate(R.layout.ad, null);
|
||||||
|
adView.show();
|
||||||
|
getListView().addHeaderView(adView);
|
||||||
|
} else {
|
||||||
|
if (adView == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getListView().removeHeaderView(adView);
|
||||||
|
adView.hide();
|
||||||
|
adView = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (checkout.onActivityResult(requestCode, resultCode, data)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (adView != null) {
|
||||||
|
adView.resume();
|
||||||
|
}
|
||||||
|
inventory.whenLoaded(new InventoryListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
if (adView != null) {
|
||||||
|
adView.pause();
|
||||||
|
}
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
if (adView != null) {
|
||||||
|
adView.destroy();
|
||||||
|
}
|
||||||
|
checkout.stop();
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
}
|
@ -1,228 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013 serso aka se.solovyev
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
* Contact details
|
|
||||||
*
|
|
||||||
* Email: se.solovyev@gmail.com
|
|
||||||
* Site: http://se.solovyev.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.solovyev.android.calculator.preferences;
|
|
||||||
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.widget.Toast;
|
|
||||||
import com.actionbarsherlock.app.SherlockPreferenceActivity;
|
|
||||||
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.solovyev.android.Activities;
|
|
||||||
import org.solovyev.android.App;
|
|
||||||
import org.solovyev.android.ads.AdsController;
|
|
||||||
import org.solovyev.android.calculator.*;
|
|
||||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
|
||||||
import org.solovyev.android.calculator.wizard.CalculatorWizards;
|
|
||||||
import org.solovyev.android.msg.AndroidMessage;
|
|
||||||
import org.solovyev.android.view.VibratorContainer;
|
|
||||||
import org.solovyev.android.wizard.WizardUi;
|
|
||||||
import org.solovyev.common.msg.Message;
|
|
||||||
import org.solovyev.common.msg.MessageType;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import static org.solovyev.android.calculator.wizard.CalculatorWizards.DEFAULT_WIZARD_FLOW;
|
|
||||||
import static org.solovyev.android.wizard.WizardUi.startWizard;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* User: serso
|
|
||||||
* Date: 7/16/11
|
|
||||||
* Time: 6:37 PM
|
|
||||||
*/
|
|
||||||
public class CalculatorPreferencesActivity extends SherlockPreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener, IBillingObserver {
|
|
||||||
|
|
||||||
public static final String PREFERENCE_CLEAR_BILLING_INFO = "clear_billing_info";
|
|
||||||
public static final String PREFERENCE_RESTART_WIZARD = "restart_wizard";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
//noinspection deprecation
|
|
||||||
addPreferencesFromResource(R.xml.preferences);
|
|
||||||
//noinspection deprecation
|
|
||||||
addPreferencesFromResource(R.xml.preferences_calculations);
|
|
||||||
addPreferencesFromResource(R.xml.preferences_appearance);
|
|
||||||
addPreferencesFromResource(R.xml.preferences_plot);
|
|
||||||
addPreferencesFromResource(R.xml.preferences_other);
|
|
||||||
addPreferencesFromResource(R.xml.preferences_onscreen);
|
|
||||||
|
|
||||||
final Preference restartWizardPreference = findPreference(PREFERENCE_RESTART_WIZARD);
|
|
||||||
restartWizardPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
|
||||||
startWizard(CalculatorApplication.getInstance().getWizards(), DEFAULT_WIZARD_FLOW, CalculatorPreferencesActivity.this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY);
|
|
||||||
adFreePreference.setEnabled(false);
|
|
||||||
|
|
||||||
// observer must be set before net.robotmedia.billing.BillingController.checkBillingSupported()
|
|
||||||
BillingController.registerObserver(this);
|
|
||||||
|
|
||||||
BillingController.checkBillingSupported(CalculatorPreferencesActivity.this);
|
|
||||||
|
|
||||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
preferences.registerOnSharedPreferenceChangeListener(this);
|
|
||||||
onSharedPreferenceChanged(preferences, AndroidCalculatorEngine.Preferences.roundResult.getKey());
|
|
||||||
onSharedPreferenceChanged(preferences, VibratorContainer.Preferences.hapticFeedbackEnabled.getKey());
|
|
||||||
|
|
||||||
final Preference clearBillingInfoPreference = findPreference(PREFERENCE_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(@Nonnull Context context, @Nonnull SharedPreferences preferences) {
|
|
||||||
final SharedPreferences.Editor editor = preferences.edit();
|
|
||||||
editor.putBoolean(AbstractBillingObserver.KEY_TRANSACTIONS_RESTORED, false);
|
|
||||||
editor.commit();
|
|
||||||
|
|
||||||
BillingController.dropBillingData(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setAdFreeAction() {
|
|
||||||
final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY);
|
|
||||||
|
|
||||||
if (!AdsController.getInstance().isAdFree(this)) {
|
|
||||||
Log.d(CalculatorPreferencesActivity.class.getName(), "Ad free is not purchased - enable preference!");
|
|
||||||
|
|
||||||
adFreePreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
|
||||||
final Context context = CalculatorPreferencesActivity.this;
|
|
||||||
context.startActivity(new Intent(context, CalculatorPurchaseDialogActivity.class));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
adFreePreference.setEnabled(true);
|
|
||||||
} else {
|
|
||||||
Log.d(CalculatorPreferencesActivity.class.getName(), "Ad free is not purchased - disable preference!");
|
|
||||||
adFreePreference.setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
BillingController.unregisterObserver(this);
|
|
||||||
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this);
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
|
||||||
if (AndroidCalculatorEngine.Preferences.roundResult.getKey().equals(key)) {
|
|
||||||
findPreference(AndroidCalculatorEngine.Preferences.precision.getKey()).setEnabled(preferences.getBoolean(key, AndroidCalculatorEngine.Preferences.roundResult.getDefaultValue()));
|
|
||||||
} else if (VibratorContainer.Preferences.hapticFeedbackEnabled.getKey().equals(key)) {
|
|
||||||
findPreference(VibratorContainer.Preferences.hapticFeedbackDuration.getKey()).setEnabled(VibratorContainer.Preferences.hapticFeedbackEnabled.getPreference(preferences));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCheckBillingSupportedResponse(boolean supported) {
|
|
||||||
if (supported) {
|
|
||||||
setAdFreeAction();
|
|
||||||
} else {
|
|
||||||
final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY);
|
|
||||||
adFreePreference.setEnabled(false);
|
|
||||||
Log.d(CalculatorPreferencesActivity.class.getName(), "Billing is not supported!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPurchaseIntentOK(@Nonnull String productId, @Nonnull PendingIntent purchaseIntent) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPurchaseIntentFailure(@Nonnull String productId, @Nonnull ResponseCode responseCode) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPurchaseStateChanged(@Nonnull String itemId, @Nonnull Transaction.PurchaseState state) {
|
|
||||||
if (CalculatorApplication.AD_FREE_PRODUCT_ID.equals(itemId)) {
|
|
||||||
final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY);
|
|
||||||
if (adFreePreference != null) {
|
|
||||||
switch (state) {
|
|
||||||
case PURCHASED:
|
|
||||||
adFreePreference.setEnabled(false);
|
|
||||||
// restart activity to disable ads
|
|
||||||
Activities.restartActivity(this);
|
|
||||||
break;
|
|
||||||
case CANCELLED:
|
|
||||||
adFreePreference.setEnabled(true);
|
|
||||||
break;
|
|
||||||
case REFUNDED:
|
|
||||||
adFreePreference.setEnabled(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRequestPurchaseResponse(@Nonnull String itemId, @Nonnull ResponseCode response) {
|
|
||||||
final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY);
|
|
||||||
if (adFreePreference != null) {
|
|
||||||
if (response == ResponseCode.RESULT_OK) {
|
|
||||||
adFreePreference.setEnabled(false);
|
|
||||||
|
|
||||||
final Message message = new AndroidMessage(R.string.cpp_purchase_thank_you_text, MessageType.info, App.getApplication());
|
|
||||||
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_message_dialog, MessageDialogData.newInstance(message, null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTransactionsRestored() {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onErrorRestoreTransactions(@Nonnull ResponseCode responseCode) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,28 +23,22 @@
|
|||||||
package org.solovyev.android.calculator.preferences;
|
package org.solovyev.android.calculator.preferences;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.method.ScrollingMovementMethod;
|
import android.text.method.ScrollingMovementMethod;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
|
|
||||||
import net.robotmedia.billing.BillingController;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import org.solovyev.android.ads.AdsController;
|
|
||||||
import org.solovyev.android.calculator.CalculatorApplication;
|
import org.solovyev.android.calculator.CalculatorApplication;
|
||||||
import org.solovyev.android.calculator.CalculatorFragment;
|
import org.solovyev.android.calculator.CalculatorFragment;
|
||||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
|
import org.solovyev.android.checkout.*;
|
||||||
import org.solovyev.android.fragments.FragmentUtils;
|
import org.solovyev.android.fragments.FragmentUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
* Date: 1/20/13
|
* Date: 1/20/13
|
||||||
@ -52,6 +46,22 @@ import org.solovyev.android.fragments.FragmentUtils;
|
|||||||
*/
|
*/
|
||||||
public class CalculatorPurchaseDialogActivity extends SherlockFragmentActivity {
|
public class CalculatorPurchaseDialogActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final ActivityCheckout checkout = Checkout.forActivity(this, CalculatorApplication.getInstance().getBilling(), Products.create().add("ad_free"));
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final RequestListener<Purchase> purchaseListener = new RequestListener<Purchase>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(@Nonnull Purchase purchase) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int i, @Nonnull Exception e) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -59,6 +69,9 @@ public class CalculatorPurchaseDialogActivity extends SherlockFragmentActivity {
|
|||||||
setContentView(R.layout.cpp_dialog);
|
setContentView(R.layout.cpp_dialog);
|
||||||
|
|
||||||
FragmentUtils.createFragment(this, PurchaseDialogFragment.class, R.id.dialog_layout, "purchase-dialog");
|
FragmentUtils.createFragment(this, PurchaseDialogFragment.class, R.id.dialog_layout, "purchase-dialog");
|
||||||
|
|
||||||
|
checkout.start();
|
||||||
|
checkout.createPurchaseFlow(purchaseListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PurchaseDialogFragment extends CalculatorFragment {
|
public static class PurchaseDialogFragment extends CalculatorFragment {
|
||||||
@ -75,36 +88,35 @@ public class CalculatorPurchaseDialogActivity extends SherlockFragmentActivity {
|
|||||||
root.findViewById(R.id.cpp_continue_button).setOnClickListener(new View.OnClickListener() {
|
root.findViewById(R.id.cpp_continue_button).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
|
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
// check billing availability
|
((CalculatorPurchaseDialogActivity) activity).purchase();
|
||||||
if (BillingController.checkBillingSupported(activity) != BillingController.BillingStatus.SUPPORTED) {
|
|
||||||
Log.d(CalculatorPreferencesActivity.class.getName(), "Billing is not supported - warn user!");
|
|
||||||
// warn about not supported billing
|
|
||||||
new AlertDialog.Builder(activity).setTitle(R.string.c_error).setMessage(R.string.c_billing_error).create().show();
|
|
||||||
} else {
|
|
||||||
Log.d(CalculatorPreferencesActivity.class.getName(), "Billing is supported - continue!");
|
|
||||||
if (!AdsController.getInstance().isAdFree(activity)) {
|
|
||||||
Log.d(CalculatorPreferencesActivity.class.getName(), "Item not purchased - try to purchase!");
|
|
||||||
|
|
||||||
// not purchased => purchasing
|
|
||||||
Toast.makeText(activity, R.string.c_calc_purchasing, Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
// show purchase window for user
|
|
||||||
BillingController.requestPurchase(activity, CalculatorApplication.AD_FREE_PRODUCT_ID, true);
|
|
||||||
} else {
|
|
||||||
// and show message to user
|
|
||||||
Toast.makeText(activity, R.string.c_calc_already_purchased, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
activity.finish();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void purchase() {
|
||||||
|
checkout.whenReady(new Checkout.ListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onReady(@Nonnull BillingRequests requests) {
|
||||||
|
requests.purchase(ProductTypes.IN_APP, "ad_free", null, checkout.getPurchaseFlow());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
checkout.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
checkout.destroyPurchaseFlow();
|
||||||
|
checkout.stop();
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 serso aka se.solovyev
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
* Contact details
|
||||||
|
*
|
||||||
|
* Email: se.solovyev@gmail.com
|
||||||
|
* Site: http://se.solovyev.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.solovyev.android.calculator.preferences;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.Preference;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
import org.solovyev.android.calculator.CalculatorApplication;
|
||||||
|
import org.solovyev.android.calculator.R;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import static org.solovyev.android.calculator.CalculatorApplication.AD_FREE_P_KEY;
|
||||||
|
import static org.solovyev.android.calculator.model.AndroidCalculatorEngine.Preferences.precision;
|
||||||
|
import static org.solovyev.android.calculator.model.AndroidCalculatorEngine.Preferences.roundResult;
|
||||||
|
import static org.solovyev.android.calculator.wizard.CalculatorWizards.DEFAULT_WIZARD_FLOW;
|
||||||
|
import static org.solovyev.android.view.VibratorContainer.Preferences.hapticFeedbackDuration;
|
||||||
|
import static org.solovyev.android.view.VibratorContainer.Preferences.hapticFeedbackEnabled;
|
||||||
|
import static org.solovyev.android.wizard.WizardUi.startWizard;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public class PreferencesActivity extends BasePreferencesActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private static final SparseArray<String> preferences = new SparseArray<String>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
preferences.append(R.xml.preferences, "screen-main");
|
||||||
|
preferences.append(R.xml.preferences_calculations, "screen-calculations");
|
||||||
|
preferences.append(R.xml.preferences_appearance, "screen-appearance");
|
||||||
|
preferences.append(R.xml.preferences_plot, "screen-plot");
|
||||||
|
preferences.append(R.xml.preferences_other, "screen-other");
|
||||||
|
preferences.append(R.xml.preferences_onscreen, "screen-onscreen");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Preference adFreePreference;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
final Intent intent = getIntent();
|
||||||
|
final int preference = intent.getIntExtra("preference", R.xml.preferences);
|
||||||
|
final String title = intent.getStringExtra("preference-title");
|
||||||
|
setPreference(preference, preferences.get(preference));
|
||||||
|
if (preference == R.xml.preferences) {
|
||||||
|
for (int i = 0; i < preferences.size(); i++) {
|
||||||
|
final int xml = preferences.keyAt(i);
|
||||||
|
final String name = preferences.valueAt(i);
|
||||||
|
setPreferenceIntent(xml, name);
|
||||||
|
}
|
||||||
|
final Preference restartWizardPreference = findPreference("restart_wizard");
|
||||||
|
restartWizardPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
|
startWizard(CalculatorApplication.getInstance().getWizards(), DEFAULT_WIZARD_FLOW, PreferencesActivity.this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
adFreePreference = findPreference(AD_FREE_P_KEY);
|
||||||
|
adFreePreference.setEnabled(false);
|
||||||
|
adFreePreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
|
startActivity(new Intent(getApplicationContext(), CalculatorPurchaseDialogActivity.class));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (title != null) {
|
||||||
|
setTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
preferences.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
onSharedPreferenceChanged(preferences, roundResult.getKey());
|
||||||
|
onSharedPreferenceChanged(preferences, hapticFeedbackEnabled.getKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setPreference(int xml, @Nonnull String name) {
|
||||||
|
addPreferencesFromResource(xml);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setPreferenceIntent(int xml, @Nonnull String name) {
|
||||||
|
final Preference preference = findPreference(name);
|
||||||
|
if (preference != null) {
|
||||||
|
final Intent intent = new Intent(getApplicationContext(), PreferencesActivity.class);
|
||||||
|
intent.putExtra("preference", xml);
|
||||||
|
intent.putExtra("preference-title", preference.getTitle());
|
||||||
|
preference.setIntent(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this);
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||||
|
if (roundResult.getKey().equals(key)) {
|
||||||
|
final Preference preference = findPreference(precision.getKey());
|
||||||
|
if (preference != null) {
|
||||||
|
preference.setEnabled(preferences.getBoolean(key, roundResult.getDefaultValue()));
|
||||||
|
}
|
||||||
|
} else if (hapticFeedbackEnabled.getKey().equals(key)) {
|
||||||
|
final Preference preference = findPreference(hapticFeedbackDuration.getKey());
|
||||||
|
if (preference != null) {
|
||||||
|
preference.setEnabled(hapticFeedbackEnabled.getPreference(preferences));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onShowAd(boolean show) {
|
||||||
|
super.onShowAd(show);
|
||||||
|
if (adFreePreference != null) {
|
||||||
|
adFreePreference.setEnabled(show);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -25,7 +25,7 @@ package org.solovyev.android.calculator.wizard;
|
|||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import org.solovyev.android.App;
|
import org.solovyev.android.calculator.App;
|
||||||
import org.solovyev.android.Views;
|
import org.solovyev.android.Views;
|
||||||
import org.solovyev.android.calculator.CalculatorPreferences;
|
import org.solovyev.android.calculator.CalculatorPreferences;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
~ Site: http://se.solovyev.org
|
~ Site: http://se.solovyev.org
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
<org.solovyev.android.calculator.AdView xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
a:id="@+id/ad_parent_view"
|
a:id="@+id/ad"
|
||||||
a:layout_width="match_parent"
|
a:layout_width="match_parent"
|
||||||
a:layout_height="wrap_content"/>
|
a:layout_height="wrap_content"
|
||||||
|
a:layout_gravity="center"
|
||||||
|
a:visibility="gone" />
|
||||||
|
33
android-app/src/main/res/layout/admob.xml
Normal file
33
android-app/src/main/res/layout/admob.xml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~ Copyright 2013 serso aka se.solovyev
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
~
|
||||||
|
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
~ Contact details
|
||||||
|
~
|
||||||
|
~ Email: se.solovyev@gmail.com
|
||||||
|
~ Site: http://se.solovyev.org
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.google.android.gms.ads.AdView xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:ads="http://schemas.android.com/apk/res-auto"
|
||||||
|
a:id="@+id/admob"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="wrap_content"
|
||||||
|
a:layout_gravity="center"
|
||||||
|
ads:adSize="BANNER"
|
||||||
|
a:visibility="gone"
|
||||||
|
ads:adUnitId="@string/admob" />
|
@ -22,18 +22,33 @@
|
|||||||
~ Site: http://se.solovyev.org
|
~ Site: http://se.solovyev.org
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
|
a:key="screen-main">
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
a:key="@string/p_calc_ad_free_key"
|
a:key="@string/p_calc_ad_free_key"
|
||||||
a:title="@string/c_calc_ad_free_title"
|
a:title="@string/c_calc_ad_free_title"
|
||||||
a:summary="@string/c_calc_ad_free_summary"
|
a:summary="@string/c_calc_ad_free_summary"
|
||||||
a:defaultValue="false"/>
|
a:defaultValue="false" />
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
a:key="restart_wizard"
|
a:key="restart_wizard"
|
||||||
a:title="@string/cpp_restart_wizard"/>
|
a:title="@string/cpp_restart_wizard" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
a:title="@string/c_prefs_calculations_category"
|
||||||
|
a:key="screen-calculations" />
|
||||||
|
<Preference
|
||||||
|
a:title="@string/c_prefs_appearance_category"
|
||||||
|
a:key="screen-appearance" />
|
||||||
|
<Preference
|
||||||
|
a:title="@string/prefs_graph_screen_title"
|
||||||
|
a:key="screen-plot" />
|
||||||
|
<Preference
|
||||||
|
a:title="@string/c_prefs_other_category"
|
||||||
|
a:key="screen-other" />
|
||||||
|
<Preference
|
||||||
|
a:title="@string/prefs_onscreen_title"
|
||||||
|
a:key="screen-onscreen" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@ -25,10 +25,6 @@
|
|||||||
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:range="http://schemas.android.com/apk/res-auto">
|
xmlns:range="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<PreferenceScreen a:title="@string/c_prefs_appearance_category">
|
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
|
||||||
|
|
||||||
<android.preference.CheckBoxPreference
|
<android.preference.CheckBoxPreference
|
||||||
a:key="@string/p_calc_color_display_key"
|
a:key="@string/p_calc_color_display_key"
|
||||||
a:summary="@string/c_calc_color_display_summary"
|
a:summary="@string/c_calc_color_display_summary"
|
||||||
@ -124,6 +120,4 @@
|
|||||||
a:title="@string/prefs_prevent_screen_from_fading_title"
|
a:title="@string/prefs_prevent_screen_from_fading_title"
|
||||||
a:summary="@string/prefs_prevent_screen_from_fading_summary"/>
|
a:summary="@string/prefs_prevent_screen_from_fading_summary"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@ -25,10 +25,6 @@
|
|||||||
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:range="http://schemas.android.com/apk/res-auto">
|
xmlns:range="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<PreferenceScreen a:title="@string/c_prefs_calculations_category">
|
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
|
||||||
|
|
||||||
<android.preference.CheckBoxPreference
|
<android.preference.CheckBoxPreference
|
||||||
a:key="@string/p_calc_round_result_key"
|
a:key="@string/p_calc_round_result_key"
|
||||||
a:summary="@string/c_calc_round_result_summary"
|
a:summary="@string/c_calc_round_result_summary"
|
||||||
@ -100,6 +96,4 @@
|
|||||||
a:title="@string/p_show_calculation_messages_dialog_title"
|
a:title="@string/p_show_calculation_messages_dialog_title"
|
||||||
a:summary="@string/p_show_calculation_messages_dialog_summary"/>
|
a:summary="@string/p_show_calculation_messages_dialog_summary"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@ -24,11 +24,7 @@
|
|||||||
|
|
||||||
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<PreferenceScreen a:title="@string/prefs_onscreen_title">
|
<android.preference.CheckBoxPreference
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
|
||||||
|
|
||||||
<android.preference.CheckBoxPreference
|
|
||||||
a:key="onscreen_start_on_boot"
|
a:key="onscreen_start_on_boot"
|
||||||
a:title="@string/prefs_onscreen_start_on_boot_title"
|
a:title="@string/prefs_onscreen_start_on_boot_title"
|
||||||
a:summary="@string/prefs_onscreen_start_on_boot_summary"/>
|
a:summary="@string/prefs_onscreen_start_on_boot_summary"/>
|
||||||
@ -38,6 +34,4 @@
|
|||||||
a:title="@string/prefs_onscreen_show_app_icon_title"
|
a:title="@string/prefs_onscreen_show_app_icon_title"
|
||||||
a:summary="@string/prefs_onscreen_show_app_icon_summary"/>
|
a:summary="@string/prefs_onscreen_show_app_icon_summary"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@ -24,10 +24,6 @@
|
|||||||
|
|
||||||
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<PreferenceScreen a:title="@string/c_prefs_other_category">
|
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
|
||||||
|
|
||||||
<android.preference.CheckBoxPreference
|
<android.preference.CheckBoxPreference
|
||||||
a:key="@string/p_calc_show_release_notes_key"
|
a:key="@string/p_calc_show_release_notes_key"
|
||||||
a:summary="@string/c_calc_show_release_notes_summary"
|
a:summary="@string/c_calc_show_release_notes_summary"
|
||||||
@ -45,6 +41,4 @@
|
|||||||
a:summary="@string/c_clear_billing_info_summary"
|
a:summary="@string/c_clear_billing_info_summary"
|
||||||
a:title="@string/c_clear_billing_info_title"/>
|
a:title="@string/c_clear_billing_info_title"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@ -24,15 +24,9 @@
|
|||||||
|
|
||||||
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<PreferenceScreen a:title="@string/prefs_graph_screen_title">
|
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
|
||||||
|
|
||||||
<android.preference.CheckBoxPreference
|
<android.preference.CheckBoxPreference
|
||||||
a:key="graph_plot_imag"
|
a:key="graph_plot_imag"
|
||||||
a:title="@string/cpp_prefs_graph_plot_imag_title"
|
a:title="@string/cpp_prefs_graph_plot_imag_title"
|
||||||
a:summary="@string/cpp_prefs_graph_plot_imag_summary"/>
|
a:summary="@string/cpp_prefs_graph_plot_imag_summary"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@ -15,7 +15,7 @@ public String android_build_tools_version() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String android_min_sdk_version() {
|
public String android_min_sdk_version() {
|
||||||
return 7
|
return 9
|
||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
@ -35,6 +35,9 @@ allprojects {
|
|||||||
maven {
|
maven {
|
||||||
url "$androidHome/extras/android/m2repository/"
|
url "$androidHome/extras/android/m2repository/"
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
url "$androidHome/extras/google/m2repository/"
|
||||||
|
}
|
||||||
|
|
||||||
def userHome = System.getenv("HOME")
|
def userHome = System.getenv("HOME")
|
||||||
maven {
|
maven {
|
||||||
|
Loading…
Reference in New Issue
Block a user