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


Java UserInfo.getPhotoUrl方法代码示例

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


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

示例1: getProviderData

import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
private void getProviderData() {
    // [START get_provider_data]
    FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
    if (user != null) {
        for (UserInfo profile : user.getProviderData()) {
            // Id of the provider (ex: google.com)
            String providerId = profile.getProviderId();

            // UID specific to the provider
            String uid = profile.getUid();

            // Name, email address, and profile photo Url
            String name = profile.getDisplayName();
            String email = profile.getEmail();
            Uri photoUrl = profile.getPhotoUrl();
        };
    }
    // [END get_provider_data]
}
 
开发者ID:firebase,项目名称:snippets-android,代码行数:20,代码来源:MainActivity.java

示例2: showProviders

import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
private void showProviders(FirebaseUser user) {
    List<? extends UserInfo> providers = user.getProviderData();

    for (int i = 0; i < providers.size(); i++) {
        UserInfo userInfo = providers.get(i);

        RadioButton radioButton = createRadio(userInfo.getProviderId());
        radioButton.setId(i);
        if(userInfo.getPhotoUrl()!= null && userInfo.getPhotoUrl().equals(user.getPhotoUrl())) {
            radioButton.setChecked(true);
        }
        providersLayout.addView(radioButton);
    }

    providersLayout.setOnCheckedChangeListener((group, checkedId) -> {
        Uri uri = providers.get(checkedId).getPhotoUrl();
        showImageAvatar(uri);
    });
}
 
开发者ID:open-roboclub,项目名称:roboclub-amu,代码行数:20,代码来源:AdminFragment.java

示例3: setupUserFirstTime

import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
public static User setupUserFirstTime(FirebaseUser firebaseUser, Context context) {

        User user = new User(firebaseUser.getUid(),
                firebaseUser.getEmail(),
                firebaseUser.getDisplayName(),
                firebaseUser.getPhotoUrl() == null ? null : firebaseUser.getPhotoUrl().toString(),
                DateUtils.getCurrentTimeString());

        try {
            if (user.getPhotoUrl() == null) {
                for (UserInfo userInfo : firebaseUser.getProviderData()) {
                    if (userInfo.getPhotoUrl() != null) {
                        user.setPhotoUrl(userInfo.getPhotoUrl().toString());
                        break;
                    }
                }
            }
        } catch (Exception ex) {

        }

        Folder myBooksFolder = new Folder();
        myBooksFolder.setId(UUID.randomUUID().toString());
        myBooksFolder.setDescription(context.getResources().getString(R.string.tab_my_books));
        myBooksFolder.setCustom(false);

        user.setFolders(Collections.singletonMap(FirebaseDatabaseHelper.REF_MY_BOOKS_FOLDER, myBooksFolder));

        return user;

    }
 
开发者ID:victoraldir,项目名称:BuddyBook,代码行数:32,代码来源:User.java

示例4: userInfoToJSONObject

import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
private static JSONObject userInfoToJSONObject(UserInfo userInfo) throws Exception {
    Uri photoUrl = userInfo.getPhotoUrl();

    JSONObject jsonUser = new JSONObject();
    jsonUser.put("uid", userInfo.getUid());
    jsonUser.put("displayName", userInfo.getDisplayName());
    jsonUser.put("email", userInfo.getEmail());
    jsonUser.put("photoURL", (photoUrl != null) ? photoUrl.toString() : null);
    jsonUser.put("providerId", userInfo.getProviderId());
    jsonUser.put("emailVerified", userInfo.isEmailVerified());
    return jsonUser;
}
 
开发者ID:jsayol,项目名称:cordova-plugin-firebase-sdk,代码行数:13,代码来源:AuthComponent.java

示例5: onAuthStateChanged

import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
    FirebaseUser user = firebaseAuth.getCurrentUser();
    if (user != null && firebaseBugFlag) {
        firebaseBugFlag = false;
        for (UserInfo profile : user.getProviderData()) {
            String providerId = profile.getProviderId();
            if (providerId.equals(FIREBASE_PROVIDER_ID)) {
                if (!user.isAnonymous()) {
                    if (context != null) {
                        String name = profile.getDisplayName();
                        String email = profile.getEmail();
                        Uri photoUrl = profile.getPhotoUrl();
                        String photo = photoUrl != null ? photoUrl.toString() : "";

                        SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(context);
                        SharedPreferences.Editor editor = shared.edit();
                        editor.putString(SSConstants.SS_USER_NAME_INDEX, name);
                        editor.putString(SSConstants.SS_USER_EMAIL_INDEX, email);
                        editor.putString(SSConstants.SS_USER_PHOTO_INDEX, photo);
                        editor.commit();
                    }
                }

                SSEvent.track(SSConstants.SS_EVENT_APP_OPEN);

                openApp();
            }
        }
    }
}
 
开发者ID:Adventech,项目名称:sabbath-school-android,代码行数:32,代码来源:SSLoginViewModel.java

示例6: onCreate

import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_userprofile);

    toolbarLayout= findViewById(R.id.tbprofile);
    toolbar= findViewById(R.id.barprofileactivity);
    toolbar.setNavigationIcon(R.mipmap.ic_arrow_back_white_24dp);
    setSupportActionBar(toolbar);
    profileimage= findViewById(R.id.imgprofile);
    mAuth=FirebaseAuth.getInstance();
    user=mAuth.getCurrentUser();
    if (user !=null) {
        for (UserInfo userdata: user.getProviderData()) {

            profileDisplayName=userdata.getDisplayName();
            toolbarLayout.setTitle(profileDisplayName);
            profilePhotoUrl=userdata.getPhotoUrl();
        }
        if (profilePhotoUrl !=null){
            String image=profilePhotoUrl.toString();
            Picasso.with(Userprofile.this)
                    .load(image)
                    .fit()
                    .into(profileimage);
        }else{
            profileimage.setImageDrawable(ContextCompat.getDrawable(Userprofile.this,R.drawable.nouserimage));
        }
    }
    tbs= findViewById(R.id.profiletabs);
    tbs.setSelectedTabIndicatorColor(ContextCompat.getColor(Userprofile.this,R.color.colorAccent));
    vwpgr= findViewById(R.id.profilevpgr);
    adaptadortabs adaptador=new adaptadortabs(getSupportFragmentManager());
    vwpgr.setAdapter(adaptador);
    tbs.setupWithViewPager(vwpgr);

}
 
开发者ID:brunomassa,项目名称:LuxVilla,代码行数:38,代码来源:Userprofile.java


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