本文整理汇总了Java中com.firebase.ui.auth.ResultCodes类的典型用法代码示例。如果您正苦于以下问题:Java ResultCodes类的具体用法?Java ResultCodes怎么用?Java ResultCodes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResultCodes类属于com.firebase.ui.auth包,在下文中一共展示了ResultCodes类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onActivityResult
import com.firebase.ui.auth.ResultCodes; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);
if (resultCode == ResultCodes.OK) {
// Successfully signed in
user = FirebaseAuth.getInstance().getCurrentUser();
email = user.getEmail();
emailEscaped = email.replaceAll("\\.","DOT").replaceFirst("@","AT");
name = user.getDisplayName();
databaseFamilies.addValueEventListener(emailListener);
databaseFamilies.addValueEventListener(managerListener);
databaseFamilies.addValueEventListener(childListener);
//databaseFamilies.addValueEventListener(nameListener);
// String id = databaseFamilies.push().getKey();
} else {
// Sign in failed, check response for error code
// ...
}
}
}
开发者ID:TranAlan,项目名称:Chore-Manager-App,代码行数:26,代码来源:AppLoginActivity.java
示例2: handleSignInResponse
import com.firebase.ui.auth.ResultCodes; //导入依赖的package包/类
private void handleSignInResponse(int resultCode, IdpResponse response) {
if (resultCode == ResultCodes.OK) {
updateAuthUI();
return;
} else {
if (response == null) {
showSnackBar("Sign in cancelled");
return;
}
if (response.getErrorCode() == ErrorCodes.NO_NETWORK) {
showSnackBar("No internet connection");
return;
}
if (response.getErrorCode() == ErrorCodes.UNKNOWN_ERROR) {
showSnackBar("Unknown error");
return;
}
}
showSnackBar("Unknown sign_in response");
}
开发者ID:GDG-Trondheim,项目名称:firebase-ui-quickstart-android,代码行数:24,代码来源:DemoActivity.java
示例3: onActivityResult
import com.firebase.ui.auth.ResultCodes; //导入依赖的package包/类
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// If this is for the sign in activity:
if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);
if (resultCode == ResultCodes.OK) {
Log.d(TAG, "Login was successful");
// Now that the user is signed in, update currentUser:
currentUser = mAuth.getCurrentUser();
// Transition to the home/settings fragment based on what the user needs to do from here:
navigateBasedOnUser();
} else {
// If there is not a success, try to figure out what went wrong:
if (response == null) Log.e(TAG, "User pressed back button");
else if (response.getErrorCode() == ErrorCodes.NO_NETWORK) {
Log.e(TAG, "Network connection error");
Toast.makeText(this, R.string.network_connection_error, Toast.LENGTH_SHORT).show();
} else if (response.getErrorCode() == ErrorCodes.UNKNOWN_ERROR) {
Log.e(TAG, "Unknown error");
Toast.makeText(this, R.string.unknown_auth_error, Toast.LENGTH_SHORT).show();
showSignIn();
} else Log.e(TAG, "Unknown response");
}
// Debug currentUser again:
Log.d(TAG, "Is the user not signed in? " + Boolean.toString(currentUser == null));
}
}
开发者ID:brianjaustin,项目名称:permitlog-android,代码行数:28,代码来源:MainActivity.java
示例4: onActivityResult
import com.firebase.ui.auth.ResultCodes; //导入依赖的package包/类
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// RC_SIGN_IN is the request code you passed into startActivityForResult(...) when starting the sign in flow.
if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);
// Successfully signed in
if (resultCode == ResultCodes.OK) {
SharedPreferences.Editor editor = getSharedPreferences(FIRST_TIME_LOGIN, MODE_PRIVATE).edit();
editor.putBoolean(Constants.IS_FIRST_TIME, true);
editor.apply();
googleLoginButton.setVisibility(View.INVISIBLE);
showWhiteSnackBar(R.string.sign_in_successful);
linearLayout.setVisibility(View.GONE);
Utils.fetchDataFromFirebase(LoginActivity.this);
return;
} else {
if (response == null) {
showWhiteSnackBar(R.string.sign_in_cancelled);
return;
}
if (response.getErrorCode() == ErrorCodes.NO_NETWORK) {
showWhiteSnackBar(R.string.no_internet_connection);
return;
}
if (response.getErrorCode() == ErrorCodes.UNKNOWN_ERROR) {
showWhiteSnackBar(R.string.unknown_error);
return;
}
}
showWhiteSnackBar(R.string.unknown_sign_in_response);
}
}
开发者ID:vixir,项目名称:Perfect-Day,代码行数:37,代码来源:LoginActivity.java
示例5: onActivityResult
import com.firebase.ui.auth.ResultCodes; //导入依赖的package包/类
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// RC_SIGN_IN is the request code you passed into startActivityForResult(...) when starting the sign in flow.
if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);
// Successfully signed in
if (resultCode == ResultCodes.OK) {
showSnackbar(R.string.signed_in);
return;
} else {
// Sign in failed
if (response == null) {
// User pressed back button
showSnackbar(R.string.sign_in_cancelled);
return;
}
if (response.getErrorCode() == ErrorCodes.NO_NETWORK) {
showSnackbar(R.string.no_internet_connection);
return;
}
if (response.getErrorCode() == ErrorCodes.UNKNOWN_ERROR) {
showSnackbar(R.string.unknown_error);
return;
}
}
showSnackbar(R.string.unknown_sign_in_response);
}
}
开发者ID:open-roboclub,项目名称:roboclub-amu,代码行数:33,代码来源:AdminFragment.java
示例6: onActivityResult
import com.firebase.ui.auth.ResultCodes; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);
// Successfully signed in
if (resultCode == ResultCodes.OK) {
Intent startMainActivityIntent = new Intent(this, BookListsActivity.class);
startActivity(startMainActivityIntent);
finish();
return;
} else {
// Sign in failed
if (response == null) {
// User pressed back button
Log.e(TAG, "onActivityResult: sign_in_cancelled");
showErrorMessage("To bad... It seems like you cancelled :/");
}
if (response.getErrorCode() == ErrorCodes.NO_NETWORK) {
Log.e(TAG, "onActivityResult: no_internet_connection");
showErrorMessage("Ups! There's no internet connection");
}
if (response.getErrorCode() == ErrorCodes.UNKNOWN_ERROR) {
Log.e(TAG, "onActivityResult: unknown_error");
showErrorMessage("Woot! Something unexpected just happend.");
}
}
if (!errorShown) {
Log.e(TAG, "onActivityResult: unknown_sign_in_response");
showErrorMessage("Woot! Something unexpected just happend.");
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
finish(); // TODO: CHANGE THIS
}
}, Snackbar.LENGTH_SHORT);
}
}
开发者ID:paulnunezm,项目名称:Boookito-Capstone-Project,代码行数:48,代码来源:DispatchActivity.java
示例7: onActivityResult
import com.firebase.ui.auth.ResultCodes; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// make sure that MainActivityFragment's onActivityResult() gets called
super.onActivityResult(requestCode, resultCode, data);
// RC_SIGN_IN is the request code you passed into startActivityForResult(...) when starting the sign in flow.
if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);
// Successfully signed in
if (resultCode == ResultCodes.OK) {
Toast.makeText(this, "WelcomeBackActivity", Toast.LENGTH_SHORT).show();
IdpResponse idpResponse = IdpResponse.fromResultIntent(data);
fillUserProfileData();
layoutLoggedIn.setVisibility(View.VISIBLE);
layoutLogin.setVisibility(View.GONE);
return;
} else {
// Sign in failed
if (response == null) {
// User pressed back button
Toast.makeText(this, "sign_in_cancelled", Toast.LENGTH_SHORT).show();
return;
}
if (response.getErrorCode() == ErrorCodes.NO_NETWORK) {
Toast.makeText(this, "no_internet_connection", Toast.LENGTH_SHORT).show();
return;
}
if (response.getErrorCode() == ErrorCodes.UNKNOWN_ERROR) {
Toast.makeText(this, "unknown_error", Toast.LENGTH_SHORT).show();
return;
}
}
Toast.makeText(this, "unknown_sign_in_response", Toast.LENGTH_SHORT).show();
}
}
开发者ID:malah-code,项目名称:Open-Quran-Radio,代码行数:42,代码来源:MainActivity.java
注:本文中的com.firebase.ui.auth.ResultCodes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论