void InitCustomViewAbove()
        {
            TouchMode = TouchMode.Margin;
            SetWillNotDraw(false);
            DescendantFocusability = DescendantFocusability.AfterDescendants;
            Focusable = true;
            _scroller = new Scroller(Context, _interpolator);
            var configuration = ViewConfiguration.Get(Context);
            _touchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);
            _minimumVelocity = configuration.ScaledMinimumFlingVelocity;
            MaximumVelocity = configuration.ScaledMaximumFlingVelocity;

            var density = Context.Resources.DisplayMetrics.Density;
            _flingDistance = (int) (MinDistanceForFling*density);

            PageSelected += (sender, args) =>
                {
                    if (_viewBehind == null) return;
                    switch (args.Position)
                    {
                        case 0:
                        case 2:
                            _viewBehind.ChildrenEnabled = true;
                            break;
                        case 1:
                            _viewBehind.ChildrenEnabled = false;
                            break;
                    }
                };
        }
Exemplo n.º 2
0
        public TitlePageIndicator(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)
        {
            //Load defaults from resources
            var   res = Resources;
            int   defaultFooterColor                     = res.GetColor(Resource.Color.default_title_indicator_footer_color);
            float defaultFooterLineHeight                = res.GetDimension(Resource.Dimension.default_title_indicator_footer_line_height);
            int   defaultFooterIndicatorStyle            = res.GetInteger(Resource.Integer.default_title_indicator_footer_indicator_style);
            float defaultFooterIndicatorHeight           = res.GetDimension(Resource.Dimension.default_title_indicator_footer_indicator_height);
            float defaultFooterIndicatorUnderlinePadding = res.GetDimension(Resource.Dimension.default_title_indicator_footer_indicator_underline_padding);
            float defaultFooterPadding                   = res.GetDimension(Resource.Dimension.default_title_indicator_footer_padding);
            int   defaultSelectedColor                   = res.GetColor(Resource.Color.default_title_indicator_selected_color);
            bool  defaultSelectedBold                    = res.GetBoolean(Resource.Boolean.default_title_indicator_selected_bold);
            int   defaultTextColor    = res.GetColor(Resource.Color.default_title_indicator_text_color);
            float defaultTextSize     = res.GetDimension(Resource.Dimension.default_title_indicator_text_size);
            float defaultTitlePadding = res.GetDimension(Resource.Dimension.default_title_indicator_title_padding);
            float defaultClipPadding  = res.GetDimension(Resource.Dimension.default_title_indicator_clip_padding);
            float defaultTopPadding   = res.GetDimension(Resource.Dimension.default_title_indicator_top_padding);

            //Retrieve styles attributes
            var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.TitlePageIndicator, defStyle, Resource.Style.Widget_TitlePageIndicator);

            //Retrieve the colors to be used for this view and apply them.
            mFooterLineHeight                = a.GetDimension(Resource.Styleable.TitlePageIndicator_footerLineHeight, defaultFooterLineHeight);
            mFooterIndicatorStyle            = (IndicatorStyle)a.GetInteger(Resource.Styleable.TitlePageIndicator_footerIndicatorStyle, defaultFooterIndicatorStyle);
            mFooterIndicatorHeight           = a.GetDimension(Resource.Styleable.TitlePageIndicator_footerIndicatorHeight, defaultFooterIndicatorHeight);
            mFooterIndicatorUnderlinePadding = a.GetDimension(Resource.Styleable.TitlePageIndicator_footerIndicatorUnderlinePadding, defaultFooterIndicatorUnderlinePadding);
            mFooterPadding = a.GetDimension(Resource.Styleable.TitlePageIndicator_footerPadding, defaultFooterPadding);
            mTopPadding    = a.GetDimension(Resource.Styleable.TitlePageIndicator_topPadding, defaultTopPadding);
            mTitlePadding  = a.GetDimension(Resource.Styleable.TitlePageIndicator_titlePadding, defaultTitlePadding);
            mClipPadding   = a.GetDimension(Resource.Styleable.TitlePageIndicator_clipPadding, defaultClipPadding);
            mColorSelected = a.GetColor(Resource.Styleable.TitlePageIndicator_selectedColor, defaultSelectedColor);
            mColorText     = a.GetColor(Resource.Styleable.TitlePageIndicator_textColor, defaultTextColor);
            mBoldText      = a.GetBoolean(Resource.Styleable.TitlePageIndicator_selectedBold, defaultSelectedBold);

            float textSize    = a.GetDimension(Resource.Styleable.TitlePageIndicator_textSize, defaultTextSize);
            Color footerColor = a.GetColor(Resource.Styleable.TitlePageIndicator_footerColor, defaultFooterColor);

            mPaintText.TextSize  = textSize;
            mPaintText.AntiAlias = true;
            mPaintFooterLine.SetStyle(Android.Graphics.Paint.Style.FillAndStroke);
            mPaintFooterLine.StrokeWidth = mFooterLineHeight;
            mPaintFooterLine.Color       = footerColor;
            mPaintFooterIndicator.SetStyle(Android.Graphics.Paint.Style.FillAndStroke);
            mPaintFooterIndicator.Color = footerColor;

            a.Recycle();

            var configuration = ViewConfiguration.Get(context);

            mTouchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);
        }
        public UnderlinePageIndicator(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            if (IsInEditMode)
            {
                return;
            }

            var res = Resources;

            var defaultFades         = res.GetBoolean(Resource.Boolean.default_underline_indicator_fades);
            var defaultFadeDelay     = res.GetInteger(Resource.Integer.default_underline_indicator_fade_delay);
            var defaultFadeLength    = res.GetInteger(Resource.Integer.default_underline_indicator_fade_length);
            var defaultSelectedColor = res.GetColor(Resource.Color.default_underline_indicator_selected_color);

            var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.UnderlinePageIndicator, defStyle, 0);

            Fades         = a.GetBoolean(Resource.Styleable.UnderlinePageIndicator_fades, defaultFades);
            SelectedColor = a.GetColor(Resource.Styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor);
            FadeDelay     = a.GetInteger(Resource.Styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay);
            FadeLength    = a.GetInteger(Resource.Styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength);

            var background = a.GetDrawable(Resource.Styleable.UnderlinePageIndicator_android_background);

            if (null != background)
            {
                Background = background;
            }

            a.Recycle();

            var configuration = ViewConfiguration.Get(context);

            _touchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);

            _fadeRunnable = new Runnable(() =>
            {
                if (!_fades)
                {
                    return;
                }

                var alpha    = Math.Max(_paint.Alpha - _fadeBy, 0);
                _paint.Alpha = alpha;
                Invalidate();
                if (alpha > 0)
                {
                    PostDelayed(_fadeRunnable, FadeFrameMs);
                }
            });
        }
        public CirclePageIndicator(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            if (IsInEditMode)
            {
                return;
            }

            var res = Resources;
            var defaultPageColor   = res.GetColor(Resource.Color.default_circle_indicator_page_color);
            var defaultFillColor   = res.GetColor(Resource.Color.default_circle_indicator_fill_color);
            var defaultOrientation = res.GetInteger(Resource.Integer.default_circle_indicator_orientation);
            var defaultStrokeColor = res.GetColor(Resource.Color.default_circle_indicator_stroke_color);
            var defaultStrokeWidth = res.GetDimension(Resource.Dimension.default_circle_indicator_stroke_width);
            var defaultRadius      = res.GetDimension(Resource.Dimension.default_circle_indicator_radius);
            var defaultCentered    = res.GetBoolean(Resource.Boolean.default_circle_indicator_centered);
            var defaultSnap        = res.GetBoolean(Resource.Boolean.default_circle_indicator_snap);

            var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.CirclePageIndicator, defStyle, 0);

            _centered    = a.GetBoolean(Resource.Styleable.CirclePageIndicator_centered, defaultCentered);
            _orientation = a.GetInt(Resource.Styleable.CirclePageIndicator_android_orientation, defaultOrientation);
            _paintPageFill.SetStyle(Paint.Style.Fill);
            _paintPageFill.Color = a.GetColor(Resource.Styleable.CirclePageIndicator_pageColor, defaultPageColor);
            _paintStroke.SetStyle(Paint.Style.Stroke);
            _paintStroke.Color       = a.GetColor(Resource.Styleable.CirclePageIndicator_strokeColor, defaultStrokeColor);
            _paintStroke.StrokeWidth = a.GetDimension(Resource.Styleable.CirclePageIndicator_strokeWidth,
                                                      defaultStrokeWidth);
            _paintFill.SetStyle(Paint.Style.Fill);
            _paintFill.Color = a.GetColor(Resource.Styleable.CirclePageIndicator_fillColor, defaultFillColor);
            _radius          = a.GetDimension(Resource.Styleable.CirclePageIndicator_radius, defaultRadius);
            _snap            = a.GetBoolean(Resource.Styleable.CirclePageIndicator_snap, defaultSnap);

            var background = a.GetDrawable(Resource.Styleable.CirclePageIndicator_android_background);

            if (null != background)
            {
                SetBackgroundDrawable(background);
            }

            a.Recycle();

            var configuration = ViewConfiguration.Get(context);

            _touchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);
        }
        void InitCustomViewAbove()
        {
            SetWillNotDraw(false);
            DescendantFocusability = DescendantFocusability.AfterDescendants;
            Focusable = true;
            Context context = Context;

            mScroller = new Scroller(context, sInterpolator);
            ViewConfiguration configuration = ViewConfiguration.Get(context);

            mTouchSlop       = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);
            mMinimumVelocity = configuration.ScaledMinimumFlingVelocity;
            mMaximumVelocity = configuration.ScaledMaximumFlingVelocity;
            SetInternalPageChangeListener(new MySimpleOnPageChangeListener(this));

            float density = context.Resources.DisplayMetrics.Density;

            mFlingDistance = (int)(MIN_DISTANCE_FOR_FLING * density);
        }
