當前位置: 首頁>>代碼示例>>Java>>正文


Java Person類代碼示例

本文整理匯總了Java中com.google.android.gms.plus.model.people.Person的典型用法代碼示例。如果您正苦於以下問題:Java Person類的具體用法?Java Person怎麽用?Java Person使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Person類屬於com.google.android.gms.plus.model.people包,在下文中一共展示了Person類的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();
        }
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:29,代碼來源:LoginActivity.java

示例2: onConnected

import com.google.android.gms.plus.model.people.Person; //導入依賴的package包/類
@Override
public void onConnected(Bundle bundle) {

    Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
    User user = new User();
    user.setProvider(PROVIDER_NAME);
    user.setProviderDisplayName("Google+");
    user.setUserId(currentPerson.getId());
    user.setUserName(currentPerson.getId());
    user.setFirstName(currentPerson.getName().getGivenName());
    user.setLastName(currentPerson.getName().getFamilyName());
    user.setDisplayName(currentPerson.getDisplayName());
    user.setMail(Plus.AccountApi.getAccountName(mGoogleApiClient));

    this.mUserHelper.setCurrentUser(user);

    if (this.mUserSessionCallback != null) {
        this.mUserSessionCallback.onLogin();
    }
}
 
開發者ID:alessandrogurgel,項目名稱:pedefacil,代碼行數:21,代碼來源:GoogleApiClientDelegate.java

示例3: onConnected

import com.google.android.gms.plus.model.people.Person; //導入依賴的package包/類
@Override
public void onConnected(Bundle bundle) {
    updateConnectButtonState();
    setProgressBarVisible(false);

    Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
    User user = new User();
    user.setProvider(PROVIDER_NAME);
    user.setProviderDisplayName("Google+");
    user.setUserId(currentPerson.getId());
    user.setUserName(currentPerson.getId());
    user.setFirstName(currentPerson.getName().getGivenName());
    user.setLastName(currentPerson.getName().getFamilyName());
    user.setDisplayName(currentPerson.getDisplayName());

    this.mUserHelper.setCurrentUser(user);

    if (this.mUserSessionCallback != null) {
        this.mUserSessionCallback.onLogin();
    }

    onPlusClientSignIn();
}
 
開發者ID:alessandrogurgel,項目名稱:pedefacil,代碼行數:24,代碼來源:GPlusDelegate.java

示例4: onResult

import com.google.android.gms.plus.model.people.Person; //導入依賴的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

示例5: 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);
    }
}
 
開發者ID:Redmart,項目名稱:os-mobilizer-android,代碼行數:26,代碼來源:AuthActivity.java

示例6: onConnected

import com.google.android.gms.plus.model.people.Person; //導入依賴的package包/類
@Override
public void onConnected(Bundle bundle) {
    mSignInButton.setEnabled(false);

    Timber.d("onConnected - Getting user details");
    String accountName = Plus.AccountApi.getAccountName(mGoogleApiClient);
    Person currentUser = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
    UserDetails userDetails = UserDetails.builder()
            .accountName(accountName)
            .googlePlusId(currentUser.getId())
            .displayName(currentUser.getDisplayName())
            .firstName(currentUser.getName().getGivenName())
            .lastName(currentUser.getName().getFamilyName())
            .profileImage(currentUser.getImage().getUrl())
            .build();

    signIn(userDetails);

    mSignInProgress = STATE_DEFAULT;
}
 
開發者ID:AndrewJack,項目名稱:moment-for-android-wear,代碼行數:21,代碼來源:SignInFragment.java

示例7: loadUserInfo

import com.google.android.gms.plus.model.people.Person; //導入依賴的package包/類
@Override
public void loadUserInfo() {
    //Gdx.app.log(TAG, "Get Player Info : " + isSignedIn());
    if (isSignedIn()) {
        waitingToGetPlayerInfo = false;
        Person person = Plus.PeopleApi.getCurrentPerson(gameHelper.getApiClient());
        if(person != null){
            try {
                CurrentUser.getInstance().init(person.getDisplayName(), person.getImage().getUrl());
            }catch (Exception e){
                System.out.println(e.getStackTrace());
            }
        }

    } else {
        waitingToGetPlayerInfo = true;
        //gameHelper.beginUserInitiatedSignIn();
    }
}
 
