当前位置: 首页>>代码示例>>Java>>正文


Java People.LoadPeopleResult方法代码示例

本文整理汇总了Java中com.google.android.gms.plus.People.LoadPeopleResult方法的典型用法代码示例。如果您正苦于以下问题:Java People.LoadPeopleResult方法的具体用法?Java People.LoadPeopleResult怎么用?Java People.LoadPeopleResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.plus.People的用法示例。


在下文中一共展示了People.LoadPeopleResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onResult

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
@Override
public void onResult(@NonNull People.LoadPeopleResult loadPeopleResult) {
    try {
        if (loadPeopleResult.getStatus().isSuccess()) {
            for (Person person : loadPeopleResult.getPersonBuffer()) {
                mContacts.put(person.getId(), new Contact(person));
            }

            if (!TextUtils.isEmpty(loadPeopleResult.getNextPageToken())) {
                Plus.PeopleApi.loadVisible(mGoogleApiClient, loadPeopleResult.getNextPageToken())
                        .setResultCallback(this);
                return;
            }

            mUiHandler.sendEmptyMessage(MSG_CIRCLES_LOADED);
            return;
        }

        Toast.makeText(DebtsListActivity.this, R.string.cannot_load_circles, Toast.LENGTH_SHORT).show();
    } finally {
        loadPeopleResult.release();
    }
}
 
开发者ID:asmolko,项目名称:MyDebts,代码行数:24,代码来源:DebtsListActivity.java

示例2: getCurrentUsersGooglePlusIds

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
private List<String> getCurrentUsersGooglePlusIds() {
    ArrayList<String> friendGooglePlusIds = new ArrayList<>();
    ConnectionResult connectionResult = googleApiClient
            .blockingConnect(Constants.CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS);
    if (connectionResult.isSuccess()) {
        People.LoadPeopleResult peopleData = Plus.PeopleApi.loadVisible(googleApiClient, null).await();
        if (peopleData.getStatus().getStatusCode() == CommonStatusCodes.SUCCESS) {
            PersonBuffer personBuffer = peopleData.getPersonBuffer();
            try {
                int count = personBuffer.getCount();
                for (int i = 0; i < count; i++) {
                    friendGooglePlusIds.add(personBuffer.get(i).getId());
                }
            } finally {
                personBuffer.close();
            }
        } else {
            Timber.w("Error requesting visible circles: %s", peopleData.getStatus());
        }
    }
    if (googleApiClient.isConnected()) {
        googleApiClient.disconnect();
    }
    return friendGooglePlusIds;
}
 
开发者ID:AndrewJack,项目名称:moment-for-android-wear,代码行数:26,代码来源:RxFriendApi.java

示例3: get

import com.google.android.gms.plus.People; //导入方法依赖的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;
}
 
开发者ID:rainbowbreeze,项目名称:playtogether,代码行数:27,代码来源:GPlusHelper.java

