protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); regularTxt = Typeface.CreateFromAsset(Assets, "fonts/SF-UI-Display-Regular.ttf"); semiboldTxt = Typeface.CreateFromAsset(Assets, "fonts/SF-UI-Display-Semibold.ttf"); //Get values UsernameEditext = FindViewById <EditText>(Resource.Id.usernamefield); PasswordEditext = FindViewById <EditText>(Resource.Id.passwordfield); progressBar = FindViewById <ProgressBar>(Resource.Id.progressBar); Btn_Login = FindViewById <Button>(Resource.Id.loginButton); RegisterButton = FindViewById <Button>(Resource.Id.signUpButton); Main_LinearLayout = FindViewById <LinearLayout>(Resource.Id.mainLinearLayout); topTitile = FindViewById <TextView>(Resource.Id.titile); topTitile.Text = AppSettings.Application_Name; subTitile = FindViewById <TextView>(Resource.Id.subtitile); subTitile.Text = this.GetText(Resource.String.Lbl_Subtitile_Login); Txt_forgetpass = FindViewById <TextView>(Resource.Id.forgetpassButton); Txt_Terms_of_service = FindViewById <TextView>(Resource.Id.secTermTextView); Txt_Privacy = FindViewById <TextView>(Resource.Id.secPrivacyTextView); progressBar.Visibility = ViewStates.Invisible; UsernameEditext.SetTypeface(regularTxt, TypefaceStyle.Normal); PasswordEditext.SetTypeface(regularTxt, TypefaceStyle.Normal); topTitile.SetTypeface(regularTxt, TypefaceStyle.Normal); subTitile.SetTypeface(regularTxt, TypefaceStyle.Normal); Txt_forgetpass.SetTypeface(regularTxt, TypefaceStyle.Normal); Txt_Terms_of_service.SetTypeface(regularTxt, TypefaceStyle.Normal); Txt_Privacy.SetTypeface(regularTxt, TypefaceStyle.Normal); FontController.SetFont(Btn_Login, 1); FontController.SetFont(RegisterButton, 1); //Social Logins >> //============================== FacebookSdk.SdkInitialize(this); mprofileTracker = new FB_MyProfileTracker(); mprofileTracker.StartTracking(); BtnFBLogin = FindViewById <LoginButton>(Resource.Id.fblogin_button); BtnFBLogin.SetReadPermissions(new List <string> { "email", "public_profile" }); mFBCallManager = CallbackManagerFactory.Create(); BtnFBLogin.RegisterCallback(mFBCallManager, this); //FB accessToken var accessToken = AccessToken.CurrentAccessToken; var isLoggedIn = accessToken != null && !accessToken.IsExpired; if (isLoggedIn && Profile.CurrentProfile != null) { LoginManager.Instance.LogOut(); } // Configure sign-in to request the user's ID, email address, and basic profile. ID and basic profile are included in DEFAULT_SIGN_IN. var gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn) .RequestIdToken(GoogleServices.ClientId) .RequestScopes(new Scope(Scopes.Profile)) .RequestScopes(new Scope(Scopes.PlusLogin)) .RequestServerAuthCode(GoogleServices.ClientId) .RequestProfile().RequestEmail().Build(); // Build a GoogleApiClient with access to the Google Sign-In API and the options specified by gso. mGoogleApiClient = new GoogleApiClient.Builder(this, this, this) .EnableAutoManage(this, this) .AddApi(Auth.GOOGLE_SIGN_IN_API, gso) .Build(); mGoogleSignIn = FindViewById <Button>(Resource.Id.Googlelogin_button); if (!AppSettings.Show_Facebook_Login) { BtnFBLogin.Visibility = ViewStates.Gone; } if (!AppSettings.Show_Google_Login) { mGoogleSignIn.Visibility = ViewStates.Gone; } //============================== if (!string.IsNullOrEmpty(OneSignalNotification.OneSignalAPP_ID)) { if (AppSettings.ShowNotification) { OneSignalNotification.RegisterNotificationDevice(); } } if ((int)Build.VERSION.SdkInt < 23) { } else { RequestPermissions(new string[] { Manifest.Permission.ReadExternalStorage, Manifest.Permission.WriteExternalStorage, }, 1); } } catch (Exception e) { Console.WriteLine(e); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); IMethods.IApp.FullScreenApp(this); //View view = MyContextWrapper.GetContentView(this, Settings.Lang, Resource.Layout.Login_Layout); SetContentView(Resource.Layout.Login_Layout); regularTxt = Typeface.CreateFromAsset(Assets, "fonts/SF-UI-Display-Regular.ttf"); semiboldTxt = Typeface.CreateFromAsset(Assets, "fonts/SF-UI-Display-Semibold.ttf"); //declare layouts and editext mEditTextEmail = (EditText)FindViewById(Resource.Id.editTxtEmail); mEditTextPassword = (EditText)FindViewById(Resource.Id.editTxtPassword); mTextViewSignUp = (TextView)FindViewById(Resource.Id.tvSignUp); // Register mButtonViewSignIn = (Button)FindViewById(Resource.Id.SignInButton); // Login mTextViewForgotPwd = (TextView)FindViewById(Resource.Id.tvForgotPwd); // Forget password mTextViewCreateAccount = (TextView)FindViewById(Resource.Id.tvCreateAccount); progressBar = FindViewById <ProgressBar>(Resource.Id.progressBar); progressBar.Visibility = ViewStates.Gone; mButtonViewSignIn.Visibility = ViewStates.Visible; //mTextViewSignIn.SetTypeface(semiboldTxt,TypefaceStyle.Bold); mTextViewCreateAccount.SetTypeface(regularTxt, TypefaceStyle.Normal); mTextViewForgotPwd.SetTypeface(regularTxt, TypefaceStyle.Normal); mTextViewSignUp.SetTypeface(regularTxt, TypefaceStyle.Normal); mEditTextEmail.SetTypeface(regularTxt, TypefaceStyle.Normal); mEditTextPassword.SetTypeface(regularTxt, TypefaceStyle.Normal); FacebookSdk.SdkInitialize(this); mprofileTracker = new FB_MyProfileTracker(); mprofileTracker.mOnProfileChanged += MprofileTrackerOnM_OnProfileChanged; mprofileTracker.StartTracking(); BtnFBLogin = FindViewById <LoginButton>(Resource.Id.fblogin_button); BtnFBLogin.SetReadPermissions(new List <string> { "email", "public_profile" }); mFBCallManager = CallbackManagerFactory.Create(); BtnFBLogin.RegisterCallback(mFBCallManager, this); //FB accessToken var accessToken = AccessToken.CurrentAccessToken; var isLoggedIn = accessToken != null && !accessToken.IsExpired; // Configure sign-in to request the user's ID, email address, and basic profile. ID and basic profile are included in DEFAULT_SIGN_IN. var gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn) .RequestIdToken(GoogleServices.ClientId) .RequestScopes(new Scope(Scopes.Profile)) .RequestScopes(new Scope(Scopes.PlusLogin)) .RequestServerAuthCode(GoogleServices.ClientId) .RequestProfile().RequestEmail().Build(); // Build a GoogleApiClient with access to the Google Sign-In API and the options specified by gso. mGoogleApiClient = new GoogleApiClient.Builder(this, this, this) .EnableAutoManage(this, this) .AddApi(Auth.GOOGLE_SIGN_IN_API, gso) .Build(); mGoogleSignIn = FindViewById <SignInButton>(Resource.Id.Googlelogin_button); mGoogleSignIn.Click += MGsignBtnOnClick; mGoogleSignIn.SetSize(SignInButton.SizeStandard); if (!Settings.Show_Facebook_Login) { BtnFBLogin.Visibility = ViewStates.Invisible; } if (!Settings.Show_Google_Login) { mGoogleSignIn.Visibility = ViewStates.Invisible; } IMethods.IApp.GetKeyHashesConfigured(this); } catch (Exception exception) { Crashes.TrackError(exception); } }