Exemple #1
0
        public override void UpdateUI(bool calledFromUiThread = false)
        {
            try
            {
                if (FragmentTicketQuestion != null)
                {
                    _tvQuestionTitle.Text = FragmentTicketQuestion.ScreenTitle;

                    //loop through all the answers
                    foreach (var answer in FragmentTicketQuestion.Answers)
                    {
                        //create a button or edittext widget for each answer, depending on the HasTextBox boolean value
                        if (!answer.HasTextBox)
                        {
                            //the answer is button selection
                            Button answerButton = new Button(Activity);
                            answerButton.SetTextAppearance(Activity, Resource.Style.GreenButton);
                            answerButton.SetBackgroundResource(Resource.Drawable.button_green);
                            answerButton.Text = answer.Title;

                            //check whether it is a submit button or not
                            if (!answer.IsTextBoxSubmitButton)
                            {
                                //answerButton.Click += delegate { ProcessAnswer(answer); };
                                answerButton.Click += delegate { ProcessStepAnswer(answer); };
                            }
                            else
                            {
                                //submit button will submit the text input entered and validate if necessary
                                answerButton.Click += delegate
                                {
                                    //loop through all the edittext widgets on the screen, get the value of each and set it to the corresponding answer
                                    for (var x = 0; x < _ticketLinearLayout.ChildCount; x++)
                                    {
                                        var widget = _ticketLinearLayout.GetChildAt(x);

                                        if (!(widget is EditText))
                                        {
                                            continue;
                                        }
                                        var textInputWidget = (EditText)widget;

                                        //get the Id of the editText widget which matches the Answer Id
                                        var answerId = textInputWidget.Id;

                                        //get the Tag of the editText which contains the boolean of whether value is required or not
                                        var isTextBoxValueRequired = (bool)textInputWidget.GetTag(Resource.Id.@fixed);

                                        if (isTextBoxValueRequired && string.IsNullOrEmpty(textInputWidget.Text))
                                        {
                                            AlertDialogBuilder.Instance
                                            .AddButton(Resource.String.ok, validateFail)
                                            .SetText(0, Resource.String.value_required)
                                            .Show(Activity);
                                            return;
                                        }

                                        //set the value of the answer to the value of the edittext
                                        FragmentTicketQuestion.Answers.Find(a => a.Id == answerId).TextBoxValue =
                                            textInputWidget.Text;

                                        ProcessStepAnswer(FragmentTicketQuestion.Answers.Find(a => a.Id == answerId));

                                        Logger.Verbose(textInputWidget.Text);
                                    }
                                };
                            }

                            LinearLayout.LayoutParams answerButtonParams = new LinearLayout.LayoutParams(
                                LinearLayout.LayoutParams.FillParent,
                                LinearLayout.LayoutParams.WrapContent
                                );

                            answerButtonParams.SetMargins(0, 0, 0, 12);
                            _ticketLinearLayout.AddView(answerButton, answerButtonParams);
                        }
                        else
                        {
                            //define the label to be placed above the text input and set it's title
                            TextView label = new TextView(Activity);
                            label.SetTextAppearance(Activity, Resource.Style.DefaultTextView);
                            label.Text = answer.Title;

                            LinearLayout.LayoutParams labelParams = new LinearLayout.LayoutParams(
                                LinearLayout.LayoutParams.WrapContent,
                                LinearLayout.LayoutParams.WrapContent
                                );

                            labelParams.SetMargins(5, 0, 0, 8);
                            labelParams.Gravity = GravityFlags.Left;

                            _ticketLinearLayout.AddView(label, labelParams);

                            //define the text input and set it's id to the Id of the answer so that it can be identified when the user hits "NEXT" button
                            EditText eText = new EditText(Activity);
                            eText.SetTextAppearance(Activity, Resource.Style.DefaultEditText);
                            eText.SetBackgroundResource(Resource.Drawable.edit_text_default);
                            eText.SetLines(8);
                            //eText.SetMaxLines(10);
                            //eText.VerticalScrollBarEnabled = IsVisible;
                            eText.Gravity = GravityFlags.Left | GravityFlags.Top;
                            eText.Id      = answer.Id;
                            eText.SetTag(Resource.Id.@fixed, answer.IsTextBoxValueRequired);
                            eText.Text = answer.TextBoxValue;

                            LinearLayout.LayoutParams eTextParams = new LinearLayout.LayoutParams(
                                LinearLayout.LayoutParams.FillParent,
                                LinearLayout.LayoutParams.WrapContent
                                );

                            eTextParams.SetMargins(0, 0, 0, 20);
                            eTextParams.Gravity = GravityFlags.Left;

                            _ticketLinearLayout.AddView(eText, eTextParams);
                        }
                    }

                    //determine whether to show the text "Scroll Down to View More", for now 5 answers or more (HACK)
                    if (FragmentTicketQuestion.Answers.Count > 5)
                    {
                        _scrollTextRelativeLayout.Visibility = ViewStates.Visible;
                    }

                    _btnPrevious.Click += delegate
                    {
                        // when the previous button is clicked, show the last step/question
                        var parentActivity = (RaiseTicketActivity)this.Activity;
                        parentActivity.ShowLastStep();
                    };
                }
            }
            catch (Exception ex)
            {
                Logger.Verbose(ex.Message);
                return;
            }
        }