示例4: L

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
public People.LoadPeopleResult L(final Status paramStatus)
{
  return new People.LoadPeopleResult()
  {
    public String getNextPageToken()
    {
      return null;
    }

    public PersonBuffer getPersonBuffer()
    {
      return null;
    }

    public Status getStatus()
    {
      return paramStatus;
    }

    public void release()
    {
    }
  };
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:25,代码来源:ia.java

示例5: onConnected

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle bundle) {
    Activity activity = getActivity("onConnected()");
    if (activity == null) {
        return;
    }

    LOGD(TAG, "Helper connected, account " + mAccountName);

    // load user's Google+ profile, if we don't have it yet
    if (!AccountUtils.hasPlusInfo(activity, mAccountName)) {
        LOGD(TAG, "We don't have Google+ info for " + mAccountName + " yet, so loading.");
        PendingResult<People.LoadPeopleResult> result = Plus.PeopleApi.load(mGoogleApiClient, "me");
        result.setResultCallback(this);
    } else {
        LOGD(TAG, "No need for Google+ info, we already have it.");
    }

    // try to authenticate, if we don't have a token yet
    if (!AccountUtils.hasToken(activity, mAccountName)) {
        LOGD(TAG, "We don't have auth token for " + mAccountName + " yet, so getting it.");
        mTokenTask = new GetTokenTask();
        mTokenTask.execute();
    } else {
        LOGD(TAG, "No need for auth token, we already have it.");
        reportAuthSuccess(false);
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:29,代码来源:LoginAndAuthHelper.java

示例6: onConnected

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle bundle) {
    Activity activity = getActivity("onConnected()");
    if (activity == null) {
        return;
    }

    LogUtils.LOGD(TAG, "Helper connected, account " + mAccountName);

    // load user's Google+ profile, if we don't have it yet
    if (!AccountUtils.hasPlusInfo(activity, mAccountName)) {
        LogUtils.LOGD(TAG, "We don't have Google+ info for " + mAccountName + " yet, so loading.");
        PendingResult<People.LoadPeopleResult> result = Plus.PeopleApi.load(mGoogleApiClient, "me");
        result.setResultCallback(this);
    } else {
        LogUtils.LOGD(TAG, "No need for Google+ info, we already have it.");
    }

    // try to authenticate, if we don't have a token yet
    if (!AccountUtils.hasToken(activity, mAccountName)) {
        LogUtils.LOGD(TAG, "We don't have auth token for " + mAccountName + " yet, so getting it.");
        mTokenTask = new GetTokenTask();
        mTokenTask.execute();
    } else {
        LogUtils.LOGD(TAG, "No need for auth token, we already have it.");
        reportAuthSuccess(false);
    }
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:29,代码来源:LoginAndAuthHelper.java

示例7: getPeopleObservable

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
public final Observable<People.LoadPeopleResult> getPeopleObservable(final String token) {
	return getLoginObserveable().flatMap(new Func1<GoogleApiClient, Observable<People.LoadPeopleResult>>() {
		@Override
		public Observable<People.LoadPeopleResult> call(GoogleApiClient googleApiClient) {
			return fromPendingResult(Plus.PeopleApi.loadVisible(googleApiClient, token));
		}
	});
}
 
开发者ID:esafirm,项目名称:Android-ReactiveGPlus,代码行数:9,代码来源:GMSProvider.java

示例8: onResult

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
public void onResult(People.LoadPeopleResult paramLoadPeopleResult)
{
  if (paramLoadPeopleResult.getStatus().getStatusCode() == 0)
    try
    {
      populateFriends(paramLoadPeopleResult.getPersonBuffer());
      return;
    }
    finally
    {
      paramLoadPeopleResult.getPersonBuffer().close();
    }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:14,代码来源:GooglePlusFriendsFragment.java

示例9: load

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
public final PendingResult<People.LoadPeopleResult> load(GoogleApiClient paramGoogleApiClient, final Collection<String> paramCollection)
{
  return paramGoogleApiClient.a(new a(this.Ea)
  {
    protected void a(hs paramAnonymoushs)
    {
      paramAnonymoushs.a(this, paramCollection);
    }
  });
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:11,代码来源:ia.java

示例10: loadConnected

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
public final PendingResult<People.LoadPeopleResult> loadConnected(GoogleApiClient paramGoogleApiClient)
{
  return paramGoogleApiClient.a(new a(this.Ea)
  {
    protected void a(hs paramAnonymoushs)
    {
      paramAnonymoushs.k(this);
    }
  });
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:11,代码来源:ia.java

示例11: loadVisible

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
public final PendingResult<People.LoadPeopleResult> loadVisible(GoogleApiClient paramGoogleApiClient, final int paramInt, final String paramString)
{
  return paramGoogleApiClient.a(new a(this.Ea)
  {
    protected void a(hs paramAnonymoushs)
    {
      paramAnonymoushs.a(this, paramInt, paramString);
    }
  });
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:11,代码来源:ia.java

示例12: onResult

import com.google.android.gms.plus.People; //导入方法依赖的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());
    }
}
 
开发者ID:ramonrabello,项目名称:devfestnorte-app,代码行数:40,代码来源:LoginAndAuthHelper.java

示例13: onConnected

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
/**
 * Called when the Google+ client is connected.
 */
@Override
public void onConnected(final Bundle bundle) {
    final Activity activity = getActivity("onConnected()");

    if (activity == null) {
        return;
    }

    Logger.debug(TAG, "Helper connected, account " + accountName);

    // load user's Google+ profile, if we don't have it yet
    if (!GoogleAccountUtils.hasPlusInfo(activity, accountName)) {
        Logger.debug(TAG, "We don't have Google+ info for " + accountName + " yet, so loading.");
        PendingResult<People.LoadPeopleResult> result = Plus.PeopleApi.load(googleApiClient, "me");
        result.setResultCallback(this);
    }
    else {
        Logger.debug(TAG, "No need for Google+ info, we already have it.");
    }

    // try to authenticate, if we don't have a token yet
    if (!AccountUtils.hasToken(activity, accountName)) {
        Logger.debug(TAG, "We don't have auth token for " + accountName + " yet, so getting it.");
        tokenTask = new GetTokenTask();
        tokenTask.execute();
    }
    else {
        Logger.debug(TAG, "No need for auth token, we already have it.");
        reportAuthSuccess(false);
    }
}
 
开发者ID:remelpugh,项目名称:android-shared,代码行数:35,代码来源:GoogleLoginAndAuthHelper.java

示例14: onResult

import com.google.android.gms.plus.People; //导入方法依赖的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());
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:45,代码来源:LoginAndAuthHelper.java

示例15: onResult

import com.google.android.gms.plus.People; //导入方法依赖的package包/类
@Override
public void onResult(People.LoadPeopleResult loadPeopleResult) {
    if (loadPeopleResult.getStatus().getStatusCode() == CommonStatusCodes.SUCCESS) {
        PersonBuffer personBuffer = loadPeopleResult.getPersonBuffer();
    }
}
 
开发者ID:kgeriiie,项目名称:android-fagyi,代码行数:7,代码来源:GooglePlusHandler.java


注:本文中的com.google.android.gms.plus.People.LoadPeopleResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。