Esempio n. 1
0
        void UpdateOnColor(SwitchCellView cell, SwitchCell switchCell)
        {
            var aSwitch = cell.AccessoryView as ASwitch;

            if (aSwitch != null)
            {
                if (switchCell.On)
                {
                    if (switchCell.OnColor == Color.Default)
                    {
                        aSwitch.TrackDrawable = _defaultTrackDrawable;
                    }
                    else
                    {
                        if (Forms.SdkInt >= BuildVersionCodes.JellyBean)
                        {
                            aSwitch.TrackDrawable.SetColorFilter(switchCell.OnColor, FilterMode.Multiply);
                        }
                    }
                }
                else
                {
                    aSwitch.TrackDrawable.ClearColorFilter();
                }
            }
        }
Esempio n. 2
0
        protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context)
        {
            var cell = (SwitchCell)Cell;

            if ((_view = convertView as SwitchCellView) == null)
            {
                _view = new SwitchCellView(context, item);
            }

            _view.Cell = cell;

            var aSwitch = _view.AccessoryView as ASwitch;

            if (aSwitch != null)
            {
                _defaultTrackDrawable = aSwitch.TrackDrawable;
            }

            UpdateText();
            UpdateChecked();
            UpdateHeight();
            UpdateIsEnabled(_view, cell);
            UpdateFlowDirection();
            UpdateOnColor(_view, cell);

            return(_view);
        }
Esempio n. 3
0
        void UpdateIsEnabled(SwitchCellView cell, SwitchCell switchCell)
        {
            cell.Enabled = switchCell.IsEnabled;
            var aSwitch = cell.AccessoryView as ASwitch;

            if (aSwitch != null)
            {
                aSwitch.Enabled = switchCell.IsEnabled;
            }
        }
Esempio n. 4
0
        protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context)
        {
            var cell = (SwitchCell)Cell;

            if ((_view = convertView as SwitchCellView) == null)
            {
                _view = new SwitchCellView(context, item);
            }

            _view.Cell = cell;

            UpdateText();
            UpdateChecked();
            UpdateHeight();
            UpdateIsEnabled(_view, cell);

            return(_view);
        }