Exemple #1
0
        void AddToolbarItems()
        {
#if __ANDROID__
            var actionButton = new FloatingActionButton(Forms.Context);

            actionButton.SetImageResource(XFDraw.Droid.Resource.Drawable.trash);
            actionButton.Click += (s, e) => OnClearClicked();

            var actionButtonFrame = new FrameLayout(Forms.Context);
            actionButtonFrame.SetClipToPadding(false);
            actionButtonFrame.SetPadding(0, 0, 50, 50);
            actionButtonFrame.AddView(actionButton);

            var actionButtonFrameView = actionButtonFrame.ToView();
            actionButtonFrameView.HorizontalOptions = LayoutOptions.End;
            actionButtonFrameView.VerticalOptions   = LayoutOptions.End;


            mainLayout.Children.Add(actionButtonFrameView, 0, 1);
#else
            clearCommand = new Command(OnClearClicked, () => { return(IsCanvasDirty); });

            var trash = new ToolbarItem()
            {
                Text    = "Clear",
                Icon    = "trash.png",
                Command = clearCommand
            };

            ToolbarItems.Add(trash);
#endif
        }
Exemple #2
0
        public override View GetView(View view, int position)
        {
            var      itemData = menuItems[position];
            View     root     = layoutInflater.Inflate(Resource.Layout.WheelTextLayout, null, false);
            TextView textView = root.FindViewById <TextView>(Resource.Id.wheel_menu_item_tv);

            textView.Visibility = ViewStates.Visible;
            textView.SetTextSize(Android.Util.ComplexUnitType.Sp, 14);
            textView.Text = itemData.mTitle;
            if (textView.LayoutParameters is FrameLayout.LayoutParams)
            {
                ((FrameLayout.LayoutParams)textView.LayoutParameters).Gravity = mGravity;
            }
            if (position == 4)
            {
                textView.SetTextColor(Android.Graphics.Color.Red);
            }
            if (position == 0)
            {
                FrameLayout container = root.FindViewById <FrameLayout>(Resource.Id.TextContainer);
                container.SetBackgroundColor(Android.Graphics.Color.Transparent);
                container.SetBackgroundResource(Resource.Drawable.slice_happy);
                container.SetMinimumHeight(340);
                container.SetPadding(0, 0, 0, 0);
                //container.s
            }
            return(root);
        }
        private void InitialMethod()
        {
            //frame
            frame       = new FrameLayout(con);
            totalHeight = con.Resources.DisplayMetrics.HeightPixels;
            totalWidth  = con.Resources.DisplayMetrics.WidthPixels;

            TypedValue tv = new TypedValue();

            if (con.Theme.ResolveAttribute(Android.Resource.Attribute.ActionBarSize, tv, true))
            {
                actionBarHeight = TypedValue.ComplexToDimensionPixelSize(tv.Data, con.Resources.DisplayMetrics);
            }
            navigationBarHeight = getNavigationBarHeight(con);
            totalHeight         = totalHeight - navigationBarHeight - actionBarHeight;
            width   = con.Resources.DisplayMetrics.WidthPixels - 40;
            density = con.Resources.DisplayMetrics.Density;

            //mainFrameLayout
            FrameLayout mainFrameLayout = new FrameLayout(con);

            mainFrameLayout.SetPadding(10, 10, 10, 10);
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.FillVertical);
            mainFrameLayout.LayoutParameters = layoutParams;

            //mainLayout
            mainLayout = new LinearLayout(con);
            mainLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            mainLayout.SetGravity(GravityFlags.FillVertical);
            mainLayout.Orientation = Orientation.Vertical;
            mainLayout.SetBackgroundColor(Color.White);
        }
Exemple #4
0
        public HSVColorPickerDialog(Context context, Color initialColor, Action <Color> listener)
            : base(context)
        {
            this.selectedColor = initialColor;
            this.listener      = listener;

            colorWheel  = new HSVColorWheel(context);
            valueSlider = new HSVValueSlider(context);
            var padding    = (int)(context.Resources.DisplayMetrics.Density * PADDING_DP);
            var borderSize = (int)(context.Resources.DisplayMetrics.Density * BORDER_DP);
            var layout     = new RelativeLayout(context);

            var lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);

            lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP);
            colorWheel.setListener((color) => valueSlider.SetColor(color, true));
            colorWheel.setColor(initialColor);
            colorWheel.Id = (1);
            layout.AddView(colorWheel, lp);

            int selectedColorHeight = (int)(context.Resources.DisplayMetrics.Density * SELECTED_COLOR_HEIGHT_DP);

            var valueSliderBorder = new FrameLayout(context);

            valueSliderBorder.SetBackgroundColor(BORDER_COLOR);
            valueSliderBorder.SetPadding(borderSize, borderSize, borderSize, borderSize);
            valueSliderBorder.Id = (2);
            lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize);
            lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP);
            lp.AddRule(LayoutRules.Below, 1);
            layout.AddView(valueSliderBorder, lp);

            valueSlider.SetColor(initialColor, false);
            valueSlider.SetListener((color) =>
            {
                selectedColor = color;
                selectedColorView.SetBackgroundColor(color);
            });
            valueSliderBorder.AddView(valueSlider);

            var selectedColorborder = new FrameLayout(context);

            selectedColorborder.SetBackgroundColor(BORDER_COLOR);
            lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize);
            selectedColorborder.SetPadding(borderSize, borderSize, borderSize, borderSize);
            lp.AddRule(LayoutRules.Below, 2);
            layout.AddView(selectedColorborder, lp);

            selectedColorView = new View(context);
            selectedColorView.SetBackgroundColor(selectedColor);
            selectedColorborder.AddView(selectedColorView);

            SetButton((int)DialogButtonType.Negative, context.GetString(Android.Resource.String.Cancel), ClickListener);
            SetButton((int)DialogButtonType.Positive, context.GetString(Android.Resource.String.Ok), ClickListener);

            SetView(layout, padding, padding, padding, padding);
        }
