当前位置: 首页>>代码示例>>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;未经允许,请勿转载。