protected override void OnElementChanged(ElementChangedEventArgs <x.Button> e)
        {
            var androidCheckBox = new Android.Widget.CheckBox(this.Context);

            this.SetNativeControl(androidCheckBox);
            base.OnElementChanged(e);
        }
Ejemplo n.º 2
0
        private void OnAppleCheckChanged(object sender, CheckBox.CheckedChangeEventArgs e)
        {
            CheckBox androidCheckBox = FindViewById <CheckBox>(Resource.Id.androidCheckBox);

            if (e.IsChecked)
            {
                androidCheckBox.Checked = false;
            }
        }
Ejemplo n.º 3
0
        private void OnTampaCheckChanged(object sender, CheckBox.CheckedChangeEventArgs e)
        {
            CheckBox hudsonCheckBox  = FindViewById <CheckBox>(Resource.Id.hudsonCheckBox);
            CheckBox orlandoCheckBox = FindViewById <CheckBox>(Resource.Id.orlandoCheckBox);

            if (e.IsChecked)
            {
                hudsonCheckBox.Checked  = false;
                orlandoCheckBox.Checked = false;
            }
        }
Ejemplo n.º 4
0
 string DetermineDevice(CheckBox android, CheckBox apple)
 {
     if (apple.Checked)
     {
         return("Apple");
     }
     if (android.Checked)
     {
         return("Android");
     }
     return("NULL");
 }
Ejemplo n.º 5
0
 // Main Activity MUST be loaded.
 public static CState GetCSTate(Activity mn)
 {
     Android.Widget.CheckBox _searchChk        = mn.FindViewById <Android.Widget.CheckBox>(Resource.Id.options_search);
     Android.Widget.CheckBox _MTChk            = mn.FindViewById <Android.Widget.CheckBox>(Resource.Id.options_multithread);
     Android.Widget.CheckBox _exportEpub       = mn.FindViewById <Android.Widget.CheckBox>(Resource.Id.options_exportEpub);
     Android.Widget.CheckBox _continueDownload = mn.FindViewById <Android.Widget.CheckBox>(Resource.Id.options_continue);
     Android.Widget.CheckBox _skipDownloaded   = mn.FindViewById <Android.Widget.CheckBox>(Resource.Id.options_skip);
     Android.Widget.EditText input             = mn.FindViewById <EditText>(Resource.Id.editText1);
     return(new CState(_searchChk.Checked, _MTChk.Checked, _exportEpub.Checked, _continueDownload.Checked, _skipDownloaded.Checked)
     {
         term = input.Text
     });
 }
Ejemplo n.º 6
0
        public void ApplyCheckBoxListeners()
        {
            CheckBox hudsonCheckBox  = FindViewById <CheckBox>(Resource.Id.hudsonCheckBox);
            CheckBox tampaCheckBox   = FindViewById <CheckBox>(Resource.Id.tampaCheckBox);
            CheckBox orlandoCheckBox = FindViewById <CheckBox>(Resource.Id.orlandoCheckBox);
            CheckBox androidCheckBox = FindViewById <CheckBox>(Resource.Id.androidCheckBox);
            CheckBox appleCheckBox   = FindViewById <CheckBox>(Resource.Id.appleCheckBox);

            hudsonCheckBox.CheckedChange  += OnHudsonCheckChanged;
            tampaCheckBox.CheckedChange   += OnTampaCheckChanged;
            orlandoCheckBox.CheckedChange += OnOrlandoCheckChanged;
            androidCheckBox.CheckedChange += OnAndroidCheckChanged;
            appleCheckBox.CheckedChange   += OnAppleCheckChanged;
        }
Ejemplo n.º 7
0
 string DetermineLocation(CheckBox hudson, CheckBox tampa, CheckBox orlando)
 {
     if (hudson.Checked)
     {
         return("Hudson");
     }
     if (tampa.Checked)
     {
         return("Tampa");
     }
     if (orlando.Checked)
     {
         return("Orlando");
     }
     return("NULL");
 }
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Button> e)
        {
            int f = 1;

            if (f == 1)
            {
                var control = new Android.Widget.CheckBox(this.Context); control.SetHeight(control.Height + 10);
                (Element as CustomCheckBox).WasCheckedChanged = WasChecked;
                this.SetNativeControl(control);
            }
            else
            {
                var control = new Android.Widget.RadioButton(this.Context); this.SetNativeControl(control);
            }

            base.OnElementChanged(e);
        }
Ejemplo n.º 9
0
        protected override void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            var control = new Android.Widget.CheckBox(Context);

            SetNativeControl(control);

            if (Element == null)
            {
                return;
            }

            element = (XCheckBox)Element;
            element.ChildRemoved += ChildRemoved;

            control.CheckedChange += CheckedChanged;
            ChangeCheckBoxColor();
            base.OnElementChanged(e);
        }
