本文整理汇总了Java中com.google.android.gms.plus.model.people.PersonBuffer.get方法的典型用法代码示例。如果您正苦于以下问题:Java PersonBuffer.get方法的具体用法?Java PersonBuffer.get怎么用?Java PersonBuffer.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.plus.model.people.PersonBuffer
的用法示例。
在下文中一共展示了PersonBuffer.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import com.google.android.gms.plus.model.people.PersonBuffer; //导入方法依赖的package包/类
/**
* Retrieve a {@link it.rainbowbreeze.playtog.domain.Player} from a Google+ user
*
* @param googleApiClient
* @param userId
* @return
*/
public Player get(GoogleApiClient googleApiClient, String userId) {
mLogFacility.v(LOG_TAG, "Retrieving G+ user for id " + userId);
People.LoadPeopleResult peopleResult = Plus.PeopleApi.load(googleApiClient, userId).await();
PersonBuffer personBuffer = peopleResult.getPersonBuffer();
Person person = null;
Player player = null;
if (personBuffer.getCount() > 0) {
person = personBuffer.get(0);
if (null != person) {
// Adds the person to the provider
player = Player.createFrom(person);
}
}
personBuffer.close();
if (null == person) {
mLogFacility.v(LOG_TAG, "Cannot find any public G+ profile");
}
return player;
}
示例2: onPeopleLoaded
import com.google.android.gms.plus.model.people.PersonBuffer; //导入方法依赖的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
}
}
示例3: populateFriends
import com.google.android.gms.plus.model.people.PersonBuffer; //导入方法依赖的package包/类
private void populateFriends(PersonBuffer paramPersonBuffer)
{
ArrayList localArrayList = new ArrayList();
HashMap localHashMap = new HashMap();
int i = paramPersonBuffer.getCount();
for (int j = 0; j < i; j++)
{
ℴ localℴ = new ℴ(paramPersonBuffer.get(j));
localArrayList.add(localℴ);
localHashMap.put(localℴ.ˊ, "");
}
Collections.sort(localArrayList);
this.allSocialFriends = localArrayList;
ךּ.ˊ("GET_SAVED_SOCIAL_FRIENDS", new Object[] { localHashMap, "google" });
}
示例4: onResult
import com.google.android.gms.plus.model.people.PersonBuffer; //导入方法依赖的package包/类
@Override
public void onResult(People.LoadPeopleResult loadPeopleResult) {
LOGD(TAG, "onPeopleLoaded, status=" + loadPeopleResult.getStatus().toString());
if (loadPeopleResult.getStatus().isSuccess()) {
PersonBuffer personBuffer = loadPeopleResult.getPersonBuffer();
if (personBuffer != null && personBuffer.getCount() > 0) {
LOGD(TAG, "Got plus profile for account " + mAccountName);
Person currentUser = personBuffer.get(0);
personBuffer.close();
// Record profile ID, image URL and name
LOGD(TAG, "Saving plus profile ID: " + currentUser.getId());
AccountUtils.setPlusProfileId(mAppContext, mAccountName, currentUser.getId());
LOGD(TAG, "Saving plus image URL: " + currentUser.getImage().getUrl());
AccountUtils.setPlusImageUrl(mAppContext, mAccountName, currentUser.getImage().getUrl());
LOGD(TAG, "Saving plus display name: " + currentUser.getDisplayName());
AccountUtils.setPlusName(mAppContext, mAccountName, currentUser.getDisplayName());
Person.Cover cover = currentUser.getCover();
if (cover != null) {
Person.Cover.CoverPhoto coverPhoto = cover.getCoverPhoto();
if (coverPhoto != null) {
LOGD(TAG, "Saving plus cover URL: " + coverPhoto.getUrl());
AccountUtils.setPlusCoverUrl(mAppContext, mAccountName, coverPhoto.getUrl());
}
} else {
LOGD(TAG, "Profile has no cover.");
}
Callbacks callbacks;
if (null != (callbacks = mCallbacksRef.get())) {
callbacks.onPlusInfoLoaded(mAccountName);
}
} else {
LOGE(TAG, "Plus response was empty! Failed to load profile.");
}
} else {
LOGE(TAG, "Failed to load plus proflie, error " + loadPeopleResult.getStatus().getStatusCode());
}
}
示例5: onResult
import com.google.android.gms.plus.model.people.PersonBuffer; //导入方法依赖的package包/类
@Override
public void onResult(People.LoadPeopleResult loadPeopleResult) {
LOGD(TAG, "onPeopleLoaded, status=" + loadPeopleResult.getStatus().toString());
if (loadPeopleResult.getStatus().isSuccess()) {
PersonBuffer personBuffer = loadPeopleResult.getPersonBuffer();
if (personBuffer != null && personBuffer.getCount() > 0) {
LOGD(TAG, "Got plus profile for account " + mAccountName);
Person currentUser = personBuffer.get(0);
personBuffer.close();
// Record profile ID, image URL and name
LOGD(TAG, "Saving plus profile ID: " + currentUser.getId());
AccountUtils.setPlusProfileId(mAppContext, mAccountName, currentUser.getId());
String imageUrl = currentUser.getImage().getUrl();
if (imageUrl != null) {
imageUrl = Uri.parse(imageUrl)
.buildUpon().appendQueryParameter("sz", "256").build().toString();
}
LOGD(TAG, "Saving plus image URL: " + imageUrl);
AccountUtils.setPlusImageUrl(mAppContext, mAccountName, imageUrl);
LOGD(TAG, "Saving plus display name: " + currentUser.getDisplayName());
AccountUtils.setPlusName(mAppContext, mAccountName, currentUser.getDisplayName());
Person.Cover cover = currentUser.getCover();
if (cover != null) {
Person.Cover.CoverPhoto coverPhoto = cover.getCoverPhoto();
if (coverPhoto != null) {
LOGD(TAG, "Saving plus cover URL: " + coverPhoto.getUrl());
AccountUtils.setPlusCoverUrl(mAppContext, mAccountName, coverPhoto.getUrl());
}
} else {
LOGD(TAG, "Profile has no cover.");
}
Callbacks callbacks;
if (null != (callbacks = mCallbacksRef.get())) {
callbacks.onPlusInfoLoaded(mAccountName);
}
} else {
LOGE(TAG, "Plus response was empty! Failed to load profile.");
}
} else {
LOGE(TAG, "Failed to load plus proflie, error " + loadPeopleResult.getStatus().getStatusCode());
}
}
示例6: onResult
import com.google.android.gms.plus.model.people.PersonBuffer; //导入方法依赖的package包/类
@Override
public void onResult(People.LoadPeopleResult loadPeopleResult) {
LogUtils.LOGD(TAG, "onPeopleLoaded, status=" + loadPeopleResult.getStatus().toString());
if (loadPeopleResult.getStatus().isSuccess()) {
PersonBuffer personBuffer = loadPeopleResult.getPersonBuffer();
if (personBuffer != null && personBuffer.getCount() > 0) {
LogUtils.LOGD(TAG, "Got plus profile for account " + mAccountName);
Person currentUser = personBuffer.get(0);
personBuffer.close();
// Record profile ID, image URL and name
LogUtils.LOGD(TAG, "Saving plus profile ID: " + currentUser.getId());
AccountUtils.setPlusProfileId(mAppContext, mAccountName, currentUser.getId());
String imageUrl = currentUser.getImage().getUrl();
if (imageUrl != null) {
imageUrl = Uri.parse(imageUrl)
.buildUpon().appendQueryParameter("sz", "256").build().toString();
}
LogUtils.LOGD(TAG, "Saving plus image URL: " + imageUrl);
AccountUtils.setPlusImageUrl(mAppContext, mAccountName, imageUrl);
LogUtils.LOGD(TAG, "Saving plus display name: " + currentUser.getDisplayName());
AccountUtils.setPlusName(mAppContext, mAccountName, currentUser.getDisplayName());
Person.Cover cover = currentUser.getCover();
if (cover != null) {
Person.Cover.CoverPhoto coverPhoto = cover.getCoverPhoto();
if (coverPhoto != null) {
LogUtils.LOGD(TAG, "Saving plus cover URL: " + coverPhoto.getUrl());
AccountUtils.setPlusCoverUrl(mAppContext, mAccountName, coverPhoto.getUrl());
}
} else {
LogUtils.LOGD(TAG, "Profile has no cover.");
}
Callbacks callbacks;
if (null != (callbacks = mCallbacksRef.get())) {
callbacks.onPlusInfoLoaded(mAccountName);
}
} else {
LogUtils.LOGE(TAG, "Plus response was empty! Failed to load profile.");
}
} else {
LogUtils.LOGE(TAG, "Failed to load plus proflie, error " + loadPeopleResult.getStatus().getStatusCode());
}
}
示例7: onResult
import com.google.android.gms.plus.model.people.PersonBuffer; //导入方法依赖的package包/类
/**
* Called asynchronously -- result of loadPeople() call
*/
@Override
public void onResult(People.LoadPeopleResult loadPeopleResult) {
Logger.debug(TAG, "onPeopleLoaded, status=" + loadPeopleResult.getStatus().toString());
if (loadPeopleResult.getStatus().isSuccess()) {
final PersonBuffer personBuffer = loadPeopleResult.getPersonBuffer();
if (personBuffer != null && personBuffer.getCount() > 0) {
Logger.debug(TAG, "Got plus profile for account " + accountName);
final Person currentUser = personBuffer.get(0);
personBuffer.close();
// Record profile ID, image URL and name
Logger.debug(TAG, "Saving plus profile ID: " + currentUser.getId());
GoogleAccountUtils.setPlusProfileId(context, accountName, currentUser.getId());
String imageUrl = currentUser.getImage().getUrl();
if (imageUrl != null) {
imageUrl = Uri.parse(imageUrl)
.buildUpon().appendQueryParameter("sz", "256").build().toString();
}
Logger.debug(TAG, "Saving plus image URL: " + imageUrl);
GoogleAccountUtils.setPlusImageUrl(context, accountName, imageUrl);
Logger.debug(TAG, "Saving plus display name: " + currentUser.getDisplayName());
GoogleAccountUtils.setPlusName(context, accountName, currentUser.getDisplayName());
final Person.Cover cover = currentUser.getCover();
if (cover != null) {
final Person.Cover.CoverPhoto coverPhoto = cover.getCoverPhoto();
if (coverPhoto != null) {
Logger.debug(TAG, "Saving plus cover URL: " + coverPhoto.getUrl());
GoogleAccountUtils.setPlusCoverUrl(context, accountName, coverPhoto.getUrl());
}
}
else {
Logger.debug(TAG, "Profile has no cover.");
}
final LoginAndAuthCallbacks callbacks;
if (null != (callbacks = callbacksReference.get())) {
callbacks.onAccountInfoLoaded(accountName);
}
}
else {
Logger.error(TAG, "Plus response was empty! Failed to load profile.");
}
}
else {
Logger.error(TAG, "Failed to load plus profile, error " + loadPeopleResult.getStatus().getStatusCode());
}
}