Exemple #5
0
        public void ShowPrompt(string title, string message,
                               string affirmButton, string denyButton,
                               Action <string> onAffirm, Action onDeny = null,
                               string text = "", string placeholder = "",
                               Func <string, bool> affirmEnableFunc = null,
                               bool isPassword = false)
        {
            Utilities.Dispatch(() => {
                var context = GetActivityContext();
                var frame   = new FrameLayout(context);
                var txt     = new EditText(context)
                {
                    Text = text,
                    Hint = placeholder
                };

                if (isPassword)
                {
                    txt.InputType = InputTypes.TextVariationPassword;
                }

                frame.SetPadding(50, 0, 50, 0);
                frame.AddView(txt);


                _Dialog = new AlertDialog.Builder(context)
                          .SetMessage(message)
                          .SetTitle(title)
                          .SetView(frame)
                          .SetPositiveButton(affirmButton, (o, e) =>
                {
                    HideKeyboard(txt);
                    onAffirm?.Invoke(txt.Text);
                })
                          .SetNegativeButton(denyButton, (o, e) =>
                {
                    HideKeyboard(txt);
                    onDeny?.Invoke();
                })
                          .SetOnDismissListener(new RestoreSIMDismissHandler
                {
                    DialogService = this
                })
                          .Show();

                ShowKeyboard(txt);

                if (affirmEnableFunc != null && _Dialog is AlertDialog dlg)
                {
                    var positiveButton     = dlg.GetButton((int)DialogButtonType.Positive);
                    positiveButton.Enabled = affirmEnableFunc(txt.Text);
                    txt.TextChanged       += (sender, e) => positiveButton.Enabled = affirmEnableFunc(txt.Text);
                }
            });
        }
        private void OptionLayout()
        {
            //propertylayout
            propertylayout             = new LinearLayout(context);
            propertylayout.Orientation = Android.Widget.Orientation.Vertical;
            showlabel = showLabelPosition;
            snapsto   = SnapsTo.None;

            //propertyLabel
            TextView propertyLabel = new TextView(context);

            propertyLabel.SetTextColor(Color.ParseColor("#282828"));
            propertyLabel.Gravity  = GravityFlags.CenterVertical;
            propertyLabel.TextSize = 18;
            propertyLabel.SetPadding(0, 10, 0, 10);
            propertyLabel.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.Left | GravityFlags.CenterHorizontal);
            propertyLabel.Text             = "  " + "OPTIONS";

            //closeLabel
            TextView closeLabel = new TextView(context);

            closeLabel.SetBackgroundColor(Color.Transparent);
            closeLabel.Gravity          = GravityFlags.CenterVertical;
            closeLabel.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Right | GravityFlags.CenterHorizontal);
            closeLabel.SetBackgroundResource(Resource.Drawable.sfclosebutton);

            //closeLayout
            FrameLayout closeLayout = new FrameLayout(context);

            closeLayout.SetBackgroundColor(Color.Transparent);
            closeLayout.SetPadding(0, 10, 0, 10);
            closeLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Right | GravityFlags.CenterHorizontal);
            closeLayout.AddView(closeLabel);

            //topProperty
            topProperty = new FrameLayout(context);
            topProperty.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            topProperty.SetBackgroundColor(Color.Rgb(230, 230, 230));
            topProperty.AddView(propertyLabel);
            topProperty.AddView(closeLayout);
            topProperty.Touch += (object sendar, View.TouchEventArgs e) =>
            {
                propertyFrameLayout.RemoveAllViews();
                buttomButtonLayout.RemoveAllViews();
                buttomButtonLayout.AddView(propertyButton);
            };
            proprtyOptionsLayout             = new LinearLayout(context);
            proprtyOptionsLayout.Orientation = Android.Widget.Orientation.Vertical;

            //spaceText
            TextView spaceText1 = new TextView(context);

            spaceText1.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 40, GravityFlags.Center);
            proprtyOptionsLayout.AddView(spaceText1);
        }
        public HSVColorPickerDialog(Context context, Color initialColor, Action<Color> listener)
            : base(context)
        {
            this.selectedColor = initialColor;
            this.listener = listener;

            colorWheel = new HSVColorWheel(context);
            valueSlider = new HSVValueSlider(context);
            var padding = (int)(context.Resources.DisplayMetrics.Density * PADDING_DP);
            var borderSize = (int)(context.Resources.DisplayMetrics.Density * BORDER_DP);
            var layout = new RelativeLayout(context);

            var lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP);
            colorWheel.setListener((color) => valueSlider.SetColor(color, true));
            colorWheel.setColor(initialColor);
            colorWheel.Id = (1);
            layout.AddView(colorWheel, lp);

            int selectedColorHeight = (int)(context.Resources.DisplayMetrics.Density * SELECTED_COLOR_HEIGHT_DP);

            var valueSliderBorder = new FrameLayout(context);
            valueSliderBorder.SetBackgroundColor(BORDER_COLOR);
            valueSliderBorder.SetPadding(borderSize, borderSize, borderSize, borderSize);
            valueSliderBorder.Id = (2);
            lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize);
            lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP);
            lp.AddRule(LayoutRules.Below, 1);
            layout.AddView(valueSliderBorder, lp);

            valueSlider.SetColor(initialColor, false);
            valueSlider.SetListener((color) =>
            {
                selectedColor = color;
                selectedColorView.SetBackgroundColor(color);
            });
            valueSliderBorder.AddView(valueSlider);

            var selectedColorborder = new FrameLayout(context);
            selectedColorborder.SetBackgroundColor(BORDER_COLOR);
            lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize);
            selectedColorborder.SetPadding(borderSize, borderSize, borderSize, borderSize);
            lp.AddRule(LayoutRules.Below, 2);
            layout.AddView(selectedColorborder, lp);

            selectedColorView = new View(context);
            selectedColorView.SetBackgroundColor(selectedColor);
            selectedColorborder.AddView(selectedColorView);

            SetButton((int)DialogButtonType.Negative, context.GetString(Android.Resource.String.Cancel), ClickListener);
            SetButton((int)DialogButtonType.Positive, context.GetString(Android.Resource.String.Ok), ClickListener);

            SetView(layout, padding, padding, padding, padding);
        }
Exemple #8
0
        private void OptionViewLayout()
        {
            /****************
            **Options View**
            ****************/
            TextView propertyLabel = new TextView(context);

            propertyLabel.SetTextColor(Color.ParseColor("#282828"));
            propertyLabel.Gravity  = GravityFlags.CenterVertical;
            propertyLabel.TextSize = 18;
            propertyLabel.SetPadding(0, 10, 0, 10);
            propertyLabel.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.Left | GravityFlags.CenterHorizontal);
            propertyLabel.Text             = "  " + "OPTIONS";

            //CloseLabel
            closeLabel = new TextView(context);
            closeLabel.SetBackgroundColor(Color.Transparent);
            closeLabel.Gravity          = GravityFlags.CenterVertical;
            closeLabel.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Right | GravityFlags.CenterHorizontal);
            closeLabel.SetBackgroundResource(Resource.Drawable.sfclosebutton);

            //CloseLayout
            FrameLayout closeLayout = new FrameLayout(context);

            closeLayout.SetBackgroundColor(Color.Transparent);
            closeLayout.SetPadding(0, 10, 0, 10);
            closeLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Right | GravityFlags.CenterHorizontal);
            closeLayout.AddView(closeLabel);

            //TopProperty
            topProperty = new FrameLayout(context);
            topProperty.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            topProperty.SetBackgroundColor(Color.Rgb(230, 230, 230));
            topProperty.AddView(propertyLabel);
            topProperty.AddView(closeLayout);

            //topProperty Touch Event
            topProperty.Touch += (object sendar, View.TouchEventArgs e) =>
            {
                propertyFrameLayout.RemoveAllViews();
                buttomButtonLayout.RemoveAllViews();
                buttomButtonLayout.AddView(propertyButton);
                mainPageScrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                propPageScrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.0003));
            };
            proprtyOptionsLayout             = new LinearLayout(context);
            proprtyOptionsLayout.Orientation = Android.Widget.Orientation.Vertical;

            //SpaceText
            TextView spaceText1 = new TextView(context);

            spaceText1.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 38, GravityFlags.Center);
            proprtyOptionsLayout.AddView(spaceText1);
        }
        public View GetSampleContent(Context con)
        {
            int   width       = con.Resources.DisplayMetrics.WidthPixels - 40;
            float density     = con.Resources.DisplayMetrics.Density;
            int   numerHeight = (int)(density * 55);

            if (density >= 3)
            {
                numerHeight = (int)(density * 65);
            }

            SamplePageContent(con);

            //AdultNumericUpDown
            adultNumericUpDown                      = new SfNumericUpDown(con);
            adultNumericUpDown.FontSize             = 18;
            adultNumericUpDown.TextGravity          = GravityFlags.CenterVertical;
            adultNumericUpDown.LayoutParameters     = new ViewGroup.LayoutParams(width, numerHeight);
            adultNumericUpDown.Minimum              = 0;
            adultNumericUpDown.Maximum              = 100;
            adultNumericUpDown.Value                = 5;
            adultNumericUpDown.FormatString         = "N";
            adultNumericUpDown.AutoReverse          = false;
            adultNumericUpDown.MaximumDecimalDigits = 0;
            adultNumericUpDown.StepValue            = 1;

            //InfantsNumericUpDown
            infantsNumericUpDown                      = new SfNumericUpDown(con);
            infantsNumericUpDown.FontSize             = 18;
            infantsNumericUpDown.TextGravity          = GravityFlags.CenterVertical;
            infantsNumericUpDown.LayoutParameters     = new ViewGroup.LayoutParams(width, numerHeight);
            infantsNumericUpDown.Minimum              = 0;
            infantsNumericUpDown.Maximum              = 100;
            infantsNumericUpDown.Value                = 2;
            infantsNumericUpDown.FormatString         = "N";
            infantsNumericUpDown.AutoReverse          = false;
            infantsNumericUpDown.MaximumDecimalDigits = 0;
            infantsNumericUpDown.StepValue            = 1;

            //MainFrameLayout
            FrameLayout mainFrameLayout = new FrameLayout(con);

            mainFrameLayout.SetPadding(10, 10, 10, 10);
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.FillVertical);
            mainFrameLayout.LayoutParameters = layoutParams;
            mainFrameLayout.AddView(GetView(con));
            ScrollView mainScrollView = new ScrollView(con);

            mainScrollView.AddView(mainFrameLayout);

            return(mainScrollView);
        }
        protected ViewGroup CreateConceptContainer(View child)
        {
            var container = new FrameLayout(Activity.BaseContext);
            var llLP      = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);

            llLP.Gravity = GravityFlags.Bottom;
            llLP.SetMargins(ToPx(2), 0, ToPx(2), 0);                    // Set spacing
            container.SetPadding(ToPx(2), ToPx(2), ToPx(2), ToPx(2));   // Set spacing
            container.LayoutParameters = llLP;
            container.AddView(child);

            return(container);
        }
        void RefreshSample(Sample selectedSample)
        {
            FrameLayout layout = (FrameLayout)FindViewById(Resource.Id.samplearea);

            layout.SetPadding(5, 5, 5, 5);
            layout.SetBackgroundColor(Color.White);
            selectedPageSample = selectedSample;
            ImageView settingsImage = (ImageView)FindViewById(Resource.Id.settings);

            if (propertyIndent != null && propertyWindow != null)
            {
                propertyWindow.Finish();
            }
            if (sample != null)
            {
                sample.Destroy();
            }
            propertyIndent = new Intent(this, typeof(PropertyWindow));
            TextView textView = (TextView)FindViewById(Resource.Id.title_text);

            textView.Text = selectedSample.Title;
            RelativeLayout settingButton = (RelativeLayout)FindViewById(Resource.Id.settingsParent);
            RelativeLayout textParent    = (RelativeLayout)FindViewById(Resource.Id.textParent);

            textParent.Click += (object sender, EventArgs e) => {
                OnBackButtonPressed();
            };
            bool isClassExists = Type.GetType("SampleBrowser." + selectedSample.Name) != null;

            if (isClassExists)
            {
                var handle = Activator.CreateInstance(null, "SampleBrowser." + selectedSample.Name);
                sample = (SamplePage)handle.Unwrap();
                layout.RemoveAllViews();
                layout.AddView(sample.GetSampleContent(this));
                if (sample.GetPropertyWindowLayout(this) == null)
                {
                    settingsImage.Visibility = ViewStates.Invisible;
                    settingButton.Clickable  = false;
                }
                else
                {
                    settingsImage.Visibility = ViewStates.Visible;
                    settingButton.Clickable  = true;
                }
            }
        }
        private void FinalLayout()
        {
            //frame
            frame.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            frame.SetBackgroundColor(Color.White);
            frame.SetPadding(10, 10, 10, 10);

            //scrollView1
            ScrollView scrollView1 = new ScrollView(con);

            scrollView1.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.7), GravityFlags.Top | GravityFlags.CenterHorizontal);
            scrollView1.AddView(linearLayout);
            frame.AddView(scrollView1);

            //buttomButtonLayout
            buttomButtonLayout = new FrameLayout(con);
            buttomButtonLayout.SetBackgroundColor(Color.Transparent);
            buttomButtonLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.1), GravityFlags.Bottom | GravityFlags.CenterHorizontal);

            //propertyButton
            propertyButton = new Button(con);
            propertyButton.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Bottom | GravityFlags.CenterHorizontal);
            propertyButton.Text             = "OPTIONS";
            propertyButton.Gravity          = GravityFlags.Start;

            //propertyFrameLayout
            propertyFrameLayout = new FrameLayout(con);
            propertyFrameLayout.SetBackgroundColor(Color.Rgb(240, 240, 240));
            propertyFrameLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.3), GravityFlags.CenterHorizontal);
            propertyFrameLayout.AddView(GetPropertyLayout(con));
            propertyButton.Click += (object sender, EventArgs e) =>
            {
                buttomButtonLayout.RemoveAllViews();
                propertyFrameLayout.RemoveAllViews();
                propertyFrameLayout.AddView(GetPropertyLayout(con));
            };

            //scrollView
            ScrollView scrollView = new ScrollView(con);

            scrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.3), GravityFlags.Bottom | GravityFlags.CenterHorizontal);
            scrollView.AddView(propertyFrameLayout);

            frame.AddView(scrollView);
            frame.AddView(buttomButtonLayout);
            frame.FocusableInTouchMode = true;
        }