Exemplo n.º 6
0
        public LinePageIndicator(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            if (IsInEditMode)
            {
                return;
            }

            var res = Resources;

            //Load defaults from resources
            var defaultSelectedColor   = res.GetColor(Resource.Color.default_line_indicator_selected_color);
            var defaultUnselectedColor = res.GetColor(Resource.Color.default_line_indicator_unselected_color);
            var defaultLineWidth       = res.GetDimension(Resource.Dimension.default_line_indicator_line_width);
            var defaultGapWidth        = res.GetDimension(Resource.Dimension.default_line_indicator_gap_width);
            var defaultStrokeWidth     = res.GetDimension(Resource.Dimension.default_line_indicator_stroke_width);
            var defaultCentered        = res.GetBoolean(Resource.Boolean.default_line_indicator_centered);

            //Retrive styles attributes
            var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.LinePageIndicator, defStyle, 0);

            _centered              = a.GetBoolean(Resource.Styleable.LinePageIndicator_centered, defaultCentered);
            _lineWidth             = a.GetDimension(Resource.Styleable.LinePageIndicator_lineWidth, defaultLineWidth);
            _gapWidth              = a.GetDimension(Resource.Styleable.LinePageIndicator_gapWidth, defaultGapWidth);
            StrokeWidth            = a.GetDimension(Resource.Styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth);
            _paintUnSelected.Color = a.GetColor(Resource.Styleable.LinePageIndicator_unselectedColor,
                                                defaultUnselectedColor);
            _paintSelected.Color = a.GetColor(Resource.Styleable.LinePageIndicator_selectedColor, defaultSelectedColor);

            var background = a.GetDrawable(Resource.Styleable.LinePageIndicator_android_background);

            if (null != background)
            {
                Background = background;
            }

            a.Recycle();

            var configuration = ViewConfiguration.Get(context);

            _touchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);
        }
        public CirclePageIndicator(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            var defaultPageColor   = Resources.GetColor(Resource.Color.default_circle_indicator_page_color);
            var defaultFillColor   = Resources.GetColor(Resource.Color.default_circle_indicator_fill_color);
            var defaultOrientation = Resources.GetInteger(Resource.Integer.default_circle_indicator_orientation);
            var defaultStrokeColor = Resources.GetColor(Resource.Color.default_circle_indicator_stroke_color);
            var defaultStrokeWidth = Resources.GetDimension(Resource.Dimension.default_circle_indicator_stroke_width);
            var defaultRadius      = Resources.GetDimension(Resource.Dimension.default_circle_indicator_radius);
            var defaultCentered    = Resources.GetBoolean(Resource.Boolean.default_circle_indicator_centered);
            var defaultSnap        = Resources.GetBoolean(Resource.Boolean.default_circle_indicator_snap);

            //Retrieve styles attributes
            var styledAttributes = context.ObtainStyledAttributes(attrs, Resource.Styleable.CirclePageIndicator, defStyle, Resource.Style.Widget_CirclePageIndicator);

            IsCentered  = styledAttributes.GetBoolean(Resource.Styleable.CirclePageIndicator_centered, defaultCentered);
            Orientation = styledAttributes.GetInt(Resource.Styleable.CirclePageIndicator_orientation, defaultOrientation);

            paintPageFill = new Paint(PaintFlags.AntiAlias);
            paintPageFill.SetStyle(Paint.Style.Fill);
            paintPageFill.Color = styledAttributes.GetColor(Resource.Styleable.CirclePageIndicator_pageColor, defaultPageColor);

            paintStroke = new Paint(PaintFlags.AntiAlias);
            paintStroke.SetStyle(Paint.Style.Stroke);
            paintStroke.Color       = styledAttributes.GetColor(Resource.Styleable.CirclePageIndicator_strokeColor, defaultStrokeColor);
            paintStroke.StrokeWidth = styledAttributes.GetDimension(Resource.Styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth);

            paintFill = new Paint(PaintFlags.AntiAlias);
            paintFill.SetStyle(Paint.Style.Fill);
            paintFill.Color = styledAttributes.GetColor(Resource.Styleable.CirclePageIndicator_fillColor, defaultFillColor);

            radius = styledAttributes.GetDimension(Resource.Styleable.CirclePageIndicator_radius, defaultRadius);
            snap   = styledAttributes.GetBoolean(Resource.Styleable.CirclePageIndicator_snap, defaultSnap);

            styledAttributes.Recycle();

            var configuration = ViewConfiguration.Get(context);

            touchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);
        }
        public LinePageIndicator(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)
        {
            if (IsInEditMode)
            {
                return;
            }

            //Load defaults from resources
            int   defaultSelectedColor   = Resources.GetColor(Resource.Color.default_line_indicator_selected_color);
            int   defaultUnselectedColor = Resources.GetColor(Resource.Color.default_line_indicator_unselected_color);
            float defaultLineWidth       = Resources.GetDimension(Resource.Dimension.default_line_indicator_line_width);
            float defaultGapWidth        = Resources.GetDimension(Resource.Dimension.default_line_indicator_gap_width);
            float defaultStrokeWidth     = Resources.GetDimension(Resource.Dimension.default_line_indicator_stroke_width);
            bool  defaultCentered        = Resources.GetBoolean(Resource.Boolean.default_line_indicator_centered);

            //Retrieve styles attributes
            TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.LinePageIndicator, defStyle, 0);

            centered  = a.GetBoolean(Resource.Styleable.LinePageIndicator_centered, defaultCentered);
            lineWidth = a.GetDimension(Resource.Styleable.LinePageIndicator_lineWidth, defaultLineWidth);
            gapWidth  = a.GetDimension(Resource.Styleable.LinePageIndicator_gapWidth, defaultGapWidth);
            SetStrokeWidth(a.GetDimension(Resource.Styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth));
            paintUnselected.Color = a.GetColor(Resource.Styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor);
            paintSelected.Color   = a.GetColor(Resource.Styleable.LinePageIndicator_selectedColor, defaultSelectedColor);

            Drawable background = a.GetDrawable(Resource.Styleable.LinePageIndicator_android_background);

            if (background != null)
            {
                SetBackgroundDrawable(background);
            }

            a.Recycle();

            ViewConfiguration configuration = ViewConfiguration.Get(context);

            mTouchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);
        }
