本文整理汇总了Java中com.google.android.gms.games.Player.getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java Player.getDisplayName方法的具体用法?Java Player.getDisplayName怎么用?Java Player.getDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.games.Player
的用法示例。
在下文中一共展示了Player.getDisplayName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playerInfo
import com.google.android.gms.games.Player; //导入方法依赖的package包/类
private void playerInfo() {
Player player = fragmentController.getGamesClientPublic().getCurrentPlayer();
String name = player.getDisplayName();
Uri uri = player.getIconImageUri();
String displayName;
if (player == null) {
Log.w(TAG, "mGamesClient.getCurrentPlayer() is NULL!");
displayName = "???";
} else {
displayName = player.getDisplayName();
appPreference.setLoginName(displayName);
}
userInfo.setText(String.format(getString(R.string.you_are_signed_in_as), displayName));
//userIcon.setImageURI(uri);
}
示例2: playerInfo
import com.google.android.gms.games.Player; //导入方法依赖的package包/类
private void playerInfo() {
Player player = getGamesClient().getCurrentPlayer();
String name = player.getDisplayName();
Uri uri = player.getIconImageUri();
String displayName;
if (player == null) {
Log.w(TAG, "mGamesClient.getCurrentPlayer() is NULL!");
displayName = "???";
} else {
displayName = player.getDisplayName();
appPreference.setLoginName(displayName);
}
userInfo.setText(String.format(getString(R.string.you_are_signed_in_as), displayName));
//userIcon.setImageURI(uri);
}
示例3: onConnected
import com.google.android.gms.games.Player; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle connectionHint)
{
// The player is signed in. Hide the sign-in button and allow the
// player to proceed.
Log.i("yoyo","Sign In Succeeded");
Player p = Games.Players.getCurrentPlayer(getApiClient());
String displayName;
String id;
if (p == null) {
Log.i("yoyo", "mGamesClient.getCurrentPlayer() is NULL!");
displayName = "???";
id="-1";
}
else {
displayName = p.getDisplayName();
id = p.getPlayerId();
}
Log.i("yoyo","Found displayname " + displayName + " with id " + id);
RunnerJNILib.OnLoginSuccess(displayName,id,"","","","","");
//Call back to generate the social event
}
示例4: onConnected
import com.google.android.gms.games.Player; //导入方法依赖的package包/类
@Override
public void onConnected(@Nullable Bundle bundle) {
Player p = Games.Players.getCurrentPlayer(mGoogleApiClient);
String displayName;
String playerId;
if (p == null) {
Log.w(TAG, "mGamesClient.getCurrentPlayer() is NULL!");
displayName = "???";
} else {
displayName = p.getDisplayName();
playerId = Games.Players.getCurrentPlayerId(mGoogleApiClient);
mApplication.setPlayerName(displayName);
mApplication.setPlayerId(playerId);
website.bloop.app.api.Player player = new website.bloop.app.api.Player(displayName, playerId, null);
addUser(player);
}
// hide button on login
loginButton.setVisibility(View.INVISIBLE);
loginText.setText(displayName);
// store that we are logged in
SharedPreferences pref = getSharedPreferences(PREF_LOGIN, Context.MODE_PRIVATE);
SharedPreferences.Editor ed = pref.edit();
ed.putBoolean(PREF_LOGIN_VAL, true);
ed.apply();
// start the main game now
Intent newIntent = new Intent(getBaseContext(), BloopActivity.class);
newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(newIntent);
finish();
}
示例5: updateGooglePlayGames
import com.google.android.gms.games.Player; //导入方法依赖的package包/类
private void updateGooglePlayGames() {
if (mGoogleApiClient.isConnected()) {
// Set the greeting appropriately on main menu
Player p = Games.Players.getCurrentPlayer(mGoogleApiClient);
String displayName;
Uri imageUri;
if (p == null) {
displayName = getString(R.string.google_play_games_player_unknown);
imageUri = null;
} else {
displayName = p.getDisplayName();
imageUri = p.hasHiResImage() ? p.getHiResImageUri() : p.getIconImageUri();
//bannerUri = p.getBannerImageLandscapeUri();
}
Log.w(TAG, "onConnected(): current player is " + displayName);
mIvGooglePlayGamesIcon.setVisibility(View.GONE);
mIvGooglePlayGamesAvatar.setVisibility(View.VISIBLE);
ImageManager.create(this).loadImage(mIvGooglePlayGamesAvatar, imageUri, R.drawable.im_avatar);
mTvGooglePlayGames.setVisibility(View.GONE);
mTvGooglePlayGamesName.setVisibility(View.VISIBLE);
mTvGooglePlayGamesName.setText(displayName);
mVgGooglePlayGamesActions.setVisibility(View.VISIBLE);
} else {
mIvGooglePlayGamesIcon.setVisibility(View.VISIBLE);
mIvGooglePlayGamesAvatar.setVisibility(View.GONE);
mTvGooglePlayGames.setVisibility(View.VISIBLE);
mTvGooglePlayGamesName.setVisibility(View.GONE);
mVgGooglePlayGamesActions.setVisibility(View.GONE);
}
}
示例6: onConnected
import com.google.android.gms.games.Player; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle bundle) {
Log.d(TAG, "onConnected(): connected to Google APIs");
// Show sign-out button on main menu
mMainMenuFragment.setShowSignInButton(false);
// Show "you are signed in" message on win screen, with no sign in button.
mWinFragment.setShowSignInButton(false);
// Set the greeting appropriately on main menu
Player p = Games.Players.getCurrentPlayer(mGoogleApiClient);
String displayName;
if (p == null) {
Log.w(TAG, "mGamesClient.getCurrentPlayer() is NULL!");
displayName = "???";
} else {
displayName = p.getDisplayName();
}
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();
}
}
示例7: onSignInSucceeded
import com.google.android.gms.games.Player; //导入方法依赖的package包/类
@Override
public void onSignInSucceeded() {
//Util.alert(cordova.getActivity(), "onSignInSucceeded");
//https://github.com/freshplanet/ANE-Google-Play-Game-Services/blob/master/android/src/com/freshplanet/googleplaygames/functions/AirGooglePlayGamesGetActivePlayerName.java
//https://developer.android.com/reference/com/google/android/gms/games/Games.html#Players
//https://developer.android.com/reference/com/google/android/gms/games/Players.html#getCurrentPlayer(com.google.android.gms.common.api.GoogleApiClient)
//https://developer.android.com/reference/com/google/android/gms/games/Player.html
Player player = Games.Players.getCurrentPlayer(getGameHelper().getApiClient());
JSONObject playerDetail = new JSONObject();
try {
if (player != null)
{
String playerId = player.getPlayerId();
String displayName = player.getDisplayName();
//String title = player.getTitle();
playerDetail.put("playerId", playerId);
playerDetail.put("playerDisplayName", displayName);
}
}
catch(JSONException ex){
}
PluginResult pr = new PluginResult(PluginResult.Status.OK, playerDetail);
//pr.setKeepCallback(true);
loginCC.sendPluginResult(pr);
//PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
//pr.setKeepCallback(true);
//loginCC.sendPluginResult(pr);
}
示例8: providePlayerOneDefaultName
import com.google.android.gms.games.Player; //导入方法依赖的package包/类
@Provides
@Named("PlayerOneDefaultName")
public String providePlayerOneDefaultName(GoogleApiClient googleApiClient,
AvatarManager avatarManager) {
if (googleApiClient.isConnected()) {
Player currentPlayer = Players.getCurrentPlayer(googleApiClient);
avatarManager.setAvatarUri(currentPlayer.getDisplayName(), currentPlayer.getIconImageUri());
return currentPlayer.getDisplayName();
} else {
return application.getString(R.string.player_one_default_name);
}
}