Skip to content

Commit 60b26a0

Browse files
committed
Minor fixes during testing of samples.
Bumping versions of play services and using split aar client libs. Change-Id: Id51ea4271a2a6eb4aedd5f338e208e4ac2a9f4cc
1 parent 1aa2c6d commit 60b26a0

File tree

10 files changed

+91
-73
lines changed

10 files changed

+91
-73
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.idea/
12
bin/
23
build.xml
34
gen/
@@ -9,5 +10,7 @@ obj/
910
.gradle/
1011
build/
1112

13+
*.iml
14+
1215
samples-android/Common/gpg-sdk/gpg-cpp-sdk/
1316
samples-android/Common/gpg-sdk/gpg_cpp_sdk.zip

samples-android/ButtonClicker/build.gradle

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
apply plugin: 'com.android.model.application'
22

3-
// Retrieve ndk path: ndk.dir MUST be set in file local.properties
4-
Properties properties = new Properties()
5-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
6-
def ndkDir = properties.getProperty('ndk.dir')
7-
83
def gpg_cpp_path = file(project(':Common/gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"
94

105
// stlport configuration ["c++_static", "c++_shared", "gnustl_static", "gnustl_shared"]
@@ -24,13 +19,13 @@ model {
2419
}
2520
}
2621
android {
27-
compileSdkVersion=22
28-
buildToolsVersion="23.0.1"
22+
compileSdkVersion=23
23+
buildToolsVersion="23.0.2"
2924

3025
defaultConfig.with {
3126
applicationId="com.google.example.games.ButtonClicker"
3227
minSdkVersion.apiLevel = 11
33-
targetSdkVersion.apiLevel = 22
28+
targetSdkVersion.apiLevel = 23
3429
}
3530
}
3631
android.sources {
@@ -75,6 +70,8 @@ model {
7570
}
7671

7772
dependencies {
78-
compile 'com.android.support:support-v4:22.2.1'
79-
compile 'com.google.android.gms:play-services:8.3.0'
73+
compile 'com.google.android.gms:play-services-games:8.4.0'
74+
compile 'com.google.android.gms:play-services-nearby:8.4.0'
75+
compile 'com.google.android.gms:play-services-plus:8.4.0'
76+
compile 'com.android.support:support-v4:23.1.1'
8077
}

samples-android/CollectAllTheStarsNative/build.gradle

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
apply plugin: 'com.android.model.application'
2-
// Retrieve ndk path: ndk.dir MUST be set in file local.properties
3-
Properties properties = new Properties()
4-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
5-
def ndkDir = properties.getProperty('ndk.dir')
62

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

@@ -23,13 +19,13 @@ model {
2319
}
2420
}
2521
android {
26-
compileSdkVersion = 22
27-
buildToolsVersion = "23.0.1"
22+
compileSdkVersion = 23
23+
buildToolsVersion = "23.0.2"
2824

2925
defaultConfig.with {
3026
applicationId = "com.google.example.games.cats"
3127
minSdkVersion.apiLevel = 11
32-
targetSdkVersion.apiLevel = 19
28+
targetSdkVersion.apiLevel = 23
3329
versionCode = 1.0
3430
versionName = '1.0'
3531
}
@@ -76,8 +72,9 @@ model {
7672
}
7773
}
7874
}
79-
8075
dependencies {
81-
compile 'com.android.support:support-v4:22.2.1'
82-
compile 'com.google.android.gms:play-services:8.3.0'
76+
compile 'com.google.android.gms:play-services-games:8.4.0'
77+
compile 'com.google.android.gms:play-services-nearby:8.4.0'
78+
compile 'com.google.android.gms:play-services-plus:8.4.0'
79+
compile 'com.android.support:support-v4:23.1.1'
8380
}

samples-android/Minimalist/build.gradle

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
apply plugin: 'com.android.model.application'
2-
// Retrieve ndk path: ndk.dir MUST be set in file local.properties
3-
Properties properties = new Properties()
4-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
5-
def ndkDir = properties.getProperty('ndk.dir')
62

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

@@ -24,13 +20,13 @@ model {
2420
}
2521

2622
android {
27-
compileSdkVersion = 22
28-
buildToolsVersion = "23.0.1"
23+
compileSdkVersion = 23
24+
buildToolsVersion = "23.0.2"
2925

3026
defaultConfig.with {
3127
applicationId = "com.google.example.games.Minimalist"
3228
minSdkVersion.apiLevel = 11
33-
targetSdkVersion.apiLevel = 10
29+
targetSdkVersion.apiLevel = 23
3430

3531
}
3632
}
@@ -74,6 +70,8 @@ model {
7470
}
7571

