コード例 #1
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            Log.Debug("MDD", "EntryElement: GetView: ConvertView: " + ((convertView == null) ? "false" : "true") +
                      " Value: " + Value + " Hint: " + Hint + " Password: "******"true" : "false"));


            TextView label;
            var      view = DroidResources.LoadStringEntryLayout(context, convertView, parent, LayoutId, out label, out _entry);

            if (view != null)
            {
                // Warning! Crazy ass hack ahead!
                // since we can't know when out convertedView was was swapped from inside us, we store the
                // old textwatcher in the tag element so it can be removed!!!! (barf, rech, yucky!)
                if (_entry.Tag != null)
                {
                    _entry.RemoveTextChangedListener((ITextWatcher)_entry.Tag);
                }

                _entry.Text = this.Value;
                _entry.Hint = this.Hint;

                if (this.Password)
                {
                    _entry.InputType = (InputTypes.ClassText | InputTypes.TextVariationPassword);
                }
                else if (this.Numeric)
                {
                    _entry.InputType = (InputTypes.ClassNumber | InputTypes.NumberFlagDecimal | InputTypes.NumberFlagSigned);
                }
                else
                {
                    _entry.InputType = InputTypes.ClassText;
                }

                // continuation of crazy ass hack, stash away the listener value so we can look it up later
                _entry.Tag = this;
                _entry.AddTextChangedListener(this);

                label.Text = (label != null) ? Caption: string.Empty;
            }
            return(view);
        }
コード例 #2
0
ファイル: StringElement.cs プロジェクト: vol16bit/xenko
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            View view = DroidResources.LoadStringElementLayout(context, convertView, parent, LayoutId, out _caption, out _text);

            if (view != null)
            {
                var fontSize = FontSize > 0 ? FontSize : 21; // taken from dialog_textarea.xml
                _caption.Text     = Caption;
                _caption.TextSize = fontSize;
                _text.Text        = Value;
                _text.TextSize    = fontSize;
                if (Click != null)
                {
                    view.Click += delegate { this.Click(); }
                }
                ;
            }
            return(view);
        }
コード例 #3
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            View view = DroidResources.LoadAchievementsElementLayout(context, convertView, parent, LayoutId, out _caption, out _description, out _percentageComplete, out _achivementImage);

            if (view != null)
            {
                _caption.Text            = Caption;
                _description.Text        = Description;
                _percentageComplete.Text = PercentageComplete.ToString();
                if (AchievementImage != null)
                {
                    _achivementImage.SetImageBitmap(AchievementImage);
                }
            }
            else
            {
                Android.Util.Log.Error("AchievementElement", "GetView failed to load template view");
            }
            return(view);
        }
コード例 #4
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            View view = DroidResources.LoadStringElementLayout(context, convertView, parent, LayoutId, out _caption, out _text);

            if (view != null)
            {
                _caption.Text     = Caption;
                _caption.TextSize = FontSize;
                _text.Text        = Value;
                _text.TextSize    = FontSize;
                _text.SetSingleLine(DetailTextSingleLine);

                if (String.IsNullOrEmpty(_caption.Text))
                {
                    _caption.Visibility = ViewStates.Gone;
                }

                if (Click != null)
                {
                    view.Touch += delegate(object sender, View.TouchEventArgs e) {
                        if (e.Event.Action == MotionEventActions.Up)
                        {
                            view.SetBackgroundColor(ReleaseBackgroundColor);
                            this.Click();
                        }
                        else if (e.Event.Action == MotionEventActions.Cancel)
                        {
                            view.SetBackgroundColor(ReleaseBackgroundColor);
                        }
                        else
                        {
                            if (PressBackgroundResource > 0)
                            {
                                view.SetBackgroundResource(PressBackgroundResource);
                            }
                        }
                    };
                }
            }
            return(view);
        }
