本文整理匯總了Java中com.google.android.gms.plus.model.people.Person.getCover方法的典型用法代碼示例。如果您正苦於以下問題:Java Person.getCover方法的具體用法?Java Person.getCover怎麽用?Java Person.getCover使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.gms.plus.model.people.Person
的用法示例。
在下文中一共展示了Person.getCover方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onConnected
import com.google.android.gms.plus.model.people.Person; //導入方法依賴的package包/類
@Override
public void onConnected(@Nullable Bundle bundle) {
loadingView.setVisibility(View.VISIBLE);
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.GET_ACCOUNTS)) {
Toast.makeText(getApplicationContext(), getString(R.string.should_accept_permissions), Toast.LENGTH_LONG).show();
return;
// ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.GET_ACCOUNTS}, PERMISSION_REQUEST_GET_ACCOUNTS);
} else {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.GET_ACCOUNTS}, PERMISSION_REQUEST_GET_ACCOUNTS);
}
return;
}
new Thread(new Runnable() {
@Override
public void run() {
DataManager.setGoogleAccountLink(true);
Drive.DriveApi.getAppFolder(mGoogleApiClient).listChildren(mGoogleApiClient).setResultCallback(connectDriveCallback);
}
}).start();
Person person = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
headerResult.removeProfile(0);
headerResult.addProfiles(new ProfileDrawerItem().withName(person.getDisplayName()).withEmail(Plus.AccountApi.getAccountName(mGoogleApiClient)).withIcon(person.getImage().getUrl()));
if (person.getCover() != null && person.getCover().getCoverPhoto() != null && person.getCover().getCoverPhoto().getUrl() != null)
headerResult.setHeaderBackground(new ImageHolder(person.getCover().getCoverPhoto().getUrl()));
drawer.removeItems(4, 11);
}
示例2: onResult
import com.google.android.gms.plus.model.people.Person; //導入方法依賴的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());
}
}
示例3: onResult
import com.google.android.gms.plus.model.people.Person; //導入方法依賴的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());
}
}
示例4: 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);
}
}
示例5: onResult
import com.google.android.gms.plus.model.people.Person; //導入方法依賴的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());
}
}
示例6: onResult
import com.google.android.gms.plus.model.people.Person; //導入方法依賴的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());
}
}