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


Java Person.getImage方法代码示例

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


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

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

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

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

示例4: getProfileImageUrl

import com.google.android.gms.plus.model.people.Person; //导入方法依赖的package包/类
private String getProfileImageUrl(Person person) {
  Person.Image image = person.getImage();
  return image.hasUrl() ? image.getUrl() : null;
}
 
开发者ID:chiuki,项目名称:friendspell,代码行数:5,代码来源:GoogleApiClientBridge.java

示例5: 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.getImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。