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


Java PersonBuffer类代码示例

本文整理汇总了Java中com.google.android.gms.plus.model.people.PersonBuffer的典型用法代码示例。如果您正苦于以下问题:Java PersonBuffer类的具体用法?Java PersonBuffer怎么用?Java PersonBuffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PersonBuffer类属于com.google.android.gms.plus.model.people包,在下文中一共展示了PersonBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCurrentUsersGooglePlusIds

import com.google.android.gms.plus.model.people.PersonBuffer; //导入依赖的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

示例2: 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;
}
 
开发者ID:rainbowbreeze,项目名称:playtogether,代码行数:27,代码来源:GPlusHelper.java

示例3: L

import com.google.android.gms.plus.model.people.PersonBuffer; //导入依赖的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

示例4: 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
    }
}
 
开发者ID:JCERTIFLab,项目名称:jcertif-android-2013,代码行数:27,代码来源:LoginFragment.java

示例5: getProfileImages

import com.google.android.gms.plus.model.people.PersonBuffer; //导入依赖的package包/类
public void getProfileImages(
    String token, final List<String> userIds, final GetProfileImagesCallback callback) {
  ArrayList<String> toFetch = new ArrayList<>();
  for (int i = 0; i < userIds.size(); ++i) {
    String userId = userIds.get(i);
    if (!profileImages.containsKey(userId)) {
      toFetch.add(userId);
    }
  }

  GoogleApiClient googleApiClient = clients.get(token);
  if (googleApiClient == null) {
    return;
  }

  Plus.PeopleApi.load(googleApiClient, userIds).setResultCallback(
      new ResultCallback<People.LoadPeopleResult>() {
    @Override
    public void onResult(People.LoadPeopleResult peopleData) {
      if (peopleData.getStatus().getStatusCode() == CommonStatusCodes.SUCCESS) {
        PersonBuffer personBuffer = peopleData.getPersonBuffer();
        try {
          int count = personBuffer.getCount();
          for (int i = 0; i < count; ++i) {
            Person person = personBuffer.get(i);
            profileImages.put(person.getId(), getProfileImageUrl(person));
          }
          callback.onSuccess();
        } finally {
          personBuffer.close();
        }
      } else {
        Timber.e("Error requesting people data: %s", peopleData.getStatus());
      }
    }
  });
}
 
开发者ID:chiuki,项目名称:friendspell,代码行数:38,代码来源:GoogleApiClientBridge.java

示例6: 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" });
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:16,代码来源:GooglePlusFriendsFragment.java

示例7: getContacts

import com.google.android.gms.plus.model.people.PersonBuffer; //导入依赖的package包/类
@Override
public void getContacts(boolean fromStart, final SocialCallbacks.ContactsListener contactsListener) {
    RefProvider = getProvider();
    if (googleApiClient != null && googleApiClient.isConnected()){
        String lastContactCursor = this.lastContactCursor;
        this.lastContactCursor = null;
        Plus.PeopleApi.loadVisible(googleApiClient, fromStart ? null : lastContactCursor)
                .setResultCallback(new ResultCallback<People.LoadPeopleResult>() {
                    @Override
                    public void onResult(People.LoadPeopleResult peopleData) {
                        if (peopleData.getStatus().getStatusCode() == CommonStatusCodes.SUCCESS) {
                            List<UserProfile> userProfiles = new ArrayList<UserProfile>();
                            PersonBuffer personBuffer = peopleData.getPersonBuffer();
                            try {
                                int count = personBuffer.getCount();
                                for (int i = 0; i < count; i++) {
                                    Person googleContact = personBuffer.get(i);
                                    userProfiles.add(parseGoogleContact(googleContact));
                                }
                                SoomlaGooglePlus.this.lastContactCursor = peopleData.getNextPageToken();

                                contactsListener.success(userProfiles, SoomlaGooglePlus.this.lastContactCursor != null);
                            } catch (Exception e){
                                contactsListener.fail("Failed getting contacts with exception: " + e.getMessage());
                            }finally {
                                personBuffer.close();
                            }
                        } else {
                            contactsListener.fail("Contact information is not available.");
                        }
                    }
                });
    }else{
        contactsListener.fail("Failed getting contacts because because not connected to Google Plus.");
    }
}
 
开发者ID:soomla,项目名称:android-profile,代码行数:37,代码来源:SoomlaGooglePlus.java

示例8: 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());
    }
}
 
开发者ID:ramonrabello,项目名称:devfestnorte-app,代码行数:40,代码来源:LoginAndAuthHelper.java

