Exemple #1
0
        private void SetReturnType(RoundedEntry entry)
        {
            ReturnType type = entry.ReturnType;

            switch (type)
            {
            case ReturnType.Go:
                Control.ImeOptions = ImeAction.Go;
                Control.SetImeActionLabel("Go", ImeAction.Go);
                break;

            case ReturnType.Next:
                Control.ImeOptions = ImeAction.Next;
                Control.SetImeActionLabel("Next", ImeAction.Next);
                break;

            case ReturnType.Send:
                Control.ImeOptions = ImeAction.Send;
                Control.SetImeActionLabel("Send", ImeAction.Send);
                break;

            case ReturnType.Search:
                Control.ImeOptions = ImeAction.Search;
                Control.SetImeActionLabel("Search", ImeAction.Search);
                break;

            default:
                Control.ImeOptions = ImeAction.Done;
                Control.SetImeActionLabel("Done", ImeAction.Done);
                break;
            }
        }
Exemple #2
0
 /// <summary>
 /// constructor
 /// </summary>
 public TempPrediction(ushort refIndex, ushort[] data)
 {
     _refIndex = refIndex;
     _entries  = new RoundedEntry[data.Length];
     for (int i = 0; i < data.Length; i++)
     {
         _entries[i] = new RoundedEntry(data[i]);
     }
 }