Ejemplo n.º 10
0
        void ClearForm()
        {
            CheckBox hudsonCheckBox  = FindViewById <CheckBox>(Resource.Id.hudsonCheckBox);
            CheckBox tampaCheckBox   = FindViewById <CheckBox>(Resource.Id.tampaCheckBox);
            CheckBox orlandoCheckBox = FindViewById <CheckBox>(Resource.Id.orlandoCheckBox);
            CheckBox androidCheckBox = FindViewById <CheckBox>(Resource.Id.androidCheckBox);
            CheckBox appleCheckBox   = FindViewById <CheckBox>(Resource.Id.appleCheckBox);

            EditText empName  = FindViewById <EditText>(Resource.Id.nameText);
            EditText issueBox = FindViewById <EditText>(Resource.Id.issueText);

            hudsonCheckBox.Checked  = false;
            tampaCheckBox.Checked   = false;
            orlandoCheckBox.Checked = false;
            androidCheckBox.Checked = false;
            appleCheckBox.Checked   = false;
            empName.Text            = "";
            issueBox.Text           = "";
        }
Ejemplo n.º 11
0
        protected override void OnElementChanged(ElementChangedEventArgs <CheckBoxs> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
            {
                var control = new Android.Widget.CheckBox(this.Context)
                {
                    ScaleX = 1.4f,
                    ScaleY = 1.4f
                };
                this.SetNativeControl(control);
            }
            if (e.NewElement != null)
            {
                Control.Checked        = e.NewElement.Checked;
                Control.CheckedChange += OnCheckChanged;
            }

            if (e.OldElement != null)
            {
                Control.CheckedChange -= OnCheckChanged;
            }
        }
Ejemplo n.º 12
0
        protected override void OnElementChanged(ElementChangedEventArgs <CustomCheckBox> e)
        {
            base.OnElementChanged(e);
            var linearLayout = new LinearLayout(base.Context);

            linearLayout.Orientation = Orientation.Horizontal;

            if (this.Control == null)
            {
                checkBox = new Android.Widget.CheckBox(this.Context);
                checkBox.CheckedChange += CheckBoxCheckedChange;

                linearLayout.AddView(checkBox);
                this.SetNativeControl(linearLayout);
            }

            checkBox.Checked = e.NewElement.Checked;
            checkBox.SetTextColor(e.NewElement.TextColor.ToAndroid());
            checkBox.CompoundDrawablePadding = 15;

            int spacing = checkBox.PaddingLeft;

            if (Element.Spacing.HasValue)
            {
                spacing = BaseUIHelper.ConvertDPToPixels(Element.Spacing.Value);
            }

            checkBox.SetPadding(spacing, checkBox.PaddingTop, checkBox.PaddingRight, checkBox.PaddingBottom);

            if (e.NewElement.EnableLink)
            {
                checkBox.Text = "";

                var textView = new TextView(base.Context);
                textView.SetTextColor(e.NewElement.TextColor.ToAndroid());
                var color = e.NewElement.TextColor.ToHex();

                textView.TextFormatted  = Html.FromHtml("<span style='color: " + color + "'>" + e.NewElement.Text + "</span> <a href='" + e.NewElement.LinkString + "' style='color: " + color + "'>" + e.NewElement.InlineText + "</a>");
                textView.MovementMethod = LinkMovementMethod.Instance;
                textView.Gravity        = Android.Views.GravityFlags.CenterVertical;

                Control.AddView(textView);
            }
            else
            {
                checkBox.Text = e.NewElement.Text;
            }

            int id = -1;

            if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
            {
                id = this.Context.Resources.GetIdentifier("btn_check_material_anim", "drawable", "android");
            }
            else
            {
                id = this.Context.Resources.GetIdentifier("btn_check_holo_light", "drawable", "android");
            }

            if (Element.CheckedImage != null && Element.UnCheckedImage != null)
            {
                var checkedDrawable   = this.Resources.GetDrawable(UIHelper.GetDrawableResource(Element.CheckedImage));
                var uncheckedDrawable = this.Resources.GetDrawable(UIHelper.GetDrawableResource(Element.UnCheckedImage));

                if (Element.ImageHeight > 0 && Element.ImageWidth > 0)
                {
                    checkedDrawable.SetBounds(0, 0, BaseUIHelper.ConvertDPToPixels(Element.ImageWidth), BaseUIHelper.ConvertDPToPixels(Element.ImageHeight));
                    uncheckedDrawable.SetBounds(0, 0, BaseUIHelper.ConvertDPToPixels(Element.ImageWidth), BaseUIHelper.ConvertDPToPixels(Element.ImageHeight));
                }

                var states = new StateListDrawable();
                states.AddState(new int[] { -Android.Resource.Attribute.StateChecked, Android.Resource.Attribute.StateEnabled }, uncheckedDrawable);
                states.AddState(new int[] { Android.Resource.Attribute.StateChecked, Android.Resource.Attribute.StateEnabled }, checkedDrawable);
                states.AddState(new int[] { -Android.Resource.Attribute.StateChecked, -Android.Resource.Attribute.StateEnabled }, uncheckedDrawable);
                states.AddState(new int[] { Android.Resource.Attribute.StateChecked, -Android.Resource.Attribute.StateEnabled }, checkedDrawable);

                //drawable.AddState(new[] { Android.Resource.Attribute.Checked },
                //                          this.Resources.GetDrawable(UIHelper.GetDrawableResource(Element.CheckedImage)));

                //drawable.AddState(new[] { ~Android.Resource.Attribute.Checked },
                //                          this.Resources.GetDrawable(UIHelper.GetDrawableResource(Element.UnCheckedImage)));
                checkBox.SetButtonDrawable(states);
            }
            else
            {
                Drawable drawable = Resources.GetDrawable(id);
                drawable.SetColorFilter(Color.White, PorterDuff.Mode.SrcAtop);
                checkBox.SetButtonDrawable(drawable);
            }


            if (e.NewElement.FontSize > 0)
            {
                checkBox.TextSize = (float)e.NewElement.FontSize;
            }

            if (!string.IsNullOrEmpty(e.NewElement.FontName))
            {
                SetTypeface(e.NewElement.FontName);
            }
        }