Exemple #13
0
        private void FrameLayout(Context context)
        {
            //frame
            frame.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            frame.SetBackgroundColor(Color.Rgb(236, 236, 236));
            frame.SetPadding(10, 10, 10, 10);

            //calendarFrame
            FrameLayout calendarFrame = new FrameLayout(context);

            calendarFrame.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.8), GravityFlags.Top | GravityFlags.CenterHorizontal);

            //bottomButtonLayout
            bottomButtonLayout = new FrameLayout(context);
            bottomButtonLayout.SetBackgroundColor(Color.Transparent);
            bottomButtonLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.1), GravityFlags.Bottom | GravityFlags.CenterHorizontal);

            //propertyButton
            propertyButton = new Button(context);
            propertyButton.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Bottom | GravityFlags.CenterHorizontal);
            propertyButton.Text             = "OPTIONS";
            propertyButton.Gravity          = GravityFlags.Start;

            //propertyFrameLayout
            propertyFrameLayout = new FrameLayout(context);
            propertyFrameLayout.SetBackgroundColor(Color.Rgb(236, 236, 236));
            propertyFrameLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.2), GravityFlags.CenterHorizontal);
            propertyFrameLayout.AddView(GetPropertyLayout(context));
            propertyButton.Click += (object sender, EventArgs e) =>
            {
                bottomButtonLayout.RemoveAllViews();
                propertyFrameLayout.RemoveAllViews();
                propertyFrameLayout.AddView(GetPropertyLayout(context));
            };

            //scrollView
            ScrollView scrollView = new ScrollView(context);

            scrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.2), GravityFlags.Bottom | GravityFlags.CenterHorizontal);
            scrollView.AddView(propertyFrameLayout);

            frame.AddView(mainLayout);
            frame.AddView(scrollView);
            frame.AddView(bottomButtonLayout);
            frame.FocusableInTouchMode = true;
        }
Exemple #14
0
        public MainPage()
        {
            InitializeComponent();



            sketchView.SketchUpdated += OnSketchUpdate;

            clearCommand = new Command(OnClearClicked, () => { return(isCanvasDirty); });

            var trash = new ToolbarItem()
            {
                Text    = "Clear",
                Icon    = "trash.png",
                Command = clearCommand,
            };

            trash.Clicked += (o, s) => OnClearClicked();

            ToolbarItems.Add(trash);

#if __ANDROID__
            var actionButton = new FloatingActionButton(Forms.Context);
            actionButton.SetImageResource(XFDraw.Droid.Resource.Drawable.pencil);
            actionButton.Click += (s, e) =>
            {
                OnColorClicked();
                actionButton.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(sketchView.InkColor.ToAndroid());
            };

            var actionButtonFrame = new FrameLayout(Forms.Context);
            actionButtonFrame.SetClipToPadding(false);
            actionButtonFrame.SetPadding(0, 0, 50, 50);
            actionButtonFrame.AddView(actionButton);

            var actionButtonFrameView = actionButtonFrame.ToView();
            actionButtonFrameView.HorizontalOptions = LayoutOptions.End;
            actionButtonFrameView.VerticalOptions   = LayoutOptions.End;

            mainLayout.Children.Add(actionButtonFrameView);
#else
            ToolbarItems.Add(new ToolbarItem("New Color", "pencil.png", OnColorClicked));
#endif
        }
Exemple #15
0
        public Xamarin.Forms.View CreateFloatingActionButton(Action tappedCallback)
        {
            //Get native control
            var actionButton = new FloatingActionButton(MainActivity.Activity);


            //Set Button background and icon
            actionButton.BackgroundTintList = ColorStateList.ValueOf(global::Android.Graphics.Color.ParseColor("#0098E9"));
            actionButton.SetImageResource(Resource.Drawable.icon);


            //Fix Button margin (this will add a shadow to button)
            float d      = MainActivity.Activity.Resources.DisplayMetrics.Density;
            var   margin = (int)(16 * d); // margin in pixels (margin * dpi)
            var   lp     = new FrameLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            lp.Gravity      = GravityFlags.CenterVertical | GravityFlags.CenterHorizontal;
            lp.LeftMargin   = margin;
            lp.TopMargin    = margin;
            lp.BottomMargin = margin;
            lp.RightMargin  = margin;
            actionButton.LayoutParameters = lp;

            //When Native control is tapped , we will pass the call to Xam.Forms through the Action received
            actionButton.Click += (s, a) => { tappedCallback(); };

            //set the position of button bottom-right corner of container
            var actionButtonFrame = new FrameLayout(MainActivity.Activity);

            actionButtonFrame.SetClipToPadding(true);
            actionButtonFrame.SetPadding(0, 0, 50, 50);
            actionButtonFrame.AddView(actionButton);

            //Convert native control  to Xam.Forms View  and return it to Xam.Forms
            var actionButtonFrameView = actionButtonFrame.ToView();

            actionButtonFrameView.HorizontalOptions = LayoutOptions.End;
            actionButtonFrameView.VerticalOptions   = LayoutOptions.End;

            return(actionButtonFrameView);
        }
Exemple #16
0
        public MyBaseEventVisual(Context context) : base(context)
        {
            _normalGrid = new LinearLayout(context)
            {
                Orientation      = Orientation.Horizontal,
                LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent)
            };

            _normalGrid.SetVerticalGravity(GravityFlags.Top);

            base.SetForegroundGravity(GravityFlags.Top | GravityFlags.FillHorizontal);

            _additionalItemsVisual = new MyAdditionalItemsVisual(context)
            {
                LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent)
            };
            _normalGrid.AddView(_additionalItemsVisual);

            base.AddView(_normalGrid);

            var expandedMargin = ThemeHelper.AsPx(context, -3);

            _expandedContainer = new FrameLayout(context)
            {
                Visibility       = ViewStates.Gone,
                Background       = ContextCompat.GetDrawable(context, Resource.Drawable.expanded_schedule_items_background),
                LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent)
                {
                    LeftMargin   = expandedMargin,
                    TopMargin    = expandedMargin,
                    RightMargin  = expandedMargin,
                    BottomMargin = expandedMargin
                }
            };
            _expandedContainer.SetPadding(0, ThemeHelper.AsPx(context, 6), 0, ThemeHelper.AsPx(context, 6));

            base.AddView(_expandedContainer);
        }