Exemple #2
0
        private void BuildScreen()
        {
            //
            sv = new ScrollView(this)
            {
                LayoutParameters = WrapContParams,
            };
            //
            InsideSVLayout = new LinearLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Vertical,
            };
            //
            OAlayout = FindViewById <LinearLayout>(Resource.Id.MainPageLayout);
            OAlayout.SetBackgroundColor(mYellow);
            //======================================================================
            //======================================================================
            TopLayout = new LinearLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };
            //
            ImageLayout = new LinearLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };
            //
            img = new ImageView(this);
            img.LayoutParameters = new ViewGroup.LayoutParams(360, 250);
            img.SetImageResource(Resource.Drawable.Logo);
            img.Click += this.Img_Click;
            //
            ImageLayout.AddView(img);
            //======================================================================
            //======================================================================
            TitleLayout = new LinearLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };
            //
            TitleTV = new TextView(this)
            {
                Text             = "הצהרת בריאות",
                TextSize         = 42,
                LayoutParameters = LP1,
            };
            TitleTV.SetTextColor(MBlue1);
            //
            TitleLayout.AddView(TitleTV);
            //======================================================================
            //======================================================================
            NameLayout = new LinearLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };
            //
            NameTV = new TextView(this)
            {
                Text             = "שם הספורטאי: ",
                LayoutParameters = LP1,
                TextSize         = 25,
            };
            NameTV.SetTextColor(MBlue2);
            //
            NameET = new EditText(this)
            {
                LayoutParameters = LP2,
                Hint             = "שם + שם משפחה",
                Text             = sp.GetString("Name", ""),
                TextSize         = 20,
                TextDirection    = TextDirection.Rtl,
            };
            NameET.SetTextColor(Color.Black);
            NameET.SetBackgroundColor(Color.White);
            NameET.SetBackgroundResource(Resource.Drawable.MyBackground);
            //
            NameLayout.LayoutDirection = LayoutDirection.Rtl;
            //
            NameLayout.AddView(NameTV);
            NameLayout.AddView(NameET);
            //======================================================================
            //======================================================================
            IDLayout = new LinearLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };
            //
            IDTV = new TextView(this)
            {
                Text             = "ת.ז הספורטאי: ",
                LayoutParameters = LP1,
                TextSize         = 25,
            };
            IDTV.SetTextColor(MBlue2);
            //
            IDET = new EditText(this)
            {
                LayoutParameters = LP2,
                Hint             = "ת.ז",
                Text             = sp.GetString("ID", ""),
                TextSize         = 20,
            };
            IDET.SetBackgroundColor(Color.White);
            IDET.SetTextColor(Color.Black);
            IDET.SetBackgroundResource(Resource.Drawable.MyBackground);
            IDLayout.LayoutDirection = LayoutDirection.Rtl;
            //
            IDLayout.AddView(IDTV);
            IDLayout.AddView(IDET);
            //======================================================================
            //======================================================================
            AGUDALayout = new LinearLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Horizontal,
            };
            //
            AGUDATV = new TextView(this)
            {
                Text             = "אגודת הספורטאי: ",
                LayoutParameters = LP1,
                TextSize         = 25,
            };
            AGUDATV.SetTextColor(MBlue2);
            //
            AGUDAET = new EditText(this)
            {
                LayoutParameters = LP2,
                Hint             = "אגודה",
                Text             = sp.GetString("AGUDA", ""),
                TextSize         = 20,
                TextDirection    = Android.Views.TextDirection.Rtl,
            };
            AGUDAET.SetTextColor(Color.Black);
            AGUDAET.SetBackgroundColor(Color.White);
            AGUDAET.SetBackgroundResource(Resource.Drawable.MyBackground);
            AGUDALayout.LayoutDirection = LayoutDirection.Rtl;
            AGUDALayout.AddView(AGUDATV);
            AGUDALayout.AddView(AGUDAET);
            //======================================================================
            //======================================================================
            CBLayout = new LinearLayout(this)
            {
                LayoutParameters = WrapContParams,
                Orientation      = Orientation.Vertical,
            };
            //
            CB1 = new CheckBox(this)
            {
                Text          = "אני מצהיר/ה כי ערכתי היום בדיקה למדידת חום גוף, בה נמצא כי חום גופי אינו עולה על 38 מעלות צלזיוס",
                TextSize      = 20,
                TextDirection = Android.Views.TextDirection.Rtl,
            };
            if (!CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft)
            {
                CB1.LayoutDirection = LayoutDirection.Rtl;
            }
            else
            {
                CB1.LayoutDirection = LayoutDirection.Ltr;
            }
            CB1.SetTextColor(MBlue3);
            //
            CB2 = new CheckBox(this)
            {
                Text          = "אני מצהיר/ה כי איני משתעל/ת וכן כי אין לי קשיים בנשימה.",
                TextSize      = 20,
                TextDirection = TextDirection.Rtl,
            };
            if (!CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft)
            {
                CB2.LayoutDirection = LayoutDirection.Rtl;
            }
            else
            {
                CB2.LayoutDirection = LayoutDirection.Ltr;
            }
            CB2.SetTextColor(MBlue3);
            CBLayout.AddView(CB1);
            CBLayout.AddView(CB2);
            //======================================================================
            //======================================================================
            SpinnerLayout = new LinearLayout(this)
            {
                LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent),
                Orientation      = Orientation.Horizontal
            };
            SpinnerLayout.SetGravity(GravityFlags.Right);
            //
            var adapter = new ArrayAdapter <String>(this, Android.Resource.Layout.SimpleSpinnerItem, trainers);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            TrainersSpinner = new Spinner(this)
            {
                Adapter          = adapter,
                LayoutParameters = new Android.Views.ViewGroup.LayoutParams(300, 120),
            };
            TrainersSpinner.SetBackgroundColor(Color.White);
            TrainersSpinner.Adapter       = adapter;
            TrainersSpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(TrainersSpinner_ItemSelected);
            TrainersSpinner.SetBackgroundResource(Resource.Drawable.SpinnerBackground);
            SpinnerLayout.AddView(TrainersSpinner);
            //======================================================================
            //======================================================================
            SendButtonLayout = new LinearLayout(this)
            {
                LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 250),
                Orientation      = Orientation.Vertical,
            };
            SendButtonLayout.SetGravity(GravityFlags.CenterHorizontal);
            //
            SendButton = new Button(this)
            {
                Text             = "שליחה",
                TextSize         = 25,
                LayoutParameters = new ViewGroup.LayoutParams(350, 150),
            };
            SendButton.SetTextColor(MBlue1);
            SendButton.SetBackgroundResource(Resource.Drawable.SpinnerBackground);
            SendButton.Click += this.SendButton_Click;
            //
            SendButtonLayout.AddView(SendButton);
            //======================================================================
            //======================================================================
            TopLayout.AddView(TitleLayout);
            TopLayout.AddView(ImageLayout);
            InsideSVLayout.AddView(TopLayout);
            InsideSVLayout.AddView(NameLayout);
            InsideSVLayout.AddView(IDLayout);
            InsideSVLayout.AddView(AGUDALayout);
            InsideSVLayout.AddView(CBLayout);
            InsideSVLayout.AddView(SpinnerLayout);
            InsideSVLayout.AddView(SendButtonLayout);
            sv.AddView(InsideSVLayout);
            OAlayout.AddView(sv);
        }
