コード例 #1
0
        private void add_multi_item_click(object sender, EventArgs args, MultiSelectSpinner multispinner)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(contextx);
            builder.SetTitle("Add Item");
            EditText input = new EditText(contextx);

            builder.SetView(input);

            builder.SetPositiveButton("Add", (senderAlert, args1) =>
            {
                KeyValue newValue = new KeyValue();
                newValue.Value    = "false";
                newValue.Id       = dropDownValues.Count;
                newValue.Name     = input.Text;

                dropDownValues.Add(newValue);
                multispinner.setItems(arrayofNames());
                builder.Dispose();
            });
            builder.SetNegativeButton("Cancel", (senderAlert, args1) =>
            {
                builder.Dispose();
            });
            builder.Show();
        }
コード例 #2
0
        private void CreateMultiDropDown(Context context, ImageView indicatorImage, int userID)
        {
            List <string> array = arrayofNames();

            multiSelectionSpinner = new MultiSelectSpinner(context, indicatorImage);
            RelativeLayout addMoreLayout = new RelativeLayout(context);
            ImageButton    addItem       = new ImageButton(context);

            multiSelectionSpinner.setItems(array);
            multiSelectionSpinner.setSelection(arrayofSelection().ToArray());

            RelativeLayout.LayoutParams paramsForSpinner = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);
            paramsForSpinner.SetMargins(0, 0, 70, 0);
            multiSelectionSpinner.LayoutParameters = paramsForSpinner;

            RelativeLayout.LayoutParams paramsForAddItem = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForAddItem.AddRule(LayoutRules.AlignParentRight);
            paramsForAddItem.AddRule(LayoutRules.RightOf, multiSelectionSpinner.Id);
            addItem.LayoutParameters = paramsForAddItem;
            //addItem.SetImageResource(Resource.Drawable.addmore);
            addItem.SetImageResource(Resource.Drawable.addbutton);
            addItem.SetBackgroundResource(0);
            addItem.Click += (sender3, e) => add_multi_item_click(sender3, e, multiSelectionSpinner);

            if (isArcheived)
            {
                multiSelectionSpinner.Enabled = false;
            }

            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    multiSelectionSpinner.Enabled = false;
                    addItem.Enabled   = false;
                    addItem.Clickable = false;

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        multiSelectionSpinner.Enabled = true;
                        addItem.Enabled   = true;
                        addItem.Clickable = true;
                    }
                }

                else
                {
                    multiSelectionSpinner.Enabled = true;
                    addItem.Enabled   = true;
                    addItem.Clickable = true;
                }
            }
            else
            {
                multiSelectionSpinner.Enabled = false;
                addItem.Enabled   = false;
                addItem.Clickable = false;
            }


            if (elementThis.AddNew)
            {
                addMoreLayout.AddView(multiSelectionSpinner);
                addMoreLayout.AddView(addItem);
                dropDownFrame.AddView(addMoreLayout);
            }
            else
            {
                dropDownFrame.AddView(multiSelectionSpinner);
            }
        }