Exemple #17
0
        private View CreateView()
        {
            FrameLayout parent = new FrameLayout(Activity);

            parent.LayoutParameters = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent,
                                                                   FrameLayout.LayoutParams.MatchParent);
            viewBg = new View(Activity);
            viewBg.LayoutParameters = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent,
                                                                   FrameLayout.LayoutParams.MatchParent);
            viewBg.SetBackgroundColor(Color.Argb(136, 0, 0, 0));
            viewBg.Id = ActionSheet.BG_VIEW_ID;
            viewBg.SetOnClickListener(this);

            panel = new LinearLayout(Activity);
            FrameLayout.LayoutParams layoutParams =
                new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.WrapContent);
            layoutParams.Gravity   = GravityFlags.Bottom;
            panel.LayoutParameters = layoutParams;
            panel.Orientation      = AWD_O.Vertical;
            parent.SetPadding(0, 0, 0, GetNavBarHeight(Activity));
            parent.AddView(viewBg);
            parent.AddView(panel);
            return(parent);
        }
Exemple #18
0
        public override View GetSampleContent(Context con)
        {
            float        height = con.Resources.DisplayMetrics.HeightPixels;;
            LinearLayout layout = new LinearLayout(con);
            Typeface     tf     = Typeface.CreateFromAsset(con.Assets, "Segoe_MDL2_Assets.ttf");

            layout.Orientation  = Android.Widget.Orientation.Vertical;
            sfpicker            = new SfPicker(con);
            sfpicker.ShowHeader = true;
            List <String> source = new List <string>();

            source.Add("Yellow");
            source.Add("Green");
            source.Add("Orange");
            source.Add("Lime");
            source.Add("LightBlue");
            source.Add("Pink");
            source.Add("SkyBlue");
            source.Add("White");
            source.Add("Red");
            source.Add("Aqua");
            sfpicker.ItemsSource      = source;
            sfpicker.LayoutParameters = new ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, (int)(height * 0.60));
            sfpicker.PickerMode       = PickerMode.Default;
            sfpicker.ShowFooter       = false;

            sfpicker.SelectedItemTextSize    = 20 * con.Resources.DisplayMetrics.Density;
            sfpicker.UnSelectedItemTextSize  = 20 * con.Resources.DisplayMetrics.Density;
            sfpicker.HeaderHeight            = 40 * con.Resources.DisplayMetrics.Density;
            sfpicker.ShowColumnHeader        = false;
            sfpicker.UnSelectedItemTextColor = Color.Black;
            sfpicker.SelectedIndex           = 7;
            float density = con.Resources.DisplayMetrics.Density;

            eventLog = new TextView(con);
            eventLog.LayoutParameters = new ViewGroup.LayoutParams(800, 400);
            layout.SetGravity(GravityFlags.CenterHorizontal);
            layout.AddView(sfpicker);
            string headerText1 = "PICK A COLOR";

            sfpicker.ShowHeader  = true;
            sfpicker.HeaderText  = headerText1;
            sfpicker.BorderColor = Color.Red;
            TextView textview = new TextView(con);

            textview.Text     = "Event Log";
            textview.Typeface = tf;
            textview.SetTextColor(Color.Black);

            textview.TextSize = 20;
            if (density > 2)
            {
                textview.SetPadding(20, 0, 0, 20);
            }
            else
            {
                textview.SetPadding(10, 0, 0, 10);
            }
            layout.AddView(textview);
            var scrollviewer = new ScrollView(con);
            var textFrame    = new LinearLayout(con);

            textFrame.Orientation = Android.Widget.Orientation.Vertical;
            scrollviewer.AddView(textFrame);
            scrollviewer.VerticalScrollBarEnabled = true;
            FrameLayout bottomFrame = new FrameLayout(con);

            bottomFrame.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(height));
            bottomFrame.SetBackgroundColor(Color.Silver);
            bottomFrame.AddView(scrollviewer);
            bottomFrame.SetPadding(10, 30, 10, 0);
            layout.AddView(bottomFrame);
            sfpicker.ColumnHeaderText = "COLOR";


            sfpicker.OnSelectionChanged += (sender, e) =>
            {
                eventLog = new TextView(con);
                eventLog.SetTextColor(Color.Black);
                if (textFrame.ChildCount == 6)
                {
                    textFrame.RemoveViewAt(0);
                }

                textFrame.AddView(eventLog);
                eventLog.Text = (e.NewValue).ToString() + " " + "has been Selected";
                Color color = PickerHelper.GetColor(e.NewValue.ToString());
                sfpicker.SetBackgroundColor(color);
                sfpicker.Background.Alpha = 128;
                // scrollviewer.ScrollTo(0, textFrame.Bottom);
            };

            return(layout);
        }
        void populateList()
        {
            var frameLoading = FindViewById <FrameLayout>(Resource.Id.frameLoading);
            var mainLayout   = FindViewById <LinearLayout>(Resource.Id.mainLayout);

            mainLayout.RemoveAllViews();

            frameLoading.Visibility = ViewStates.Visible;

            string fullString;

            if (File.Exists(filename))
            {
                fullString = File.ReadAllText(filename);
            }
            else
            {
                fullString = new StreamReader(Assets.Open("DeviceList.txt")).ReadToEnd();
                writeFile(fullString);
            }


            string[] lineString = fullString.Split('\n');
            string[,] dev = new string[lineString.Length, 3];


            for (int i = 1; i < lineString.Length; i++)
            {
                dev[i, 0] = lineString[i].Split('#')[0];
                dev[i, 1] = lineString[i].Split('#')[1];
                dev[i, 2] = lineString[i].Split('#')[2];

                var frame = new FrameLayout(this);
                frame.SetBackgroundColor(Android.Graphics.Color.Rgb(71, 75, 54));
                frame.SetPadding(10, 10, 10, 10);

                var textSwitch = new TextView(this);
                textSwitch.SetPadding(10, 10, 10, 10);
                textSwitch.SetTextSize(Android.Util.ComplexUnitType.Dip, 25);
                textSwitch.SetPadding(10, 7, 10, 10);
                textSwitch.Gravity = GravityFlags.FillVertical;

                var selectSwitch = new Switch(this);
                selectSwitch.SetPadding(10, 14, 10, 10);
                selectSwitch.Gravity = GravityFlags.FillVertical;

                var spaceDivider = new Space(this);
                spaceDivider.SetMinimumHeight(10);

                textSwitch.Text = dev[i, 0];

                selectSwitch.Tag = i;

                selectSwitch.CheckedChange += (sender, e) => {
                    if (selectSwitch.Checked)
                    {
                        turnOnDevice(dev[(int)selectSwitch.Tag, 0] /*Device Name*/, dev[(int)selectSwitch.Tag, 1] /*DeviceOn Serial*/);
                    }
                    else
                    {
                        turnOffDevice(dev[(int)selectSwitch.Tag, 0] /*Device Name*/, dev[(int)selectSwitch.Tag, 2] /*DeviceOff Serial*/);
                    }
                };

                frame.AddView(textSwitch);
                frame.AddView(selectSwitch);

                mainLayout.AddView(frame);
                mainLayout.AddView(spaceDivider);
            }

            frameLoading.Visibility = ViewStates.Gone;
        }
        private void StartBot()
        {
            this.RunOnUiThread(() =>
            {
                Toast.MakeText(this, Resource.String.botrun_starting, ToastLength.Short).Show();

                var nb = new Notification.Builder(this);
                nb.SetContentTitle(this.GetString(Resource.String.servicenotif_botrunning));
                nb.SetContentText(this.GetString(Resource.String.servicenotif_botopen));
                nb.SetSmallIcon(Resource.Drawable.Iconmini);
                nb.SetOngoing(true);
                nb.SetAutoCancel(false);

                this.ServiceNotification = nb.Build();

                this.ServiceNotificationIntent = new Intent(this, this.GetType());
                this.ServiceNotificationIntent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop);
                var intent = PendingIntent.GetActivity(this, 0, this.ServiceNotificationIntent, 0);

                this.ServiceNotification.SetLatestEventInfo(this, this.GetString(Resource.String.servicenotif_botrunning), this.GetString(Resource.String.servicenotif_botopen), intent);
                this.ServiceNotification.Flags |= NotificationFlags.NoClear | NotificationFlags.OngoingEvent;

                this.NotificationManager.Notify(PERMID_NOTIFICATION, this.ServiceNotification);
            });

            var pth = Environment.ExternalStorageDirectory.AbsolutePath;

            pth = Path.Combine(pth, "emzi0767", "companioncube");

            if (!Directory.Exists(pth))
            {
                Directory.CreateDirectory(pth);
            }

            var utf8 = new UTF8Encoding(false);
            var aid  = Settings.System.GetString(this.ContentResolver, Settings.Secure.AndroidId);
            var akey = utf8.GetBytes(aid);
            var aiv  = new byte[16];
            var rng  = new RNGCryptoServiceProvider();
            var cc   = 0ul;

            pth = Path.Combine(pth, "settings.bin");
            if (File.Exists(pth))
            {
                using (var fs = File.OpenRead(pth))
                    using (var br = new BinaryReader(fs))
                        aiv = br.ReadBytes(aiv.Length);
            }
            else
            {
                rng.GetBytes(aiv);
            }

            cc = BitConverter.ToUInt16(aiv, 0);

            using (var sha256 = SHA256Managed.Create())
                for (var i = 0u; i < cc; i++)
                {
                    akey = sha256.ComputeHash(akey);
                }

            var token = "";

            using (var aes = RijndaelManaged.Create())
            {
                if (!File.Exists(pth))
                {
                    this.RunOnUiThread(() =>
                    {
                        var dm = Resources.DisplayMetrics;

                        var et = new EditText(this)
                        {
                            InputType = InputTypes.ClassText | InputTypes.TextVariationPassword
                        };
                        et.Hint             = this.GetString(Resource.String.token_dialog_placeholder);
                        et.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);

                        var fl = new FrameLayout(this);
                        fl.SetPadding((int)(20 * dm.Density), 0, (int)(20 * dm.Density), 0);
                        fl.AddView(et);

                        var adb = new AlertDialog.Builder(this);
                        adb.SetTitle(Resource.String.token_dialog_title);
                        adb.SetMessage(Resource.String.token_dialog_message);
                        adb.SetView(fl);
                        adb.SetPositiveButton(Resource.String.token_dialog_confirm, delegate { this.CloseDialog(); token = et.Text; this.ContinueStartup(token, akey, aiv, pth); });
                        adb.SetNegativeButton(Resource.String.token_dialog_cancel, delegate { this.Finish(); });
                        this.Dialog = adb.Create();
                        this.Dialog.Show();
                    });
                }
                else
                {
                    using (var aes_dec = aes.CreateDecryptor(akey, aiv))
                        using (var fs = File.OpenRead(pth))
                            using (var bw = new BinaryReader(fs))
                                using (var cs = new CryptoStream(fs, aes_dec, CryptoStreamMode.Read))
                                {
                                    aiv = bw.ReadBytes(16);
                                    var tkb = new byte[ushort.MaxValue];
                                    var br  = 0;
                                    while ((br = cs.Read(tkb, 0, tkb.Length)) > 0)
                                    {
                                        token = string.Concat(token, utf8.GetString(tkb, 0, br));
                                    }
                                }

                    this.ContinueStartup(token, akey, aiv, pth);
                }
            }
        }
        public Android.Views.View GetView(Com.Syncfusion.Autocomplete.SfAutoComplete autoComplete, string text, int index)
        {
            GC.Collect();
            string contactTypeValue = "", contactImageValue = "", contactNameValue = "", contactNumberValue = "";

            var contactType = autoComplete.DataSource.ElementAt(index);

            foreach (var property in contactType.GetType().GetProperties())
            {
                if (property.Name.Equals("ContactType"))
                {
                    contactTypeValue = (property.GetValue(contactType).ToString().ToLower());
                    contactTypeValue = contactTypeValue.Split('.')[0];
                }
                else if (property.Name.Equals("ContactImage"))
                {
                    contactImageValue = (property.GetValue(contactType).ToString().ToLower());
                    contactImageValue = contactImageValue.Split('.')[0];
                }
                else if (property.Name.Equals("ContactName"))
                {
                    contactNameValue = (property.GetValue(contactType).ToString());
                }
                else if (property.Name.Equals("ContactNumber"))
                {
                    contactNumberValue = (property.GetValue(contactType).ToString());
                }
            }

            ImageView contactTypeImage = new ImageView(autoComplete.Context);

            contactTypeImage.SetImageResource(autoComplete.GetImageResId(contactTypeValue));
            LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams((int)(40 * autoComplete.GetDensity()), (int)(40 * autoComplete.GetDensity()));
            contactTypeImage.LayoutParameters = parms;

            ImageView contactImageImage = new ImageView(autoComplete.Context);

            contactImageImage.SetImageResource(autoComplete.GetImageResId(contactImageValue));
            LinearLayout.LayoutParams parms12 = new LinearLayout.LayoutParams((int)(40 * autoComplete.GetDensity()), (int)(40 * autoComplete.GetDensity()));
            contactImageImage.LayoutParameters = parms12;

            FrameLayout frameLayout = new FrameLayout(autoComplete.Context);

            frameLayout.SetPadding((int)(10 * autoComplete.GetDensity()), (int)(3 * autoComplete.GetDensity()), 0, 0);
            FrameLayout.LayoutParams parmsFrame = new FrameLayout.LayoutParams((int)(50 * autoComplete.GetDensity()), (int)(43 * autoComplete.GetDensity()));
            frameLayout.LayoutParameters = parmsFrame;
            //frameLayout.AddView(contactTypeImage);
            frameLayout.AddView(contactImageImage);


            TextView nameText = new TextView(autoComplete.Context);

            nameText.Text     = contactNameValue;
            nameText.TextSize = 16;

            TextView emailText = new TextView(autoComplete.Context);

            emailText.Text     = contactNumberValue;
            emailText.TextSize = 12;

            LinearLayout textLayout = new LinearLayout(autoComplete.Context);

            textLayout.SetPadding((int)(10 * autoComplete.GetDensity()), (int)(3 * autoComplete.GetDensity()), (int)(3 * autoComplete.GetDensity()), (int)(3 * autoComplete.GetDensity()));
            textLayout.LayoutParameters = new ViewGroup.LayoutParams(autoComplete.LayoutParameters.Width, autoComplete.LayoutParameters.Height);
            textLayout.Orientation      = Android.Widget.Orientation.Vertical;
            textLayout.AddView(nameText);
            textLayout.AddView(emailText);

            LinearLayout linearLayout = new LinearLayout(autoComplete.Context);

            linearLayout.SetPadding((int)(3 * autoComplete.GetDensity()), (int)(3 * autoComplete.GetDensity()), (int)(3 * autoComplete.GetDensity()), (int)(3 * autoComplete.GetDensity()));
            linearLayout.LayoutParameters = new ViewGroup.LayoutParams(autoComplete.LayoutParameters.Width, autoComplete.LayoutParameters.Height);
            linearLayout.Orientation      = Android.Widget.Orientation.Horizontal;
            linearLayout.AddView(frameLayout);
            linearLayout.AddView(textLayout);
            linearLayout.SetGravity(GravityFlags.CenterVertical);

            return(linearLayout);
        }
