Beispiel #1
0
        private async void LoginButton_Click(object sender, EventArgs e)
        {
            User u = new User();

            progressBar.Visibility = ViewStates.Visible;
            if (loginEditText.Text.Length >= 5 && passwordEditText.Text.Length >= 5)
            {
                u.Password = GlobalHelper.GenerateSHA512(passwordEditText.Text);
                u.Login    = loginEditText.Text.Trim();
                var user = await APIHelper.getUser(u);

                if (user == null)
                {
                    Toast.MakeText(this, "Niepoprwany login lub hasło", ToastLength.Long).Show();
                    progressBar.Visibility = ViewStates.Invisible;
                    loginEditText.Text     = "";
                    passwordEditText.Text  = "";
                    loginEditText.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                    passwordEditText.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                    return;
                }
                if (rememberMe.Checked)
                {
                    if (rememberMe.Checked)
                    {
                        GlobalHelper.switchSavedUser(user);
                    }
                }

                GlobalMemory._user = user;
                if (!GlobalMemory._user.Access)
                {
                    this.StartActivity(typeof(AccessActivity));
                    this.Finish();
                }
                else
                {
                    this.StartActivity(typeof(MainPageActivity));
                    this.Finish();
                }
            }
            else
            {
                Toast.MakeText(this, "Podany login lub hasło są za krótkie!", ToastLength.Long).Show();
                loginEditText.Text    = "";
                passwordEditText.Text = "";
                loginEditText.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                passwordEditText.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
            }
            progressBar.Visibility = ViewStates.Invisible;
            //hasło poddać działaniu funkcji skrótu;
        }
Beispiel #2
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            client = GlobalMemory.m_client;

            if (client.Password == GlobalHelper.getMD5(actualPass.Text.Trim()) && newPass1.Text.Trim() == newPass2.Text.Trim())
            {
                client.Password = GlobalHelper.getMD5(newPass1.Text.Trim());

                if (MySQLHelper.UpdateDataBase(client, connection))
                {
                    setAlert("Nowe has³o ustawiono pomyœlnie");
                    // czyszczenie zapisanego konta
                    ISharedPreferences       pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private);
                    ISharedPreferencesEditor edit = pref.Edit();
                    edit.Clear();
                    edit.Apply();
                    this.Finish();
                }
                else
                {
                    setAlert("Brak po³¹czenia internetowego");
                }
            }
            else
            {
                actualPass.Text = "";
                newPass1.Text   = "";
                newPass2.Text   = "";
                actualPass.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                newPass1.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                newPass2.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));

                setAlert("Poda³eœ z³e haslo lub podane nowe has³a nie s¹ identyczne");
            }
        }
Beispiel #3
0
        private void LogButton_Click(object sender, EventArgs e)
        {
            loginBar.Visibility   = ViewStates.Visible;
            passwordEditText.Text = Helper.GlobalHelper.getMD5(passwordEditText.Text);
            Helper.Client client;
            bool          result = Helper.MySQLHelper.check_if_account_is_correct(this.loginEditText.Text, this.passwordEditText.Text, connection, out client);

            if (result)
            {
                GlobalMemory.m_client = client;

                loginEditText.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
                passwordEditText.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
                if (rememberMe.Checked)
                {
                    ISharedPreferences       pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private);
                    ISharedPreferencesEditor edit = pref.Edit();
                    edit.PutString("UserName", loginEditText.Text.Trim());
                    edit.PutString("Password", passwordEditText.Text.Trim());
                    edit.Apply();
                }
                StartActivity(typeof(MenuPage));
                this.Finish();
                loginBar.Visibility = ViewStates.Invisible;
            }
            else
            {
                setAlert("Podane dane logowania s¹ niepoprawne.");
                loginBar.Visibility   = ViewStates.Invisible;
                loginEditText.Text    = "";
                passwordEditText.Text = "";
                loginEditText.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                passwordEditText.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
            }
        }
Beispiel #4
0
        public void SetCorrect(EditText editText)
        {
            GradientDrawable gd = new GradientDrawable();

            gd.SetColor(Color.White);
            gd.SetCornerRadius(0);
            gd.SetStroke(0, Color.White);
            editText.SetBackgroundDrawable(gd);
        }