開發者ID:UnderwaterApps,項目名稱:submarine,代碼行數:20,代碼來源:AndroidGameServices.java

示例8: get

import com.google.android.gms.plus.model.people.Person; //導入依賴的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

示例9: createFrom

import com.google.android.gms.plus.model.people.Person; //導入依賴的package包/類
public static Player createFrom(Person person) {
    if (null == person) return null;
    Player player = new Player();
    player.setBackendId("");
    if (!TextUtils.isEmpty(person.getDisplayName())) {
        player.setName(person.getDisplayName());
    } else if (null != person.getName() && !TextUtils.isEmpty(person.getName().toString())) {
        player.setName(person.getName().toString());
    } else if (!TextUtils.isEmpty(person.getNickname())) {
        player.setName(person.getNickname());
    } else {
        player.setName("Unknown name");
    }
    if (null != person.getImage()) {
        player.setPictureUrl(person.getImage().getUrl());
        //Workaround to obtain larger profile picture
        player.setPictureUrl(player.getPictureUrl().replace("?sz=50", "?sz=300"));
    }
    player
            .setSelected(false)
            .setSocialId(person.getId());
    return player;
}
 
開發者ID:rainbowbreeze,項目名稱:playtogether,代碼行數:24,代碼來源:Player.java

示例10: 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;
    }
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:26,代碼來源:GoogleLoginActivity.java

示例11: setProfileInfo

import com.google.android.gms.plus.model.people.Person; //導入依賴的package包/類
public void setProfileInfo() {
    if (!mGoogleApiClient.isConnected()
            || Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) == null) {
        ((ImageView) getView().findViewById(R.id.avatar))
                .setImageDrawable(null);
        ((TextView) getView().findViewById(R.id.display_name))
                .setText(R.string.not_signed_in);
    } else {
        Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
        if (currentPerson.hasImage()) {
            mImageFetcher.loadImage(currentPerson.getImage().getUrl(),
                    ((ImageView) getView().findViewById(R.id.avatar)));
        }
        if (currentPerson.hasDisplayName()) {
            ((TextView) getView().findViewById(R.id.display_name))
                    .setText(currentPerson.getDisplayName());
        }
    }
}
 
開發者ID:holtaf,項目名稱:youtube_livestream,代碼行數:20,代碼來源:EventsListFragment.java

示例12: build

import com.google.android.gms.plus.model.people.Person; //導入依賴的package包/類
public UserProfile build() {

        UserProfile newUserProfile = new UserProfile();
        String email = Plus.AccountApi.getAccountName(googleApiClient);
        newUserProfile.setEmail(email);


        if (Plus.PeopleApi.getCurrentPerson(googleApiClient) != null) {
            Person currentPerson = Plus.PeopleApi.getCurrentPerson(googleApiClient);
            newUserProfile.setUserName(currentPerson.getDisplayName());
            newUserProfile.setFirstName(currentPerson.getName().getGivenName());
            newUserProfile.setLastName(currentPerson.getName().getFamilyName());
            newUserProfile.setImageURL(currentPerson.getImage().getUrl());
            return (newUserProfile);
        }


        return null;
    }
 
開發者ID:groupflix,項目名稱:android-pubnub-example,代碼行數:20,代碼來源:GPlusUserProfileBuilder.java

示例13: 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();
    }
 
開發者ID:tarasM,項目名稱:Bozon.kg_App,代碼行數:24,代碼來源:My_Private_Profile.java

示例14: 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();
    }
 
開發者ID:tarasM,項目名稱:Bozon.kg_App,代碼行數:24,代碼來源:Drawer.java

示例15: 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();
    }
}
 
開發者ID:ITsvetkoFF,項目名稱:Kv-009,代碼行數:29,代碼來源:LoginFragment.java


注:本文中的com.google.android.gms.plus.model.people.Person類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。