Exemplo n.º 9
0
        public CirclePageIndicator(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)
        {
#pragma warning disable 618
            int defaultPageColor   = Resources.GetColor(Resource.Color.default_circle_indicator_page_color);
            int defaultFillColor   = Resources.GetColor(Resource.Color.default_circle_indicator_fill_color);
            int defaultStrokeColor = Resources.GetColor(Resource.Color.default_circle_indicator_stroke_color);
#pragma warning restore 618

            int   defaultOrientation = Resources.GetInteger(Resource.Integer.default_circle_indicator_orientation);
            float defaultStrokeWidth = Resources.GetDimension(Resource.Dimension.default_circle_indicator_stroke_width);
            float defaultRadius      = Resources.GetDimension(Resource.Dimension.default_circle_indicator_radius);
            bool  defaultCentered    = Resources.GetBoolean(Resource.Boolean.default_circle_indicator_centered);
            bool  defaultSnap        = Resources.GetBoolean(Resource.Boolean.default_circle_indicator_snap);

            //Retrieve styles attributes
            var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.CirclePageIndicator, defStyle, 0);

            mCentered      = a.GetBoolean(Resource.Styleable.CirclePageIndicator_centered, defaultCentered);
            mOrientation   = a.GetInt(Resource.Styleable.CirclePageIndicator_android_orientation, defaultOrientation);
            mPaintPageFill = new Paint(PaintFlags.AntiAlias);
            mPaintPageFill.SetStyle(Paint.Style.Fill);
            mPaintPageFill.Color = a.GetColor(Resource.Styleable.CirclePageIndicator_pageColor, defaultPageColor);
            mPaintStroke         = new Paint(PaintFlags.AntiAlias);
            mPaintStroke.SetStyle(Paint.Style.Stroke);
            mPaintStroke.Color       = a.GetColor(Resource.Styleable.CirclePageIndicator_strokeColor, defaultStrokeColor);
            mPaintStroke.StrokeWidth = a.GetDimension(Resource.Styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth);
            mPaintFill = new Paint(PaintFlags.AntiAlias);
            mPaintFill.SetStyle(Paint.Style.Fill);
            mPaintFill.Color = a.GetColor(Resource.Styleable.CirclePageIndicator_fillColor, defaultFillColor);
            mRadius          = a.GetDimension(Resource.Styleable.CirclePageIndicator_radius, defaultRadius);
            mSnap            = a.GetBoolean(Resource.Styleable.CirclePageIndicator_snap, defaultSnap);

            a.Recycle();

            var configuration = ViewConfiguration.Get(context);
            mTouchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);
        }
