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


Java Person.getDisplayName方法代码示例

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


在下文中一共展示了Person.getDisplayName方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: onPeopleLoaded

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

示例8: createRegistrationBundle

import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
/**
 * Creates the registration bundle and fills it with user information.
 *
 * @param googleApiClient The connected api client.
 * @return A bundle with registration data.
 */
private Bundle createRegistrationBundle(GoogleApiClient googleApiClient) {
    // Get the current user's information for registration
    final Person currentPerson = Plus.PeopleApi.getCurrentPerson(googleApiClient);
    final String displayName;
    final String profilePictureUrl;

    Bundle registration = new Bundle();
    if (currentPerson != null) {
        displayName = currentPerson.getDisplayName();
        profilePictureUrl = currentPerson.getImage().getUrl();
    } else {
        Log.e(TAG, "Couldn't load person. Falling back to default.");
        Log.d(TAG, "Make sure that the Google+ API is enabled for your project.");
        Log.d(TAG, "More information can be found here: "
                + "https://developers.google.com/+/mobile/android/"
                + "getting-started#step_1_enable_the_google_api");
        displayName = "Anonymous Kitten";
        profilePictureUrl = "http://placekitten.com/g/500/500";
    }

    // Create the bundle for registration with the server.
    registration.putString(PingerKeys.ACTION, GcmAction.REGISTER_NEW_CLIENT);
    registration.putString(PingerKeys.NAME, displayName);
    registration.putString(PingerKeys.PICTURE_URL, profilePictureUrl);
    return registration;
}
 
开发者ID:googlearchive,项目名称:friendlyping,代码行数:33,代码来源:RegistrationIntentService.java

示例9: updateUI

import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
private void updateUI(boolean isSignedIn) {
    if (isSignedIn) {
        Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
        if (currentPerson != null) {
            // Show signed-in user's name
            String name = currentPerson.getDisplayName();
            mStatus.setText(getString(R.string.signed_in_fmt, name));

            // Show users' email address (which requires GET_ACCOUNTS permission)
            if (checkAccountsPermission()) {
                String currentAccount = Plus.AccountApi.getAccountName(mGoogleApiClient);
                ((TextView) findViewById(R.id.detail)).setText(currentAccount);
            }
        } else {
            // If getCurrentPerson returns null there is generally some error with the
            // configuration of the application (invalid Client ID, Plus API not enabled, etc).
            Log.w(TAG, getString(R.string.error_null_person));
            mStatus.setText(getString(R.string.signed_in_err));
        }

        // Set button visibility
        findViewById(R.id.sign_in_button).setVisibility(View.GONE);
        findViewById(R.id.sign_out_and_disconnect).setVisibility(View.VISIBLE);
    } else {
        // Show signed-out message and clear email field
        mStatus.setText(R.string.signed_out);
        ((TextView) findViewById(R.id.detail)).setText("");

        // Set button visibility
        findViewById(R.id.sign_in_button).setEnabled(true);
        findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
        findViewById(R.id.sign_out_and_disconnect).setVisibility(View.GONE);
    }
}
 
开发者ID:googlesamples,项目名称:google-services,代码行数:35,代码来源:MainActivity.java

示例10: if

