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


Java AuthUI类代码示例

本文整理汇总了Java中com.firebase.ui.auth.AuthUI的典型用法代码示例。如果您正苦于以下问题:Java AuthUI类的具体用法?Java AuthUI怎么用?Java AuthUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onOptionsItemSelected

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

        case R.id.subscribe:
            FirebaseMessaging.getInstance().subscribeToTopic("pushNotifications");
            Toast.makeText(MainActivity.this, "Subscribed to Topic: Push Notifications", Toast.LENGTH_SHORT).show();
            break;
        case R.id.unsubscribe:
            FirebaseMessaging.getInstance().unsubscribeFromTopic("pushNotifications");
            Toast.makeText(MainActivity.this, "Unsubscribed to Topic: Push Notifications", Toast.LENGTH_SHORT).show();
            break;
        case R.id.sign_out_menu:
            AuthUI.getInstance().signOut(this);
            break;

        default:
            return super.onOptionsItemSelected(item);

    }
return true;}
 
开发者ID:SinanYilmaz9,项目名称:CloudFunctionsExample,代码行数:22,代码来源:MainActivity.java

示例2: launchLoginActivityResult

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
private void launchLoginActivityResult() {

        //Test
        if(mIdlingResource != null)
            mIdlingResource.setIdleState(false);

        startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setTheme(R.style.LoginTheme)
                        .setIsSmartLockEnabled(!BuildConfig.DEBUG)
                        .setAvailableProviders(
                                Arrays.asList(new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(),
                                        new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(),
                                        new AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build()))
                        .build(),
                RC_SIGN_IN);

        overridePendingTransition(R.anim.fui_slide_in_right, R.anim.fui_slide_in_right);


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

示例3: onCreate

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.AppTheme);
    super.onCreate(savedInstanceState);
    counter =0;
    mAuth = FirebaseAuth.getInstance();
    databaseFamilies = FirebaseDatabase.getInstance().getReference("Families");
    setContentView(R.layout.activity_app_login);
    Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button);
    //Signs in user with Google sign in
    mEmailSignInButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            // Check if user is signed in (non-null)
            FirebaseUser currentUser = mAuth.getCurrentUser();
            // Add user to database
            startActivityForResult(
                    AuthUI.getInstance()
                            .createSignInIntentBuilder()
                            .setAvailableProviders(providers)
                            .build(),
                    RC_SIGN_IN);
        }
    });
}
 
开发者ID:TranAlan,项目名称:Chore-Manager-App,代码行数:26,代码来源:AppLoginActivity.java

示例4: onOptionsItemSelected

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  // Handle action bar item clicks here. The action bar will
  // automatically handle clicks on the Home/Up button, so long
  // as you specify a parent activity in AndroidManifest.xml.
  int id = item.getItemId();

  //noinspection SimplifiableIfStatement
  if (id == R.id.action_logout) {
    AuthUI.getInstance()
        .signOut(this)
        .addOnCompleteListener(new OnCompleteListener<Void>() {
          public void onComplete(@NonNull Task<Void> task) {
            // user is now signed out
            startActivity(new Intent(BookListsActivity.this, DispatchActivity.class));
            finish();
          }
        });

    return true;
  }

  return super.onOptionsItemSelected(item);
}
 
开发者ID:paulnunezm,项目名称:Boookito-Capstone-Project,代码行数:25,代码来源:BookListsActivity.java

示例5: onOptionsItemSelected

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // TODO: 10/30/17 respect the design remove repository from here.
    MainRepository repository = viewModel.getRepository();
    switch (item.getItemId()) {
        case R.id.menu_add_items:
            repository.addRestaurants(this);
            break;
        case R.id.menu_sign_out:
            AuthUI.getInstance().signOut(this);
            startSignIn();
            break;
        case R.id.menu_delete:
            repository.deleteAll();
            break;
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:amrro,项目名称:firestore-android-arch-components,代码行数:19,代码来源:MainActivity.java

示例6: onOptionsItemSelected

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_add_items:
            onAddItemsClicked();
            break;
        case R.id.menu_sign_out:
            AuthUI.getInstance().signOut(this);
            startSignIn();
            break;
        case R.id.menu_delete:
            RestaurantUtil.deleteAll();
            break;
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:firebase,项目名称:quickstart-android,代码行数:17,代码来源:MainActivity.java

示例7: onOptionsItemSelected

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_admin_page:
            Intent intent = new Intent(this, AdminPageActivity.class);
            startActivity(intent);
            return true;
        case R.id.action_sign_out:
            AuthUI.getInstance()
                    .signOut(this)
                    .addOnCompleteListener(new OnCompleteListener<Void>() {
                        public void onComplete(@NonNull Task<Void> task) {
                            // user is now signed out
                            startActivity(new Intent(WizardActivity.this, WizardActivity.class));
                            finish();
                        }
                    });
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
开发者ID:Consamables,项目名称:AndroidPizza,代码行数:23,代码来源:WizardActivity.java

示例8: onOptionsItemSelected

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_sign_out:
            AuthUI.getInstance()
                    .signOut(this)
                    .addOnCompleteListener(new OnCompleteListener<Void>() {
                        @Override
                        public void onComplete(@NonNull Task<Void> task) {
                            showSignIn();
                            finish();
                        }
                    });
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
开发者ID:akhbulatov,项目名称:messengeralda,代码行数:19,代码来源:MainActivity.java

示例9: logout

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
private void logout() {
    Alert.showConfirm(this, R.string.drawer_logout_title, R.string.leave,
            R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    finish();
                    AuthUI.getInstance()
                            .signOut(MainActivity.this)
                            .addOnCompleteListener(new OnCompleteListener<Void>() {
                                public void onComplete(@NonNull Task<Void> task) {
                                    // user is now signed out
                                    startActivity(new Intent(MainActivity.this, SplashActivity.class));
                                    finish();
                                }
                            });

                }
            });
}
 
