diff --git a/ButtonClicker/build.gradle b/ButtonClicker/build.gradle index 849ba361..cfbc3a59 100644 --- a/ButtonClicker/build.gradle +++ b/ButtonClicker/build.gradle @@ -22,17 +22,13 @@ android { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt') } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } } } dependencies { - implementation 'androidx.appcompat:appcompat:1.0.0' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation "com.google.android.gms:play-services-games:20.0.1" + implementation "com.android.support:appcompat-v7:${appcompat_library_version}" + implementation "com.android.support:support-v4:${support_library_version}" + implementation "com.google.android.gms:play-services-games:${gms_library_version}" implementation "com.google.android.gms:play-services-auth:${gms_library_version}" } @@ -40,4 +36,4 @@ buildscript { repositories { jcenter() } -} \ No newline at end of file +} diff --git a/ButtonClicker/src/main/java/com/google/example/games/bc/MainActivity.java b/ButtonClicker/src/main/java/com/google/example/games/bc/MainActivity.java index 593b3ff3..2c872be9 100644 --- a/ButtonClicker/src/main/java/com/google/example/games/bc/MainActivity.java +++ b/ButtonClicker/src/main/java/com/google/example/games/bc/MainActivity.java @@ -20,7 +20,7 @@ import android.content.Intent; import android.os.Bundle; import android.os.Handler; -import androidx.annotation.NonNull; +import android.support.annotation.NonNull; import android.util.Log; import android.view.KeyEvent; import android.view.View; diff --git a/ButtonClicker/src/main/res/values-v13/styles.xml b/ButtonClicker/src/main/res/values-v13/styles.xml index 03b93037..997965b5 100644 --- a/ButtonClicker/src/main/res/values-v13/styles.xml +++ b/ButtonClicker/src/main/res/values-v13/styles.xml @@ -16,5 +16,5 @@ --> - diff --git a/CollectAllTheStars2/src/main/res/values-v14/styles.xml b/CollectAllTheStars2/src/main/res/values-v14/styles.xml index 54a8dc22..9e1013d7 100644 --- a/CollectAllTheStars2/src/main/res/values-v14/styles.xml +++ b/CollectAllTheStars2/src/main/res/values-v14/styles.xml @@ -22,7 +22,7 @@ AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. --> - diff --git a/SkeletonTbmp/build.gradle b/SkeletonTbmp/build.gradle index 261419c4..82ad2eba 100644 --- a/SkeletonTbmp/build.gradle +++ b/SkeletonTbmp/build.gradle @@ -25,8 +25,8 @@ android { } dependencies { - implementation 'androidx.appcompat:appcompat:1.0.0' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation "com.android.support:appcompat-v7:${appcompat_library_version}" + implementation "com.android.support:support-v4:${support_library_version}" implementation "com.google.android.gms:play-services-games:${gms_library_version}" implementation "com.google.android.gms:play-services-auth:${gms_library_version}" } diff --git a/SkeletonTbmp/src/main/java/com/google/example/games/tbmpskeleton/SkeletonActivity.java b/SkeletonTbmp/src/main/java/com/google/example/games/tbmpskeleton/SkeletonActivity.java index 40edb29e..307af0af 100644 --- a/SkeletonTbmp/src/main/java/com/google/example/games/tbmpskeleton/SkeletonActivity.java +++ b/SkeletonTbmp/src/main/java/com/google/example/games/tbmpskeleton/SkeletonActivity.java @@ -17,18 +17,16 @@ package com.google.example.games.tbmpskeleton; import android.app.Activity; +import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; +import android.support.annotation.NonNull; import android.util.Log; import android.view.View; import android.widget.TextView; import android.widget.Toast; -import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatActivity; - import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInClient; @@ -73,7 +71,7 @@ * * @author Wolff (wolff@google.com), 2013 */ -public class SkeletonActivity extends AppCompatActivity implements +public class SkeletonActivity extends Activity implements View.OnClickListener { public static final String TAG = "SkeletonActivity"; diff --git a/SkeletonTbmp/src/main/res/values-v11/styles.xml b/SkeletonTbmp/src/main/res/values-v11/styles.xml index a4a95bc4..3c02242a 100644 --- a/SkeletonTbmp/src/main/res/values-v11/styles.xml +++ b/SkeletonTbmp/src/main/res/values-v11/styles.xml @@ -4,7 +4,7 @@ Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. --> - diff --git a/SkeletonTbmp/src/main/res/values-v14/styles.xml b/SkeletonTbmp/src/main/res/values-v14/styles.xml index 664f4f16..a91fd037 100644 --- a/SkeletonTbmp/src/main/res/values-v14/styles.xml +++ b/SkeletonTbmp/src/main/res/values-v14/styles.xml @@ -5,7 +5,7 @@ AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. --> - diff --git a/TypeANumber/build.gradle b/TypeANumber/build.gradle index 0f516a0b..cfbc3a59 100644 --- a/TypeANumber/build.gradle +++ b/TypeANumber/build.gradle @@ -26,12 +26,9 @@ android { } dependencies { - implementation 'androidx.appcompat:appcompat:1.3.0-alpha01' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation "androidx.activity:activity:1.2.0-alpha08" - implementation "androidx.activity:activity-ktx:1.2.0-alpha03" - implementation "androidx.fragment:fragment:1.3.0-alpha08" - implementation "com.google.android.gms:play-services-games:20.0.1" + implementation "com.android.support:appcompat-v7:${appcompat_library_version}" + implementation "com.android.support:support-v4:${support_library_version}" + implementation "com.google.android.gms:play-services-games:${gms_library_version}" implementation "com.google.android.gms:play-services-auth:${gms_library_version}" } diff --git a/TypeANumber/src/main/java/com/google/example/games/tanc/FriendsFragment.java b/TypeANumber/src/main/java/com/google/example/games/tanc/FriendsFragment.java deleted file mode 100644 index 5cd5b601..00000000 --- a/TypeANumber/src/main/java/com/google/example/games/tanc/FriendsFragment.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.google.example.games.tanc; - -import static com.google.example.games.tanc.MainActivity.RC_FRIEND_PROFILE; - -import android.app.Activity; -import android.app.PendingIntent; -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.ImageButton; -import android.widget.ListView; -import android.widget.TextView; -import androidx.activity.result.ActivityResult; -import androidx.activity.result.ActivityResultCallback; -import androidx.activity.result.ActivityResultLauncher; -import androidx.activity.result.IntentSenderRequest; -import androidx.activity.result.contract.ActivityResultContracts; -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import com.google.android.gms.common.api.ResolvableApiException; -import com.google.android.gms.common.data.DataBufferUtils; -import com.google.android.gms.games.AnnotatedData; -import com.google.android.gms.games.Player; -import com.google.android.gms.games.PlayerBuffer; -import com.google.android.gms.tasks.OnCompleteListener; -import com.google.android.gms.tasks.OnSuccessListener; -import com.google.android.gms.tasks.Task; -import java.util.ArrayList; - -/** Fragment that shows the list of friends. */ -public class FriendsFragment extends Fragment { - private static final String TAG = "FriendsFragment"; - private static final int PAGE_SIZE = 200; - - interface Listener { - // called when the user presses the `Back` button - void onBackButtonClicked(); - } - - private View mView; - private ListView mListView; - private View mSpinner; - private ArrayAdapter mAdapter; - private MainActivity mActivity; - private ActivityResultLauncher resolveLauncherFriendsConsent; - private ActivityResultLauncher resolveLauncherCompareProfile; - - private Listener mListener = null; - private OnCompleteListener> onCompleteListener = - new OnCompleteListener>() { - @Override - public void onComplete(@NonNull Task> task) { - if (task.isSuccessful()) { - if (task.getResult() == null) { - mListener.onBackButtonClicked(); - } - PlayerBuffer playerBuffer = task.getResult().get(); - try { - if (DataBufferUtils.hasNextPage(playerBuffer)) { - mActivity - .getPlayersClient() - .loadMoreFriends(PAGE_SIZE) - .addOnCompleteListener(mActivity, onCompleteListener); - } else { - LayoutInflater inflater = LayoutInflater.from(getContext()); - mAdapter = getAdapter(playerBuffer, inflater); - mListView.setAdapter(mAdapter); - mSpinner.setVisibility(View.GONE); - mListView.setVisibility(View.VISIBLE); - } - } finally { - playerBuffer.release(); - } - } else { - Log.e(TAG, "Getting friends failed with exception: " + task.getException()); - try { - if (task.getException() instanceof ResolvableApiException) { - PendingIntent pendingIntent = - ((ResolvableApiException) task.getException()).getResolution(); - resolveLauncherFriendsConsent.launch( - new IntentSenderRequest.Builder(pendingIntent).build()); - } - } catch (Exception e) { - Log.e(TAG, "Getting consent failed with exception: " + e); - mListener.onBackButtonClicked(); - } - } - } - }; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { - mView = inflater.inflate(R.layout.friends_screen, container, /* attachToRoot= */ false); - mListView = mView.findViewById(R.id.load_friends_game_list); - mSpinner = mView.findViewById(R.id.progress_bar); - mActivity = (MainActivity) getActivity(); - mView - .findViewById(R.id.back_button) - .setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View view) { - mListener.onBackButtonClicked(); - } - }); - resolveLauncherFriendsConsent = - registerForActivityResult( - new ActivityResultContracts.StartIntentSenderForResult(), - new ActivityResultCallback() { - @Override - public void onActivityResult(ActivityResult result) { - if (result.getResultCode() == Activity.RESULT_OK) { - refreshFriends(); - } else { - mListener.onBackButtonClicked(); - } - } - }); - resolveLauncherCompareProfile = - registerForActivityResult( - new ActivityResultContracts.StartActivityForResult(), - new ActivityResultCallback() { - @Override - public void onActivityResult(ActivityResult result) { - if (result.getResultCode() == Activity.RESULT_OK) { - refreshFriends(); - } - } - }); - refreshFriends(); - return mView; - } - - void setListener(Listener listener) { - mListener = listener; - } - - @NonNull - private ArrayAdapter getAdapter( - PlayerBuffer playerBuffer, final LayoutInflater inflater) { - ArrayList players = new ArrayList<>(); - for (int i = 0; i < playerBuffer.getCount(); i++) { - players.add(playerBuffer.get(i).freeze()); - } - return new ArrayAdapter(mActivity, R.layout.friends_row, players) { - @Override - public View getView(int position, View convertView, ViewGroup viewGroup) { - View rowView = inflater.inflate(R.layout.friends_row, viewGroup, /* attachToRoot= */ false); - final Player player = getItem(position); - TextView textView = rowView.findViewById(R.id.friend_name); - textView.setText(player.getDisplayName()); - ImageButton showProfileButton = rowView.findViewById(R.id.show_profile); - showProfileButton.setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View v) { - mActivity - .getPlayersClient() - .getCompareProfileIntentWithAlternativeNameHints( - player.getPlayerId(), player.getDisplayName(), mActivity.getDisplayName()) - .addOnSuccessListener( - mActivity, - new OnSuccessListener() { - @Override - public void onSuccess(Intent intent) { - resolveLauncherCompareProfile.launch(intent); - } - }); - } - }); - return rowView; - } - }; - } - - void refreshFriends() { - mListView.setAdapter(null); - mSpinner.setVisibility(View.VISIBLE); - mActivity - .getPlayersClient() - .loadFriends(PAGE_SIZE, /* forceReload= */ false) - .addOnCompleteListener(mActivity, onCompleteListener); - } -} \ No newline at end of file diff --git a/TypeANumber/src/main/java/com/google/example/games/tanc/GameplayFragment.java b/TypeANumber/src/main/java/com/google/example/games/tanc/GameplayFragment.java index 6102f582..2c58b734 100644 --- a/TypeANumber/src/main/java/com/google/example/games/tanc/GameplayFragment.java +++ b/TypeANumber/src/main/java/com/google/example/games/tanc/GameplayFragment.java @@ -17,13 +17,14 @@ package com.google.example.games.tanc; import android.os.Bundle; +import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; -import androidx.fragment.app.Fragment; + import java.util.Locale; /** diff --git a/TypeANumber/src/main/java/com/google/example/games/tanc/MainActivity.java b/TypeANumber/src/main/java/com/google/example/games/tanc/MainActivity.java index 7cb31d14..75b94023 100644 --- a/TypeANumber/src/main/java/com/google/example/games/tanc/MainActivity.java +++ b/TypeANumber/src/main/java/com/google/example/games/tanc/MainActivity.java @@ -16,27 +16,20 @@ package com.google.example.games.tanc; -import android.app.Activity; +import android.app.AlertDialog; import android.content.Intent; import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentActivity; import android.util.Log; import android.widget.Toast; -import androidx.activity.result.ActivityResult; -import androidx.activity.result.ActivityResultCallback; -import androidx.activity.result.ActivityResultLauncher; -import androidx.activity.result.IntentSenderRequest; -import androidx.activity.result.contract.ActivityResultContracts; -import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentActivity; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInClient; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.common.api.ApiException; -import com.google.android.gms.common.api.ResolvableApiException; import com.google.android.gms.games.AchievementsClient; import com.google.android.gms.games.AnnotatedData; import com.google.android.gms.games.EventsClient; @@ -46,39 +39,35 @@ import com.google.android.gms.games.PlayersClient; import com.google.android.gms.games.event.Event; import com.google.android.gms.games.event.EventBuffer; -import com.google.android.gms.games.leaderboard.LeaderboardScore; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; -import static com.google.android.gms.games.leaderboard.LeaderboardVariant.COLLECTION_FRIENDS; -import static com.google.android.gms.games.leaderboard.LeaderboardVariant.COLLECTION_PUBLIC; - /** * Our main activity for the game. - * - *

IMPORTANT: Before attempting to run this sample, please change the package name to your own - * package name (not com.android.*) and replace the IDs on res/values/ids.xml by your own IDs (you - * must create a game in the developer console to get those IDs). - * - *

This is a very simple game where the user selects "easy mode" or "hard mode" and then the - * "gameplay" consists of inputting the desired score (0 to 9999). In easy mode, you get the score - * you request; in hard mode, you get half. + *

+ * IMPORTANT: Before attempting to run this sample, please change + * the package name to your own package name (not com.android.*) and + * replace the IDs on res/values/ids.xml by your own IDs (you must + * create a game in the developer console to get those IDs). + *

+ * This is a very simple game where the user selects "easy mode" or + * "hard mode" and then the "gameplay" consists of inputting the + * desired score (0 to 9999). In easy mode, you get the score you + * request; in hard mode, you get half. * * @author Bruno Oliveira */ -public class MainActivity extends FragmentActivity - implements MainMenuFragment.Listener, - GameplayFragment.Callback, - WinFragment.Listener, - FriendsFragment.Listener { +public class MainActivity extends FragmentActivity implements + MainMenuFragment.Listener, + GameplayFragment.Callback, + WinFragment.Listener { // Fragments private MainMenuFragment mMainMenuFragment; private GameplayFragment mGameplayFragment; private WinFragment mWinFragment; - public FriendsFragment mFriendsFragment; // Client used to sign in with Google APIs private GoogleSignInClient mGoogleSignInClient; @@ -93,18 +82,12 @@ public class MainActivity extends FragmentActivity private static final int RC_UNUSED = 5001; private static final int RC_SIGN_IN = 9001; - static final int RC_FRIEND_PROFILE = 9002; - static final int RC_RESOLUTION = 9003; - // tag for debug logging private static final String TAG = "TanC"; // playing on hard mode? private boolean mHardMode = false; - // The diplay name of the signed in user. - private String mDisplayName = ""; - // achievements and scores we're pending to push to the cloud // (waiting for the user to sign in, for instance) private final AccomplishmentsOutbox mOutbox = new AccomplishmentsOutbox(); @@ -123,13 +106,11 @@ public void onCreate(Bundle savedInstanceState) { mMainMenuFragment = new MainMenuFragment(); mGameplayFragment = new GameplayFragment(); mWinFragment = new WinFragment(); - mFriendsFragment = new FriendsFragment(); // Set the listeners and callbacks of fragment events. mMainMenuFragment.setListener(this); mGameplayFragment.setCallback(this); mWinFragment.setListener(this); - mFriendsFragment.setListener(this); // Add initial Main Menu fragment. // IMPORTANT: if this Activity supported rotation, we'd have to be @@ -137,8 +118,8 @@ public void onCreate(Bundle savedInstanceState) { // already be there after rotation and trying to add it again would // result in overlapping fragments. But since we don't support rotation, // we don't deal with that for code simplicity. - getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, mMainMenuFragment) - .commit(); + getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, + mMainMenuFragment).commit(); checkPlaceholderIds(); } @@ -181,7 +162,7 @@ private void checkPlaceholderIds() { problems.append("\nThese problems may prevent the app from working properly."); problems.append("\n\nSee the TODO window in Android Studio for more information"); (new AlertDialog.Builder(this)).setMessage(problems.toString()) - .setNeutralButton(android.R.string.ok, null).create().show(); + .setNeutralButton(android.R.string.ok, null).create().show(); } } @@ -204,7 +185,10 @@ public void onSuccess(AnnotatedData eventBufferAnnotatedData) { for (int i = 0; i < count; i++) { Event event = eventBuffer.get(i); - Log.i(TAG, "event: " + event.getName() + " -> " + event.getValue()); + Log.i(TAG, "event: " + + event.getName() + + " -> " + + event.getValue()); } } }) @@ -218,10 +202,8 @@ public void onFailure(@NonNull Exception e) { // Switch UI to the given fragment private void switchToFragment(Fragment newFrag) { - getSupportFragmentManager() - .beginTransaction() - .replace(R.id.fragment_container, newFrag) - .commit(); + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, newFrag) + .commit(); } private boolean isSignedIn() { @@ -243,7 +225,7 @@ public void onComplete(@NonNull Task task) { onDisconnected(); } } - }); + }); } private void startSignInIntent() { @@ -277,7 +259,7 @@ public void onComplete(@NonNull Task task) { onDisconnected(); } - }); + }); } @Override @@ -295,10 +277,10 @@ public void onSuccess(Intent intent) { } }) .addOnFailureListener(new OnFailureListener() { - @Override - public void onFailure(@NonNull Exception e) { - handleException(e, getString(R.string.achievements_exception)); - } + @Override + public void onFailure(@NonNull Exception e) { + handleException(e, getString(R.string.achievements_exception)); + } }); } @@ -447,7 +429,6 @@ private void pushAccomplishments() { if (mOutbox.mBoredSteps > 0) { mAchievementsClient.increment(getString(R.string.achievement_really_bored), mOutbox.mBoredSteps); - mAchievementsClient.increment(getString(R.string.achievement_bored), mOutbox.mBoredSteps); mOutbox.mBoredSteps = 0; @@ -464,14 +445,6 @@ private void pushAccomplishments() { } } - public PlayersClient getPlayersClient() { - return mPlayersClient; - } - - public String getDisplayName() { - return mDisplayName; - } - /** * Update leaderboards with the user's score. * @@ -494,7 +467,8 @@ public void onWinScreenDismissed() { protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (requestCode == RC_SIGN_IN) { - Task task = GoogleSignIn.getSignedInAccountFromIntent(intent); + Task task = + GoogleSignIn.getSignedInAccountFromIntent(intent); try { GoogleSignInAccount account = task.getResult(ApiException.class); @@ -542,16 +516,16 @@ public void onComplete(@NonNull Task task) { handleException(e, getString(R.string.players_exception)); displayName = "???"; } - mDisplayName = displayName; mMainMenuFragment.setGreeting("Hello, " + displayName); } }); + // if we have accomplishments to push, push them if (!mOutbox.isEmpty()) { pushAccomplishments(); - Toast.makeText(this, - getString(R.string.your_progress_will_be_uploaded), Toast.LENGTH_LONG).show(); + Toast.makeText(this, getString(R.string.your_progress_will_be_uploaded), + Toast.LENGTH_LONG).show(); } loadAndPrintEvents(); @@ -583,16 +557,6 @@ public void onSignOutButtonClicked() { signOut(); } - @Override - public void onShowFriendsButtonClicked() { - switchToFragment(mFriendsFragment); - } - - @Override - public void onBackButtonClicked() { - switchToFragment(mMainMenuFragment); - } - private class AccomplishmentsOutbox { boolean mPrimeAchievement = false; boolean mHumbleAchievement = false; @@ -603,9 +567,9 @@ private class AccomplishmentsOutbox { int mHardModeScore = -1; boolean isEmpty() { - return !mPrimeAchievement && !mHumbleAchievement && !mLeetAchievement - && !mArrogantAchievement && mBoredSteps == 0 && mEasyModeScore < 0 - && mHardModeScore < 0; + return !mPrimeAchievement && !mHumbleAchievement && !mLeetAchievement && + !mArrogantAchievement && mBoredSteps == 0 && mEasyModeScore < 0 && + mHardModeScore < 0; } } diff --git a/TypeANumber/src/main/java/com/google/example/games/tanc/MainMenuFragment.java b/TypeANumber/src/main/java/com/google/example/games/tanc/MainMenuFragment.java index ac7b2ba8..9cd7b524 100644 --- a/TypeANumber/src/main/java/com/google/example/games/tanc/MainMenuFragment.java +++ b/TypeANumber/src/main/java/com/google/example/games/tanc/MainMenuFragment.java @@ -16,12 +16,12 @@ package com.google.example.games.tanc; import android.os.Bundle; +import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.TextView; -import androidx.fragment.app.Fragment; /** * Fragment with the main menu for the game. The main menu allows the player @@ -37,7 +37,6 @@ public class MainMenuFragment extends Fragment implements OnClickListener { private View mSignOutBarView; private View mShowAchievementsButton; private View mShowLeaderboardsButton; - private View mShowFriendsButton; interface Listener { // called when the user presses the `Easy` or `Okay` button; will pass in which via `hardMode` @@ -54,9 +53,6 @@ interface Listener { // called when the user presses the `Sign Out` button void onSignOutButtonClicked(); - - // called when the user presses the `Friends` button - void onShowFriendsButtonClicked(); } private Listener mListener = null; @@ -75,8 +71,7 @@ public View onCreateView(LayoutInflater inflater, R.id.show_achievements_button, R.id.show_leaderboards_button, R.id.sign_in_button, - R.id.sign_out_button, - R.id.show_friends_button + R.id.sign_out_button }; for (int clickableId : clickableIds) { @@ -86,7 +81,6 @@ public View onCreateView(LayoutInflater inflater, // cache views mShowAchievementsButton = view.findViewById(R.id.show_achievements_button); mShowLeaderboardsButton = view.findViewById(R.id.show_leaderboards_button); - mShowFriendsButton = view.findViewById(R.id.show_friends_button); mGreetingTextView = view.findViewById(R.id.text_greeting); mSignInBarView = view.findViewById(R.id.sign_in_bar); @@ -110,7 +104,6 @@ private void updateUI() { mGreetingTextView.setText(mGreeting); mShowAchievementsButton.setEnabled(!mShowSignInButton); mShowLeaderboardsButton.setEnabled(!mShowSignInButton); - mShowFriendsButton.setEnabled(!mShowSignInButton); mSignInBarView.setVisibility(mShowSignInButton ? View.VISIBLE : View.GONE); mSignOutBarView.setVisibility(mShowSignInButton ? View.GONE : View.VISIBLE); } @@ -130,9 +123,6 @@ public void onClick(View view) { case R.id.show_leaderboards_button: mListener.onShowLeaderboardsRequested(); break; - case R.id.show_friends_button: - mListener.onShowFriendsButtonClicked(); - break; case R.id.sign_in_button: mListener.onSignInButtonClicked(); break; diff --git a/TypeANumber/src/main/java/com/google/example/games/tanc/WinFragment.java b/TypeANumber/src/main/java/com/google/example/games/tanc/WinFragment.java index 1d4e03ba..860eadaf 100644 --- a/TypeANumber/src/main/java/com/google/example/games/tanc/WinFragment.java +++ b/TypeANumber/src/main/java/com/google/example/games/tanc/WinFragment.java @@ -17,12 +17,12 @@ package com.google.example.games.tanc; import android.os.Bundle; +import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.TextView; -import androidx.fragment.app.Fragment; /** * Fragment that shows the 'You won' message. Apart from congratulating the user @@ -123,4 +123,4 @@ public void setShowSignInButton(boolean showSignIn) { mShowSignIn = showSignIn; updateUI(); } -} \ No newline at end of file +} diff --git a/TypeANumber/src/main/res/drawable-hdpi/pgs_signed_in_friend.png b/TypeANumber/src/main/res/drawable-hdpi/pgs_signed_in_friend.png deleted file mode 100644 index ef8a5084..00000000 Binary files a/TypeANumber/src/main/res/drawable-hdpi/pgs_signed_in_friend.png and /dev/null differ diff --git a/TypeANumber/src/main/res/drawable-ldpi/pgs_signed_in_friend.png b/TypeANumber/src/main/res/drawable-ldpi/pgs_signed_in_friend.png deleted file mode 100644 index fd2c6063..00000000 Binary files a/TypeANumber/src/main/res/drawable-ldpi/pgs_signed_in_friend.png and /dev/null differ diff --git a/TypeANumber/src/main/res/drawable-mdpi/pgs_signed_in_friend.png b/TypeANumber/src/main/res/drawable-mdpi/pgs_signed_in_friend.png deleted file mode 100644 index 299b359d..00000000 Binary files a/TypeANumber/src/main/res/drawable-mdpi/pgs_signed_in_friend.png and /dev/null differ diff --git a/TypeANumber/src/main/res/drawable-xhdpi/pgs_signed_in_friend.png b/TypeANumber/src/main/res/drawable-xhdpi/pgs_signed_in_friend.png deleted file mode 100644 index 7a953a8c..00000000 Binary files a/TypeANumber/src/main/res/drawable-xhdpi/pgs_signed_in_friend.png and /dev/null differ diff --git a/TypeANumber/src/main/res/layout/fragment_mainmenu.xml b/TypeANumber/src/main/res/layout/fragment_mainmenu.xml index 1a427642..0bae8ccd 100644 --- a/TypeANumber/src/main/res/layout/fragment_mainmenu.xml +++ b/TypeANumber/src/main/res/layout/fragment_mainmenu.xml @@ -86,13 +86,7 @@