Skip to content

Commit bd72ba9

Browse files
Merge pull request #312 from playgameservices/addFriendsSupport
Add Friends Functionality
2 parents 79dd9b0 + cc3d244 commit bd72ba9

File tree

32 files changed

+392
-45
lines changed

32 files changed

+392
-45
lines changed

ButtonClicker/build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ android {
2222
minifyEnabled true
2323
proguardFiles getDefaultProguardFile('proguard-android.txt')
2424
}
25+
compileOptions {
26+
sourceCompatibility JavaVersion.VERSION_1_8
27+
targetCompatibility JavaVersion.VERSION_1_8
28+
}
2529
}
2630
}
2731

2832
dependencies {
29-
implementation "com.android.support:appcompat-v7:${appcompat_library_version}"
30-
implementation "com.android.support:support-v4:${support_library_version}"
31-
implementation "com.google.android.gms:play-services-games:${gms_library_version}"
33+
implementation 'androidx.appcompat:appcompat:1.0.0'
34+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
35+
implementation "com.google.android.gms:play-services-games:20.0.1"
3236
implementation "com.google.android.gms:play-services-auth:${gms_library_version}"
3337
}
3438

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import android.content.Intent;
2121
import android.os.Bundle;
2222
import android.os.Handler;
23-
import android.support.annotation.NonNull;
23+
import androidx.annotation.NonNull;
2424
import android.util.Log;
2525
import android.view.KeyEvent;
2626
import android.view.View;

ButtonClicker/src/main/res/values-v13/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
-->
1717

1818
<resources>
19-
<style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar" />
19+
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar" />
2020
</resources>

CollectAllTheStars2/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ android {
2626
}
2727

2828
dependencies {
29-
implementation "com.android.support:appcompat-v7:${appcompat_library_version}"
30-
implementation "com.android.support:support-v4:${support_library_version}"
29+
implementation 'androidx.appcompat:appcompat:1.0.0'
30+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
3131
implementation "com.google.android.gms:play-services-games:${gms_library_version}"
3232
implementation "com.google.android.gms:play-services-auth:${gms_library_version}"
3333
}

CollectAllTheStars2/src/main/java/com/google/example/games/catt2/MainActivity.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@
1515

1616
package com.google.example.games.catt2;
1717

18-
import android.app.Activity;
19-
import android.app.AlertDialog;
2018
import android.app.ProgressDialog;
2119
import android.content.Intent;
2220
import android.graphics.Bitmap;
2321
import android.os.Bundle;
24-
import android.support.annotation.NonNull;
2522
import android.util.Log;
2623
import android.view.Menu;
2724
import android.view.MenuItem;
@@ -32,6 +29,10 @@
3229
import android.widget.TextView;
3330
import android.widget.Toast;
3431

32+
import androidx.annotation.NonNull;
33+
import androidx.appcompat.app.AlertDialog;
34+
import androidx.appcompat.app.AppCompatActivity;
35+
3536
import com.google.android.gms.auth.api.signin.GoogleSignIn;
3637
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
3738
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
@@ -72,7 +73,7 @@
7273
*
7374
* @author Bruno Oliveira (Google)
7475
*/
75-
public class MainActivity extends Activity implements
76+
public class MainActivity extends AppCompatActivity implements
7677
View.OnClickListener,
7778
OnRatingBarChangeListener {
7879

@@ -393,7 +394,7 @@ protected void onStart() {
393394
checkPlaceholderIds();
394395
}
395396

396-
public static boolean verifySampleSetup(Activity activity, int... resIds) {
397+
public static boolean verifySampleSetup(AppCompatActivity activity, int... resIds) {
397398
StringBuilder problems = new StringBuilder();
398399
boolean problemFound = false;
399400
problems.append("The following set up problems were found:\n\n");

CollectAllTheStars2/src/main/java/com/google/example/games/catt2/SelectSnapshotActivity.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515
package com.google.example.games.catt2;
1616

17-
import android.app.Activity;
1817
import android.content.Context;
1918
import android.content.Intent;
2019
import android.os.Bundle;
@@ -28,6 +27,8 @@
2827
import android.widget.ListView;
2928
import android.widget.TextView;
3029

30+
import androidx.appcompat.app.AppCompatActivity;
31+
3132
import com.google.android.gms.common.images.ImageManager;
3233
import com.google.android.gms.games.snapshot.Snapshot;
3334
import com.google.android.gms.games.snapshot.SnapshotMetadata;
@@ -44,7 +45,7 @@
4445
*
4546
* @author Clayton Wilkinson (Google)
4647
*/
47-
public class SelectSnapshotActivity extends Activity implements AdapterView.OnItemClickListener {
48+
public class SelectSnapshotActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
4849

4950
private static final String TAG = "SelSnapshotActivity";
5051
// intent data which is a snapshot metadata
@@ -116,7 +117,7 @@ public void onItemClick(AdapterView<?> adapterView, View view, int position, lon
116117
static class SnapshotListAdapter<T> extends ArrayAdapter<T> {
117118

118119

119-
public SnapshotListAdapter(Activity activity, ArrayList<T> data) {
120+
public SnapshotListAdapter(AppCompatActivity activity, ArrayList<T> data) {
120121
super(activity, R.layout.snapshotlayout, data);
121122
}
122123

CollectAllTheStars2/src/main/java/com/google/example/games/catt2/SnapshotCoordinator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import android.content.Intent;
1717
import android.os.AsyncTask;
1818
import android.os.Bundle;
19-
import android.support.annotation.NonNull;
19+
import androidx.annotation.NonNull;
2020
import android.util.Log;
2121

2222
import com.google.android.gms.common.api.CommonStatusCodes;

CollectAllTheStars2/src/main/res/values-v11/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Base application theme for API 11+. This theme completely replaces
2222
AppBaseTheme from res/values/styles.xml on API 11+ devices.
2323
-->
24-
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
24+
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
2525
<!-- API 11 theme customizations can go here. -->
2626
</style>
2727

CollectAllTheStars2/src/main/res/values-v14/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
AppBaseTheme from BOTH res/values/styles.xml and
2323
res/values-v11/styles.xml on API 14+ devices.
2424
-->
25-
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
25+
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
2626
<!-- API 14 theme customizations can go here. -->
2727
</style>
2828

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ These are the Android samples for Google Play game services.
1010

1111
* **CollectAllTheStars2**. Demonstrates how to use the Snapshots feature to save game data. The sample signs the user in, synchronizes their data from a named Snapshot, then updates the UI to reflect the game state saved in the Snapshot.
1212

13-
* **TypeANumber**. Demonstrates how to use leaderboards, achievements and events. In this exciting game, you type the score you think you deserve. But wait! There is a twist. If you are playing in easy mode, you get the score you requested. However, if you are playing in hard mode, you only get half! (tough game, we know).
13+
* **TypeANumber**. Demonstrates how to use leaderboards, achievements, events, and friends. In this exciting game, you type the score you think you deserve. But wait! There is a twist. If you are playing in easy mode, you get the score you requested. However, if you are playing in hard mode, you only get half! (tough game, we know). You can also check how your friends perform in this game by checking out social leaderboards.
1414

1515
* **SkeletonTbmp** A trivial turn-based-multiplayer game. In this thrilling game, you can invite many friends, then send a shared gamestate string back and forth until someone finishes, cancels, or the second-to-last player leaves.
1616

0 commit comments

Comments
 (0)