Ejemplo n.º 13
0
        public async Task OnSubmitClickedAsync()
        {
            CheckBox hudsonCheckBox  = FindViewById <CheckBox>(Resource.Id.hudsonCheckBox);
            CheckBox tampaCheckBox   = FindViewById <CheckBox>(Resource.Id.tampaCheckBox);
            CheckBox orlandoCheckBox = FindViewById <CheckBox>(Resource.Id.orlandoCheckBox);

            CheckBox androidCheckBox = FindViewById <CheckBox>(Resource.Id.androidCheckBox);
            CheckBox appleCheckBox   = FindViewById <CheckBox>(Resource.Id.appleCheckBox);

            EditText empName  = FindViewById <EditText>(Resource.Id.nameText);
            EditText issueBox = FindViewById <EditText>(Resource.Id.issueText);

            //no location
            if (!hudsonCheckBox.Checked && !tampaCheckBox.Checked && !orlandoCheckBox.Checked)
            {
                await DisplayFailureNotice("No location checked.");

                return;
            }

            //no device type
            if (!appleCheckBox.Checked && !androidCheckBox.Checked)
            {
                await DisplayFailureNotice("No device type checked.");

                return;
            }

            //no name
            string name = empName.Text;

            if (name.Equals(""))
            {
                await DisplayFailureNotice("No employee name specified.");

                return;
            }

            string issue = issueBox.Text;

            //no issue
            if (issue.Equals(""))
            {
                await DisplayFailureNotice("No issue entered.");

                return;
            }

            string location = DetermineLocation(hudsonCheckBox, tampaCheckBox, orlandoCheckBox);
            string device   = DetermineDevice(androidCheckBox, appleCheckBox);
            string number   = await GetPhoneNumberAsync();

            string ticket = "";

            ticket += "Name: " + name + "\n";
            ticket += "Number: " + number + "\n";
            ticket += "Location: " + location + "\n";
            ticket += "Device: " + device + "\n";
            ticket += "Issue: " + issue + "\n";

            await Task.Run(() => BayonetChat.PostMessageToChat(ticket, name));

            await DisplayNotification();

            Analytics.TrackEvent("Ticket Submitted");

            Task.Run(() => ClearForm());

            GoToActivity(typeof(Calendly));
        }
 protected override void OnElementChanged(ElementChangedEventArgs<x.Button> e)
 {
     var androidCheckBox = new Android.Widget.CheckBox(this.Context);
     this.SetNativeControl(androidCheckBox);
     base.OnElementChanged(e);
 }
Ejemplo n.º 15
0
 private void Back_Click(object sender, EventArgs e)
 {
     Android.Widget.CheckBox _SaveToSD = FindViewById <Android.Widget.CheckBox>(Resource.Id.stgs_saveToSD);
     SaveNewSettings(new string[] { "_SaveToSD" }, new bool[] { _SaveToSD.Checked });
     reloadActivityMain();
 }