Exemple #3
0
        public FormDate(Context context, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus Reportstatus)
            : base(context)
        {
            resource                = context.Resources;
            OwnerID                 = ownerID;
            VerifierID              = verifiedID;
            theme                   = new FormTheme(context, element.Title);
            Orientation             = Orientation.Vertical;
            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();
            Popup                   = new InformationPopup(context);
            contextx                = context;
            isArcheived             = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);
            reportStatus            = Reportstatus;
            dateFrame               = new RelativeLayout(context);

            dateDisplay    = new EditText(context);
            dateDisplay.Id = element.Id;

            RelativeLayout.LayoutParams dateFrameParametere = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
            dateFrame.LayoutParameters = dateFrameParametere;

            //datedisplay
            RelativeLayout.LayoutParams paramsOfDateDisplay = new RelativeLayout.LayoutParams(500, RelativeLayout.LayoutParams.WrapContent);
            paramsOfDateDisplay.AddRule(LayoutRules.AlignParentLeft);

            RelativeLayout.LayoutParams paramsOfWeekDisplay = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);
            paramsOfWeekDisplay.AddRule(LayoutRules.AlignParentBottom);
            paramsOfWeekDisplay.AddRule(LayoutRules.Below, dateDisplay.Id);

            ImageView indicatorImage = (ImageView)theme.GetChildAt(1);

            Popup.activateElementInfo(theme, element);

            dateDisplay    = new EditText(context);
            dateDisplay.Id = element.Id;
            dateDisplay.SetTextColor(Color.Black);
            dateDisplay.LayoutParameters = paramsOfDateDisplay;
            dateDisplay.SetBackgroundResource(Resource.Drawable.custom_edit_text_color);
            dateDisplay.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
            dateDisplay.Touch    += (s, e) => {
                var handled = false;
                if (e.Event.Action == MotionEventActions.Down)
                {
                    createDateDialog(context);
                    handled = true;
                }
                else if (e.Event.Action == MotionEventActions.Up)
                {
                    // do other stuff
                    handled = true;
                }
                e.Handled = handled;
            };

            //button
            RelativeLayout.LayoutParams paramsOfClearButton = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            //paramsOfClearButton.AddRule(LayoutRules.CenterVertical);
            paramsOfClearButton.AddRule(LayoutRules.RightOf, dateDisplay.Id);

            clearDateButton          = new Button(context);
            clearDateButton.Text     = "Clear";
            clearDateButton.TextSize = 12;
            clearDateButton.SetTextColor(Resources.GetColor(Resource.Color.theme_color));
            clearDateButton.SetBackgroundResource(0);
            clearDateButton.LayoutParameters = paramsOfClearButton;
            //clearDateButton.SetBackgroundResource(Resource.Drawable.clear_button);
            clearDateButton.Click += delegate { clearDate(); };

            if (string.IsNullOrEmpty(element.Value))
            {
                dateDisplay.Text = "";
                indicatorImage.SetImageResource(0);
                clearDateButton.Visibility = ViewStates.Gone;
            }
            else
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                dateDisplay.Text = dateLogic(element.Value);
                //have to set week
            }

            dateDisplay.TextChanged += (sender, e) =>
            {
                if (!dateDisplay.Text.Equals(""))
                {
                    indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                    clearDateButton.Visibility = ViewStates.Visible;
                }
                else
                {
                    indicatorImage.SetImageResource(0);
                    clearDateButton.Visibility = ViewStates.Gone;
                }
                sharedPreferencesEditor.PutBoolean("ReportEditFlag", true);
                sharedPreferencesEditor.Commit();
            };

            weekDisplay = new TextView(context);
            weekDisplay.SetWidth(80);
            weekDisplay.SetPadding(40, 0, 0, 0);

            if (element.Value == "")
            {
                //donothing
            }
            else
            {
                DateTime dateTime = Convert.ToDateTime(element.Value);
                weekDisplay.Text = resource.GetString(Resource.String.week) + getWeekNo(dateTime);
            }


            weekDisplay.SetTextColor(Color.Black);
            weekDisplay.LayoutParameters = paramsOfWeekDisplay;

            date = DateTime.Today;

            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    clearDateButton.Enabled    = false;
                    clearDateButton.Visibility = ViewStates.Gone;
                    dateDisplay.Enabled        = false;
                    dateDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey));
                    weekDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey));

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        clearDateButton.Enabled    = true;
                        clearDateButton.Visibility = ViewStates.Gone;
                        dateDisplay.Enabled        = true;
                        dateDisplay.SetTextColor(Resources.GetColor(Resource.Color.black));
                        weekDisplay.SetTextColor(Resources.GetColor(Resource.Color.black));
                    }
                }

                else
                {
                    clearDateButton.Enabled    = true;
                    clearDateButton.Visibility = ViewStates.Gone;
                    dateDisplay.Enabled        = true;
                    dateDisplay.SetTextColor(Resources.GetColor(Resource.Color.black));
                    weekDisplay.SetTextColor(Resources.GetColor(Resource.Color.black));
                }
            }
            else
            {
                clearDateButton.Enabled    = false;
                clearDateButton.Visibility = ViewStates.Gone;
                dateDisplay.Enabled        = false;
                dateDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey));
                weekDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey));
            }

            if (isArcheived)
            {
                clearDateButton.Enabled    = false;
                clearDateButton.Visibility = ViewStates.Gone;
                dateDisplay.Enabled        = false;
                dateDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey));
            }

            dateFrame.AddView(dateDisplay);
            dateFrame.AddView(clearDateButton);
            dateFrame.AddView(weekDisplay);

            AddView(theme);
            AddView(dateFrame);
            SetPadding(45, 10, 45, 20);
        }
Exemple #4
0
 private void SetStyle()
 {
     txtCodTabelaPreco.SetBackgroundResource(Resource.Drawable.EditTextStyle);
     txtDescricaoTabelaPreco.SetBackgroundResource(Resource.Drawable.EditTextStyle);
 }
        public FormMultiLineEditText(Context context, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus Reportstatus)
            : base(context)
        {
            resource                = context.Resources;
            contextx                = context;
            OwnerID                 = ownerID;
            VerifierID              = verifiedID;
            theme                   = new FormTheme(context, element.Title);
            Orientation             = Orientation.Vertical;
            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();
            Popup                   = new InformationPopup(context);
            reportStatus            = Reportstatus;

            isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);

            EditText editText = new EditText(context);

            editText.Id   = element.Id;
            editText.Text = element.Value;
            editText.SetBackgroundResource(Resource.Drawable.custom_edit_text_color);
            editText.InputType = Android.Text.InputTypes.TextFlagCapSentences;
            //editText.SetSingleLine(true);

            ImageView indicatorImage = (ImageView)theme.GetChildAt(1);

            //activateElementInfo(element);
            Popup.activateElementInfo(theme, element);
            editText.TextChanged += (sender, e) =>
            {
                if (!editText.Text.Equals(""))
                {
                    indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                }
                else
                {
                    indicatorImage.SetImageResource(0);
                }
                sharedPreferencesEditor.PutBoolean("ReportEditFlag", true);
                sharedPreferencesEditor.Commit();
            };

            //when opening a Draft or Archive
            if (!editText.Text.Equals(""))
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
            }

            TextView elementSplitLine = new TextView(context);

            elementSplitLine.TextSize = 0.5f;
            elementSplitLine.SetBackgroundColor(Color.ParseColor(resource.GetString(Resource.Color.grey)));

            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    editText.Enabled = false;
                    editText.SetTextColor(Resources.GetColor(Resource.Color.grey));

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        editText.Enabled = true;
                        editText.SetTextColor(Resources.GetColor(Resource.Color.black));
                    }
                }

                else
                {
                    editText.Enabled = true;
                    editText.SetTextColor(Resources.GetColor(Resource.Color.black));
                }
            }
            else
            {
                editText.Enabled = false;
                editText.SetTextColor(Resources.GetColor(Resource.Color.grey));
            }

            if (isArcheived)
            {
                editText.Enabled = false;
                editText.SetTextColor(Resources.GetColor(Resource.Color.grey));
            }

            AddView(theme);
            AddView(editText);
            SetPadding(45, 10, 45, 20);
        }
Exemple #6
0
 private void SetStyle()
 {
     txtCodigoProd.SetBackgroundResource(Resource.Drawable.EditTextStyle);
     txtNomeProd.SetBackgroundResource(Resource.Drawable.EditTextStyle);
     txtValorProd.SetBackgroundResource(Resource.Drawable.EditTextStyle);
 }