Beispiel #5
0
        public void SetError(EditText editText)
        {
            GradientDrawable gd = new GradientDrawable();

            gd.SetColor(Color.ParseColor("#fae5ea"));
            gd.SetCornerRadius(5);
            gd.SetStroke(2, Color.Red);
            editText.SetBackgroundDrawable(gd);
        }
        public static void SetTheme(EditText editText, FlatTheme theme,
                                    FlatUI.FlatFontFamily fontFamily, FlatUI.FlatFontWeight fontWeight, FlatUI.FlatTextAppearance textAppearance,
                                    int style, int radius, int padding, int border)
        {
            float[] outerR = new float[] { radius, radius, radius, radius, radius, radius, radius, radius };

            // creating normal state drawable
            var normalFront = new ShapeDrawable(new RoundRectShape(outerR, null, null));

            normalFront.SetPadding(padding, padding, padding, padding);

            var normalBack = new ShapeDrawable(new RoundRectShape(outerR, null, null));

            normalBack.SetPadding(border, border, border, border);

            if (style == 0)                           // flat
            {
                normalFront.Paint.Color = Color.Transparent;
                normalBack.Paint.Color  = theme.LightAccentColor;
                editText.SetTextColor(theme.VeryLightAccentColor);
            }
            else if (style == 1)                      // box
            {
                normalFront.Paint.Color = Color.White;
                normalBack.Paint.Color  = theme.LightAccentColor;
                editText.SetTextColor(theme.BackgroundColor);
            }
            else if (style == 2)                      // transparent
            {
                normalFront.Paint.Color = Color.Transparent;
                normalBack.Paint.Color  = Color.Transparent;
                editText.SetTextColor(theme.BackgroundColor);
            }

            Drawable[]    d      = { normalBack, normalFront };
            LayerDrawable normal = new LayerDrawable(d);

            editText.SetBackgroundDrawable(normal);

            editText.SetHintTextColor(theme.VeryLightAccentColor);

            if (textAppearance == FlatUI.FlatTextAppearance.Dark)
            {
                editText.SetTextColor(theme.DarkAccentColor);
            }
            else if (textAppearance == FlatUI.FlatTextAppearance.Light)
            {
                editText.SetTextColor(theme.VeryLightAccentColor);
            }

            var typeface = FlatUI.GetFont(editText.Context, fontFamily, fontWeight);

            if (typeface != null)
            {
                editText.SetTypeface(typeface, TypefaceStyle.Normal);
            }
        }
Beispiel #7
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.login, container, false);

            loginButton        = view.FindViewById <Button>(Resource.Id.loginButton);
            usernameEditText   = view.FindViewById <EditText>(Resource.Id.usernameEditText);
            pwdEditText        = view.FindViewById <EditText>(Resource.Id.pwdEditText);
            loginButton.Click += delegate
            {
                if (usernameEditText.Text != "" && pwdEditText.Text != "")
                {
                    usernameEditText.SetBackgroundDrawable(this.Context.GetDrawable(Resource.Drawable.rounder_corner_login));
                    pwdEditText.SetBackgroundDrawable(this.Context.GetDrawable(Resource.Drawable.rounder_corner_login));
                }
                else
                {
                    usernameEditText.SetBackgroundDrawable(this.Context.GetDrawable(Resource.Drawable.rounder_corner_login_red));
                    pwdEditText.SetBackgroundDrawable(this.Context.GetDrawable(Resource.Drawable.rounder_corner_login_red));
                }
            };
            return(view);
        }
Beispiel #8
0
        private bool validateRegister()
        {
            bool validate = true;

            if (loginTxt.Text.Trim().Length < 5)
            {
                loginTxt.Text = "";
                loginTxt.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                Toast.MakeText(this, "Login jest za krótki!", ToastLength.Long).Show();
                validate = false;
            }
            if ((password2Txt.Text != passwordTxt.Text))
            {
                passwordTxt.Text  = "";
                password2Txt.Text = "";
                // registerBar.Visibility = ViewStates.Invisible;
                passwordTxt.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                password2Txt.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                validate = false;
                Toast.MakeText(this, "Podane hasła są różne!", ToastLength.Long).Show();
            }
            if (passwordTxt.Text.Length < 5)
            {
                passwordTxt.Text  = "";
                password2Txt.Text = "";
                // registerBar.Visibility = ViewStates.Invisible;
                passwordTxt.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                password2Txt.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                Toast.MakeText(this, "Hasło jest krótsze niż 5 znaków!", ToastLength.Long).Show();
                validate = false;
            }
            if (!Android.Util.Patterns.EmailAddress.Matcher(email.Text.Trim()).Matches())
            {
                email.Text = "";
                email.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                Toast.MakeText(this, "Adres email jest nieprawidłowy!", ToastLength.Long).Show();
                validate = false;
            }
            if (_mediaFile == null)
            {
                Toast.MakeText(this, "Nie wybrano zdjęcia!", ToastLength.Long).Show();
                validate = false;
            }
            if (!validate)
            {
                scroll.SmoothScrollTo(0, 0);
            }

            progressBar.Visibility = ViewStates.Invisible;
            return(validate);
        }
