com.google.android.gms.common.SignInButton Java Examples
The following examples show how to use
com.google.android.gms.common.SignInButton.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java From identity-samples with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState != null) { mIsResolving = savedInstanceState.getBoolean(KEY_IS_RESOLVING, false); mCredential = savedInstanceState.getParcelable(KEY_CREDENTIAL); } // Build CredentialsClient and GoogleSignInClient, don't set account name buildClients(null); // Sign in button SignInButton signInButton = (SignInButton) findViewById(R.id.button_google_sign_in); signInButton.setSize(SignInButton.SIZE_WIDE); signInButton.setOnClickListener(this); // Other buttons findViewById(R.id.button_email_sign_in).setOnClickListener(this); findViewById(R.id.button_google_revoke).setOnClickListener(this); findViewById(R.id.button_google_sign_out).setOnClickListener(this); findViewById(R.id.button_email_save).setOnClickListener(this); }
Example #2
Source File: SignInActivity.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_in); // Assign fields mSignInButton = (SignInButton) findViewById(R.id.sign_in_button); // Set click listeners mSignInButton.setOnClickListener(this); // Configure Google Sign In GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); mGoogleApiClient = new GoogleApiClient.Builder(this) // .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); // Initialize FirebaseAuth }
Example #3
Source File: MainActivity.java From android-google-accounts with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); mSignInButton = (SignInButton) findViewById(R.id.sign_in_button); mSignOutButton = (Button) findViewById(R.id.sign_out_button); mRevokeButton = (Button) findViewById(R.id.revoke_access_button); mStatus = (TextView) findViewById(R.id.sign_in_status); mSignInButton.setOnClickListener(this); mSignOutButton.setOnClickListener(this); mRevokeButton.setOnClickListener(this); if (savedInstanceState != null) { mSignInProgress = savedInstanceState.getInt(SAVED_PROGRESS, STATE_DEFAULT); } rebuildGoogleApiClient(); }
Example #4
Source File: MainActivity.java From android-google-accounts with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); mSignInButton = (SignInButton) findViewById(R.id.sign_in_button); mSignOutButton = (Button) findViewById(R.id.sign_out_button); mRevokeButton = (Button) findViewById(R.id.revoke_access_button); mStatus = (TextView) findViewById(R.id.sign_in_status); mSignInButton.setOnClickListener(this); mSignOutButton.setOnClickListener(this); mRevokeButton.setOnClickListener(this); if (isSignedIn()) { rebuildGoogleApiClient(); // TODO: This next IF statement temporarily deals with an issue where autoManage doesn't // call the onConnected callback after a Builder.build() when re-connecting after a // rotation change. Will remove when fixed. if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) { onConnected(null); } } }
Example #5
Source File: SignInActivity.java From codelab-friendlychat-android with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_in); // Assign fields mSignInButton = (SignInButton) findViewById(R.id.sign_in_button); // Set click listeners mSignInButton.setOnClickListener(this); // Configure Google Sign In GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); mSignInClient = GoogleSignIn.getClient(this, gso); // Initialize FirebaseAuth }
Example #6
Source File: SignInActivity.java From codelab-friendlychat-android with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_in); // Assign fields mSignInButton = (SignInButton) findViewById(R.id.sign_in_button); // Set click listeners mSignInButton.setOnClickListener(this); // Configure Google Sign In GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); mSignInClient = GoogleSignIn.getClient(this, gso); // Initialize FirebaseAuth mFirebaseAuth = FirebaseAuth.getInstance(); }
Example #7
Source File: SignInActivity.java From codelab-friendlychat-android with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_in); // Assign fields mSignInButton = (SignInButton) findViewById(R.id.sign_in_button); // Set click listeners mSignInButton.setOnClickListener(this); // Configure Google Sign In GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); mSignInClient = GoogleSignIn.getClient(this, gso); // Initialize FirebaseAuth mFirebaseAuth = FirebaseAuth.getInstance(); }
Example #8
Source File: SignInActivity.java From jterm-cswithandroid with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_in); // Assign fields mSignInButton = (SignInButton) findViewById(R.id.sign_in_button); // Set click listeners mSignInButton.setOnClickListener(this); // Configure Google Sign In GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); // Initialize FirebaseAuth mFirebaseAuth = FirebaseAuth.getInstance(); }
Example #9
Source File: MainActivity.java From android-credentials with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState != null) { mIsResolving = savedInstanceState.getBoolean(KEY_IS_RESOLVING, false); mCredential = savedInstanceState.getParcelable(KEY_CREDENTIAL); } // Build CredentialsClient and GoogleSignInClient, don't set account name buildClients(null); // Sign in button SignInButton signInButton = (SignInButton) findViewById(R.id.button_google_sign_in); signInButton.setSize(SignInButton.SIZE_WIDE); signInButton.setOnClickListener(this); // Other buttons findViewById(R.id.button_email_sign_in).setOnClickListener(this); findViewById(R.id.button_google_revoke).setOnClickListener(this); findViewById(R.id.button_google_sign_out).setOnClickListener(this); findViewById(R.id.button_email_save).setOnClickListener(this); }
Example #10
Source File: MainActivity.java From io2015-codelabs with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSignInButton = (SignInButton) findViewById(R.id.sign_in_button); mSignOutButton = (Button) findViewById(R.id.sign_out_button); mRevokeButton = (Button) findViewById(R.id.revoke_access_button); mStatus = (TextView) findViewById(R.id.statuslabel); mSignInButton.setOnClickListener(this); mSignOutButton.setOnClickListener(this); mRevokeButton.setOnClickListener(this); mGoogleApiClient = buildGoogleApiClient(); }
Example #11
Source File: SignIn.java From easygoogle with Apache License 2.0 | 6 votes |
/** * Add a {@link SignInButton} to the current Activity/Fragment. When clicked, the button * will automatically make a call to {@link SignIn#signIn()}. * @param context the calling context. * @param container a ViewGroup into which the SignInButton should be placed as the first child. * @return the instantiated SignInButton, which can be customized further. */ public SignInButton createSignInButton(Context context, ViewGroup container) { // Create SignInButton and configure style SignInButton signInButton = new SignInButton(context); signInButton.setSize(SignInButton.SIZE_STANDARD); signInButton.setColorScheme(SignInButton.COLOR_DARK); // Make it start sign-in on click signInButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { signIn(); } }); // Add to the layout, return reference to the button for user styling container.addView(signInButton, 0); return signInButton; }
Example #12
Source File: RestApiActivity.java From google-services with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Views mStatusTextView = findViewById(R.id.status); mDetailTextView = findViewById(R.id.detail); // Button listeners findViewById(R.id.sign_in_button).setOnClickListener(this); findViewById(R.id.sign_out_button).setOnClickListener(this); // For this example we don't need the disconnect button findViewById(R.id.disconnect_button).setVisibility(View.GONE); // Restore instance state if (savedInstanceState != null) { mAccount = savedInstanceState.getParcelable(KEY_ACCOUNT); } // Configure sign-in to request the user's ID, email address, basic profile, // and readonly access to contacts. GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestScopes(new Scope(CONTACTS_SCOPE)) .requestEmail() .build(); mGoogleSignInClient = GoogleSignIn.getClient(this, gso); // Show a standard Google Sign In button. If your application does not rely on Google Sign // In for authentication you could replace this with a "Get Google Contacts" button // or similar. SignInButton signInButton = findViewById(R.id.sign_in_button); signInButton.setSize(SignInButton.SIZE_STANDARD); }
Example #13
Source File: SignInActivity.java From google-services with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Views mStatusTextView = findViewById(R.id.status); // Button listeners findViewById(R.id.sign_in_button).setOnClickListener(this); findViewById(R.id.sign_out_button).setOnClickListener(this); findViewById(R.id.disconnect_button).setOnClickListener(this); // [START configure_signin] // Configure sign-in to request the user's ID, email address, and basic // profile. ID and basic profile are included in DEFAULT_SIGN_IN. GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .build(); // [END configure_signin] // [START build_client] // Build a GoogleSignInClient with the options specified by gso. mGoogleSignInClient = GoogleSignIn.getClient(this, gso); // [END build_client] // [START customize_button] // Set the dimensions of the sign-in button. SignInButton signInButton = findViewById(R.id.sign_in_button); signInButton.setSize(SignInButton.SIZE_STANDARD); signInButton.setColorScheme(SignInButton.COLOR_LIGHT); // [END customize_button] }
Example #14
Source File: RNGoogleSigninButtonViewManager.java From google-signin with MIT License | 5 votes |
@Override protected SignInButton createViewInstance(final ThemedReactContext reactContext) { SignInButton button = new SignInButton(reactContext); button.setSize(SignInButton.SIZE_STANDARD); button.setColorScheme(SignInButton.COLOR_AUTO); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("RNGoogleSigninButtonClicked", null); } }); return button; }
Example #15
Source File: RNGoogleSigninModule.java From google-signin with MIT License | 5 votes |
@Override public Map<String, Object> getConstants() { final Map<String, Object> constants = new HashMap<>(); constants.put("BUTTON_SIZE_ICON", SignInButton.SIZE_ICON_ONLY); constants.put("BUTTON_SIZE_STANDARD", SignInButton.SIZE_STANDARD); constants.put("BUTTON_SIZE_WIDE", SignInButton.SIZE_WIDE); constants.put("BUTTON_COLOR_AUTO", SignInButton.COLOR_AUTO); constants.put("BUTTON_COLOR_LIGHT", SignInButton.COLOR_LIGHT); constants.put("BUTTON_COLOR_DARK", SignInButton.COLOR_DARK); constants.put("SIGN_IN_CANCELLED", String.valueOf(GoogleSignInStatusCodes.SIGN_IN_CANCELLED)); constants.put("SIGN_IN_REQUIRED", String.valueOf(CommonStatusCodes.SIGN_IN_REQUIRED)); constants.put("IN_PROGRESS", ASYNC_OP_IN_PROGRESS); constants.put(PLAY_SERVICES_NOT_AVAILABLE, PLAY_SERVICES_NOT_AVAILABLE); return constants; }
Example #16
Source File: LoginFragment.java From androidpay-quickstart with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_login, container, false); SignInButton signInButton = (SignInButton) view.findViewById(R.id.sign_in_button); signInButton.setSize(SignInButton.SIZE_WIDE); signInButton.setOnClickListener(this); view.findViewById(R.id.button_login_bikestore).setOnClickListener(this); return view; }
Example #17
Source File: LoginWithGooglePlusSDKActivity.java From Android-SDK with MIT License | 5 votes |
private void initUI() { loginGooglePlusButton = (SignInButton) findViewById(R.id.button_googlePlusLogin); gpLogoutBackendlessButton = (Button) findViewById(R.id.button_gpBackendlessLogout); socialAccountInfo = (EditText) findViewById(R.id.editText_gpSocialAccountInfo); backendlessUserInfo = (EditText) findViewById(R.id.editText_gpBackendlessUserInfo); }
Example #18
Source File: MainMenuActivity.java From tedroid with Apache License 2.0 | 5 votes |
/** Inicializa las vistas */ private void initViews() { appTitle = (TextView) findViewById(R.id.app_title); signedUserLayout = (RelativeLayout) findViewById(R.id.signed_user_layout); signedUserImageView = (ImageView) findViewById(R.id.signed_user_photo); signedUserTextView = (TextView) findViewById(R.id.signed_user_name); signInWhy = (TextView) findViewById(R.id.sign_in_why_text); playButton = (Button) findViewById(R.id.play_button); scoresButton = (Button) findViewById(R.id.scores_button); achievementsButton = (Button) findViewById(R.id.achievements_button); leaderboardsButton = (Button) findViewById(R.id.leaderboards_button); settingsButton = (Button) findViewById(R.id.settings_button); signInButton = (SignInButton) findViewById(R.id.sign_in_button); signInLayout = (LinearLayout) findViewById(R.id.sign_in_layout); }
Example #19
Source File: SignInActivityWithDrive.java From google-services with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Views mStatusTextView = findViewById(R.id.status); // Button listeners findViewById(R.id.sign_in_button).setOnClickListener(this); findViewById(R.id.sign_out_button).setOnClickListener(this); findViewById(R.id.disconnect_button).setOnClickListener(this); // [START configure_signin] // Configure sign-in to request the user's ID, email address, and basic // profile. ID and basic profile are included in DEFAULT_SIGN_IN. GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestScopes(new Scope(Scopes.DRIVE_APPFOLDER)) .requestEmail() .build(); // [END configure_signin] // [START build_client] // Build a GoogleSignInClient with access to the Google Sign-In API and the // options specified by gso. mGoogleSignInClient = GoogleSignIn.getClient(this, gso); // [END build_client] // [START customize_button] // Customize sign-in button. The sign-in button can be displayed in // multiple sizes. SignInButton signInButton = findViewById(R.id.sign_in_button); signInButton.setSize(SignInButton.SIZE_STANDARD); // [END customize_button] }
Example #20
Source File: LoginView.java From FastAccess with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { type = getIntent().getExtras().getInt(TYPE); } setTitle(type == BACKUP_TYPE ? R.string.backup : R.string.restore); signInBtn.setSize(SignInButton.SIZE_WIDE); }
Example #21
Source File: LoginActivity.java From TwrpBuilder with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); new FirebaseDBInstance(); FirebaseDBInstance.getDatabase(); auth = FirebaseAuth.getInstance(); setContentView(R.layout.activity_login); SignInButton gSignInButton = findViewById(R.id.google_signIn); if (auth.getCurrentUser() != null) { startActivity(new Intent(LoginActivity.this, MainActivity.class)); finish(); } GoogleSignInOptions googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); googleSignInClient = GoogleSignIn.getClient(this, googleSignInOptions); gSignInButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { signIn(); } }); }
Example #22
Source File: LoginPresenterImpl.java From Saude-no-Mapa with MIT License | 5 votes |
@Override public void onReactivateAccountClicked() { mIsValidationFromDialog = true; mBottomSheetDialog = new BottomSheetDialog(mContext); View dialogView = LayoutInflater.from(mContext).inflate(R.layout.dialog_bottom_sheet_reactivate_account, null); mBottomViews = new ReactivateViews(); ButterKnife.bind(mBottomViews, dialogView); mInteractor.validateReactivateForms(mBottomViews.loginEmailEdit, mBottomViews.loginPasswordEdit, this); mBottomViews.loginGoogleButton.setSize(SignInButton.SIZE_STANDARD); mBottomViews.loginGoogleButton.setScopes(mGso.getScopeArray()); mBottomViews.filterButton.setOnClickListener(v -> { requestReactivateNormalAccount(); }); mBottomViews.loginGoogleButton.setOnClickListener(v -> { googleLoginClicked(); }); mBottomViews.loginFacebookButton.setOnClickListener(v -> { facebookLoginClicked(); }); mBottomSheetDialog.setContentView(dialogView); mBottomViews.bottomSheet.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) dialogView.getParent()); mBehavior.setPeekHeight(mBottomViews.bottomSheet.getMeasuredHeight() + 200); mBottomSheetDialog.setOnDismissListener(dialog -> { mIsValidationFromDialog = false; }); mBottomSheetDialog.show(); }
Example #23
Source File: SigninActivity.java From wmn-safety with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signin); final GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); mGoogleSigninClient = GoogleSignIn.getClient(this, gso); mHelpers = new Helpers(this); mFirebaseAuth = FirebaseAuth.getInstance(); FirebaseUser user = mFirebaseAuth.getCurrentUser(); if (user != null) { navigateToHome(); } mFirebaseDatabase = FirebaseDatabase.getInstance(); SignInButton mGoogleSignInButton = findViewById(R.id.sign_in_goggle_button); mGoogleSignInButton.setSize(SignInButton.SIZE_WIDE); mGoogleSignInButton.setColorScheme(SignInButton.COLOR_DARK); mEmailText = findViewById(R.id.sign_in_email_tv); mPasswordText = findViewById(R.id.sign_in_password_tv); mGoogleSignInButton.setOnClickListener(this); findViewById(R.id.sign_in_button).setOnClickListener(this); findViewById(R.id.sign_in_register_tv).setOnClickListener(this); findViewById(R.id.sign_in_forgot_pass_tv).setOnClickListener(this); }
Example #24
Source File: Fido2DemoActivity.java From security-samples with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_navigation); // START Google sign in API client // configure sign-in to request user info GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .requestIdToken(Constants.SERVER_CLIENT_ID) .build(); // build client with access to Google Sign-In API and the options specified by gso googleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); // END Google sign in API client // START prepare main layout Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); progressBar = findViewById(R.id.progressBar); swipeRefreshLayout = findViewById(R.id.swipe_container); swipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.colorAccent)); swipeRefreshLayout.setRefreshing(true); swipeRefreshLayout.setOnRefreshListener( new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { updateAndDisplayRegisteredKeys(); } }); recyclerView = findViewById(R.id.list); recyclerView.setLayoutManager(new LinearLayoutManager(this)); adapter = new SecurityTokenAdapter( new ArrayList<Map<String, String>>(), R.layout.row_token, Fido2DemoActivity.this); // END prepare main layout // START prepare drawer layout DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); navigationView.setItemIconTintList(null); View header = navigationView.getHeaderView(0); userEmailTextView = header.findViewById(R.id.userEmail); displayNameTextView = header.findViewById(R.id.displayName); Menu menu = navigationView.getMenu(); operationMenuItem = menu.findItem(R.id.nav_fido2Operations); signInMenuItem = menu.findItem(R.id.nav_signin); signOutMenuItem = menu.findItem(R.id.nav_signout); signInButton = findViewById(R.id.sign_in_button); signInButton.setSize(SignInButton.SIZE_WIDE); signInButton.setScopes(gso.getScopeArray()); signInButton.setOnClickListener(this); // END prepare drawer layout // request SignIn or load registered tokens updateUI(); }
Example #25
Source File: RNGoogleSigninButtonViewManager.java From google-signin with MIT License | 4 votes |
@ReactProp(name = "size") public void setSize(SignInButton button, int size) { button.setSize(size); }
Example #26
Source File: RNGoogleSigninButtonViewManager.java From google-signin with MIT License | 4 votes |
@ReactProp(name = "color") public void setColor(SignInButton button, int color) { button.setColorScheme(color); }
Example #27
Source File: RNGoogleSigninButtonViewManager.java From google-signin with MIT License | 4 votes |
@ReactProp(name = "disabled") public void setDisabled(SignInButton button, boolean disabled) { button.setEnabled(!disabled); }
Example #28
Source File: PlayActivity.java From firebase-android-client with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { ListView messageHistory; super.onCreate(savedInstanceState); setContentView(R.layout.activity_play); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); channelMenu = navigationView.getMenu(); navigationView.setNavigationItemSelectedListener(this); initChannels(); GoogleSignInOptions.Builder gsoBuilder = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail(); GoogleSignInOptions gso = gsoBuilder.build(); mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this, this) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); SignInButton signInButton = findViewById(R.id.sign_in_button); signInButton.setSize(SignInButton.SIZE_STANDARD); signInButton.setOnClickListener(this); channelLabel = findViewById(R.id.channelLabel); Button signOutButton = findViewById(R.id.sign_out_button); signOutButton.setOnClickListener(this); ImageButton microphoneButton = findViewById(R.id.microphone_button); microphoneButton.setOnClickListener(this); messages = new ArrayList<>(); messageAdapter = new SimpleAdapter(this, messages, android.R.layout.simple_list_item_2, new String[]{"message", "meta"}, new int[]{android.R.id.text1, android.R.id.text2}); messageHistory = findViewById(R.id.messageHistory); messageHistory.setOnItemClickListener(this); messageHistory.setAdapter(messageAdapter); messageText = findViewById(R.id.messageText); messageText.setOnKeyListener(this); fmt = new SimpleDateFormat("yy.MM.dd HH:mm z", Locale.US); status = findViewById(R.id.status); }
Example #29
Source File: LoginActivity.java From Saude-no-Mapa with MIT License | 4 votes |
@Override public void setGoogleButtonScope(GoogleSignInOptions gso) { loginGoogleButton.setSize(SignInButton.SIZE_STANDARD); loginGoogleButton.setScopes(gso.getScopeArray()); }
Example #30
Source File: SplashActivity.java From FChat with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); bindLogo(); customToast = new CustomToast(this); viewHelper = new ViewHelper(getApplicationContext()); viewHelper.clearNotofication(); // Assign fields signInButton = (SignInButton) findViewById(R.id.sign_in_button); loginProgress = (ProgressBar) findViewById(R.id.login_progress); // Set click listeners signInButton.setOnClickListener(v -> signIn()); GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)).requestEmail().build(); mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */) .addApi(Auth.GOOGLE_SIGN_IN_API, gso).build(); // Initialize FirebaseAuth mFirebaseAuth = FirebaseAuth.getInstance(); set = new SettingsAPI(this); if (getIntent().getStringExtra("mode") != null) { if (getIntent().getStringExtra("mode").equals("logout")) { mGoogleApiClient.connect(); mGoogleApiClient .registerConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Override public void onConnected( @Nullable Bundle bundle) { mFirebaseAuth.signOut(); Auth.GoogleSignInApi.signOut(mGoogleApiClient); set.deleteAllSettings(); } @Override public void onConnectionSuspended(int i) { } }); } } if (!mGoogleApiClient.isConnecting()) { if (!set.readSetting(Constants.PREF_MY_ID).equals("na")) { signInButton.setVisibility(View.GONE); final Handler handler = new Handler(); handler.postDelayed(() -> { startActivity(new Intent(SplashActivity.this, MainActivity.class)); finish(); }, 3000); } } // for system bar in lollipop if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Tools.systemBarLolipop(this); } }