Exemple #7
0
        //Dialog MyButton Click
        public void BuildDialog(object sender, int f)
        {
            MyButton b = (MyButton)sender;

            for (int i = 0; i < exes.Count; i++)
            {
                if (exes[i].name.Equals(b.Text))
                {
                    ab1 = exes[i];
                }
            }
            d1 = new Dialog(this);
            //if (exes.Contains)
            d1.SetCancelable(true);
            d1.SetTitle(ab1.name);
            d1.SetContentView(Resource.Layout.MyDialog);
            LinearLayout ll = d1.FindViewById <LinearLayout>(Resource.Id.AbcDEF);

            ll.Orientation = Orientation.Vertical;
            //
            LinearLayout DialogLayout = new LinearLayout(this);

            DialogLayout.LayoutParameters = vWrap;
            DialogLayout.Orientation      = Orientation.Vertical;
            DialogLayout.SetGravity(GravityFlags.CenterVertical);
            //Dialog TitleTV
            ExDialogTitle = new EditText(this);
            ExDialogTitle.SetBackgroundColor(Color.RoyalBlue);
            ExDialogTitle.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            ExDialogTitle.SetTextColor(Color.DarkRed);
            ExDialogTitle.TextSize = 40;
            ExDialogTitle.Text     = ab1.name;
            DialogLayout.AddView(ExDialogTitle);
            //
            DialogExplenationTextView          = new EditText(this);
            DialogExplenationTextView.Text     = ab1.explenatiotn.ToString();
            DialogExplenationTextView.TextSize = 30;
            DialogExplenationTextView.SetTextColor(Color.Black);
            //
            if (f == 1)
            {
                if (!h)
                {
                    for (int i = 0; i < exes.Count; i++)
                    {
                        if (buttons[i].Text == b.Text)
                        {
                            b.Time = buttons[i].Time;

                            h = true;
                        }
                    }
                }
                dur = new EditText(this)
                {
                    Text             = b.Time.ToString(),
                    LayoutParameters = OneTwentyParams,
                    Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf"),
                    TextSize         = 35,
                };
                dur.SetBackgroundResource(Resource.Drawable.MyBackground);
                dur.InputType = InputTypes.ClassPhone;
                //
            }
            Save = new MyButton(this)
            {
                Text             = "Save",
                LayoutParameters = OneTwentyParams,
                TextSize         = 35,
                Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf"),
            };
            bool a = false;

            Save.Click += delegate
            {
                OAduration       -= b.Time;
                b.Time            = int.Parse(dur.Text);
                OAduration       += b.Time;
                OAdurationTV.Text = OAduration.ToString();
                a = true;
                if (OAduration <= 50 && OAduration >= 40)
                {
                    OAdurationTV.SetTextColor(Color.LawnGreen);
                }
                else if (OAduration > 50)
                {
                    OAdurationTV.SetTextColor(Color.Red);
                }
                else
                {
                    OAdurationTV.SetTextColor(Color.Black);
                }
                if (ExDialogTitle.Text != ab1.name)
                {
                    ab1.name = ExDialogTitle.Text;
                    a        = true;
                    Toasty.Info(this, "Happened2", 2, false).Show();
                }
                else if (DialogExplenationTextView.Text != ab1.explenatiotn)
                {
                    ab1.explenatiotn = DialogExplenationTextView.Text;
                    a = true;
                    Toasty.Info(this, "Happened3", 2, false).Show();
                }
                if (a == true)
                {
                    HashMap map = new HashMap();
                    map.Put("Explenation", ab1.explenatiotn);
                    map.Put("Name", ab1.name);
                    DocumentReference DocRef = database.Collection("Users").Document(admin.email).Collection("Exercises").Document(ab1.name);
                    DocRef.Set(map);
                }
            };
            ////Add BitMap
            //
            DialogLayout.AddView(DialogExplenationTextView);
            if (f == 1)
            {
                DialogLayout.AddView(dur);
            }
            DialogLayout.AddView(Save);
            ll.AddView(DialogLayout);
            d1.Show();
        }
Exemple #8
0
        public FormSlider(Context context, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus Reportstatus)
            : base(context)
        {
            resource     = context.Resources;
            contextx     = context;
            OwnerID      = ownerID;
            VerifierID   = verifiedID;
            Popup        = new InformationPopup(context);
            reportStatus = Reportstatus;

            if (element.Value == "")
            {
                element.Value = "0";
            }

            theme = new FormTheme(context, element.Title);
            RelativeLayout countHolder = new RelativeLayout(context);

            Orientation             = Orientation.Vertical;
            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();

            EditText counterEditText = new EditText(context);

            counterEditText.Text      = element.Value;
            counterEditText.TextSize  = 30;
            counterEditText.InputType = Android.Text.InputTypes.ClassNumber;
            counterEditText.SetTextColor(Color.ParseColor((resource.GetString(Resource.Color.green_primary))));
            counterEditText.Gravity = GravityFlags.CenterHorizontal;
            counterEditText.SetPadding(10, 0, 10, 0);
            counterEditText.SetBackgroundResource(Resource.Drawable.back);
            counterEditText.SetWidth(200);

            RelativeLayout.LayoutParams paramsForSliderCounter = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            paramsForSliderCounter.AddRule(LayoutRules.CenterHorizontal);
            counterEditText.LayoutParameters = paramsForSliderCounter; //causes layout update
            counterEditText.SetPadding(20, 5, 20, 5);

            countHolder.AddView(counterEditText);

            ImageView indicatorImageView = (ImageView)theme.GetChildAt(1);

            indicatorImageView.SetImageResource(0);
            //activateElementInfo(element);
            Popup.activateElementInfo(theme, element);

            SeekBar slider = new SeekBar(context);

            slider.Progress = Integer.ParseInt(element.Value);
            slider.SetPadding(45, 15, 45, 20);
            slider.Id  = element.Id;
            slider.Max = 31;

            isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);

            slider.ProgressChanged += (sender, e) =>
            {
                if (e.FromUser)
                {
                    counterEditText.Text = $"{e.Progress}";

                    if (counterEditText.Text.Equals("0"))
                    {
                        indicatorImageView.SetImageResource(0);
                    }
                    else
                    {
                        indicatorImageView.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                        sharedPreferencesEditor.PutBoolean("ReportEditFlag", true);
                        sharedPreferencesEditor.Commit();
                    }
                }
            };

            counterEditText.TextChanged += (sender, e) =>
            {
                if (!counterEditText.Text.Equals("0"))
                {
                    indicatorImageView.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);

                    if (Integer.ParseInt(counterEditText.Text) > 31 || Integer.ParseInt(counterEditText.Text) < 0)
                    {
                        sliderValuePopUp(context);
                        counterEditText.Text = "0";
                        slider.Progress      = 0;
                    }
                    slider.Progress = Integer.ParseInt(counterEditText.Text);
                }
                else
                {
                    indicatorImageView.SetImageResource(0);
                }
            };

            //when opening a Draft or Archive
            if (!counterEditText.Text.Equals("0"))
            {
                indicatorImageView.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
            }

            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    slider.Enabled          = false;
                    counterEditText.Enabled = false;

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        slider.Enabled          = true;
                        counterEditText.Enabled = true;
                    }
                }

                else
                {
                    slider.Enabled          = true;
                    counterEditText.Enabled = true;
                }
            }
            else
            {
                slider.Enabled          = false;
                counterEditText.Enabled = false;
            }

            if (isArcheived)
            {
                slider.Enabled          = false;
                counterEditText.Enabled = false;
            }

            AddView(theme);
            AddView(countHolder);
            AddView(slider);
            SetPadding(45, 10, 45, 20);
        }
 private void SetStyle()
 {
     txt_ProdTabPreco.SetBackgroundResource(Resource.Drawable.EditTextStyle);
 }
