protected override void UpdateCaptionDisplay(View cell)
        {
            if (cell == null)
            {
                return;
            }

            ImageView achivementImage;
            TextView  caption;
            TextView  description;
            TextView  percentageComplete;

            DroidResources.DecodeAchievementsElementLayout(Context, cell, out caption, out description, out percentageComplete, out achivementImage);

            if (caption != null)
            {
                caption.Text = Caption;
            }
        }
Exemple #2
0
        protected override void UpdateCaptionDisplay(View cell)
        {
            if (cell == null)
            {
                return;
            }

            TextView _caption;
            TextView _subCaption;
            View     _rawCheckboxView;

            DroidResources.DecodeBooleanElementLayout(Context, cell, out _caption, out _subCaption, out _rawCheckboxView);
            _caption.Text = Caption;

            if (_subCaption != null)
            {
                _subCaption.Text = SubCaption;
            }
        }
        protected virtual void UpdatePercentageCompleteDisplay(View cell)
        {
            if (cell == null)
            {
                return;
            }

            ImageView achivementImage;
            TextView  caption;
            TextView  description;
            TextView  percentageComplete;

            DroidResources.DecodeAchievementsElementLayout(Context, cell, out caption, out description, out percentageComplete, out achivementImage);

            if (percentageComplete != null)
            {
                percentageComplete.Text = PercentageComplete.ToString(CultureInfo.InvariantCulture);
            }
        }
        protected override View GetViewImpl(Context context, View convertView, ViewGroup parent)
        {
            View view = DroidResources.LoadFloatElementLayout(context, convertView, parent, LayoutName);

            if (view != null)
            {
                TextView  label;
                SeekBar   slider;
                ImageView left;
                ImageView right;
                DroidResources.DecodeFloatElementLayout(Context, view, out label, out slider, out left, out right);
                slider.SetOnSeekBarChangeListener(this);
            }
            else
            {
                Util.Log.Error("FloatElement", "GetViewImpl failed to load template view");
            }

            return(view);
        }
Exemple #5
0
        protected override void UpdateDetailDisplay(View cell)
        {
            if (cell == null)
            {
                return;
            }

            TextView _caption;
            TextView _subCaption;
            View     _rawCheckboxView;

            DroidResources.DecodeBooleanElementLayout(Context, cell, out _caption, out _subCaption, out _rawCheckboxView);

            var _checkbox = (CheckBox)_rawCheckboxView;

            _checkbox.SetOnCheckedChangeListener(null);
            _checkbox.Checked = Value;
            _checkbox.SetOnCheckedChangeListener(this);
            _checkbox.Clickable = !ReadOnly;
        }
        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(CultureInfo.InvariantCulture);
                if (AchievementImage != null)
                {
                    _achivementImage.SetImageBitmap(AchievementImage);
                }
            }
            else
            {
                Util.Log.Error("AchievementElement", "GetView failed to load template view");
            }
            return(view);
        }
        public override void Selected()
        {
            if (CurrentAttachedCell == null)
            {
                // how did this happen?!
                return;
            }

            View     _rawToggleButton;
            TextView _caption;
            TextView _subCaption;

            DroidResources.DecodeBooleanElementLayout(Context, CurrentAttachedCell, out _caption, out _subCaption, out _rawToggleButton);
            ToggleButton _toggleButton = (ToggleButton)_rawToggleButton;

            if (_toggleButton != null)
            {
                _toggleButton.Toggle();
            }
        }
        protected override void UpdateDetailDisplay(View cell)
        {
            if (cell == null)
            {
                return;
            }

            TextView  label;
            SeekBar   slider;
            ImageView left;
            ImageView right;

            DroidResources.DecodeFloatElementLayout(Context, cell, out label, out slider, out left, out right);
            if (left != null)
            {
                if (Left != null)
                {
                    left.SetImageBitmap(Left);
                }
                else
                {
                    left.Visibility = ViewStates.Gone;
                }
            }
            if (right != null)
            {
                if (Right != null)
                {
                    right.SetImageBitmap(Right);
                }
                else
                {
                    right.Visibility = ViewStates.Gone;
                }
            }
            if (slider != null)
            {
                slider.Max      = (int)((_maxValue - _minValue) * precision);
                slider.Progress = (int)((Value - _minValue) * precision);
            }
        }
Exemple #9
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 = (CheckBox)checkboxView;
                _checkbox.SetOnCheckedChangeListener(null);
                _checkbox.Checked = Value;
                _checkbox.SetOnCheckedChangeListener(this);
                _checkbox.Clickable = !ReadOnly;

                if (_subCaption != null)
                {
                    _subCaption.Text = SubCaption;
                }
            }
            return(view);
        }