Exemplo n.º 10
0
        public TitlePageIndicator(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            if (IsInEditMode)
            {
                return;
            }

            var res = Resources;

            //Load defaults from resources
            var defaultFooterColor          = res.GetColor(Resource.Color.default_title_indicator_footer_color);
            var defaultFooterLineHeight     = res.GetDimension(Resource.Dimension.default_title_indicator_footer_line_height);
            var defaultFooterIndicatorStyle =
                res.GetInteger(Resource.Integer.default_title_indicator_footer_indicator_style);
            var defaultFooterIndicatorHeight =
                res.GetDimension(Resource.Dimension.default_title_indicator_footer_indicator_height);
            var defaultFooterIndicatorUnderlinePadding =
                res.GetDimension(Resource.Dimension.default_title_indicator_footer_indicator_underline_padding);
            var defaultFooterPadding = res.GetDimension(Resource.Dimension.default_title_indicator_footer_padding);
            var defaultLinePosition  = res.GetInteger(Resource.Integer.default_title_indicator_line_position);
            var defaultSelectedColor = res.GetColor(Resource.Color.default_title_indicator_selected_color);
            var defaultSelectedBold  = res.GetBoolean(Resource.Boolean.default_title_indicator_selected_bold);
            var defaultTextColor     = res.GetColor(Resource.Color.default_title_indicator_text_color);
            var defaultTextSize      = res.GetDimension(Resource.Dimension.default_title_indicator_text_size);
            var defaultTitlePadding  = res.GetDimension(Resource.Dimension.default_title_indicator_title_padding);
            var defaultClipPadding   = res.GetDimension(Resource.Dimension.default_title_indicator_clip_padding);
            var defaultTopPadding    = res.GetDimension(Resource.Dimension.default_title_indicator_top_padding);

            var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.TitlePageIndicator, defStyle, 0);

            _footerLineHeight = a.GetDimension(Resource.Styleable.TitlePageIndicator_footerLineHeight,
                                               defaultFooterLineHeight);
            _footerIndicatorStyle =
                (IndicatorStyle)a.GetInteger(Resource.Styleable.TitlePageIndicator_footerIndicatorStyle, defaultFooterIndicatorStyle);
            _footerIndicatorHeight = a.GetDimension(Resource.Styleable.TitlePageIndicator_footerIndicatorHeight,
                                                    defaultFooterIndicatorHeight);
            _footerIndicatorUnderlinePadding =
                a.GetDimension(Resource.Styleable.TitlePageIndicator_footerIndicatorUnderlinePadding,
                               defaultFooterIndicatorUnderlinePadding);
            _footerPadding = a.GetDimension(Resource.Styleable.TitlePageIndicator_footerPadding, defaultFooterPadding);
            _linePosition  =
                (LinePosition)a.GetInteger(Resource.Styleable.TitlePageIndicator_linePosition, defaultLinePosition);
            _topPadding    = a.GetDimension(Resource.Styleable.TitlePageIndicator_topPadding, defaultTopPadding);
            _titlePadding  = a.GetDimension(Resource.Styleable.TitlePageIndicator_titlePadding, defaultTitlePadding);
            _clipPadding   = a.GetDimension(Resource.Styleable.TitlePageIndicator_clipPadding, defaultClipPadding);
            _colorSelected = a.GetColor(Resource.Styleable.TitlePageIndicator_selectedColor, defaultSelectedColor);
            _colorText     = a.GetColor(Resource.Styleable.TitlePageIndicator_android_textColor, defaultTextColor);
            _boldText      = a.GetBoolean(Resource.Styleable.TitlePageIndicator_selectedBold, defaultSelectedBold);

            var textSize    = a.GetDimension(Resource.Styleable.TitlePageIndicator_android_textSize, defaultTextSize);
            var footerColor = a.GetColor(Resource.Styleable.TitlePageIndicator_footerColor, defaultFooterColor);

            _paintText.TextSize = textSize;
            _paintFooterLine.SetStyle(Paint.Style.FillAndStroke);
            _paintFooterLine.StrokeWidth = _footerLineHeight;
            _paintFooterLine.Color       = footerColor;
            _paintFooterIndicator.SetStyle(Paint.Style.FillAndStroke);
            _paintFooterIndicator.Color = footerColor;

            var background = a.GetDrawable(Resource.Styleable.TitlePageIndicator_android_background);

            if (null != background)
            {
                SetBackgroundDrawable(background);
            }

            a.Recycle();

            var configuration = ViewConfiguration.Get(context);

            _touchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);
        }