Exemple #10
0
        public FormTime(Context context, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus Reportstatus)
            : base(context)
        {
            resource                = context.Resources;
            contextx                = context;
            OwnerID                 = ownerID;
            VerifierID              = verifiedID;
            theme                   = new FormTheme(context, element.Title);
            Orientation             = Orientation.Vertical;
            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();
            Popup                   = new InformationPopup(context);
            reportStatus            = Reportstatus;

            isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);

            timeFrame = new RelativeLayout(context);

            RelativeLayout.LayoutParams parms2 = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
            timeFrame.LayoutParameters = parms2;

            ImageView indicatorImage = (ImageView)theme.GetChildAt(1);

            //activateElementInfo(element);
            Popup.activateElementInfo(theme, element);

            RelativeLayout.LayoutParams paramsOfTimeDisplay = new RelativeLayout.LayoutParams(500, RelativeLayout.LayoutParams.WrapContent);
            paramsOfTimeDisplay.AddRule(LayoutRules.CenterVertical);
            paramsOfTimeDisplay.AddRule(LayoutRules.AlignParentLeft);

            timeDisplay    = new EditText(context);
            timeDisplay.Id = element.Id;
            timeDisplay.SetTextColor(Color.Black);
            timeDisplay.LayoutParameters = paramsOfTimeDisplay;
            timeDisplay.Focusable        = false;
            timeDisplay.SetBackgroundResource(Resource.Drawable.custom_edit_text_color);
            timeDisplay.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;

            RelativeLayout.LayoutParams paramsOfClearButton = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsOfClearButton.AddRule(LayoutRules.RightOf, timeDisplay.Id);

            timeDisplay.Touch += (s, e) =>
            {
                var handled = false;
                if (e.Event.Action == MotionEventActions.Down)
                {
                    createTimeDialog(context);
                    handled = true;
                }
                else if (e.Event.Action == MotionEventActions.Up)
                {
                    handled = true;
                }
                e.Handled = handled;
            };

            clearTimeButton          = new Button(context);
            clearTimeButton.Text     = "Clear";
            clearTimeButton.TextSize = 12;
            clearTimeButton.SetTextColor(Resources.GetColor(Resource.Color.theme_color));
            clearTimeButton.SetBackgroundResource(0);
            clearTimeButton.LayoutParameters = paramsOfClearButton;
            clearTimeButton.Click           += delegate { clearTime(); };

            hour   = DateTime.Now.Hour;
            minute = DateTime.Now.Minute;

            if (string.IsNullOrEmpty(element.Value))
            {
                timeDisplay.Text = "";
                indicatorImage.SetImageResource(0);
                clearTimeButton.Visibility = ViewStates.Gone;
            }
            else
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                timeDisplay.Text = element.Value;
            }

            timeDisplay.TextChanged += (sender, e) =>
            {
                if (!timeDisplay.Text.Equals(""))
                {
                    indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                    clearTimeButton.Visibility = ViewStates.Visible;
                }
                else
                {
                    indicatorImage.SetImageResource(0);
                    clearTimeButton.Visibility = ViewStates.Gone;
                }

                sharedPreferencesEditor.PutBoolean("ReportEditFlag", true);
                sharedPreferencesEditor.Commit();
            };

            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    clearTimeButton.Enabled    = false;
                    clearTimeButton.Visibility = ViewStates.Gone;
                    timeDisplay.Enabled        = false;
                    timeDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey));

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        clearTimeButton.Enabled    = true;
                        clearTimeButton.Visibility = ViewStates.Gone;
                        timeDisplay.Enabled        = true;
                        timeDisplay.SetTextColor(Resources.GetColor(Resource.Color.black));
                    }
                }

                else
                {
                    clearTimeButton.Enabled    = true;
                    clearTimeButton.Visibility = ViewStates.Gone;
                    timeDisplay.Enabled        = true;
                    timeDisplay.SetTextColor(Resources.GetColor(Resource.Color.black));
                }
            }
            else
            {
                clearTimeButton.Enabled    = false;
                clearTimeButton.Visibility = ViewStates.Gone;
                timeDisplay.Enabled        = false;
                timeDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey));
            }


            if (isArcheived)
            {
                timeDisplay.Enabled        = false;
                clearTimeButton.Visibility = ViewStates.Gone;
                timeDisplay.Enabled        = false;
                timeDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey));
            }

            timeFrame.AddView(timeDisplay);
            timeFrame.AddView(clearTimeButton);
            AddView(theme);
            AddView(timeFrame);
            SetPadding(45, 10, 45, 20);
        }
        private void SetStyle()
        {
            txtid_Codigo.SetBackgroundResource(Resource.Drawable.EditTextStyle);
            txtid_Vendedor.SetBackgroundResource(Resource.Drawable.EditTextStyle);
            txtDataEmissao.SetBackgroundResource(Resource.Drawable.EditTextStyle);
            txtValor_Total.SetBackgroundResource(Resource.Drawable.EditTextStyle);
            txtMsgPedido.SetBackgroundResource(Resource.Drawable.EditTextStyle);
            txtMsgNF.SetBackgroundResource(Resource.Drawable.EditTextStyle);

            if (pedido != null)
            {
                if (pedido.fl_status == 0)
                {
                    txtStatusPedido.SetBackgroundResource(Resource.Drawable.Status_Orcamento);
                }

                if (pedido.fl_status == 1)
                {
                    txtStatusPedido.SetBackgroundResource(Resource.Drawable.StatusFinalizado);
                }

                if (pedido.fl_status == 2)
                {
                    txtStatusPedido.SetBackgroundResource(Resource.Drawable.StatusSincronizado);
                }

                if (pedido.fl_status == 3)
                {
                    txtStatusPedido.SetBackgroundResource(Resource.Drawable.StatusParcProcessado);
                }

                if (pedido.fl_status == 4)
                {
                    txtStatusPedido.SetBackgroundResource(Resource.Drawable.StatusNaoProcessado);
                }

                if (pedido.fl_status == 5)
                {
                    txtStatusPedido.SetBackgroundResource(Resource.Drawable.StatusCancelado);
                }

                if (pedido.fl_status == 6)
                {
                    txtStatusPedido.SetBackgroundResource(Resource.Drawable.StatusParcFaturado);
                }

                if (pedido.fl_status == 7)
                {
                    txtStatusPedido.SetBackgroundResource(Resource.Drawable.StatusFaturado);
                }

                if (pedido.fl_status == 8)
                {
                    txtStatusPedido.SetBackgroundResource(Resource.Drawable.StatusParcEntregue);
                }

                if (pedido.fl_status == 9)
                {
                    txtStatusPedido.SetBackgroundResource(Resource.Drawable.StatusEntregue);
                }
            }
        }