コード例 #5
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            View checkboxView;
            View view = DroidResources.LoadBooleanElementLayout(context, convertView, parent, LayoutId, out _caption, out _subCaption, out checkboxView);

            if (view != null)
            {
                _caption.Text = Caption;

                _checkbox = checkboxView as CheckBox;
                _checkbox.SetOnCheckedChangeListener(this);
                _checkbox.Checked   = Value;
                _checkbox.Clickable = !ReadOnly;

                if (_subCaption != null)
                {
                    _subCaption.Text = SubCaption;
                }
            }
            return(view);
        }
コード例 #6
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            Context = context;

            LayoutInflater inflater = LayoutInflater.FromContext(context);

            View cell = new TextView(context)
            {
                TextSize = 16f, Text = Caption
            };
            var radio = _group as RadioGroup;

            if (radio != null)
            {
                string radioValue = GetSelectedValue();
                cell = DroidResources.LoadStringElementLayout(context, convertView, parent, LayoutId, out _caption, out _value);
                if (cell != null)
                {
                    _caption.Text = Caption;
                    _value.Text   = radioValue;
                    this.Click    = (o, e) => { SelectRadio(); };
                }
            }
            else if (_group != null)
            {
                int count = 0;
                foreach (var s in Sections)
                {
                    foreach (var e in s.Elements)
                    {
                        var ce = e as CheckboxElement;
                        if (ce != null)
                        {
                            if (ce.Value)
                            {
                                count++;
                            }
                            continue;
                        }
                        var be = e as BoolElement;
                        if (be != null)
                        {
                            if (be.Value)
                            {
                                count++;
                            }
                            continue;
                        }
                    }
                }
                //cell.DetailTextLabel.Text = count.ToString();
            }
            else if (_summarySection != -1 && _summarySection < Sections.Count)
            {
                var s = Sections[_summarySection];
                //if (summaryElement < s.Elements.Count)
                //    cell.DetailTextLabel.Text = s.Elements[summaryElement].Summary();
            }
            //cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;

            return(cell);
        }
コード例 #7
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            TextView label;
            var      view = DroidResources.LoadStringEntryLayout(context, convertView, parent, LayoutId, out label, out _entry);

            if (view != null)
            {
                // Warning! Crazy ass hack ahead!
                // since we can't know when out convertedView was was swapped from inside us, we store the
                // old textwatcher in the tag element so it can be removed!!!! (barf, rech, yucky!)
                if (_entry.Tag != null)
                {
                    _entry.RemoveTextChangedListener((ITextWatcher)_entry.Tag);
                }

                _entry.Text         = this.Value;
                _entry.Hint         = this.Hint;
                _entry.EditorAction = null;
                _entry.ImeOptions   = (int)ImeAction.Unspecified;

                if (this.Password)
                {
                    _entry.InputType = (int)(InputTypes.ClassText | InputTypes.TextVariationPassword);
                }
                else if (this.Numeric)
                {
                    _entry.InputType = (int)(InputTypes.ClassNumber | InputTypes.NumberFlagDecimal | InputTypes.NumberFlagSigned);
                }
                else
                {
                    _entry.InputType = (int)InputTypes.ClassText;
                }

                if (Lines > 1)
                {
                    _entry.InputType |= (int)InputTypes.TextFlagMultiLine;
                    _entry.SetLines(Lines);
                }
                else if (Send != null)
                {
                    _entry.ImeOptions = ImeAction.Go;
                    _entry.SetImeActionLabel("Go", ImeAction.Go);
                    _entry.EditorAction = (o, actionId, e) =>
                    {
                        if (actionId == ImeAction.Go)
                        {
                            Send();
                            return(true);
                        }
                        return(false);
                    };
                }

                // continuation of crazy ass hack, stash away the listener value so we can look it up later
                _entry.Tag = this;
                _entry.AddTextChangedListener(this);
                if (label == null)
                {
                    _entry.Hint = Caption;
                }
                else
                {
                    label.Text = Caption;
                }
            }

            return(view);
        }