Beispiel #9
0
        private async Task <bool> validateUpdate()
        {
            bool validate = true;

            if (!Android.Util.Patterns.EmailAddress.Matcher(email.Text).Matches())
            {
                email.Text = "";
                email.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                Toast.MakeText(this, "Adres e-mail jest nieprawidłowy", ToastLength.Long).Show();
                validate = false;
            }
            if (await APIHelper.findEmail(email.Text))
            {
                Toast.MakeText(this, "Email " + email.Text + " jest już zajęty", ToastLength.Long).Show();
                email.Text = "";
                validate   = false;
            }

            return(validate);
        }
        private bool validate()
        {
            bool valid = true;

            if (GlobalHelper.GenerateSHA512(actualPassword.Text) == GlobalMemory._user.Password)
            {
                if (GlobalHelper.GenerateSHA512(newPassword1.Text) == GlobalMemory._user.Password)
                {
                    actualPassword.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                    actualPassword.Text = "";
                    Toast.MakeText(this, "Podane hasło jest identyczne z aktualnym!", ToastLength.Long).Show();
                    valid = false;
                }
                else
                {
                    if (newPassword1.Text != newPassword2.Text)
                    {
                        newPassword1.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                        newPassword2.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                        newPassword1.Text = "";
                        newPassword2.Text = "";
                        Toast.MakeText(this, "Podane hasła muszą być identyncze!", ToastLength.Long).Show();
                        valid = false;
                    }
                    if (newPassword1.Text.Length < 5)
                    {
                        newPassword1.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                        newPassword2.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                        newPassword1.Text = "";
                        newPassword2.Text = "";
                        Toast.MakeText(this, "Haslo musi mieć minimum 5 znaków!", ToastLength.Long).Show();

                        valid = false;
                    }
                }
            }
            progressBar.Visibility = ViewStates.Invisible;
            return(valid);
        }
Beispiel #11
0
        protected void SetButtons()
        {
            Button addState = FindViewById <Button>(Resource.Id.addState);

            addState.Click += delegate {
                AddState();
            };
            Button addSymbol = FindViewById <Button>(Resource.Id.addSymbol);

            addSymbol.Click += delegate {
                AddSymbol();
            };
            Button startMachine = FindViewById <Button>(Resource.Id.startMachine);

            startMachine.Click += delegate {
                EndWork();
                StartWork();
            };
            EditText inputView = FindViewById <EditText>(Resource.Id.input);

            inputView.TextChanged += delegate {
                inputView.SetBackgroundDrawable(editTextDrawable);
            };
        }
