Skip to content

Commit 24b7738

Browse files
author
Bruno Oliveira
committed
Reorganizing samples to a more Gradle-friendly structure and moving the Gradle build files to the right places. The samples can now be built using Gradle and easily imported into Android Studio.
1 parent 12e8683 commit 24b7738

107 files changed

Lines changed: 512 additions & 293 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#Wed Dec 11 17:04:15 PST 2013
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

568 KB
Binary file not shown.
4.89 MB
Binary file not shown.
56.9 KB
Binary file not shown.
509 KB
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apply plugin: 'android'
2+
3+
buildscript {
4+
repositories {
5+
mavenCentral()
6+
}
7+
dependencies {
8+
classpath 'com.android.tools.build:gradle:0.5+'
9+
}
10+
}
11+
12+
repositories {
13+
mavenCentral()
14+
}
15+
16+
dependencies {
17+
compile 'com.google.android.gms:play-services:4.0.30+'
18+
compile project(':libraries:BaseGameUtils')
19+
}
20+
21+
android {
22+
compileSdkVersion 19
23+
buildToolsVersion "19.0.0"
24+
}
25+

ButtonClicker/AndroidManifest.xml renamed to BasicSamples/ButtonClicker/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<uses-sdk
2424
android:minSdkVersion="8"
25-
android:targetSdkVersion="17" />
25+
android:targetSdkVersion="19" />
2626

2727
<application
2828
android:icon="@drawable/ic_launcher"
@@ -31,6 +31,8 @@
3131

3232
<meta-data android:name="com.google.android.gms.games.APP_ID"
3333
android:value="@string/app_id" />
34+
<meta-data android:name="com.google.android.gms.version"
35+
android:value="@integer/google_play_services_version"/>
3436

3537
<activity
3638
android:name="com.google.example.games.bc.MainActivity"

ButtonClicker/src/com/google/example/games/bc/MainActivity.java renamed to BasicSamples/ButtonClicker/src/main/java/com/google/example/games/bc/MainActivity.java

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,14 @@ public void onPeerInvitedToRoom(Room room, List<String> arg1) {
510510
updateRoom(room);
511511
}
512512

513+
@Override
514+
public void onP2PDisconnected(String participant) {
515+
}
516+
517+
@Override
518+
public void onP2PConnected(String participant) {
519+
}
520+
513521
@Override
514522
public void onPeerJoined(Room room, List<String> arg1) {
515523
updateRoom(room);
@@ -541,8 +549,12 @@ public void onPeersDisconnected(Room room, List<String> peers) {
541549
}
542550

543551
void updateRoom(Room room) {
544-
mParticipants = room.getParticipants();
545-
updatePeerScoresDisplay();
552+
if (room != null) {
553+
mParticipants = room.getParticipants();
554+
}
555+
if (mParticipants != null) {
556+
updatePeerScoresDisplay();
557+
}
546558
}
547559

548560
/*
@@ -815,19 +827,26 @@ void updatePeerScoresDisplay() {
815827
*/
816828
boolean verifyPlaceholderIdsReplaced() {
817829
final boolean CHECK_PKGNAME = true; // set to false to disable check
818-
// (not recommended!)
830+
// (not recommended!)
819831

820832
// Did the developer forget to change the package name?
821-
if (CHECK_PKGNAME && getPackageName().startsWith("com.google.example."))
833+
if (CHECK_PKGNAME && getPackageName().startsWith("com.google.example.")) {
834+
Log.e(TAG, "*** Sample setup problem: " +
835+
"package name cannot be com.google.example.*. Use your own " +
836+
"package name.");
822837
return false;
838+
}
823839

824840
// Did the developer forget to replace a placeholder ID?
825841
int res_ids[] = new int[] {
826842
R.string.app_id
827843
};
828844
for (int i : res_ids) {
829-
if (getString(i).equalsIgnoreCase("ReplaceMe"))
845+
if (getString(i).equalsIgnoreCase("ReplaceMe")) {
846+
Log.e(TAG, "*** Sample setup problem: You must replace all " +
847+
"placeholder IDs in the ids.xml file by your project's IDs.");
830848
return false;
849+
}
831850
}
832851
return true;
833852
}

0 commit comments

Comments
 (0)