Exemple #10
0
        protected override View GetViewImpl(Context context, View convertView, ViewGroup parent)
        {
#warning convertView is junk here?
            View view;
            if (_layoutId > 0)
            {
                view = DroidResources.LoadLayout(context, parent, _layoutId);
            }
            else
            {
                view = DroidResources.LoadLayout(context, parent, LayoutName);
            }

            if (view == null)
            {
                Log.Error("Android.Dialog", "ViewElement: Failed to load resource: " + LayoutName);
            }
            else if (Populate != null)
            {
                Populate(view);
            }
            return(view);
        }
Exemple #11
0
        public override void Selected()
        {
            if (ReadOnly)
            {
                return;
            }

            if (CurrentAttachedCell == null)
            {
                // how on earth did this happen!
                return;
            }

            TextView _caption;
            TextView _subCaption;
            View     _rawCheckboxView;

            DroidResources.DecodeBooleanElementLayout(Context, CurrentAttachedCell, out _caption, out _subCaption, out _rawCheckboxView);

            var _checkbox = (CheckBox)_rawCheckboxView;

            _checkbox.Toggle();
        }
        protected virtual void UpdateDescriptionDisplay(View cell)
        {
            if (cell == null)
            {
                return;
            }

            ImageView achivementImage;
            TextView  caption;
            TextView  description;
            TextView  percentageComplete;

            DroidResources.DecodeAchievementsElementLayout(Context, cell, out caption, out description, out percentageComplete, out achivementImage);

            // TODO - this is slow for things which don't need complete rebinding...
            caption.Text            = Caption;
            description.Text        = Description;
            percentageComplete.Text = PercentageComplete.ToString(CultureInfo.InvariantCulture);
            if (AchievementImage != null)
            {
                achivementImage.SetImageBitmap(AchievementImage);
            }
        }
        protected override void UpdateDetailDisplay(View cell)
        {
            if (cell == null)
            {
                return;
            }

            View     _rawToggleButton;
            TextView _caption;
            TextView _subCaption;

            DroidResources.DecodeBooleanElementLayout(Context, cell, out _caption, out _subCaption, out _rawToggleButton);
            ToggleButton _toggleButton = (ToggleButton)_rawToggleButton;

            _toggleButton.SetOnCheckedChangeListener(null);
            _toggleButton.Checked = Value;
            _toggleButton.SetOnCheckedChangeListener(this);

            if (TextOff != null)
            {
                _toggleButton.TextOff = TextOff;
                if (!Value)
                {
                    _toggleButton.Text = TextOff;
                }
            }

            if (TextOn != null)
            {
                _toggleButton.TextOn = TextOn;
                if (Value)
                {
                    _toggleButton.Text = TextOn;
                }
            }
        }
Exemple #14
0
        protected override View GetViewImpl(Context context, View convertView, ViewGroup parent)
        {
            var view = DroidResources.LoadStringEntryLayout(context, convertView, parent, LayoutName);

            if (view != null)
            {
                view.FocusableInTouchMode = false;
                view.Focusable            = false;
                view.Clickable            = false;

                TextView label;
                EditText _entry;
                DroidResources.DecodeStringEntryLayout(context, view, out label, out _entry);

                _entry.FocusableInTouchMode = true;
                _entry.Focusable            = true;
                _entry.Clickable            = true;

                var helper = EntryElementHelper.EnsureTagged(_entry);
                helper.Owner = this;
            }

            return(view);
        }
Exemple #15
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);
        }
Exemple #16
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)
            {
                view.FocusableInTouchMode = false;
                view.Focusable            = false;
                view.Clickable            = false;

                _entry.FocusableInTouchMode = true;
                _entry.Focusable            = true;
                _entry.Clickable            = true;

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

                _entry.InputType = KeyboardType.InputTypesFromUIKeyboardType();

                if (Password)
                {
                    _entry.InputType |= InputTypes.TextVariationPassword;
                }

                if (Lines > 1)
                {
                    _entry.InputType |= InputTypes.TextFlagMultiLine;
                    _entry.SetLines(Lines);
                }
                else if (Send != null)
                {
                    _entry.ImeOptions = ImeAction.Go;
                    _entry.SetImeActionLabel("Go", ImeAction.Go);
                }
                else
                {
                    _entry.ImeOptions = ReturnKeyType.ImeActionFromUIReturnKeyType();
                }

                if (_entry.Tag == null)
                {
                    _entry.Tag = this;
                    _entry.AddTextChangedListener(this);
                }
                else if (_entry.Tag != this)
                {
                    _entry.RemoveTextChangedListener((ITextWatcher)_entry.Tag);
                    _entry.AddTextChangedListener(this);
                    if (Send != null)
                    {
                        _entry.EditorAction += _entry_EditorAction;
                    }
                }

                _entry.OnFocusChangeListener = this;

                if (label == null)
                {
                    _entry.Hint = Caption;
                }
                else
                {
                    label.Text = Caption;
                }
            }

            return(view);
        }
        protected override View GetViewImpl(Context context, View convertView, ViewGroup parent)
        {
            View view = DroidResources.LoadBooleanElementLayout(context, convertView, parent, LayoutName);

            return(view);
        }