开发者ID:douglasmarques,项目名称:survey-android,代码行数:20,代码来源:MainActivity.java

示例10: onCreate

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FirebaseAuth auth = FirebaseAuth.getInstance();
        Intent intent;
        if (auth.getCurrentUser() == null) {
            startActivityForResult(
                    AuthUI.getInstance().createSignInIntentBuilder()
//                            .setTheme(getSelectedTheme())
//                            .setLogo(getSelectedLogo())
                            .setProviders(getSelectedProviders())
//                            .setTosUrl(getSelectedTosUrl())
                            .build(),
                    RC_SIGN_IN);
        }else{
            intent = new Intent(this, MainActivity.class);
            startActivity(intent);
            finish();
        }


    }
 
开发者ID:douglasmarques,项目名称:survey-android,代码行数:23,代码来源:SplashActivity.java

示例11: signOut

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
/**
 * This method to sign out, from both the email sign or google sign
 */
protected void signOut() {

    AuthUI.getInstance()
            .signOut(this)
            .addOnCompleteListener(this, new OnCompleteListener<Void>() {
                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    // user is now sign out

                    // Get back to the sign in page
                    startActivity(new Intent(getBaseContext(), SignInUI.class));
                    finish();
                }
            });
}
 
开发者ID:Hishmad,项目名称:stockita-point-of-sale,代码行数:19,代码来源:BaseActivity.java

示例12: onCreate

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    FirebaseAuth auth = FirebaseAuth.getInstance();
    if (auth.getCurrentUser() != null) {
        // already signed in

    } else {
        // not signed in
        startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setProviders(
                                AuthUI.GOOGLE_PROVIDER
                        )
                        .setIsSmartLockEnabled(false)
                        .build(),
                RESULT_CODE_ACTIVITY);
    }
}
 
开发者ID:DroidCamp,项目名称:Android-Examples,代码行数:23,代码来源:MainActivity.java

示例13: startSignInProcess

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
public void startSignInProcess() {

        if (!checkGooglePlayServices()) {
            return;
        }

        FirebaseAuth auth = FirebaseAuth.getInstance();
        if (auth.getCurrentUser() != null) {
            RxBus.INSTANCE.post(new SnackbarRequest(new SnackbarBundle(getString(R.string.sign_in_successful))));
        } else {
            ArrayList<AuthUI.IdpConfig> providers = new ArrayList<>();
            providers.add(new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build());
            providers.add(new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build());
            startActivityForResult(
                    // Get an instance of AuthUI based on the default app
                    AuthUI.getInstance()
                            .createSignInIntentBuilder()
                            .setProviders(providers)
                            .setLogo(R.drawable.logo)
                            .setTosUrl("https://github.com/jamieadkins95/Yennefr/blob/master/TOS.md")
                            .setIsSmartLockEnabled(!BuildConfig.DEBUG)
                            .setTheme(R.style.Theme_Gwent)
                            .build(),
                    REQUEST_CODE_SIGN_IN);
        }
    }
 
开发者ID:jamieadkins95,项目名称:Roach,代码行数:27,代码来源:AuthenticationActivity.java

示例14: signOut

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
@OnClick(R.id.sign_out)
public void signOut() {
    AuthUI.getInstance()
            .signOut(this)
            .addOnCompleteListener(new OnCompleteListener<Void>() {
                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    if (task.isSuccessful()) {
                        startActivity(AuthUiActivity.createIntent(SignedInActivity.this));
                        finish();
                    } else {
                        showSnackbar(R.string.sign_out_failed);
                    }
                }
            });
}
 
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:17,代码来源:SignedInActivity.java

示例15: providerIdToAccountType

import com.firebase.ui.auth.AuthUI; //导入依赖的package包/类
/**
 * Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a
 * Credentials API account type (such as {@link IdentityProviders#GOOGLE}).
 */
public static String providerIdToAccountType(@AuthUI.SupportedProvider @NonNull String providerId) {
    switch (providerId) {
        case GoogleAuthProvider.PROVIDER_ID:
            return IdentityProviders.GOOGLE;
        case FacebookAuthProvider.PROVIDER_ID:
            return IdentityProviders.FACEBOOK;
        case TwitterAuthProvider.PROVIDER_ID:
            return IdentityProviders.TWITTER;
        case PhoneAuthProvider.PROVIDER_ID:
            return PHONE_IDENTITY;
        // The account type for email/password creds is null
        case EmailAuthProvider.PROVIDER_ID:
        default:
            return null;
    }
}
 
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:21,代码来源:ProviderUtils.java


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