Exemple #12
0
        public FormGPS(Context context, ReportElement element, int ownerID, int userID, int verifiedID, ReportStatus Reportstatus)
            : base(context)
        {
            resource    = context.Resources;
            contextx    = context;
            OwnerID     = userID;
            VerifierID  = verifiedID;
            theme       = new FormTheme(context, element.Title);
            Orientation = Orientation.Vertical;
            RelativeLayout gpsHolder = new RelativeLayout(contextx);

            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();
            List <KeyValue> existingValue = element.Values;

            Popup        = new InformationPopup(context);
            reportStatus = Reportstatus;

            editText = new EditText(context);
            Id       = element.Id;

            isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);

            if (existingValue != null)
            {
                foreach (var address in existingValue)
                {
                    if (address.Name == "address")
                    {
                        editText.Text = address.Value;
                        curaddress    = address.Value;
                    }

                    if (address.Name == "longitude")
                    {
                        longtitude = address.Value;
                    }

                    if (address.Name == "latitude")
                    {
                        latitude = address.Value;
                    }
                }
            }

            editText.SetBackgroundResource(Resource.Drawable.custom_edit_text_color);

            RelativeLayout.LayoutParams paramsForGPSHolder = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);
            gpsHolder.LayoutParameters = paramsForGPSHolder;

            ImageButton locationBtn = new ImageButton(context);

            locationBtn.Id = 891;
            locationBtn.SetBackgroundResource(0);
            locationBtn.SetImageResource(Resource.Drawable.android_form_gps_icon);
            locationBtn.Click += (senderGPS, e) => AddressButton_OnClick(editText, this);

            RelativeLayout.LayoutParams paramsForlocationBtn = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForlocationBtn.AddRule(LayoutRules.AlignParentTop);
            paramsForlocationBtn.AddRule(LayoutRules.AlignParentEnd);
            locationBtn.LayoutParameters = paramsForlocationBtn;

            RelativeLayout.LayoutParams paramsForEditText = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForEditText.AddRule(LayoutRules.AlignParentTop);
            paramsForEditText.AddRule(LayoutRules.AlignParentStart);
            paramsForEditText.AddRule(LayoutRules.StartOf, locationBtn.Id);
            editText.LayoutParameters = paramsForEditText;
            //editText.Gravity = GravityFlags.CenterVertical;

            gpsHolder.AddView(editText);
            gpsHolder.AddView(locationBtn);

            ImageView indicatorImage = (ImageView)theme.GetChildAt(1);

            //activateElementInfo(element);
            Popup.activateElementInfo(theme, element);
            editText.TextChanged += (sender, e) =>
            {
                if (!editText.Text.Equals(""))
                {
                    indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                    curaddress = editText.Text;
                }
                else
                {
                    indicatorImage.SetImageResource(0);
                }
            };

            //when opening a Draft or Archive
            if (!editText.Text.Equals(""))
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
            }


            if (string.IsNullOrEmpty(element.FilledBy))
            {
                //do nothing
            }
            else if (element.FilledBy == userID + "")
            {
                //do nothing
            }
            else
            {
                editText.Enabled = false;
                editText.SetTextColor(Resources.GetColor(Resource.Color.grey));
            }

            TextView elementSplitLine = new TextView(context);

            elementSplitLine.TextSize = 0.5f;
            elementSplitLine.SetBackgroundColor(Color.ParseColor(resource.GetString(Resource.Color.grey)));


            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    editText.Enabled = false;
                    editText.SetTextColor(Resources.GetColor(Resource.Color.grey));
                    locationBtn.Enabled = false;
                    locationBtn.Click  += null;

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        editText.Enabled = true;
                        editText.SetTextColor(Resources.GetColor(Resource.Color.black));
                        locationBtn.Enabled = true;
                    }
                }

                else
                {
                    editText.Enabled = true;
                    editText.SetTextColor(Resources.GetColor(Resource.Color.black));
                    locationBtn.Enabled = true;
                }
            }
            else
            {
                editText.Enabled = false;
                editText.SetTextColor(Resources.GetColor(Resource.Color.grey));
                locationBtn.Enabled = false;
                locationBtn.Click  += null;
            }

            if (isArcheived)
            {
                editText.Enabled = false;
                editText.SetTextColor(Resources.GetColor(Resource.Color.grey));
                locationBtn.Enabled = false;
                locationBtn.Click  += null;
            }


            AddView(theme);
            AddView(gpsHolder);
            SetPadding(45, 10, 45, 20);
        }
        protected override void OnCreate(Bundle bundle)
        {
            //RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.Pay_SMS_Main);

            sendSMS_btn = FindViewById<Button> (Resource.Id.sendSMS);

            numberEditText = FindViewById<EditText> (Resource.Id.editText_number);
            numberEditText.Text = GeoFencer.inZone ();

            listView = FindViewById<ListView> (Resource.Id.List_SMS_Main_History);
            listView.ItemClick += OnListItemClick;

            messageEditText = FindViewById<EditText> (Resource.Id.editText_message);
            //prikazuje sva slova kao velika.(upper) i ogranicava velicinu registracije na registrationLength
            messageEditText.SetFilters (new IInputFilter[] { new InputFilterAllCaps (),new InputFilterLengthFilter (registrationLength) });

            var prefs = Application.Context.GetSharedPreferences("MySharedPrefs", FileCreationMode.Private);
            const int regaPicDefault=Resource.Drawable.ociscena_rega;

            messageEditText.SetBackgroundResource ( prefs.GetInt("MyRegistrationPrefs",regaPicDefault ));

            try{
                messageEditText.Text = prefs.GetString ("MyRegistrationDefaultPrefs", "");
                //Log.Debug ("defaultna rega",messageEditText.Text);
            }catch(Exception e){
                Log.Debug ("Nema registracije na izbor",e.ToString ());
            }

            #region Ucitava podatke iz datoteke svaki put kad se otvori layout Pay_SMS_Main
            //Log.Debug ("ON CREATE","DULJINA"+new FileInfo(message_Data).Length+" -- "+Enable_message_update);
            long duljina=0;
            try{
                duljina = new FileInfo (message_Data).Length;
            }catch(Exception e){

                Log.Debug ("Pay_SMS_Main","FILE INFO krivo učitava "+e.ToString ());
            }

            if (duljina != 0 || Fill_ListView_With_Data.update_inbox_messages==true) {
                List<string> data = new List<string> ();
                String line;

                StreamReader reader = new StreamReader (message_Data);
                while ((line=reader.ReadLine ()) != null) {
                    data.Add (line);
                }

                reader.Close ();
                podaciDialogLista=data;
                try{
                    Fill_ListView_With_Data.FillListWithData (data,this,listView);
                }
                catch(NullReferenceException e){
                    Log.Debug ("FillListWithData:Na pocetku Pay_SMS_Main",	e.ToString ());
                }
            }else{
                Fill_ListView_With_Data.DeleteHistory ();
            }

            #endregion

            //if user enabled Inbox messages
            if(Fill_ListView_With_Data.Enable_message_update==true){
                Fill_ListView_With_Data.Fill_With_Inbox_Data (this,listView);
            }

            try{
                var tuple=ParseZoneNumbers.LoadZoneNumbersAssetsData (this);
                zone = tuple.Item1; //zone
                zoneDictionary = tuple.Item2; // zone i pripadni stringovi
            }catch(Exception e){
                Log.Debug ("Greska prilikom ucitavanja zone i zoneDictionary u Pay_SMS_Main",e.ToString ());
            }

            //dodavanje metode EventHandler delegatu iz OnReceiveSMS
            //OnReceiveSMS.ReceiveSMSmessage += new OnReceiveSMS.ReceiveSMSdelegate (EventHandler);

            //spremanje popisa brojeva zona u memoriju
            var prefsZone = Application.Context.GetSharedPreferences("MySharedPrefs", FileCreationMode.Private);
            var prefsZoneEditor = prefsZone.Edit ();
            prefsZoneEditor.PutStringSet("MyZonePrefs", zone);
            prefsZoneEditor.Commit();

            //spremanje dictionarya zone-numbers u memoriju
            var prefsDict = Application.Context.GetSharedPreferences("MySharedPrefs", FileCreationMode.Private);
            var prefsDictEditor = prefsDict.Edit ();
            string dict = string.Join (", ", zoneDictionary
                                             .Select (m => m.Key + ":" + m.Value)
                                             .ToArray ());
            prefsDictEditor.PutString("MyDictPrefs", dict);
            prefsDictEditor.Commit();

            #region Button inicijalizacija zona i Click metoda

            /*
             * Inicijalizacija dugmova zona i postavljanje njihovog rada.
             */
            Button vuki_btn = FindViewById<Button> (Resource.Id.zona01_btn);
            Button zona1_btn = FindViewById<Button> (Resource.Id.zona1_btn);
            Button zona2_btn = FindViewById<Button> (Resource.Id.zona2_btn);
            Button zona3_btn = FindViewById<Button> (Resource.Id.zona3_btn);
            Button zona4_1_btn = FindViewById<Button> (Resource.Id.zona4_1_btn);
            Button zona4_2_btn = FindViewById<Button> (Resource.Id.zona4_2_btn);

            string zone_number = "";

            vuki_btn.Click += delegate {
                zone_number=zone[0];  //prikazuje broj "+385989305003"
                //zone_number = Resources.GetString (Resource.String.vuki_number);
                zona30=true;
                String broj="700101";
                numberEditText.Text = (broj + " [ ZONA 1#30 ] ");
            };

            zona1_btn.Click += delegate {
                zone_number=zone[1];
                zona30=false;
                //zone_number = Resources.GetString (Resource.String.zona1_number);
                numberEditText.Text = (zone_number + " [ ZONA 1 ] ");
            };

            zona2_btn.Click += delegate {
                zone_number=zone[2];
                zona30=false;
                //zone_number = Resources.GetString (Resource.String.zona2_number);
                numberEditText.Text = (zone_number + " [ ZONA 2 ] ");
            };
            zona3_btn.Click += delegate {
                zone_number=zone[3];
                zona30=false;
                //zone_number = Resources.GetString (Resource.String.zona3_number);
                numberEditText.Text = (zone_number + " [ ZONA 3 ] ");
            };
            zona4_1_btn.Click += delegate {
                zone_number=zone[4];
                zona30=false;
                //zone_number = Resources.GetString (Resource.String.zona4_1_number);
                numberEditText.Text = (zone_number + " [ ZONA 4.1 ] ");
            };
            zona4_2_btn.Click += delegate {
                zone_number=zone[5];
                zona30=false;
                //zone_number = Resources.GetString (Resource.String.zona4_2_number);
                numberEditText.Text = (zone_number + " [ ZONA 4.2 ] ");
            };

            #endregion

            #region Slanje SMS poruke
            /**
             * Dio za slanje SMS poruke.
             */
            sendSMS_btn.Click += delegate {
                String sms_message="";
                String sms_messageClean=messageEditText.Text;

                if(zona30==true){
                    zona30=false;
                    zone_number="700101"; //TODO  prepravka da salje na pravi broj //sa komentarom salje na vuki broj, bez salje dobro.
                    sms_message=messageEditText.Text+"#30";
                }else{
                    sms_message=messageEditText.Text;
                }

                if(sms_message.Length>=1 && CheckSMSNumbers (zone_number) )
                {
                    valid_check = true;
                }

                if (valid_check) {
                    smsManager.SendTextMessage (zone_number, null, sms_message, null, null);

                    //ako je omogucen alarm prikazi Toast
                    var valid_Alarm=prefs.GetBoolean ("MyAlarmValue", true);
                    if(valid_Alarm){
                        Toast.MakeText (ApplicationContext, "SMS poruka je poslana. (alarm JE upaljen)", ToastLength.Short).Show ();
                    }else{
                        Toast.MakeText (ApplicationContext, "SMS poruka je poslana. (alarm NIJE upaljen)", ToastLength.Short).Show ();
                    }

                    ICollection<string>  rege=prefs.GetStringSet("MyRegistrationTextPrefs", null);
                    rege.Add (sms_messageClean);
                    var prefsEditor = prefsZone.Edit ();
                    prefsEditor.PutStringSet ("MyRegistrationTextPrefs", rege);
                    prefsEditor.Commit ();

                    var activity_pay_main=new Intent (this,typeof(Pay_Main));
                    StartActivity (activity_pay_main);

                } else {

                    if (zone_number.Length == 0 && sms_message.Length == 0) {
                        Toast.MakeText (ApplicationContext, "Odaberite zonu i upišite registracijsku oznaku.", ToastLength.Short).Show ();
                    } else if (zone_number.Length == 0 && sms_message.Length != 0) {
                        Toast.MakeText (ApplicationContext, "Odaberite zonu.", ToastLength.Short).Show ();
                    } else {
                        Toast.MakeText (ApplicationContext, "Upišite registracijsku oznaku.", ToastLength.Short).Show ();
                    }
                }

            };
            #endregion
        }
        public FormPlusMinusCounter(Context context, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus Reportstatus)
            : base(context)
        {
            resource     = context.Resources;
            contextx     = context;
            OwnerID      = ownerID;
            VerifierID   = verifiedID;
            Popup        = new InformationPopup(context);
            reportStatus = Reportstatus;

            if (element.Value == "")
            {
                element.Value = "0";
            }

            theme = new FormTheme(context, element.Title);
            RelativeLayout countHolder = new RelativeLayout(context);

            Orientation             = Orientation.Vertical;
            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();

            RelativeLayout stepperlayout = new RelativeLayout(context);

            stepperlayout.FocusableInTouchMode = true;
            stepperlayout.Focusable            = true;
            stepperlayout.SetPadding(0, 5, 0, 5);

            RelativeLayout.LayoutParams paramsForStepperLayout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);
            paramsForStepperLayout.AddRule(LayoutRules.CenterHorizontal);
            stepperlayout.LayoutParameters = paramsForStepperLayout; //causes layout update

            ImageButton negativeButton = new ImageButton(context);

            negativeButton.SetImageResource(0);
            negativeButton.SetBackgroundResource(Resource.Drawable.decrement);

            ImageButton positiveButton = new ImageButton(context);

            positiveButton.SetImageResource(0);
            positiveButton.SetBackgroundResource(Resource.Drawable.increment);

            negativeButton.Click += (sender3, e) => decreaseCount(sender3, e, element.Info);
            positiveButton.Click += (sender4, e) => increaseCount(sender4, e, element.Info);

            counterEditText           = new EditText(context);
            counterEditText.Id        = element.Id;
            counterEditText.Text      = element.Value;
            counterEditText.TextSize  = 25;
            counterEditText.InputType = Android.Text.InputTypes.ClassNumber;
            counterEditText.SetTextColor(Color.ParseColor((resource.GetString(Resource.Color.green_primary))));

            counterEditText.Gravity = GravityFlags.Center;
            counterEditText.SetBackgroundResource(Resource.Drawable.back);
            counterEditText.SetPadding(10, 15, 10, 10);

            counterEditText.SetMaxWidth(350);
            counterEditText.SetMinWidth(220);
            counterEditText.SetMinimumWidth(220);

            counterEditText.SetMaxHeight(200);
            counterEditText.SetMinHeight(100);
            counterEditText.SetMinimumHeight(100);

            //counterEditText.Focusable = false;

            RelativeLayout.LayoutParams paramsForSliderCounter = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForSliderCounter.AddRule(LayoutRules.CenterInParent);
            counterEditText.LayoutParameters = paramsForSliderCounter;

            RelativeLayout.LayoutParams paramsForNegative = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForNegative.AddRule(LayoutRules.LeftOf, counterEditText.Id);
            paramsForNegative.AddRule(LayoutRules.AlignBottom, counterEditText.Id);
            paramsForNegative.AddRule(LayoutRules.AlignTop, counterEditText.Id);
            negativeButton.LayoutParameters = paramsForNegative;

            negativeButton.SetMinimumHeight(100);
            negativeButton.SetMaxHeight(150);
            negativeButton.SetMinimumWidth(200);
            negativeButton.SetMaxHeight(100);

            RelativeLayout.LayoutParams paramsForPositive = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForPositive.AddRule(LayoutRules.RightOf, counterEditText.Id);
            paramsForPositive.AddRule(LayoutRules.AlignBottom, counterEditText.Id);
            paramsForPositive.AddRule(LayoutRules.AlignTop, counterEditText.Id);
            positiveButton.LayoutParameters = paramsForPositive;

            positiveButton.SetMinimumHeight(100);
            positiveButton.SetMaxHeight(150);
            positiveButton.SetMinimumWidth(200);
            positiveButton.SetMaxHeight(100);

            ImageView indicatorImageView = (ImageView)theme.GetChildAt(1);

            indicatorImageView.SetImageResource(0);
            Popup.activateElementInfo(theme, element);

            isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);

            counterEditText.TextChanged += (sender, e) =>
            {
                if (!counterEditText.Text.Equals("0"))
                {
                    indicatorImageView.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                    sharedPreferencesEditor.PutBoolean("ReportEditFlag", true);
                    sharedPreferencesEditor.Commit();
                }
                else
                {
                    indicatorImageView.SetImageResource(0);
                }
            };

            //when opening a Draft or Archive
            if (!counterEditText.Text.Equals("0"))
            {
                indicatorImageView.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
            }

            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    negativeButton.Enabled  = false;
                    positiveButton.Enabled  = false;
                    counterEditText.Enabled = false;

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        negativeButton.Enabled  = true;
                        positiveButton.Enabled  = true;
                        counterEditText.Enabled = true;
                    }
                }

                else
                {
                    negativeButton.Enabled  = true;
                    positiveButton.Enabled  = true;
                    counterEditText.Enabled = true;
                }
            }
            else
            {
                negativeButton.Enabled  = false;
                positiveButton.Enabled  = false;
                counterEditText.Enabled = false;
            }

            if (isArcheived)
            {
                negativeButton.Enabled  = false;
                positiveButton.Enabled  = false;
                counterEditText.Enabled = false;
            }

            stepperlayout.AddView(negativeButton);
            stepperlayout.AddView(counterEditText);
            stepperlayout.AddView(positiveButton);

            AddView(theme);
            AddView(stepperlayout);
            SetPadding(45, 10, 45, 20);
        }
        private void AddInputView(string labelTitle, int stepType, string persistedStepAnswer)
        {
            //define the label to be placed above the text input and set it's title
            TextView label = new TextView(Activity);

            label.SetTextAppearance(Activity, Resource.Style.DefaultTextView);
            label.Text = labelTitle;

            LinearLayout.LayoutParams labelParams = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.WrapContent,
                LinearLayout.LayoutParams.WrapContent
                );

            labelParams.SetMargins(5, 0, 0, 8);
            labelParams.Gravity = GravityFlags.Left;

            _ticketLinearLayout.AddView(label, labelParams);

            //define the text input
            EditText eText = new EditText(Activity);

            eText.SetTextAppearance(Activity, Resource.Style.DefaultEditText);
            eText.SetBackgroundResource(Resource.Drawable.edit_text_default);

            //and set the inputtype depending on whether a text, numeric or date input is required
            switch (ProcessFlowStep.Type)
            {
            case (int)StepInputTypeEnum.TextInput:

                eText.SetLines(8);
                eText.Gravity = GravityFlags.Left | GravityFlags.Top;

                break;

            case (int)StepInputTypeEnum.NumericInput:

                eText.InputType = InputTypes.ClassNumber;

                break;

            case (int)StepInputTypeEnum.DateInput:

                eText.InputType = InputTypes.ClassDatetime;

                break;
            }

            if (persistedStepAnswer != null)
            {
                eText.Text = persistedStepAnswer;
            }

            LinearLayout.LayoutParams eTextParams = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FillParent,
                LinearLayout.LayoutParams.WrapContent
                );

            eTextParams.SetMargins(0, 0, 0, 20);
            eTextParams.Gravity = GravityFlags.Left;

            _ticketLinearLayout.AddView(eText, eTextParams);

            //show the button(s), if any, under the text input (typically a NEXT button should be present)
            if (ProcessFlowStep.SubSteps.Any())
            {
                //each substep is rendered as a button
                foreach (var substep in ProcessFlowStep.SubSteps)
                {
                    var processFlowSubStep = substep;

                    var answerButton = new Button(Activity);
                    answerButton.SetTextAppearance(Activity, Resource.Style.GreenButton);
                    answerButton.SetBackgroundResource(Resource.Drawable.button_green);
                    answerButton.Text   = substep.NavigationText;
                    answerButton.Click += delegate
                    {
                        // If this is the last step, inform parent activity to show summary in next activity
                        if (processFlowSubStep.IsEndPoint)
                        {
                            string stepAnswer = null;

                            //loop through all the edittext widgets on the screen, get the value of each and set it to the corresponding answer
                            for (var x = 0; x < _ticketLinearLayout.ChildCount; x++)
                            {
                                var widget = _ticketLinearLayout.GetChildAt(x);

                                if (!(widget is EditText))
                                {
                                    continue;
                                }
                                var textInputWidget = (EditText)widget;

                                if (string.IsNullOrEmpty(textInputWidget.Text))
                                {
                                    AlertDialogBuilder.Instance
                                    .AddButton(Resource.String.ok, validateFail)
                                    .SetText(0, Resource.String.value_required)
                                    .Show(Activity);
                                    return;
                                }

                                stepAnswer = textInputWidget.Text;
                            }

                            //for now we assume there is only one textinput per step
                            _processFlowListener.PersistInputAnswerToState(ProcessFlowStep.Id, stepAnswer);

                            _processFlowListener.ShowProcessFlowSummary(processFlowSubStep);
                        }
                        else
                        {
                            string stepAnswer = null;

                            //loop through all the edittext widgets on the screen, get the value of each and set it to the corresponding answer
                            for (var x = 0; x < _ticketLinearLayout.ChildCount; x++)
                            {
                                var widget = _ticketLinearLayout.GetChildAt(x);

                                if (!(widget is EditText))
                                {
                                    continue;
                                }
                                var textInputWidget = (EditText)widget;

                                if (string.IsNullOrEmpty(textInputWidget.Text))
                                {
                                    AlertDialogBuilder.Instance
                                    .AddButton(Resource.String.ok, validateFail)
                                    .SetText(0, Resource.String.value_required)
                                    .Show(Activity);
                                    return;
                                }

                                stepAnswer = textInputWidget.Text;
                            }

                            //for now we assume there is only one textinput per step
                            _processFlowListener.PersistInputAnswerToState(ProcessFlowStep.Id, stepAnswer);

                            // If not, display the step
                            _processFlowListener.ShowStep(processFlowSubStep);
                        }
                    };

                    LinearLayout.LayoutParams answerButtonParams = new LinearLayout.LayoutParams(
                        LinearLayout.LayoutParams.FillParent,
                        LinearLayout.LayoutParams.WrapContent
                        );

                    answerButtonParams.SetMargins(0, 0, 0, 12);
                    _ticketLinearLayout.AddView(answerButton, answerButtonParams);
                }
            }
        }
        public void UpdateControlUI()
        {
            //use this if IsUnderlined == true
            Drawable drawable = _editText.Background;

            // else remove the underline in the android entry field
            GradientDrawable gradientDrawable = new GradientDrawable();

            gradientDrawable.SetCornerRadius(5);

            //set stroke
            if (_ultimateEntry.ShowError)
            {
                gradientDrawable.SetStroke(4, _ultimateEntry.ErrorColor.ToAndroid());
                drawable.SetColorFilter(_ultimateEntry.ErrorColor.ToAndroid(), PorterDuff.Mode.SrcIn);
            }
            else if (!_ultimateEntry.ShowError && _editText.IsFocused)
            {
                gradientDrawable.SetStroke(4, _ultimateEntry.FocusedBorderColor.ToAndroid());
                drawable.SetColorFilter(_ultimateEntry.FocusedBorderColor.ToAndroid(), PorterDuff.Mode.SrcIn);
            }
            else
            {
                gradientDrawable.SetStroke(4, Color.Transparent.ToAndroid());
                drawable.ClearColorFilter();
            }

            //get background color
            var bgColor = _editText.IsFocused
                    ? _ultimateEntry.FocusedBackgroundColor
                    : _entryBackgroundColor;

            //set background
            if (_ultimateEntry.IsRoundedEntry)
            {
                gradientDrawable.SetColor(bgColor.ToAndroid());
                _editText.Background = gradientDrawable;
            }
            else
            {
                _editText.SetBackgroundResource(Resource.Drawable.ExtEntryShape);
                _ultimateEntry.BackgroundColor = bgColor;
            }


            //handle toggling visibility to image on focus
            if (_editText.IsFocused)
            {
                if (!_ultimateEntry.AlwaysShowRightImage)
                {
                    _editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, _imageResourceId, 0);
                }
            }
            else
            {
                if (!_ultimateEntry.AlwaysShowRightImage)
                {
                    _editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0);
                }
            }
        }