7672
dependencies {
77-
compile 'com.android.support:support-v4:22.2.1'
78-
compile 'com.google.android.gms:play-services:8.3.0'
73+
compile 'com.google.android.gms:play-services-games:8.4.0'
74+
compile 'com.google.android.gms:play-services-nearby:8.4.0'
75+
compile 'com.google.android.gms:play-services-plus:8.4.0'
76+
compile 'com.android.support:support-v4:23.1.1'
7977
}

samples-android/TbmpSkeletonNative/build.gradle

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
apply plugin: 'com.android.model.application'
2-
// Retrieve ndk path: ndk.dir MUST be set in file local.properties
3-
Properties properties = new Properties()
4-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
5-
def ndkDir = properties.getProperty('ndk.dir')
62

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

@@ -24,13 +20,13 @@ model {
2420
}
2521

2622
android {
27-
compileSdkVersion = 22
28-
buildToolsVersion = "23.0.1"
23+
compileSdkVersion = 23
24+
buildToolsVersion = "23.0.2"
2925

3026
defaultConfig.with {
3127
applicationId= "com.google.example.games.tbmpskel"
3228
minSdkVersion.apiLevel = 11
33-
targetSdkVersion.apiLevel = 22
29+
targetSdkVersion.apiLevel = 23
3430

3531
versionCode = 1.0
3632
versionName = '1.0'
@@ -82,6 +78,8 @@ model {
8278

8379

8480
dependencies {
85-
compile 'com.android.support:support-v4:22.2.1'
86-
compile 'com.google.android.gms:play-services:8.3.0'
81+
compile 'com.google.android.gms:play-services-games:8.4.0'
82+
compile 'com.google.android.gms:play-services-nearby:8.4.0'
83+
compile 'com.google.android.gms:play-services-plus:8.4.0'
84+
compile 'com.android.support:support-v4:23.1.1'
8785
}

samples-android/Teapot/build.gradle

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
apply plugin: 'com.android.model.application'
2-
// Retrieve ndk path: ndk.dir MUST be set in file local.properties
3-
Properties properties = new Properties()
4-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
5-
def ndkDir = properties.getProperty('ndk.dir')
62

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

@@ -23,13 +19,13 @@ model {
2319
}
2420
}
2521
android {
26-
compileSdkVersion=22
27-
buildToolsVersion="23.0.1"
22+
compileSdkVersion=23
23+
buildToolsVersion="23.0.2"
2824

2925
defaultConfig.with {
3026
applicationId = "com.google.example.nativegame"
3127
minSdkVersion.apiLevel = 11
32-
targetSdkVersion.apiLevel = 19
28+
targetSdkVersion.apiLevel = 23
3329

3430
}
3531
}
@@ -73,8 +69,9 @@ model {
7369
}
7470
}
7571
}
76-
7772
dependencies {
78-
compile 'com.android.support:support-v4:22.2.1'
79-
compile 'com.google.android.gms:play-services:8.3.0'
73+
compile 'com.google.android.gms:play-services-games:8.4.0'
74+
compile 'com.google.android.gms:play-services-nearby:8.4.0'
75+
compile 'com.google.android.gms:play-services-plus:8.4.0'
76+
compile 'com.android.support:support-v4:23.1.1'
8077
}

samples-android/Teapot/src/main/java/com/google/example/nativegame/NativeGameActivity.java

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package com.google.example.nativegame;
1818

19+
import android.app.Activity;
1920
import android.app.NativeActivity;
21+
import android.content.Intent;
2022
import android.os.Bundle;
2123
import android.view.Gravity;
2224
import android.view.LayoutInflater;
@@ -130,26 +132,38 @@ public void run() {
130132

131133
}});
132134
}
133-
134-
protected void onPause() {
135-
super.onPause();
135+
136+
protected void onPause() {
137+
super.onPause();
136138
if (_popupWindow != null) {
137139
_popupWindow.dismiss();
138140
_popupWindow = null;
139141
}
140142

141143
// This call is to suppress 'E/WindowManager():
142-
// android.view.WindowLeaked...' errors.
143-
// Since orientation change events in NativeActivity comes later than
144-
// expected, we can not dismiss
145-
// popupWindow gracefully from NativeActivity.
146-
// So we are releasing popupWindows explicitly triggered from Java
147-
// callback through JNI call.
148-
OnPauseHandler();
149-
}
144+
// android.view.WindowLeaked...' errors.
145+
// Since orientation change events in NativeActivity comes later than
146+
// expected, we can not dismiss
147+
// popupWindow gracefully from NativeActivity.
148+
// So we are releasing popupWindows explicitly triggered from Java
149+
// callback through JNI call.
150+
OnPauseHandler();
151+
}
152+
153+
native public void OnPauseHandler();
150154