import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
public ℴ(Person paramPerson)
{
  this.ˊ = paramPerson.getId();
  this.ˋ = paramPerson.getDisplayName();
  this.ˎ = paramPerson.getImage().getUrl();
  if (this.ˎ == null)
    this.ˎ = "";
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:9,代码来源:‚Ñ¥.java

示例11: parseGoogleContact

import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
private static UserProfile parseGoogleContact(Person googleContact){
    String fullName = googleContact.getDisplayName();
    String firstName = "";
    String lastName = "";

    if (!TextUtils.isEmpty(fullName)) {
        String[] splitName = fullName.split(" ");
        if (splitName.length > 0) {
            firstName = splitName[0];
            if (splitName.length > 1) {
                lastName = splitName[1];
            }
        }
    }

    UserProfile result = new UserProfile(RefProvider,
            parseGoogleContactInfo(googleContact.getId()),
            "", //TODO: user name
            "", //TODO: email
            firstName,
            lastName);
    result.setGender(parseGoogleContactInfo(googleContact.getGender()));
    result.setBirthday(parseGoogleContactInfo(googleContact.getBirthday()));
    result.setLanguage(parseGoogleContactInfo(googleContact.getLanguage()));
    result.setLocation(parseGoogleContactInfo(googleContact.getCurrentLocation()));
    result.setAvatarLink(parseGoogleContactInfo(googleContact.getImage().getUrl()));

    return result;
}
 
开发者ID:soomla,项目名称:android-profile,代码行数:30,代码来源:SoomlaGooglePlus.java

示例12: onPlusClientSignIn

import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
@Override
protected void onPlusClientSignIn() {
    mConnectionProgressDialog.dismiss();

    session = new SessionManager(this);
    if (getPlusClient().getCurrentPerson() != null) {
        String accountName = getPlusClient().getAccountName();
        Person currentPerson = getPlusClient().getCurrentPerson();
        String personName = currentPerson.getDisplayName();
        String personPhotoUrl = currentPerson.getImage().getUrl();
        String personGooglePlusProfile = currentPerson.getUrl();
        String personGooglePlusId = currentPerson.getId();
        String location = currentPerson.getCurrentLocation();
        session.createLoginSession(personName, accountName, personPhotoUrl, personGooglePlusProfile, personGooglePlusId, location);
    }

    Toast.makeText(this, "Welcome to ListSketcher!", Toast.LENGTH_LONG).show();
    Intent i = new Intent(this, MainActivity.class);
    // Closing all the Activities
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    // Add new Flag to start new Activity
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    startActivity(i);
    finish();

}
 
开发者ID:gangeshwark,项目名称:listsketcher,代码行数:28,代码来源:LoginPref.java

示例13: Contact

import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
public Contact(Person person) {
    // persons are loaded with image, id and display name so no need in null-checks
    this.imageUrl = person.getImage().getUrl();
    this.displayName = person.getDisplayName();
    this.googleId = person.getId();
}
 
开发者ID:asmolko,项目名称:MyDebts,代码行数:7,代码来源:Contact.java

示例14: onConnected

import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle bundle) {
    if (operationLogin) {
        Person person = Plus.PeopleApi.getCurrentPerson(googleApiClient);
        final String id = person.getId();
        final String displayName = person.getDisplayName();
        final Person.Image image = person.getImage();
        final String imageUrl = image.hasUrl() ? image.getUrl() : null;
        final String accountName = Plus.AccountApi.getAccountName(googleApiClient);
        new AsyncTask<Void, Void, Void>() {
            AuthData authData;
            Exception cause;

            @Override
            protected Void doInBackground(Void... params) {
                try {
                    String token = GoogleAuthUtil.getToken(activity, accountName, "oauth2:" + Plus.SCOPE_PLUS_LOGIN);
                    authData = createAuthData(id, token, displayName, imageUrl);
                } catch (IOException | GoogleAuthException e) {
                    cause = e;
                }
                googleApiClient.disconnect();
                return null;
            }

            @Override
            protected void onPostExecute(Void aVoid) {
                super.onPostExecute(aVoid);

                if (cause != null) {
                    onError(createAuthError(cause));
                } else {
                    onSuccess(authData);
                }
            }
        }.execute();
    } else {
        Plus.AccountApi.clearDefaultAccount(googleApiClient);
        Plus.AccountApi.revokeAccessAndDisconnect(googleApiClient).setResultCallback(new ResultCallback<Status>() {
            @Override
            public void onResult(Status status) {
                googleApiClient.disconnect();
                if (status.isSuccess()) {
                    onSuccess(createAuthData());
                } else if (status.isCanceled()) {
                    onCancelled(createAuthCancel());
                } else {
                    onError(createAuthError(status.getStatusMessage()));
                }
            }
        });
    }
}
 
开发者ID:bbqapp,项目名称:bbqapp-android,代码行数:54,代码来源:GooglePlus.java

示例15: 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);
    }
}
 
开发者ID:hishamMuneer,项目名称:Android-Design-Support-Library,代码行数:54,代码来源:GoogleLoginActivity.java


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