Exemple #3
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || e.NewElement == null)
            {
                return;
            }

            view = (RoundedEntry)Element;
            var editText = this.Control;

            if (view.IsCurvedCornersEnabled)
            {
                // creating gradient drawable for the curved background
                var gradientBackground = new GradientDrawable();
                gradientBackground.SetShape(ShapeType.Rectangle);
                gradientBackground.SetColor(view.BackgroundColor.ToAndroid());

                // Thickness of the stroke line
                gradientBackground.SetStroke(view.BorderWidth, view.BorderColor.ToAndroid());

                // Radius for the curves
                gradientBackground.SetCornerRadius(
                    DpToPixels(this.Context,
                               Convert.ToSingle(view.CornerRadius)));

                // set the background of the label
                Control.SetBackground(gradientBackground);
            }

            // Set padding for the internal text from border
            Control.SetPadding(view.SidePadding, 0, view.SidePadding, 0);
            Control.Gravity = Android.Views.GravityFlags.CenterVertical;
            // Set Image for entry control
            if (!string.IsNullOrEmpty(view.Image))
            {
                switch (view.ImageAlignment)
                {
                case ImageAlignment.Left:
                    editText.SetCompoundDrawablesWithIntrinsicBounds(GetDrawable(view.Image), null, null, null);
                    break;

                case ImageAlignment.Right:
                    editText.SetCompoundDrawablesWithIntrinsicBounds(null, null, GetDrawable(view.Image), null);
                    break;
                }
            }
            Control.CompoundDrawablePadding = 20;
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || e.NewElement == null)
            {
                return;
            }

            element = (RoundedEntry)this.Element;
            var editText = this.Control;

            var gradientDrawable = new GradientDrawable();

            gradientDrawable.SetCornerRadius(60f);
            gradientDrawable.SetStroke(2, Android.Graphics.Color.Gray);
            gradientDrawable.SetColor(Android.Graphics.Color.White);
            editText.SetBackground(gradientDrawable);

            editText.SetPadding(15, Control.PaddingTop, Control.PaddingRight, Control.PaddingBottom);
            if (!string.IsNullOrEmpty(element.Image))
            {
                switch (element.ImageAlignment)
                {
                case ImageAlignment.Left:
                    editText.SetCompoundDrawablesWithIntrinsicBounds(GetDrawable(element.Image), null, null, null);
                    break;

                case ImageAlignment.Right:
                    editText.SetCompoundDrawablesWithIntrinsicBounds(null, null, GetDrawable(element.Image), null);
                    break;
                }
            }
            //if(e.OldElement == null)
            //{
            //   var gradientDrawable = new GradientDrawable();
            //    gradientDrawable.SetCornerRadius(60f);
            //    gradientDrawable.SetStroke(2, Android.Graphics.Color.Gray);
            //    gradientDrawable.SetColor(Android.Graphics.Color.White);
            //    Control.SetBackground(gradientDrawable);

            //    Control.SetPadding(50, Control.PaddingTop, Control.PaddingRight, Control.PaddingBottom);

            //}
        }
        Entry CreateEntry(string placeholder = "", int marginBottom = 0, string bindingPropName = "")
        {
            RoundedEntry entry = new RoundedEntry()
            {
                Placeholder      = placeholder,
                Margin           = new Thickness(20, 0, 20, marginBottom),
                PlaceholderColor = ColorPalette.DarkBlue,
                TextAreaColor    = Color.White,
                FontSize         = 13,
                FontAttributes   = FontAttributes.Bold
            };

            if (!string.IsNullOrWhiteSpace(bindingPropName))
            {
                entry.SetBinding(Entry.TextProperty, new Binding(bindingPropName, source: ViewModel));
            }

            return(entry);
        }
        private void ConfigureScreen()
        {
            StackLayout socialMediaLoginButtons = new StackLayout()
            {
                Children =
                {
                    new SocialMediaButton()
                    {
                        HeightRequest     = 60,
                        Margin            = new Thickness(10, -10, 10, 0),
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        Button            = new RoundedButton()
                        {
                            Text            = "Entre com o Facebook",
                            TextColor       = Color.White,
                            FontAttributes  = FontAttributes.Bold,
                            BackgroundColor = ColorPalette.LightBlue,
                            FontSize        = 15,
                            Command         = ViewModel.Register
                        },
                        Icon = new Icon()
                        {
                            FileName = "facebook.svg",
                            CentralizeHorizontally = false,
                            Color = Color.White
                        }
                    },
                    new SocialMediaButton()
                    {
                        HeightRequest     = 60,
                        Margin            = new Thickness(10, -20, 10, 0),
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        Button            = new RoundedButton()
                        {
                            Text              = "Entre com o Google",
                            TextColor         = Color.White,
                            FontAttributes    = FontAttributes.Bold,
                            BackgroundColor   = ColorPalette.LightBlue,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            VerticalOptions   = LayoutOptions.CenterAndExpand,
                            FontSize          = 15,
                            Command           = ViewModel.Register
                        },
                        Icon = new Icon()
                        {
                            FileName = "gmail.svg",
                            CentralizeHorizontally = false,
                            //Margin = 5,
                            Color = Color.White
                        },
                    }
                }
            };

            Margin          = new Thickness(15, 25);
            VerticalOptions = LayoutOptions.Fill;


            name = new RoundedEntry()
            {
                Placeholder      = "Nome",
                Margin           = new Thickness(20, 0, 20, 0),
                PlaceholderColor = ColorPalette.DarkBlue,
                TextAreaColor    = Color.White,
                FontSize         = 13,
                FontAttributes   = FontAttributes.Bold
            };

            datePicker = new DatePicker
            {
                MinimumDate = new DateTime(2018, 1, 1),
                MaximumDate = new DateTime(2018, 12, 31),
                Date        = new DateTime(2018, 6, 21)
            };

            birthday = new RoundedEntry()
            {
                Placeholder      = "Nascimento",
                Margin           = new Thickness(20, 0, 20, 0),
                PlaceholderColor = ColorPalette.DarkBlue,
                TextAreaColor    = Color.White,
                FontSize         = 13,

                FontAttributes = FontAttributes.Bold
            };

            Content = new StackLayout()
            {
                Children =
                {
                    new Icon()
                    {
                        Margin            = new Thickness(0, 8, 0, 0),
                        FileName          = "logo_baliza.svg",
                        WidthRequest      = App.ScreenWidth / 3,
                        HeightRequest     = App.ScreenWidth / 3,
                        Color             = Color.White,
                        HorizontalOptions = LayoutOptions.Center,
                    },
                    new Label()
                    {
                        TextColor = Color.White,
                        Text      = "cadastro".ToUpper(),
                        HorizontalTextAlignment = TextAlignment.Center,
                        HorizontalOptions       = LayoutOptions.CenterAndExpand,
                        FontSize = 16,
                        Margin   = new Thickness(10)
                    },
                    name,
                    birthday,
                    //new Label()
                    //{
                    //    TextColor = Color.White,
                    //    Text = "ou",
                    //    HorizontalTextAlignment = TextAlignment.Center,
                    //    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    //    FontSize = 15
                    //},
                    //socialMediaLoginButtons,
                    new Button()
                    {
                        BackgroundColor = ColorPalette.Pink,
                        TextColor       = Color.White,
                        Text            = "Cadastrar".ToUpper(),
                        FontAttributes  = FontAttributes.Bold,
                        FontSize        = 17,
                        BorderRadius    = 18,
                        Margin          = 10,
                        HeightRequest   = 55,
                        //Padding = new Thickness(13),
                        VerticalOptions = LayoutOptions.EndAndExpand,
                        Command         = ViewModel.Register
                    },
                }
            };
            name.TextChanged += CompletedText;
        }