Skip to content

Commit

Permalink
Minor fixes during testing of samples.
Browse files Browse the repository at this point in the history
Bumping versions of play services and using split aar client libs.

Change-Id: Id51ea4271a2a6eb4aedd5f338e208e4ac2a9f4cc
  • Loading branch information
claywilkinson committed Jan 8, 2016
1 parent 1aa2c6d commit 60b26a0
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 73 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
bin/
build.xml
gen/
Expand All @@ -9,5 +10,7 @@ obj/
.gradle/
build/

*.iml

samples-android/Common/gpg-sdk/gpg-cpp-sdk/
samples-android/Common/gpg-sdk/gpg_cpp_sdk.zip
17 changes: 7 additions & 10 deletions samples-android/ButtonClicker/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
apply plugin: 'com.android.model.application'

// Retrieve ndk path: ndk.dir MUST be set in file local.properties
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ndkDir = properties.getProperty('ndk.dir')

def gpg_cpp_path = file(project(':Common/gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"

// stlport configuration ["c++_static", "c++_shared", "gnustl_static", "gnustl_shared"]
Expand All @@ -24,13 +19,13 @@ model {
}
}
android {
compileSdkVersion=22
buildToolsVersion="23.0.1"
compileSdkVersion=23
buildToolsVersion="23.0.2"

defaultConfig.with {
applicationId="com.google.example.games.ButtonClicker"
minSdkVersion.apiLevel = 11
targetSdkVersion.apiLevel = 22
targetSdkVersion.apiLevel = 23
}
}
android.sources {
Expand Down Expand Up @@ -75,6 +70,8 @@ model {
}

dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-games:8.4.0'
compile 'com.google.android.gms:play-services-nearby:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
}
17 changes: 7 additions & 10 deletions samples-android/CollectAllTheStarsNative/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
apply plugin: 'com.android.model.application'
// Retrieve ndk path: ndk.dir MUST be set in file local.properties
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ndkDir = properties.getProperty('ndk.dir')

def gpg_cpp_path = file(project(':Common/gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"

Expand All @@ -23,13 +19,13 @@ model {
}
}
android {
compileSdkVersion = 22
buildToolsVersion = "23.0.1"
compileSdkVersion = 23
buildToolsVersion = "23.0.2"

defaultConfig.with {
applicationId = "com.google.example.games.cats"
minSdkVersion.apiLevel = 11
targetSdkVersion.apiLevel = 19
targetSdkVersion.apiLevel = 23
versionCode = 1.0
versionName = '1.0'
}
Expand Down Expand Up @@ -76,8 +72,9 @@ model {
}
}
}

dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-games:8.4.0'
compile 'com.google.android.gms:play-services-nearby:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
}
16 changes: 7 additions & 9 deletions samples-android/Minimalist/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
apply plugin: 'com.android.model.application'
// Retrieve ndk path: ndk.dir MUST be set in file local.properties
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ndkDir = properties.getProperty('ndk.dir')