Beispiel #12
0
        public void setItemLogin()
        {
            var txtFormat = Android.Util.ComplexUnitType.Px;

            linearButtonLogin   = new LinearLayout(this);
            linearEditTextLogin = new LinearLayout(this);
            linearTextLogin     = new LinearLayout(this);



            etxtUser        = new EditText(this);
            etxtPassword    = new EditText(this);
            btnLoginInto    = new ImageButton(this);
            txtLogin_a      = new TextView(this);
            txtLogin_b      = new TextView(this);
            txtInicioSesion = new TextView(this);

            linearButtonLogin.LayoutParameters   = new LinearLayout.LayoutParams(-1, LinearLayout.LayoutParams.WrapContent);
            linearEditTextLogin.LayoutParameters = new LinearLayout.LayoutParams(-1, LinearLayout.LayoutParams.WrapContent);
            linearTextLogin.LayoutParameters     = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);

            etxtUser.LayoutParameters     = new ViewGroup.LayoutParams(Configuration.getWidth(507), Configuration.getHeight(78));
            etxtPassword.LayoutParameters = new ViewGroup.LayoutParams(Configuration.getWidth(507), Configuration.getHeight(78));


            linearButtonLogin.Orientation = Orientation.Horizontal;
            linearButtonLogin.SetGravity(GravityFlags.Center);
            linearEditTextLogin.Orientation = Orientation.Vertical;
            linearEditTextLogin.SetGravity(GravityFlags.Center);
            linearTextLogin.Orientation = Orientation.Vertical;
            linearTextLogin.SetGravity(GravityFlags.Center);



            etxtUser.Hint     = "  Usuario";
            etxtUser.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

            etxtPassword.Hint      = "  Contraseña";
            etxtPassword.InputType = Android.Text.InputTypes.TextVariationPassword | Android.Text.InputTypes.ClassText;
            etxtPassword.Typeface  = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");
            etxtPassword.InputType = InputTypes.TextVariationVisiblePassword;

            txtLogin_a.Text     = "FORGOT PASSWORD?";
            txtLogin_a.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

            txtLogin_b.Text     = "            CHANGE";
            txtLogin_b.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

            txtLogin_a.SetTextSize(txtFormat, Configuration.getHeight(30));
            txtLogin_b.SetTextSize(txtFormat, Configuration.getHeight(30));


            txtInicioSesion.Text     = "Iniciar Sesión";
            txtInicioSesion.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");
            txtInicioSesion.SetTextColor(Color.ParseColor("#ffffff"));
            txtInicioSesion.SetTextSize(Android.Util.ComplexUnitType.Px, Configuration.getHeight(36));

            btnLoginInto.SetImageBitmap(Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/otherlogin.png"), Configuration.getWidth(242), Configuration.getHeight(78), true));
            etxtUser.SetTextColor(Color.ParseColor("#ffffff"));
            etxtPassword.SetTextColor(Color.ParseColor("#ffffff"));



            btnLoginInto.Click += delegate {
                _dialog.Show();
                var com = ((LoginViewModel)this.DataContext).LoginCommand;
                com.Execute(null);
                //AlertDialog.Builder popupBuilder = new AlertDialog.Builder(this);
            };

            initButtonColor(btnLoginInto);

            etxtPassword.InputType            = InputTypes.TextVariationVisiblePassword;
            etxtPassword.TransformationMethod = Android.Text.Method.PasswordTransformationMethod.Instance;

            txtLogin_a.SetTextColor(Color.ParseColor("#ffffff"));
            txtLogin_b.SetTextColor(Color.ParseColor("#00c6ff"));


            Drawable drawableEditText = new BitmapDrawable(Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/cajatexto.png"), Configuration.getWidth(507), Configuration.getHeight(80), true));

            etxtUser.SetBackgroundDrawable(drawableEditText);
            etxtPassword.SetBackgroundDrawable(drawableEditText);

            etxtUser.SetSingleLine(true);
            etxtPassword.SetSingleLine(true);

            LinearLayout space = new LinearLayout(this);

            space.LayoutParameters = new LinearLayout.LayoutParams(-1, 20);


            linearTextLogin.AddView(txtLogin_a);

            linearTextLogin.AddView(txtLogin_b);

            //linearButtonLogin.AddView (btnLoginInto);
            //linearButtonLogin.AddView (linearTextLogin);

            linearEditTextLogin.AddView(etxtUser);
            linearEditTextLogin.AddView(space);
            linearEditTextLogin.AddView(etxtPassword);


            txtInicioSesion.SetX(Configuration.getWidth(75)); txtInicioSesion.SetY(Configuration.getHeight(680));
            linearEditTextLogin.SetX(0); linearEditTextLogin.SetY(Configuration.getHeight(741));
            //linearButtonLogin.SetX (0); linearButtonLogin.SetY (Configuration.getHeight(978));


            btnLoginInto.SetX(Configuration.getWidth(45)); btnLoginInto.SetY(Configuration.getHeight(980));
            linearTextLogin.SetX(Configuration.getWidth(345)); linearTextLogin.SetY(Configuration.getHeight(995));

            relLogin.AddView(txtInicioSesion);
            relLogin.AddView(linearEditTextLogin);
            //relLogin.AddView (linearButtonLogin);
            relLogin.AddView(btnLoginInto);
            relLogin.AddView(linearTextLogin);

            ((LoginViewModel)this.ViewModel).PropertyChanged += Login_propertyChanged;;



            var set = this.CreateBindingSet <LoginView, LoginViewModel>();

            set.Bind(etxtUser).To(vm => vm.Username);
            set.Bind(etxtPassword).To(vm => vm.Password);
            set.Apply();

            mainLayout.AddView(relLogin);
        }
Beispiel #13
0
        private void CheckRegister(bool findLogin)
        {
            if (findLogin || login.Text.Trim() == String.Empty)
            {
                goodRegister           = false;
                login.Text             = "";
                registerBar.Visibility = ViewStates.Invisible;
                scrollV.SmoothScrollTo(0, 0);
                login.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
            }
            else
            {
                login.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
            }

            if (password1.Text.Trim() != password2.Text.Trim() || password1.Text.Trim() == String.Empty)
            {
                goodRegister   = false;
                password1.Text = "";
                password2.Text = "";
                scrollV.SmoothScrollTo(0, 0);
                registerBar.Visibility = ViewStates.Invisible;
                password1.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                password2.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
            }
            else
            {
                password1.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
                password2.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
            }
            if (name.Text.Trim() == String.Empty)
            {
                name.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                goodRegister           = false;
                registerBar.Visibility = ViewStates.Invisible;
            }
            else
            {
                name.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
            }

            if (lastName.Text.Trim() == String.Empty)
            {
                lastName.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                goodRegister           = false;
                registerBar.Visibility = ViewStates.Invisible;
            }
            else
            {
                lastName.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
            }

            if (passsportNumber.Text.Trim() == String.Empty)
            {
                passsportNumber.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                goodRegister           = false;
                registerBar.Visibility = ViewStates.Invisible;
            }
            else
            {
                passsportNumber.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
            }

            if (nationality.Text.Trim() == String.Empty)
            {
                nationality.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                goodRegister           = false;
                registerBar.Visibility = ViewStates.Invisible;
            }
            else
            {
                nationality.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
            }

            if (city.Text.Trim() == String.Empty)
            {
                city.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                goodRegister           = false;
                registerBar.Visibility = ViewStates.Invisible;
            }
            else
            {
                city.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
            }

            if (street.Text.Trim() == String.Empty)
            {
                street.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                goodRegister           = false;
                registerBar.Visibility = ViewStates.Invisible;
            }
            else
            {
                street.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
            }

            if (postCode.Text.Trim() == String.Empty)
            {
                postCode.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder));
                goodRegister           = false;
                registerBar.Visibility = ViewStates.Invisible;
            }
            else
            {
                postCode.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
            }
        }