Exemple #22
0
        private async Task PromptAsync(string message, string title,
                                       string affirmButton, string denyButton,
                                       Action <string> onAffirm, Action onDeny = null,
                                       string text   = "", string placeholder = "",
                                       bool password = false,
                                       Func <string, string, bool> validationFunc = null)
        {
            Utilities.Dispatch(() => {
                var context = GetActivityContext();
                var frame   = new FrameLayout(context);
                var txt     = new EditText(context)
                {
                    Text = text,
                    Hint = placeholder
                };

                if (password)
                {
                    txt.InputType = InputTypes.TextVariationPassword;
                }

                txt.TextChanged += (sender, e) => {
                    if (validationFunc == null || !_canChangePromtText)
                    {
                        _canChangePromtText = true;

                        return;
                    }

                    if (!validationFunc(_oldPromtText, txt.Text))
                    {
                        _canChangePromtText = false;
                        txt.Text            = _oldPromtText;
                    }
                    else
                    {
                        _oldPromtText = txt.Text;
                    }
                };
                frame.SetPadding(50, 0, 50, 0);
                frame.AddView(txt);

                _Dialog = new AlertDialog.Builder(context)
                          .SetMessage(message)
                          .SetTitle(title)
                          .SetView(frame)
                          .SetPositiveButton(affirmButton, (o, e) =>
                {
                    HideKeyboard(txt);
                    onAffirm?.Invoke(txt.Text);
                })
                          .SetNegativeButton(denyButton, (o, e) =>
                {
                    HideKeyboard(txt);
                    onDeny?.Invoke();
                })
                          .SetOnDismissListener(new RestoreSIMDismissHandler {
                    DialogService = this
                })
                          .Show();

                ShowKeyboard(txt);
            });
        }
        private void Init()
        {
            RemoveAllViews();

            Orientation = Orientation.Horizontal;

            LayoutParams lp = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            lp.Gravity       = GravityFlags.CenterVertical;
            LayoutParameters = lp;

            cardImageLayout = new FrameLayout(Context);

            LayoutParams cardImageLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            cardImageLayoutParams.Gravity    = GravityFlags.CenterVertical;
            cardImageLayout.LayoutParameters = cardImageLayoutParams;

            cardImageLayout.SetPadding(0, 0, UiUtils.ToPixels(Context, 8), 0);

            SetCardImageWithoutAnimation(Resource.Drawable.ic_card_cv2);

            cv2TextView = new CV2TextView(Context);

            LayoutParams parameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            parameters.Weight  = 1;
            parameters.Gravity = GravityFlags.Center;


            NeededCVTwoLength = (CurrentCard != CardType.AMEX ? 3 : 4);

            cv2TextView.LayoutParameters = parameters;

            cv2TextView.OnEntryComplete += cardNumber => {
                Complete = true;
                if (OnCreditCardEntered != null)
                {
                    OnCreditCardEntered(cardNumber);
                }
            };

            cv2TextView.OnProgress += position => {
                if (position < (NeededCVTwoLength + 6))
                {
                    if (Complete)
                    {
                        Complete = false;
                    }
                }
            };

            LayoutParams textViewLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent);

            textViewLayoutParams.Gravity = GravityFlags.Center;

            last4CCNosTextView                  = new TextView(Context);
            last4CCNosTextView.Gravity          = GravityFlags.Center;
            last4CCNosTextView.Text             = "0000";
            last4CCNosTextView.LayoutParameters = textViewLayoutParams;
            last4CCNosTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            last4CCNosTextView.TextSize = 18;
            last4CCNosTextView.SetTextColor(Resources.GetColor(Resource.Color.normal_text));
            last4CCNosTextView.Focusable = false;
            last4CCNosTextView.Enabled   = false;
            last4CCNosTextView.SetSingleLine();
            last4CCNosTextView.SetBackgroundDrawable(null);

            AddView(cardImageLayout);
            AddView(last4CCNosTextView);
            AddView(cv2TextView);
        }
