Admob version update + checkout library instead of old billing

This commit is contained in:
serso
2015-01-24 23:22:04 +01:00
parent 9ab677af81
commit d5e5c9b6ac
42 changed files with 846 additions and 451 deletions

View File

@@ -84,10 +84,10 @@
</content>
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
<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="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="android-common-core-1.1.18" 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-views-1.1.18" 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="support-annotations-21.0.3" 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="simple-xml-2.6.1" level="project" />

View File

@@ -48,13 +48,13 @@ dependencies {
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-preferences:1.1.18@aar'
compile 'org.solovyev.android:android-common-app:1.1.18@aar'
compile('org.solovyev:jscl:1.0.8') {
exclude(module: 'xercesImpl')
}
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 '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'
}

View File

@@ -8,4 +8,8 @@
android:minSdkVersion="4"
android:targetSdkVersion="17"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</manifest>

View File

@@ -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;
}
}

View File

@@ -0,0 +1,7 @@
package org.solovyev.android.calculator;
/**
* Marker interface for service locator
*/
public interface ServiceLocator {
}

View File

@@ -27,17 +27,15 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.preference.PreferenceManager;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.simpleframework.xml.Serializer;
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.MathEntityPersistenceContainer;
import org.solovyev.android.calculator.MathPersistenceEntity;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.StringWriter;
/**

View 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>