Beispiel #14
0
        public void init()
        {
            mainLayout           = new RelativeLayout(this);
            txtRegister          = new TextView(this);
            etxtEmail            = new EditText(this);
            etxtUser             = new EditText(this);
            etxtPassword         = new EditText(this);
            btnCreateAccount     = new ImageButton(this);
            linearButtonRegister = new LinearLayout(this);
            linearRegister       = new LinearLayout(this);


            linearButtonRegister.LayoutParameters = new LinearLayout.LayoutParams(-1, LinearLayout.LayoutParams.WrapContent);
            linearRegister.LayoutParameters       = new LinearLayout.LayoutParams(-1, LinearLayout.LayoutParams.WrapContent);
            linearButtonRegister.Orientation      = Orientation.Horizontal;
            linearRegister.Orientation            = Orientation.Vertical;
            linearButtonRegister.SetGravity(GravityFlags.Center);
            linearRegister.SetGravity(GravityFlags.Center);

            etxtUser.LayoutParameters     = new ViewGroup.LayoutParams(Configuration.getWidth(507), Configuration.getHeight(78));
            etxtPassword.LayoutParameters = new ViewGroup.LayoutParams(Configuration.getWidth(507), Configuration.getHeight(78));
            etxtEmail.LayoutParameters    = new ViewGroup.LayoutParams(Configuration.getWidth(507), Configuration.getHeight(78));



            mainLayout.LayoutParameters = new RelativeLayout.LayoutParams(-1, -1);
            Drawable drawableBackground = new BitmapDrawable(Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/afondo.png"), 768, 1024, true));

            mainLayout.SetBackgroundDrawable(drawableBackground);


            txtRegister.Text     = "Registro";
            txtRegister.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


            etxtUser.Hint     = "  Nombre de usuario";
            etxtUser.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


            etxtEmail.Hint     = "  Dirección de correo";
            etxtEmail.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


            etxtPassword.Hint     = "  Contraseña";
            etxtPassword.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


            Drawable drawableEditText = new BitmapDrawable(Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/cajatexto.png"), Configuration.getWidth(507), Configuration.getHeight(80), true));

            etxtUser.SetBackgroundDrawable(drawableEditText);
            etxtPassword.SetBackgroundDrawable(drawableEditText);
            etxtEmail.SetBackgroundDrawable(drawableEditText);

            etxtUser.SetTextColor(Color.ParseColor("#ffffff"));
            etxtUser.SetHintTextColor(Color.ParseColor("#ffffff"));
            etxtUser.SetSingleLine(true);
            etxtPassword.SetTextColor(Color.ParseColor("#ffffff"));
            etxtPassword.SetHintTextColor(Color.ParseColor("#ffffff"));
            etxtPassword.SetSingleLine(true);
            etxtEmail.SetTextColor(Color.ParseColor("#ffffff"));
            etxtEmail.SetHintTextColor(Color.ParseColor("#ffffff"));
            etxtEmail.SetSingleLine(true);

            txtRegister.SetTextColor(Color.ParseColor("#ffffff"));
            txtRegister.SetTextSize(Android.Util.ComplexUnitType.Px, Configuration.getHeight(40));

            etxtPassword.InputType            = InputTypes.TextVariationVisiblePassword;
            etxtPassword.TransformationMethod = Android.Text.Method.PasswordTransformationMethod.Instance;

            btnCreateAccount.SetImageBitmap(Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/crearcuenta.png"), Configuration.getWidth(507), Configuration.getHeight(80), true));
            btnCreateAccount.Alpha = 255;
            //btn.SetAlpha(255);
            btnCreateAccount.SetBackgroundColor(Color.Transparent);


            LinearLayout space = new LinearLayout(this);

            space.LayoutParameters = new LinearLayout.LayoutParams(-1, 20);
            LinearLayout space2 = new LinearLayout(this);

            space2.LayoutParameters = new LinearLayout.LayoutParams(-1, 20);

            linearRegister.AddView(etxtUser);
            linearRegister.AddView(space);
            linearRegister.AddView(etxtEmail);
            linearRegister.AddView(space2);
            linearRegister.AddView(etxtPassword);

            linearButtonRegister.AddView(btnCreateAccount);

            txtRegister.SetX(Configuration.getWidth(72)); txtRegister.SetY(Configuration.getHeight(535));
            linearRegister.SetX(0); linearRegister.SetY(Configuration.getHeight(592));
            linearButtonRegister.SetX(0); linearButtonRegister.SetY(Configuration.getHeight(975));
            mainLayout.AddView(txtRegister);
            mainLayout.AddView(linearRegister);
            mainLayout.AddView(linearButtonRegister);

            //string ndef = "None" ;

            //string foto = "http://www.clinicatorielli.com/img/icons/no-user.png";

            EditText lastName = new EditText(this);

            lastName.Text = "None";

            EditText url = new EditText(this);

            url.Text = "http://www.clinicatorielli.com/img/icons/no-user.png";

            var set = this.CreateBindingSet <RegisterView, RegisterViewModel>();

            set.Bind(etxtUser).To(vm => vm.RegUsername);
            set.Bind(etxtEmail).To(vm => vm.Email);
            set.Bind(etxtPassword).To(vm => vm.RegPassword);
            set.Bind(etxtUser).To(vm => vm.Name);


            set.Apply();

            btnCreateAccount.Click += delegate {
                var com = ((RegisterViewModel)this.DataContext).RegisterCommand;
                com.Execute(null);
            };
        }
Beispiel #15
0
		public void setItemLogin(){



			var txtFormat = Android.Util.ComplexUnitType.Px;

			linearButtonLogin = new LinearLayout (this);
			linearEditTextLogin = new LinearLayout (this);
			linearTextLogin = new LinearLayout (this);



			etxtUser = new EditText (this);
			etxtPassword = new EditText (this);
			btnLoginInto = new ImageButton (this);
			txtLogin_a = new TextView (this);
			txtLogin_b = new TextView (this);
			txtInicioSesion = new TextView (this);

			linearButtonLogin.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearEditTextLogin.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearTextLogin.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);

			etxtUser.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));
			etxtPassword.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));


			linearButtonLogin.Orientation = Orientation.Horizontal;
			linearButtonLogin.SetGravity (GravityFlags.Center);
			linearEditTextLogin.Orientation = Orientation.Vertical;
			linearEditTextLogin.SetGravity (GravityFlags.Center);
			linearTextLogin.Orientation = Orientation.Vertical;
			linearTextLogin.SetGravity (GravityFlags.Center);



			etxtUser.Hint = "  Usuario"; 
			etxtUser.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			etxtPassword.Hint = "  Contraseña";
			etxtPassword.InputType = Android.Text.InputTypes.TextVariationPassword | Android.Text.InputTypes.ClassText;
			etxtPassword.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");
			etxtPassword.InputType = InputTypes.TextVariationVisiblePassword;

			txtLogin_a.Text = "FORGOT PASSWORD?";
			txtLogin_a.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtLogin_b.Text = "            CHANGE";
			txtLogin_b.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtLogin_a.SetTextSize (txtFormat,Configuration.getHeight(30));
			txtLogin_b.SetTextSize (txtFormat, Configuration.getHeight (30));


			txtInicioSesion.Text = "Iniciar Sesión";
			txtInicioSesion.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");
			txtInicioSesion.SetTextColor (Color.ParseColor("#ffffff"));
			txtInicioSesion.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (36));

			btnLoginInto.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/otherlogin.png"),Configuration.getWidth (242), Configuration.getHeight (78),true));
			etxtUser.SetTextColor (Color.ParseColor ("#ffffff"));
			etxtPassword.SetTextColor (Color.ParseColor ("#ffffff"));



			btnLoginInto.Click += delegate {
				_dialog.Show();
				var com = ((LoginViewModel)this.DataContext).LoginCommand;
				com.Execute(null);
				//AlertDialog.Builder popupBuilder = new AlertDialog.Builder(this);




			};

			initButtonColor (btnLoginInto);

			etxtPassword.InputType = InputTypes.TextVariationVisiblePassword;
			etxtPassword.TransformationMethod = Android.Text.Method.PasswordTransformationMethod.Instance;

			txtLogin_a.SetTextColor (Color.ParseColor ("#ffffff"));
			txtLogin_b.SetTextColor (Color.ParseColor ("#00c6ff"));


			Drawable drawableEditText = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/cajatexto.png"), Configuration.getWidth(507), Configuration.getHeight(80), true));
			etxtUser.SetBackgroundDrawable (drawableEditText);
			etxtPassword.SetBackgroundDrawable (drawableEditText);

			etxtUser.SetSingleLine (true);
			etxtPassword.SetSingleLine (true);

			LinearLayout space = new LinearLayout (this);
			space.LayoutParameters = new LinearLayout.LayoutParams (-1, 20);


			linearTextLogin.AddView (txtLogin_a);

			linearTextLogin.AddView (txtLogin_b);

			//linearButtonLogin.AddView (btnLoginInto);
			//linearButtonLogin.AddView (linearTextLogin);

			linearEditTextLogin.AddView (etxtUser);
			linearEditTextLogin.AddView (space);
			linearEditTextLogin.AddView (etxtPassword);


			txtInicioSesion.SetX (Configuration.getWidth(75)); txtInicioSesion.SetY (Configuration.getHeight(680));
			linearEditTextLogin.SetX (0); linearEditTextLogin.SetY (Configuration.getHeight(741));
			//linearButtonLogin.SetX (0); linearButtonLogin.SetY (Configuration.getHeight(978));


			btnLoginInto.SetX (Configuration.getWidth (45));btnLoginInto.SetY (Configuration.getHeight (980));
			linearTextLogin.SetX (Configuration.getWidth (345));linearTextLogin.SetY (Configuration.getHeight(995));

			relLogin.AddView (txtInicioSesion);
			relLogin.AddView (linearEditTextLogin);
			//relLogin.AddView (linearButtonLogin);
			relLogin.AddView(btnLoginInto);
			relLogin.AddView (linearTextLogin);

			((LoginViewModel)this.ViewModel).PropertyChanged += Login_propertyChanged;;



			var set = this.CreateBindingSet<LoginView, LoginViewModel>();
			set.Bind(etxtUser).To(vm => vm.Username);
			set.Bind(etxtPassword).To(vm => vm.Password);
			set.Apply(); 

			mainLayout.AddView (relLogin);
		}
		public static void SetTheme(EditText editText, FlatTheme theme, 
			FlatUI.FlatFontFamily fontFamily, FlatUI.FlatFontWeight fontWeight, FlatUI.FlatTextAppearance textAppearance,
			int style, int radius, int padding, int border)
		{
			float[] outerR = new float[]{radius, radius, radius, radius, radius, radius, radius, radius};

			// creating normal state drawable
			var normalFront = new ShapeDrawable(new RoundRectShape(outerR, null, null));
			normalFront.SetPadding(padding, padding, padding, padding);

			var normalBack = new ShapeDrawable(new RoundRectShape(outerR, null, null));
			normalBack.SetPadding(border, border, border, border);

			if (style == 0) {             // flat
				normalFront.Paint.Color = Color.Transparent;
				normalBack.Paint.Color = theme.LightAccentColor;
				editText.SetTextColor(theme.VeryLightAccentColor);

			} else if (style == 1) {      // box
				normalFront.Paint.Color = Color.White;
				normalBack.Paint.Color = theme.LightAccentColor;
				editText.SetTextColor(theme.BackgroundColor);

			} else if (style == 2) {      // transparent
				normalFront.Paint.Color = Color.Transparent;
				normalBack.Paint.Color = Color.Transparent;
				editText.SetTextColor(theme.BackgroundColor);
			}

			Drawable[] d = {normalBack, normalFront};
			LayerDrawable normal = new LayerDrawable(d);

			editText.SetBackgroundDrawable(normal);

			editText.SetHintTextColor(theme.VeryLightAccentColor);

			if (textAppearance == FlatUI.FlatTextAppearance.Dark) editText.SetTextColor(theme.DarkAccentColor);
			else if (textAppearance == FlatUI.FlatTextAppearance.Light) editText.SetTextColor(theme.VeryLightAccentColor);

			var typeface = FlatUI.GetFont(editText.Context, fontFamily, fontWeight);
			if (typeface != null)
				editText.SetTypeface(typeface, TypefaceStyle.Normal);
		}