示例9: onResult

import com.google.android.gms.plus.model.people.PersonBuffer; //导入依赖的package包/类
@Override
public void onResult(LoadPeopleResult peopleData) {
    switch (peopleData.getStatus().getStatusCode()) {
        case CommonStatusCodes.SUCCESS:
            mListItems.clear();
            PersonBuffer personBuffer = peopleData.getPersonBuffer();
            try {
                int count = personBuffer.getCount();
                for (int i = 0; i < count; i++) {
                    mListItems.add(personBuffer.get(i).getDisplayName());
                }
            } finally {
                personBuffer.close();
            }

            mListAdapter.notifyDataSetChanged();
            break;

        case CommonStatusCodes.SIGN_IN_REQUIRED:
            mGoogleApiClient.disconnect();
            mGoogleApiClient.connect();
            break;

        default:
            Log.e(TAG, "Error when listing people: " + peopleData.getStatus());
            break;
    }
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:29,代码来源:ListVisiblePeopleActivity.java

示例10: onPeopleLoaded

import com.google.android.gms.plus.model.people.PersonBuffer; //导入依赖的package包/类
@Override
public void onPeopleLoaded(ConnectionResult status, PersonBuffer personBuffer,
        String nextPageToken) {
    switch (status.getErrorCode()) {
        case ConnectionResult.SUCCESS:
            mListItems.clear();
            try {
                int count = personBuffer.getCount();
                for (int i = 0; i < count; i++) {
                    mListItems.add(personBuffer.get(i).getDisplayName());
                }
            } finally {
                personBuffer.close();
            }

            mListAdapter.notifyDataSetChanged();
            break;

        case ConnectionResult.SIGN_IN_REQUIRED:
            mPlusClient.disconnect();
            mPlusClient.connect();
            break;

        default:
            Log.e(TAG, "Error when listing people: " + status);
            break;
    }
}
 
开发者ID:laurion,项目名称:wabbit-client,代码行数:29,代码来源:ListPeopleActivity.java

示例11: onPeopleLoaded

import com.google.android.gms.plus.model.people.PersonBuffer; //导入依赖的package包/类
@Override
public void onPeopleLoaded(ConnectionResult status, PersonBuffer personBuffer,
        String nextPageToken) {
    if (status.isSuccess()) {
        if (personBuffer != null && personBuffer.getCount() > 0) {
            // Set the profile id
            AccountUtils.setPlusProfileId(this, personBuffer.get(0).getId());
        }
    } else {
        LOGE(TAG, "Got " + status.getErrorCode() + ". Could not load plus profile.");
    }
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:13,代码来源:AccountActivity.java

示例12: loadPeople

import com.google.android.gms.plus.model.people.PersonBuffer; //导入依赖的package包/类
/**
 * Query Google+ for a list of the current person's friends
 *
 * @param listener The listener to be invoked when the query is completed
 */
public void loadPeople(final GooglePlusPeopleLoadedListener listener) {

  if (!plus.isConnected()) {
    plus.connect();
    listener.onGooglePlusPeopleLoaded(null);
  } else {
    plus.loadPeople(new OnPeopleLoadedListener() {

      @Override
      public void onPeopleLoaded(
          ConnectionResult status, PersonBuffer personBuffer, String nextPageToken) {

        switch (status.getErrorCode()) {
          case ConnectionResult.SUCCESS:
            listener.onGooglePlusPeopleLoaded(personBuffer);
            break;
          case ConnectionResult.SIGN_IN_REQUIRED:
            try {
              if (status.hasResolution()) {
                status.startResolutionForResult((Activity) getApplicationContext(),
                    RequestCodes.REQUEST_GOOGLE_PLUS_AUTHORIZATION);
              } else {
                listener.onGooglePlusPeopleLoaded(null);
                renewConnection();
              }
            } catch (SendIntentException e) {
              listener.onGooglePlusPeopleLoaded(null);
              renewConnection();
            }
            break;
          default:
            listener.onGooglePlusPeopleLoaded(null);
            break;
        }
      }
    }, Person.Collection.VISIBLE);
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:solutions-griddler-sample-android-client,代码行数:44,代码来源:GooglePlusService.java

示例13: 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());
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:45,代码来源:LoginAndAuthHelper.java

示例14: onResult

import com.google.android.gms.plus.model.people.PersonBuffer; //导入依赖的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

示例15: 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());
    }
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:45,代码来源:LoginAndAuthHelper.java


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