本文整理汇总了Java中com.google.android.gms.plus.model.people.Person.getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java Person.getDisplayName方法的具体用法?Java Person.getDisplayName怎么用?Java Person.getDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.plus.model.people.Person
的用法示例。
在下文中一共展示了Person.getDisplayName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProfileInformation
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
/**
* Fetching user's information name, email, profile pic
* */
private void getProfileInformation() {
ringProgressDialog.dismiss();
if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
Person currentPerson = Plus.PeopleApi
.getCurrentPerson(mGoogleApiClient);
String personName = currentPerson.getDisplayName();
String personPhotoUrl = currentPerson.getImage().getUrl();
String personGooglePlusProfile = currentPerson.getUrl();
String birth = currentPerson.getBirthday();
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
// by default the profile url gives 50x50 px image only
// we can replace the value with whatever dimension we want by
// replacing sz=X
// personPhotoUrl = personPhotoUrl.substring(0,
// personPhotoUrl.length() - 2)
// + PROFILE_PIC_SIZE;
//new LoadProfileImage().execute(personPhotoUrl);
} else {
Toast.makeText(getApplicationContext(),
"Person information is null", Toast.LENGTH_LONG).show();
}
}
示例2: authComplete
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
private void authComplete(String token) {
if (token != null) {
if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
String name = currentPerson.getDisplayName();
String image = currentPerson.getImage().getUrl();
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
/** Add additional logic here if you want to restrict access to subset of users **/
MobilizerApp.get().getUser().setName(name);
MobilizerApp.get().getUser().setEmail(email);
MobilizerApp.get().getUser().setImageUrl(image);
MobilizerApp.get().getUser().setAccessToken(token);
Intent home = new Intent(AuthActivity.this, HomeActivity.class);
startActivityForResult(home, RC_LOGOUT);
} else {
mSignInLayout.setVisibility(View.VISIBLE);
mProgressBar.setVisibility(View.GONE);
}
} else {
mSignInLayout.setVisibility(View.VISIBLE);
mProgressBar.setVisibility(View.GONE);
}
}
示例3: onConnected
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle bundle) {
if (!mClearingAccounts) {
String email = Plus.AccountApi.getAccountName(google);
Person person = Plus.PeopleApi.getCurrentPerson(google);
if (person != null) {
String personName = person.getDisplayName();
Person.Image avatar = person.getImage();
String photoURL = "false";
if (person.hasImage() && avatar.hasUrl()) {
photoURL = avatar.getUrl().split("\\?")[0];
}
OUser user = new OUser();
user.setUsername(email);
user.setPassword("odoo_mobile_shop_google_user");
user.setName(personName);
user.setAvatar(photoURL);
user.setDatabase(OConstants.publicUser().getDatabase());
new AccountCreator().execute(user);
}
} else {
Plus.AccountApi.clearDefaultAccount(google);
mClearingAccounts = false;
}
}
示例4: getProfileInformation
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
public void getProfileInformation() {
Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
Person currentPerson = Plus.PeopleApi
.getCurrentPerson(mGoogleApiClient);
String personName = currentPerson.getDisplayName();
String personPhotoUrl = currentPerson.getImage().getUrl();
String personGooglePlusProfile = currentPerson.getUrl();
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
textView_name.setText(personName);
textView_email.setText(email);
// by default the profile url gives 50x50 px image only
// we can replace the value with whatever dimension we want by
// replacing sz=X
personPhotoUrl = personPhotoUrl.substring(0,
personPhotoUrl.length() - 2)
+ 400;
new LoadProfileImage(imageView_profile_image).execute(personPhotoUrl);
Toast.makeText(getApplicationContext(),
"Information is loaded", Toast.LENGTH_LONG).show();
}
示例5: getProfileInformation2
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
public void getProfileInformation2() {
Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
Person currentPerson = Plus.PeopleApi
.getCurrentPerson(mGoogleApiClient);
String personName = currentPerson.getDisplayName();
String personPhotoUrl = currentPerson.getImage().getUrl();
String personGooglePlusProfile = currentPerson.getUrl();
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
Drawer_textView_name.setText(personName);
drawer_textView_email.setText(email);
// by default the profile url gives 50x50 px image only
// we can replace the value with whatever dimension we want by
// replacing sz=X
personPhotoUrl = personPhotoUrl.substring(0,
personPhotoUrl.length() - 2)
+ 400;
new LoadProfileImage3(drawerImageProfile).execute(personPhotoUrl);
Toast.makeText(getApplicationContext(),
"Information is loaded in Nav_drawer", Toast.LENGTH_LONG).show();
}
示例6: getProfileInformation
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
/**
* Fetching user's information name, email, profile pic
*/
private void getProfileInformation() {
try {
if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
Person currentPerson = Plus.PeopleApi
.getCurrentPerson(mGoogleApiClient);
String personName = currentPerson.getDisplayName();
String[] wholeName = personName.split(" ", 2);
String firstName = wholeName[0];
String lastName = wholeName[1];
String personGooglePlusProfile = currentPerson.getUrl();
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
new SocialLoginTask(LoginFragment.this, getActivity())
.execute("google",
firstName,
lastName,
personGooglePlusProfile,
email);
} else {
Toast.makeText(mContext,
"Person information is null", Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: onPeopleLoaded
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
@Override
public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) {
if (connectionResult.getErrorCode() == ConnectionResult.SUCCESS) {
Person person = persons.get(0);
user = new Participant();
String fullName = person.getDisplayName();
user.setFirstname(fullName.substring(0, fullName.indexOf(' ')));
user.setLastname(fullName.substring(fullName.indexOf(' ')));
user.setEmail(mPlusClient.getAccountName());
user.setBiography(person.getTagline());
user.setCity((person.getCurrentLocation() == null) ? "N/A" : person.getCurrentLocation());
user.setCountry((person.getCurrentLocation() == null) ? "N/A" : person.getCurrentLocation());
user.setCompany(person.getOrganizations().get(0).getName());
user.setPhoto(getBestPictureSize(person.getImage().getUrl()));
user.setWebsite(person.getUrl());
user.setPassword(getFakePassword());
user.setPhone("N/A");
registerUser();
} else {
// TODO handle this
}
}
示例8: createRegistrationBundle
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
/**
* Creates the registration bundle and fills it with user information.
*
* @param googleApiClient The connected api client.
* @return A bundle with registration data.
*/
private Bundle createRegistrationBundle(GoogleApiClient googleApiClient) {
// Get the current user's information for registration
final Person currentPerson = Plus.PeopleApi.getCurrentPerson(googleApiClient);
final String displayName;
final String profilePictureUrl;
Bundle registration = new Bundle();
if (currentPerson != null) {
displayName = currentPerson.getDisplayName();
profilePictureUrl = currentPerson.getImage().getUrl();
} else {
Log.e(TAG, "Couldn't load person. Falling back to default.");
Log.d(TAG, "Make sure that the Google+ API is enabled for your project.");
Log.d(TAG, "More information can be found here: "
+ "https://developers.google.com/+/mobile/android/"
+ "getting-started#step_1_enable_the_google_api");
displayName = "Anonymous Kitten";
profilePictureUrl = "http://placekitten.com/g/500/500";
}
// Create the bundle for registration with the server.
registration.putString(PingerKeys.ACTION, GcmAction.REGISTER_NEW_CLIENT);
registration.putString(PingerKeys.NAME, displayName);
registration.putString(PingerKeys.PICTURE_URL, profilePictureUrl);
return registration;
}
示例9: updateUI
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
private void updateUI(boolean isSignedIn) {
if (isSignedIn) {
Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
if (currentPerson != null) {
// Show signed-in user's name
String name = currentPerson.getDisplayName();
mStatus.setText(getString(R.string.signed_in_fmt, name));
// Show users' email address (which requires GET_ACCOUNTS permission)
if (checkAccountsPermission()) {
String currentAccount = Plus.AccountApi.getAccountName(mGoogleApiClient);
((TextView) findViewById(R.id.detail)).setText(currentAccount);
}
} else {
// If getCurrentPerson returns null there is generally some error with the
// configuration of the application (invalid Client ID, Plus API not enabled, etc).
Log.w(TAG, getString(R.string.error_null_person));
mStatus.setText(getString(R.string.signed_in_err));
}
// Set button visibility
findViewById(R.id.sign_in_button).setVisibility(View.GONE);
findViewById(R.id.sign_out_and_disconnect).setVisibility(View.VISIBLE);
} else {
// Show signed-out message and clear email field
mStatus.setText(R.string.signed_out);
((TextView) findViewById(R.id.detail)).setText("");
// Set button visibility
findViewById(R.id.sign_in_button).setEnabled(true);
findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
findViewById(R.id.sign_out_and_disconnect).setVisibility(View.GONE);
}
}
示例10: if
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
public ℴ(Person paramPerson)
{
this.ˊ = paramPerson.getId();
this.ˋ = paramPerson.getDisplayName();
this.ˎ = paramPerson.getImage().getUrl();
if (this.ˎ == null)
this.ˎ = "";
}
示例11: parseGoogleContact
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
private static UserProfile parseGoogleContact(Person googleContact){
String fullName = googleContact.getDisplayName();
String firstName = "";
String lastName = "";
if (!TextUtils.isEmpty(fullName)) {
String[] splitName = fullName.split(" ");
if (splitName.length > 0) {
firstName = splitName[0];
if (splitName.length > 1) {
lastName = splitName[1];
}
}
}
UserProfile result = new UserProfile(RefProvider,
parseGoogleContactInfo(googleContact.getId()),
"", //TODO: user name
"", //TODO: email
firstName,
lastName);
result.setGender(parseGoogleContactInfo(googleContact.getGender()));
result.setBirthday(parseGoogleContactInfo(googleContact.getBirthday()));
result.setLanguage(parseGoogleContactInfo(googleContact.getLanguage()));
result.setLocation(parseGoogleContactInfo(googleContact.getCurrentLocation()));
result.setAvatarLink(parseGoogleContactInfo(googleContact.getImage().getUrl()));
return result;
}
示例12: onPlusClientSignIn
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
@Override
protected void onPlusClientSignIn() {
mConnectionProgressDialog.dismiss();
session = new SessionManager(this);
if (getPlusClient().getCurrentPerson() != null) {
String accountName = getPlusClient().getAccountName();
Person currentPerson = getPlusClient().getCurrentPerson();
String personName = currentPerson.getDisplayName();
String personPhotoUrl = currentPerson.getImage().getUrl();
String personGooglePlusProfile = currentPerson.getUrl();
String personGooglePlusId = currentPerson.getId();
String location = currentPerson.getCurrentLocation();
session.createLoginSession(personName, accountName, personPhotoUrl, personGooglePlusProfile, personGooglePlusId, location);
}
Toast.makeText(this, "Welcome to ListSketcher!", Toast.LENGTH_LONG).show();
Intent i = new Intent(this, MainActivity.class);
// Closing all the Activities
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// Add new Flag to start new Activity
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
finish();
}
示例13: Contact
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
public Contact(Person person) {
// persons are loaded with image, id and display name so no need in null-checks
this.imageUrl = person.getImage().getUrl();
this.displayName = person.getDisplayName();
this.googleId = person.getId();
}
示例14: onConnected
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle bundle) {
if (operationLogin) {
Person person = Plus.PeopleApi.getCurrentPerson(googleApiClient);
final String id = person.getId();
final String displayName = person.getDisplayName();
final Person.Image image = person.getImage();
final String imageUrl = image.hasUrl() ? image.getUrl() : null;
final String accountName = Plus.AccountApi.getAccountName(googleApiClient);
new AsyncTask<Void, Void, Void>() {
AuthData authData;
Exception cause;
@Override
protected Void doInBackground(Void... params) {
try {
String token = GoogleAuthUtil.getToken(activity, accountName, "oauth2:" + Plus.SCOPE_PLUS_LOGIN);
authData = createAuthData(id, token, displayName, imageUrl);
} catch (IOException | GoogleAuthException e) {
cause = e;
}
googleApiClient.disconnect();
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
if (cause != null) {
onError(createAuthError(cause));
} else {
onSuccess(authData);
}
}
}.execute();
} else {
Plus.AccountApi.clearDefaultAccount(googleApiClient);
Plus.AccountApi.revokeAccessAndDisconnect(googleApiClient).setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
googleApiClient.disconnect();
if (status.isSuccess()) {
onSuccess(createAuthData());
} else if (status.isCanceled()) {
onCancelled(createAuthCancel());
} else {
onError(createAuthError(status.getStatusMessage()));
}
}
});
}
}
示例15: onConnected
import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle connectionHint) {
mSignInClicked = false;
doIfLoggedIn();
if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
String personName = currentPerson.getDisplayName();
//String personPhoto = currentPerson.getImage();
// String personGooglePlusProfile = currentPerson.getUrl();
// String imageUrl = currentPerson.getImage().getUrl();
//String cover = currentPerson.getCover().getCoverPhoto().getUrl();
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
Toast.makeText(this, "User is connected: " + personName + " | Email: " + email, Toast.LENGTH_LONG).show();
ArrayList<String> list = showAllMethodsWithValues(currentPerson);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, list);
listView.setAdapter(adapter);
if(currentPerson.hasCover())
new ImageLoaderTask().execute(currentPerson.getCover().getCoverPhoto().getUrl());
else if(currentPerson.hasImage())
new ImageLoaderTask().execute(currentPerson.getImage().getUrl());
String details = "";
details += "getId = " + currentPerson.getId() + " \n";
details += "getAboutMe = " + currentPerson.getAboutMe() + " \n";
details += "getBirthday = " + currentPerson.getBirthday() + " \n";
details += "getBraggingRights = " + currentPerson.getBraggingRights() + " \n";
details += "getCurrentLocation = " + currentPerson.getCurrentLocation() + " \n";
details += "getDisplayName = " + currentPerson.getDisplayName() + " \n";
details += "getLanguage = " + currentPerson.getLanguage() + " \n";
details += "getNickname = " + currentPerson.getNickname() + " \n";
details += "getTagline = " + currentPerson.getTagline() + " \n";
details += "getUrl = " + currentPerson.getUrl() + " \n";
details += "getAgeRange = " + currentPerson.getAgeRange() + " \n";
details += "getCircledByCount = " + currentPerson.getCircledByCount() + " \n";
details += "getCover = " + currentPerson.getCover() + " \n";
details += "getGender = " + currentPerson.getGender() + " \n";
details += "getImage = " + currentPerson.getImage() + " \n";
details += "getName = " + currentPerson.getName() + " \n";
details += "getObjectType = " + currentPerson.getObjectType() + " \n";
details += "getOrganizations = " + currentPerson.getOrganizations() + " \n";
details += "getPlacesLived = " + currentPerson.getPlacesLived() + " \n";
details += "getPlusOneCount = " + currentPerson.getPlusOneCount() + " \n";
details += "getRelationshipStatus = " + currentPerson.getRelationshipStatus() + " \n";
details += "getUrls = " + currentPerson.getUrls() + " \n";
details += "getOrganizations = " + currentPerson.getOrganizations() + " \n";
txtDetails.setText(details);
}
}