151-
native public void OnPauseHandler();
152155

156+
/*
157+
* This is needed to foward the onActivityResult call to the games SDK.
158+
* The SDK uses this to manage the display of the standard UI calls.
159+
*/
160+
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
161+
nativeOnActivityResult(this, requestCode,resultCode, data);
162+
}
163+
164+
// Implemented in C++.
165+
public static native void nativeOnActivityResult(Activity activity,
166+
int requestCode, int resultCode, Intent data);
153167
}
154168

155169

samples-android/Teapot/src/main/java/com/sample/helper/NDKHelper.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616

1717
package com.sample.helper;
1818

19-
import java.io.File;
20-
import java.io.FileInputStream;
21-
import javax.microedition.khronos.opengles.GL10;
22-
2319
import android.annotation.TargetApi;
2420
import android.app.NativeActivity;
2521
import android.content.Context;
@@ -35,6 +31,11 @@
3531
import android.os.Build;
3632
import android.util.Log;
3733

34+
import java.io.File;
35+
import java.io.FileInputStream;
36+
37+
import javax.microedition.khronos.opengles.GL10;
38+
3839
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
3940
public class NDKHelper {
4041

@@ -210,6 +211,12 @@ public String getApplicationName() {
210211
return applicationName;
211212
}
212213

214+
public String getStringResource(String resourceName) {
215+
int id = activity.getResources().getIdentifier(resourceName, "string", activity.getPackageName());
216+
String value = id == 0 ? "" : (String)activity.getResources().getText(id);
217+
return value;
218+
}
219+
213220
//
214221
// Audio related helpers
215222
//

samples-android/Teapot/src/main/jni/NativeGameActivity.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
// For GPGS
2828
#include "gpg/android_platform_configuration.h"
2929
#include "gpg/android_initialization.h"
30+
#include "gpg/android_support.h"
3031

3132
#include "JavaUI.h"
3233
#include "NDKHelper.h"
@@ -605,5 +606,13 @@ Java_com_google_example_nativegame_NativeGameActivity_OnPauseHandler(
605606
// through JNI call.
606607
jui_helper::JUIWindow::GetInstance()->Suspend(APP_CMD_PAUSE);
607608
}
609+
610+
JNIEXPORT void
611+
Java_com_google_example_nativegame_NativeGameActivity_nativeOnActivityResult(
612+
JNIEnv *env, jobject thiz, jobject activity, jint requestCode,
613+
jint resultCode, jobject data) {
614+
gpg::AndroidSupport::OnActivityResult(env, activity, requestCode, resultCode,
615+
data);
616+
}
608617
} // extern "C"
609618

samples-android/TrivialQuestNative/build.gradle

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
apply plugin: 'com.android.model.application'
2-
// Retrieve ndk path: ndk.dir MUST be set in file local.properties
3-
Properties properties = new Properties()
4-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
5-
def ndkDir = properties.getProperty('ndk.dir')
62

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

@@ -24,13 +20,13 @@ model {
2420
}
2521

2622
android {
27-
compileSdkVersion = 22
28-
buildToolsVersion = "23.0.1"
23+
compileSdkVersion = 23
24+
buildToolsVersion = "23.0.2"
2925

3026
defaultConfig.with {
3127
applicationId = "com.google.example.games.tq"
3228
minSdkVersion.apiLevel = 11
33-
targetSdkVersion.apiLevel = 22
29+
targetSdkVersion.apiLevel = 23
3430
}
3531

3632
}
@@ -76,6 +72,8 @@ model {
7672
}
7773

7874
dependencies {
79-
compile 'com.android.support:support-v4:22.1.0'
80-
compile 'com.google.android.gms:play-services:8.3.0'
75+
compile 'com.google.android.gms:play-services-games:8.4.0'
76+
compile 'com.google.android.gms:play-services-nearby:8.4.0'
77+
compile 'com.google.android.gms:play-services-plus:8.4.0'
78+
compile 'com.android.support:support-v4:23.1.1'
8179
}

0 commit comments

Comments
 (0)