def gpg_cpp_path = file(project(':Common/gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"

Expand All @@ -24,13 +20,13 @@ model {
}

android {
compileSdkVersion = 22
buildToolsVersion = "23.0.1"
compileSdkVersion = 23
buildToolsVersion = "23.0.2"

defaultConfig.with {
applicationId = "com.google.example.games.Minimalist"
minSdkVersion.apiLevel = 11
targetSdkVersion.apiLevel = 10
targetSdkVersion.apiLevel = 23

}
}
Expand Down Expand Up @@ -74,6 +70,8 @@ model {
}

dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-games:8.4.0'
compile 'com.google.android.gms:play-services-nearby:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
}
16 changes: 7 additions & 9 deletions samples-android/TbmpSkeletonNative/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
apply plugin: 'com.android.model.application'
// Retrieve ndk path: ndk.dir MUST be set in file local.properties
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ndkDir = properties.getProperty('ndk.dir')

def gpg_cpp_path = file(project(':Common/gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"

Expand All @@ -24,13 +20,13 @@ model {
}

android {
compileSdkVersion = 22
buildToolsVersion = "23.0.1"
compileSdkVersion = 23
buildToolsVersion = "23.0.2"

defaultConfig.with {
applicationId= "com.google.example.games.tbmpskel"
minSdkVersion.apiLevel = 11
targetSdkVersion.apiLevel = 22
targetSdkVersion.apiLevel = 23

versionCode = 1.0
versionName = '1.0'
Expand Down Expand Up @@ -82,6 +78,8 @@ model {


dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-games:8.4.0'
compile 'com.google.android.gms:play-services-nearby:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
}
17 changes: 7 additions & 10 deletions samples-android/Teapot/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
apply plugin: 'com.android.model.application'
// Retrieve ndk path: ndk.dir MUST be set in file local.properties
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ndkDir = properties.getProperty('ndk.dir')

def gpg_cpp_path = file(project(':Common/gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"

Expand All @@ -23,13 +19,13 @@ model {
}
}
android {
compileSdkVersion=22
buildToolsVersion="23.0.1"
compileSdkVersion=23
buildToolsVersion="23.0.2"

defaultConfig.with {
applicationId = "com.google.example.nativegame"
minSdkVersion.apiLevel = 11
targetSdkVersion.apiLevel = 19
targetSdkVersion.apiLevel = 23

}
}
Expand Down Expand Up @@ -73,8 +69,9 @@ model {
}
}
}

dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-games:8.4.0'
compile 'com.google.android.gms:play-services-nearby:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

package com.google.example.nativegame;

import android.app.Activity;
import android.app.NativeActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -130,26 +132,38 @@ public void run() {

}});
}
protected void onPause() {
super.onPause();

protected void onPause() {
super.onPause();
if (_popupWindow != null) {
_popupWindow.dismiss();
_popupWindow = null;
}

// This call is to suppress 'E/WindowManager():
// android.view.WindowLeaked...' errors.
// Since orientation change events in NativeActivity comes later than
// expected, we can not dismiss
// popupWindow gracefully from NativeActivity.
// So we are releasing popupWindows explicitly triggered from Java
// callback through JNI call.
OnPauseHandler();
}
// android.view.WindowLeaked...' errors.
// Since orientation change events in NativeActivity comes later than
// expected, we can not dismiss
// popupWindow gracefully from NativeActivity.
// So we are releasing popupWindows explicitly triggered from Java
// callback through JNI call.
OnPauseHandler();
}

native public void OnPauseHandler();

native public void OnPauseHandler();

/*
* This is needed to foward the onActivityResult call to the games SDK.
* The SDK uses this to manage the display of the standard UI calls.
*/
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
nativeOnActivityResult(this, requestCode,resultCode, data);
}

// Implemented in C++.
public static native void nativeOnActivityResult(Activity activity,
int requestCode, int resultCode, Intent data);
}


Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

package com.sample.helper;

import java.io.File;
import java.io.FileInputStream;
import javax.microedition.khronos.opengles.GL10;

import android.annotation.TargetApi;
import android.app.NativeActivity;
import android.content.Context;
Expand All @@ -35,6 +31,11 @@
import android.os.Build;
import android.util.Log;

import java.io.File;
import java.io.FileInputStream;

import javax.microedition.khronos.opengles.GL10;

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public class NDKHelper {

Expand Down Expand Up @@ -210,6 +211,12 @@ public String getApplicationName() {
return applicationName;
}

public String getStringResource(String resourceName) {
int id = activity.getResources().getIdentifier(resourceName, "string", activity.getPackageName());
String value = id == 0 ? "" : (String)activity.getResources().getText(id);
return value;
}

//
// Audio related helpers
//
Expand Down
9 changes: 9 additions & 0 deletions samples-android/Teapot/src/main/jni/NativeGameActivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
// For GPGS
#include "gpg/android_platform_configuration.h"
#include "gpg/android_initialization.h"
#include "gpg/android_support.h"

#include "JavaUI.h"
#include "NDKHelper.h"
Expand Down Expand Up @@ -605,5 +606,13 @@ Java_com_google_example_nativegame_NativeGameActivity_OnPauseHandler(
// through JNI call.
jui_helper::JUIWindow::GetInstance()->Suspend(APP_CMD_PAUSE);
}

JNIEXPORT void
Java_com_google_example_nativegame_NativeGameActivity_nativeOnActivityResult(
JNIEnv *env, jobject thiz, jobject activity, jint requestCode,
jint resultCode, jobject data) {
gpg::AndroidSupport::OnActivityResult(env, activity, requestCode, resultCode,
data);
}
} // extern "C"

16 changes: 7 additions & 9 deletions samples-android/TrivialQuestNative/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
apply plugin: 'com.android.model.application'
// Retrieve ndk path: ndk.dir MUST be set in file local.properties
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ndkDir = properties.getProperty('ndk.dir')

def gpg_cpp_path = file(project(':Common/gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"

Expand All @@ -24,13 +20,13 @@ model {
}

android {
compileSdkVersion = 22
buildToolsVersion = "23.0.1"
compileSdkVersion = 23
buildToolsVersion = "23.0.2"

defaultConfig.with {
applicationId = "com.google.example.games.tq"
minSdkVersion.apiLevel = 11
targetSdkVersion.apiLevel = 22
targetSdkVersion.apiLevel = 23
}

}
Expand Down Expand Up @@ -76,6 +72,8 @@ model {
}

dependencies {
compile 'com.android.support:support-v4:22.1.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-games:8.4.0'
compile 'com.google.android.gms:play-services-nearby:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
}

0 comments on commit 60b26a0

Please sign in to comment.