Beispiel #17
0
		public void init(){
			mainLayout = new RelativeLayout (this);
			txtRegister = new TextView (this);
			etxtEmail = new EditText (this);
			etxtUser = new EditText (this);
			etxtPassword = new EditText (this);
			btnCreateAccount = new ImageButton (this);
			linearButtonRegister = new LinearLayout (this);
			linearRegister = new LinearLayout (this);


			linearButtonRegister.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent);
			linearRegister.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent);
			linearButtonRegister.Orientation = Orientation.Horizontal;
			linearRegister.Orientation = Orientation.Vertical;
			linearButtonRegister.SetGravity (GravityFlags.Center);
			linearRegister.SetGravity (GravityFlags.Center);

			etxtUser.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));
			etxtPassword.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));
			etxtEmail.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));
				
	


			mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1);
			Drawable drawableBackground = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/cfondo.png"), 768, 1024, true));
			mainLayout.SetBackgroundDrawable (drawableBackground);


			txtRegister.Text = "Registro";
			txtRegister.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


			etxtUser.Hint ="  Nombre de usuario";
			etxtUser.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


			etxtEmail.Hint = "  Dirección de correo";
			etxtEmail.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


			etxtPassword.Hint ="  Contraseña";
			etxtPassword.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


			Drawable drawableEditText = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/cajatexto.png"), Configuration.getWidth (507), Configuration.getHeight (80), true));

			etxtUser.SetBackgroundDrawable (drawableEditText);
			etxtPassword.SetBackgroundDrawable (drawableEditText);
			etxtEmail.SetBackgroundDrawable (drawableEditText);

			etxtUser.SetTextColor (Color.ParseColor ("#ffffff"));
			etxtUser.SetSingleLine (true);
			etxtPassword.SetTextColor (Color.ParseColor ("#ffffff"));
			etxtPassword.SetSingleLine (true);
			etxtEmail.SetTextColor (Color.ParseColor ("#ffffff"));
			etxtEmail.SetSingleLine (true);

			txtRegister.SetTextColor (Color.ParseColor("#ffffff"));
			txtRegister.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (40));

			etxtPassword.InputType = InputTypes.TextVariationVisiblePassword;
			etxtPassword.TransformationMethod = Android.Text.Method.PasswordTransformationMethod.Instance;

			btnCreateAccount.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/crearcuenta.png"), Configuration.getWidth (507), Configuration.getHeight (80), true));
			btnCreateAccount.Alpha = 255;
			//btn.SetAlpha(255);
			btnCreateAccount.SetBackgroundColor(Color.Transparent);


			LinearLayout space = new LinearLayout (this);
			space.LayoutParameters = new LinearLayout.LayoutParams (-1, 20);
			LinearLayout space2 = new LinearLayout (this);
			space2.LayoutParameters = new LinearLayout.LayoutParams (-1, 20);

			linearRegister.AddView (etxtUser);
			linearRegister.AddView (space);
			linearRegister.AddView (etxtEmail);
			linearRegister.AddView (space2);
			linearRegister.AddView (etxtPassword);

			linearButtonRegister.AddView (btnCreateAccount);

			txtRegister.SetX (Configuration.getWidth(72)); txtRegister.SetY (Configuration.getHeight(535));
			linearRegister.SetX (0); linearRegister.SetY (Configuration.getHeight(592));
			linearButtonRegister.SetX (0); linearButtonRegister.SetY (Configuration.getHeight(975));
			mainLayout.AddView (txtRegister);
			mainLayout.AddView (linearRegister);
			mainLayout.AddView (linearButtonRegister);

			//string ndef = "None" ;

			//string foto = "http://www.clinicatorielli.com/img/icons/no-user.png";

			EditText lastName = new EditText (this);
			lastName.Text = "None";

			EditText url = new EditText (this);
			url.Text = "http://www.clinicatorielli.com/img/icons/no-user.png";

			var set = this.CreateBindingSet<RegisterView, RegisterViewModel>();
			set.Bind(etxtUser).To(vm=>vm.RegUsername);
			set.Bind(etxtEmail).To(vm=>vm.Email);
			set.Bind(etxtPassword).To(vm=>vm.RegPassword);
			set.Bind(etxtUser).To(vm=>vm.Name);


			set.Apply ();

			btnCreateAccount.Click += delegate {
				var com = ((RegisterViewModel)this.DataContext).RegisterCommand;
				com.Execute (null);
			};


		}