Exemple #24
0
        private void MainLayout()
        {
            ArrayAdapter <String> experienceAdapter = new ArrayAdapter <String>(con,
                                                                                Android.Resource.Layout.SimpleListItem1, Experience);

            experienceSpinner.Adapter          = experienceAdapter;
            experienceSpinner.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, con.Resources.GetDimensionPixelSize(Resource.Dimension.auto_picker_ht));
            //mainLayout
            LinearLayout mainLayout = new LinearLayout(con);

            mainLayout.SetPadding(20, 20, 20, 30);
            mainLayout.SetBackgroundColor(Color.White);
            mainLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.6), GravityFlags.Top | GravityFlags.CenterHorizontal);
            mainLayout.Orientation      = Orientation.Vertical;
            mainLayout.AddView(jobSearchLabel);
            mainLayout.AddView(jobSearchLabelSpacing);
            mainLayout.AddView(countryLabel);
            mainLayout.AddView(countryLabelSpacing);
            mainLayout.AddView(countryNameAutoComplete);
            mainLayout.AddView(countryAutoCompleteSpacing);
            mainLayout.AddView(jobFieldLabel);
            mainLayout.AddView(jobFieldLabelSpacing);
            mainLayout.AddView(jobFieldAutoComplete);
            mainLayout.AddView(jobFieldAutoCompleteSpacing);
            mainLayout.AddView(experienceLabel);
            mainLayout.AddView(experienceLabelSpacing);
            mainLayout.AddView(experienceSpinner);
            mainLayout.AddView(experienceSpinnerSpacing);
            mainLayout.AddView(searchButtonSpacing);
            mainLayout.AddView(searchButton);
            mainLayout.Touch += (object sender, View.TouchEventArgs e) =>
            {
                if (countryNameAutoComplete.IsFocused || jobFieldAutoComplete.IsFocused)
                {
                    Rect outRect = new Rect();
                    countryNameAutoComplete.GetGlobalVisibleRect(outRect);
                    jobFieldAutoComplete.GetGlobalVisibleRect(outRect);

                    if (!outRect.Contains((int)e.Event.RawX, (int)e.Event.RawY))
                    {
                        countryNameAutoComplete.ClearFocus();
                        jobFieldAutoComplete.ClearFocus();
                    }
                }
                hideSoftKeyboard((Activity)con);
            };

            frame.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            frame.SetBackgroundColor(Color.White);
            frame.SetPadding(10, 10, 10, 10);

            //scrollView1
            ScrollView scrollView1 = new ScrollView(con);

            scrollView1.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.6), GravityFlags.Top | GravityFlags.CenterHorizontal);
            scrollView1.AddView(mainLayout);
            frame.AddView(scrollView1);

            //buttomButtonLayout
            buttomButtonLayout = new FrameLayout(con);
            buttomButtonLayout.SetBackgroundColor(Color.Transparent);
            buttomButtonLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.1), GravityFlags.Bottom | GravityFlags.CenterHorizontal);

            //propertyButton
            propertyButton = new Button(con);
            propertyButton.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Bottom | GravityFlags.CenterHorizontal);
            propertyButton.Text             = "OPTIONS";
            propertyButton.Gravity          = GravityFlags.Start;
            propertyFrameLayout             = new FrameLayout(con);
            propertyFrameLayout.SetBackgroundColor(Color.Rgb(236, 236, 236));
            propertyFrameLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.4), GravityFlags.CenterHorizontal);
            propertyFrameLayout.AddView(GetPropertyLayout(con));

            //propertyButton Click Listener
            propertyButton.Click += (object sender, EventArgs e) =>
            {
                buttomButtonLayout.RemoveAllViews();
                propertyFrameLayout.RemoveAllViews();
                countryNameAutoComplete.ClearFocus();
                jobFieldAutoComplete.ClearFocus();
                scrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.4), GravityFlags.Bottom | GravityFlags.CenterHorizontal);

                propertyFrameLayout.AddView(GetPropertyLayout(con));
            };

            //scrollView
            scrollView = new ScrollView(con);
            scrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.4), GravityFlags.Bottom | GravityFlags.CenterHorizontal);
            scrollView.AddView(propertyFrameLayout);

            frame.AddView(scrollView);
            frame.AddView(buttomButtonLayout);
            frame.FocusableInTouchMode = true;
        }
        public override View GetSampleContent(Context context)
        {
            mainLayout                  = new LinearLayout(context);
            mainLayout.Orientation      = Orientation.Vertical;
            mainLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            con     = context;
            density = con.Resources.DisplayMetrics.Density;
            TextView about = new TextView(context);

            about.Text = "About Syncfusion";
            if (IsTabletDevice(context))
            {
                about.SetPadding(0, 10, 0, 40);

                about.Gravity = GravityFlags.Center;
            }
            about.SetTextColor(Color.Black);
            about.SetBackgroundColor(Color.Transparent);
            about.TextSize = 10 * density;             //TypedValue.ApplyDimension(ComplexUnitType.Pt, 5, context.Resources.DisplayMetrics);
            mainLayout.AddView(about);
            TextView desc = new TextView(context);

            if (density > 2)
            {
                mainLayout.SetPadding(10, 10, 10, 10);
                about.TextSize = 20;
            }
            else
            {
                about.TextSize = 17;
                mainLayout.SetPadding(5, 5, 5, 5);
            }
            if (IsTabletDevice(context))
            {
                desc.Text = "\tSyncfusion is the enterprise technology partner of choice for software development, delivering \n \n a broad range of web, mobile, and desktop controls coupled with a service-oriented approach \n \n throughout the entire application lifecycle. Syncfusion has established itself as the trusted\n\n partner worldwide for use in applications.";
            }
            else
            {
                desc.Text = "\tSyncfusion is the enterprise technology partner of choice for software development, delivering a broad range of web, mobile, and desktop controls coupled with a service-oriented approach throughout the entire application lifecycle. Syncfusion has established itself as the trusted partner worldwide for use in applications.";
            }

            desc.SetTextColor(Color.Black);
            desc.SetBackgroundColor(Color.Transparent);
            //desc.TextSize =5 * density; //TypedValue.ApplyDimension(ComplexUnitType.Pt, 3.5f, context.Resources.DisplayMetrics);
            mainLayout.AddView(desc);

            FrameLayout backFrame = new FrameLayout(context);

            backFrame.SetBackgroundColor(Color.Gray);
            mainLayout.AddView(backFrame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
            FrameLayout frontFrame = new FrameLayout(context);

            frontFrame.SetBackgroundColor(Color.White);
            frontFrame.SetPadding(5, 5, 5, 5);
            touchDraw      = new Button(context);
            touchDraw.Text = "Tap here to follow us";
            touchDraw.SetTextColor(Color.Blue);
            touchDraw.SetBackgroundColor(Color.Transparent);
            //touchDraw.TextSize = 10 * density; //TypedValue.ApplyDimension(ComplexUnitType.Pt, 3, context.Resources.DisplayMetrics);
            frontFrame.AddView(touchDraw, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.Center));
            Typeface typeface = Typeface.CreateFromAsset(context.Assets, "socialicons.ttf");

            radialMenu                = new SfRadialMenu(context);
            radialMenu.RimColor       = Color.Transparent;
            radialMenu.SelectionColor = Color.Transparent;


            FrameLayout facebookLayout = new FrameLayout(context);

            facebookLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent);
            ImageView facebookImage = new ImageView(context);

            facebookImage.LayoutParameters = facebookLayout.LayoutParameters;
            facebookImage.SetImageResource(Resource.Drawable.facebook);
            facebookImage.SetScaleType(ImageView.ScaleType.FitXy);
            TextView facebookText = new TextView(context);

            facebookText.LayoutParameters = facebookLayout.LayoutParameters;
            facebookText.Text             = "\uE700";
            facebookText.Typeface         = typeface;
            facebookText.TextSize         = 20;
            facebookText.TextAlignment    = TextAlignment.Center;
            facebookText.Gravity          = GravityFlags.Center;
            facebookText.SetTextColor(Color.White);
            facebookLayout.AddView(facebookImage);
            facebookLayout.AddView(facebookText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent));
            SfRadialMenuItem facebookItem = new SfRadialMenuItem(context)
            {
                View = facebookLayout, ItemWidth = 50, ItemHeight = 50
            };

            facebookItem.ItemTapped += FacebookItem_ItemTapped;
            facebookItem.SetBackgroundColor(Color.Transparent);
            radialMenu.Items.Add(facebookItem);


            FrameLayout gplusLayout = new FrameLayout(context);

            gplusLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent);
            ImageView gplusImage = new ImageView(context);

            gplusImage.LayoutParameters = gplusLayout.LayoutParameters;
            gplusImage.SetImageResource(Resource.Drawable.gplus);
            gplusImage.SetScaleType(ImageView.ScaleType.FitXy);
            TextView gplusText = new TextView(context);

            gplusText.LayoutParameters = gplusLayout.LayoutParameters;
            gplusText.Text             = "\uE707";
            gplusText.Typeface         = typeface;
            gplusText.TextSize         = 20;
            gplusText.TextAlignment    = TextAlignment.Center;
            gplusText.Gravity          = GravityFlags.Center;
            gplusText.SetTextColor(Color.White);
            gplusLayout.AddView(gplusImage);
            gplusLayout.AddView(gplusText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent));
            SfRadialMenuItem gplusItem = new SfRadialMenuItem(context)
            {
                View = gplusLayout, ItemWidth = 50, ItemHeight = 50
            };

            gplusItem.ItemTapped += GplusItem_ItemTapped;
            gplusItem.SetBackgroundColor(Color.Transparent);
            radialMenu.Items.Add(gplusItem);


            FrameLayout twitterLayout = new FrameLayout(context);

            twitterLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent);
            ImageView twitterImage = new ImageView(context);

            twitterImage.LayoutParameters = twitterLayout.LayoutParameters;
            twitterImage.SetImageResource(Resource.Drawable.twitter);
            twitterImage.SetScaleType(ImageView.ScaleType.FitXy);
            TextView twitterText = new TextView(context);

            twitterText.LayoutParameters = twitterLayout.LayoutParameters;
            twitterText.Text             = "\uE704";
            twitterText.Typeface         = typeface;
            twitterText.TextSize         = 20;
            twitterText.TextAlignment    = TextAlignment.Center;
            twitterText.Gravity          = GravityFlags.Center;
            twitterText.SetTextColor(Color.White);
            twitterLayout.AddView(twitterImage);
            twitterLayout.AddView(twitterText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent));
            SfRadialMenuItem twitterItem = new SfRadialMenuItem(context)
            {
                View = twitterLayout, ItemWidth = 50, ItemHeight = 50
            };

            twitterItem.ItemTapped += TwitterItem_ItemTapped;
            twitterItem.SetBackgroundColor(Color.Transparent);
            radialMenu.Items.Add(twitterItem);


            FrameLayout pinterestLayout = new FrameLayout(context);

            pinterestLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent);
            ImageView pinterestImage = new ImageView(context);

            pinterestImage.LayoutParameters = pinterestLayout.LayoutParameters;
            pinterestImage.SetImageResource(Resource.Drawable.pinterest);
            pinterestImage.SetScaleType(ImageView.ScaleType.FitXy);
            TextView pinterestText = new TextView(context);

            pinterestText.LayoutParameters = pinterestLayout.LayoutParameters;
            pinterestText.Text             = "\uE705";
            pinterestText.Typeface         = typeface;
            pinterestText.TextSize         = 20;
            pinterestText.TextAlignment    = TextAlignment.Center;
            pinterestText.Gravity          = GravityFlags.Center;
            pinterestText.SetTextColor(Color.White);
            pinterestLayout.AddView(pinterestImage);
            pinterestLayout.AddView(pinterestText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent));
            SfRadialMenuItem pinterestItem = new SfRadialMenuItem(context)
            {
                View = pinterestLayout, ItemWidth = 50, ItemHeight = 50
            };

            pinterestItem.ItemTapped += PinterestItem_ItemTapped;
            pinterestItem.SetBackgroundColor(Color.Transparent);
            radialMenu.Items.Add(pinterestItem);

            FrameLayout linkedInLayout = new FrameLayout(context);

            linkedInLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent);
            ImageView linkedInImage = new ImageView(context);

            linkedInImage.LayoutParameters = linkedInLayout.LayoutParameters;
            linkedInImage.SetImageResource(Resource.Drawable.linkedin);
            linkedInImage.SetScaleType(ImageView.ScaleType.FitXy);
            TextView linkedInText = new TextView(context);

            linkedInText.LayoutParameters = linkedInLayout.LayoutParameters;
            linkedInText.Text             = "\uE706";
            linkedInText.Typeface         = typeface;
            linkedInText.TextSize         = 20;
            linkedInText.TextAlignment    = TextAlignment.Center;
            linkedInText.Gravity          = GravityFlags.Center;
            linkedInText.SetTextColor(Color.White);
            linkedInLayout.AddView(linkedInImage);
            linkedInLayout.AddView(linkedInText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent));
            SfRadialMenuItem linkedInItem = new SfRadialMenuItem(context)
            {
                View = linkedInLayout, ItemWidth = 50, ItemHeight = 50
            };

            linkedInItem.ItemTapped += LinkedInItem_ItemTapped;
            linkedInItem.SetBackgroundColor(Color.Transparent);
            radialMenu.Items.Add(linkedInItem);


            FrameLayout instagramLayout = new FrameLayout(context);

            instagramLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent);
            ImageView instagramImage = new ImageView(context);

            instagramImage.LayoutParameters = instagramLayout.LayoutParameters;
            instagramImage.SetImageResource(Resource.Drawable.instagram);
            instagramImage.SetScaleType(ImageView.ScaleType.FitXy);
            TextView instagramText = new TextView(context);

            instagramText.LayoutParameters = instagramLayout.LayoutParameters;
            instagramText.Text             = "\uE708";
            instagramText.Typeface         = typeface;
            instagramText.TextSize         = 20;
            instagramText.TextAlignment    = TextAlignment.Center;
            instagramText.Gravity          = GravityFlags.Center;
            instagramText.SetTextColor(Color.White);
            instagramLayout.AddView(instagramImage);
            instagramLayout.AddView(instagramText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent));
            SfRadialMenuItem instagramItem = new SfRadialMenuItem(context)
            {
                View = instagramLayout, ItemWidth = 50, ItemHeight = 50
            };

            instagramItem.ItemTapped += InstagramItem_ItemTapped;
            instagramItem.SetBackgroundColor(Color.Transparent);
            radialMenu.Items.Add(instagramItem);


            backFrame.AddView(frontFrame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));

            TextView menuIcon = new TextView(context);

            menuIcon.Text     = "\uE703";
            menuIcon.TextSize = 20;
            menuIcon.Typeface = typeface;
            menuIcon.SetTextColor(Color.White);
            menuIcon.LayoutParameters         = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            menuIcon.Gravity                  = GravityFlags.Center;
            radialMenu.Visibility             = ViewStates.Invisible;
            radialMenu.CenterButtonView       = menuIcon;
            radialMenu.IsDragEnabled          = false;
            radialMenu.EnableRotation         = false;
            radialMenu.OuterRimColor          = Color.Transparent;
            radialMenu.CenterButtonBackground = Color.Rgb(41, 146, 247);
            radialMenu.CenterButtonRadius     = 25;
            radialMenu.RimRadius              = 100;
            radialMenu.Closed                += RadialMenu_Closed;
            frontFrame.AddView(radialMenu);

            touchDraw.Click += (sender, e) =>
            {
                radialMenu.Visibility = ViewStates.Visible;
                touchDraw.Visibility  = ViewStates.Invisible;
                radialMenu.Show();
            };

            return(mainLayout);
        }
        public override View GetSampleContent(Context context)
        {
            height  = context.Resources.DisplayMetrics.HeightPixels;
            width   = context.Resources.DisplayMetrics.WidthPixels;
            con     = context;
            density = con.Resources.DisplayMetrics.Density;
            ImageView image = new ImageView(context);

            image.SetImageResource(Resource.Drawable.Font);
            FrameLayout frame = new FrameLayout(context);

            frame.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(400, 400);


            mainLayout                  = new LinearLayout(con);
            mainLayout.Orientation      = Android.Widget.Orientation.Vertical;
            mainLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            FrameLayout radialFrame = new FrameLayout(con);

            radialFrame.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(height * 0.60));
            radialMenu = new SfRadialMenu(con);
            ///radialMenu.MenuIcon = image;
            ImageView back = new ImageView(con);

            back.SetImageResource(Resource.Drawable.Previous);
            //radialMenu.BackIcon = back;
            radialMenu.RimColor      = Color.LightGray;
            radialMenu.OuterRimColor = Color.Transparent;
            Typeface tf = Typeface.CreateFromAsset(con.Assets, "Segoe_MDL2_Assets.ttf");

            for (int i = 0; i < 6; i++)
            {
                SfRadialMenuItem item = new SfRadialMenuItem(con)
                {
                    IconFont = tf, FontIconSize = 20, FontIconText = layer[i], FontIconColor = Color.Black, ItemWidth = 45, ItemHeight = 45
                };
                item.ItemTapped += Item_ItemTapped;
                radialMenu.Items.Add(item);
            }

            for (int i = 0; i < 4; i++)
            {
                SfRadialMenuItem item = new SfRadialMenuItem(con)
                {
                    IconFont = tf, FontIconSize = 20, FontIconText = wifi[i], FontIconColor = Color.Black
                };
                item.ItemTapped += Item_ItemTapped;
                (radialMenu.Items[0] as SfRadialMenuItem).Items.Add(item);
            }
            for (int i = 0; i < 4; i++)
            {
                SfRadialMenuItem item = new SfRadialMenuItem(con)
                {
                    IconFont = tf, FontIconSize = 20, FontIconText = wifi[i], FontIconColor = Color.Black
                };
                item.ItemTapped += Item_ItemTapped;
                (radialMenu.Items[1] as SfRadialMenuItem).Items.Add(item);
            }
            for (int i = 0; i < 3; i++)
            {
                SfRadialMenuItem item = new SfRadialMenuItem(con)
                {
                    IconFont = tf, FontIconSize = 20, FontIconText = profile[i], FontIconColor = Color.Black
                };
                item.ItemTapped += Item_ItemTapped;
                (radialMenu.Items[2] as SfRadialMenuItem).Items.Add(item);
            }
            for (int i = 0; i < 3; i++)
            {
                SfRadialMenuItem item = new SfRadialMenuItem(con)
                {
                    IconFont = tf, FontIconSize = 20, FontIconText = brightness[i], FontIconColor = Color.Black
                };
                item.ItemTapped += Item_ItemTapped;
                (radialMenu.Items[3] as SfRadialMenuItem).Items.Add(item);
            }
            for (int i = 0; i < 3; i++)
            {
                SfRadialMenuItem item = new SfRadialMenuItem(con)
                {
                    IconFont = tf, FontIconSize = 20, FontIconText = battery[i], FontIconColor = Color.Black, ItemWidth = 45, ItemHeight = 45
                };
                item.ItemTapped += Item_ItemTapped;
                (radialMenu.Items[4] as SfRadialMenuItem).Items.Add(item);
            }
            for (int i = 0; i < 3; i++)
            {
                SfRadialMenuItem item = new SfRadialMenuItem(con)
                {
                    IconFont = tf, FontIconSize = 20, FontIconText = power[i], FontIconColor = Color.Black, ItemWidth = 45, ItemHeight = 45
                };
                item.ItemTapped += Item_ItemTapped;
                (radialMenu.Items[5] as SfRadialMenuItem).Items.Add(item);
            }

            radialMenu.RimRadius               = radialRadius;
            radialMenu.CenterButtonRadius      = 30;
            radialMenu.Opening                += RadialMenu_Opening;
            radialMenu.Opened                 += RadialMenu_Opened;
            radialMenu.Closing                += RadialMenu_Closing;
            radialMenu.Closed                 += RadialMenu_Closed;
            radialMenu.Navigating             += RadialMenu_Navigating;
            radialMenu.Navigated              += RadialMenu_Navigated;
            radialMenu.CenterButtonBackTapped += RadialMenu_CenterButtonBackTapped;
            radialFrame.AddView(radialMenu);
            mainLayout.AddView(radialFrame);
            scrollviewer = new ScrollView(con);
            textFrame    = new LinearLayout(con);

            TextView menuIcon = new TextView(con);

            menuIcon.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            menuIcon.Text             = "\uE713";
            menuIcon.Typeface         = tf;
            menuIcon.TextSize         = 30;
            menuIcon.SetTextColor(Color.White);
            menuIcon.Gravity            = GravityFlags.Center;
            radialMenu.CenterButtonView = menuIcon;

            TextView backIcon = new TextView(con);

            backIcon.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            backIcon.Text             = "\uE72B";
            backIcon.TextSize         = 25;
            backIcon.Typeface         = tf;
            backIcon.SetTextColor(Color.White);
            backIcon.Gravity = GravityFlags.Center;
            radialMenu.CenterButtonBackIcon = backIcon;

            TextView textview = new TextView(con);

            textview.Text     = "Event Log";
            textview.Typeface = tf;
            textview.SetTextColor(Color.Black);
            textview.TextSize = 20;
            if (density > 2)
            {
                textview.SetPadding(20, 0, 0, 20);
            }
            else
            {
                textview.SetPadding(10, 0, 0, 10);
            }
            mainLayout.AddView(textview);

            textFrame.Orientation = Android.Widget.Orientation.Vertical;
            textFrame.SetScrollContainer(true);
            scrollviewer.AddView(textFrame);
            scrollviewer.VerticalScrollBarEnabled = true;
            FrameLayout bottomFrame = new FrameLayout(con);

            bottomFrame.SetScrollContainer(true);
            bottomFrame.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(height * 0.40));
            bottomFrame.SetBackgroundColor(Color.Silver);
            bottomFrame.AddView(scrollviewer);
            bottomFrame.SetPadding(10, 0, 10, 0);
            mainLayout.AddView(bottomFrame);
            mainLayout.SetBackgroundColor(Color.White);
            radialMenu.EnableRotation = rotate;
            radialMenu.IsDragEnabled  = drag;
            return(mainLayout);
        }
        private void Init()
        {
            RemoveAllViews();
 
            Orientation = Orientation.Horizontal;

            LayoutParams lp = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            lp.Gravity = GravityFlags.CenterVertical;
            LayoutParameters = lp;

            cardImageLayout = new FrameLayout(Context);

            LayoutParams cardImageLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            cardImageLayoutParams.Gravity = GravityFlags.CenterVertical;
            cardImageLayout.LayoutParameters = cardImageLayoutParams;

            cardImageLayout.SetPadding(0, 0, UiUtils.ToPixels(Context, 8), 0);

            SetCardImageWithoutAnimation(Resource.Drawable.ic_card_cv2);

            cv2TextView = new CV2TextView(Context);

            LayoutParams parameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            parameters.Weight = 1;
            parameters.Gravity = GravityFlags.Center;

            cv2TextView.LayoutParameters = parameters;

            cv2TextView.OnEntryComplete += cardNumber =>
            {
                if (OnCreditCardEntered != null)
                {
                    OnCreditCardEntered(cardNumber);
                }
            };

            LayoutParams textViewLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent);
            textViewLayoutParams.Gravity = GravityFlags.Center;

            last4CCNosTextView = new TextView(Context);
            last4CCNosTextView.Gravity = GravityFlags.Center;
            last4CCNosTextView.Text = "0000";
            last4CCNosTextView.LayoutParameters = textViewLayoutParams;
            last4CCNosTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            last4CCNosTextView.TextSize = 18;
            last4CCNosTextView.SetTextColor(Resources.GetColor(Resource.Color.normal_text));
            last4CCNosTextView.Focusable = false;
            last4CCNosTextView.Enabled = false;
            last4CCNosTextView.SetSingleLine();
            last4CCNosTextView.SetBackgroundDrawable(null);

            AddView(cardImageLayout);
            AddView(last4CCNosTextView);
            AddView(cv2TextView);
        }