Example #1
0
            protected override void onDraw(android.graphics.Canvas canvas)
            {
                {
                    var paint = new android.graphics.Paint();

                    paint.setStyle(android.graphics.Paint.Style.STROKE);
                    //paint.setStyle(android.graphics.Paint.Style.FILL_AND_STROKE);
                    //paint.setColor(android.graphics.Color.RED);
                    //paint.setColor(android.graphics.Color.YELLOW);
                    paint.setColor(color);
                    paint.setTextSize(textSize);
                    paint.setAlpha(alpha);

                    var a = this.text().Split('\n');

                    a.WithEachIndex(
                        (text, i) =>
                    {
                        canvas.drawText(text, x, y + i * 24, paint);
                        canvas.drawText(text, x + 2560 / 2, y + i * 24, paint);
                    }
                        );
                }

                if (AtDraw != null)
                {
                    AtDraw(canvas);
                }


                base.onDraw(canvas);
            }
Example #2
0
 public CanvasView(android.content.Context context) : base(context)
 {
     paint = new android.graphics.Paint();
     paint.setColor(android.graphics.Color.RED);
     paint.setAntiAlias(true);
     paint.setStrokeWidth(4);
     paint.setTextSize(30);
 }
            protected override void onDraw(android.graphics.Canvas canvas)
            {
                var paint = new android.graphics.Paint();

                paint.setStyle(android.graphics.Paint.Style.STROKE);
                //paint.setStyle(android.graphics.Paint.Style.FILL_AND_STROKE);
                paint.setColor(android.graphics.Color.RED);
                paint.setTextSize(textSize);

                var text = this.text();

                canvas.drawText(text, x, y, paint);
                canvas.drawText(text, x + 2560 / 2, y, paint);

                base.onDraw(canvas);
            }
Example #4
0
        private void init(android.content.Context context)
        {
            // Get both the scrollbar states drawables
            android.content.res.TypedArray ta = context.getTheme().obtainStyledAttributes(ATTRS
                                                                                          );
            useThumbDrawable(context, ta.getDrawable(THUMB_DRAWABLE));
            mTrackDrawable        = ta.getDrawable(TRACK_DRAWABLE);
            mOverlayDrawableLeft  = ta.getDrawable(PREVIEW_BACKGROUND_LEFT);
            mOverlayDrawableRight = ta.getDrawable(PREVIEW_BACKGROUND_RIGHT);
            mOverlayPosition      = ta.getInt(OVERLAY_POSITION, OVERLAY_FLOATING);
            mScrollCompleted      = true;
            getSectionsFromIndexer();
            mOverlaySize = context.getResources().getDimensionPixelSize([email protected]
                                                                        .fastscroll_overlay_size);
            mOverlayPos = new android.graphics.RectF();
            mScrollFade = new android.widget.FastScroller.ScrollFade(this);
            mPaint      = new android.graphics.Paint();
            mPaint.setAntiAlias(true);
            mPaint.setTextAlign(android.graphics.Paint.Align.CENTER);
            mPaint.setTextSize(mOverlaySize / 2);
            android.content.res.ColorStateList textColor = ta.getColorStateList(TEXT_COLOR);
            int textColorNormal = textColor.getDefaultColor();

            mPaint.setColor(textColorNormal);
            mPaint.setStyle(android.graphics.Paint.Style.FILL_AND_STROKE);
            // to show mOverlayDrawable properly
            if (mList.getWidth() > 0 && mList.getHeight() > 0)
            {
                onSizeChanged(mList.getWidth(), mList.getHeight(), 0, 0);
            }
            mState = STATE_NONE;
            refreshDrawableState();
            ta.recycle();
            mScaledTouchSlop = android.view.ViewConfiguration.get(context).getScaledTouchSlop
                                   ();
            mMatchDragPosition = context.getApplicationInfo().targetSdkVersion >= android.os.Build
                                 .VERSION_CODES.HONEYCOMB;
            setScrollbarPosition(mList.getVerticalScrollbarPosition());
        }
            protected override void onDraw(android.graphics.Canvas canvas)
            {

                var paint = new android.graphics.Paint();

                paint.setStyle(android.graphics.Paint.Style.STROKE);
                //paint.setStyle(android.graphics.Paint.Style.FILL_AND_STROKE);
                paint.setColor(android.graphics.Color.RED);
                paint.setTextSize(textSize);

                var text = this.text();

                canvas.drawText(text, x, y, paint);
                canvas.drawText(text, x + 2560 / 2, y, paint);

                base.onDraw(canvas);
            }
            protected override void onDraw(android.graphics.Canvas canvas)
            {
                {
                    var paint = new android.graphics.Paint();

                    paint.setStyle(android.graphics.Paint.Style.STROKE);
                    //paint.setStyle(android.graphics.Paint.Style.FILL_AND_STROKE);
                    //paint.setColor(android.graphics.Color.RED);
                    //paint.setColor(android.graphics.Color.YELLOW);
                    paint.setColor(color);
                    paint.setTextSize(textSize);
                    paint.setAlpha(alpha);

                    var a = this.text().Split('\n');

                    a.WithEachIndex(
                        (text, i) =>
                        {

                            canvas.drawText(text, x, y + i * 24, paint);
                            canvas.drawText(text, x + 2560 / 2, y + i * 24, paint);
                        }
                    );
                }

                if (AtDraw != null)
                    AtDraw(canvas);


                base.onDraw(canvas);
            }
Example #7
0
		/// <summary>Create a new number picker</summary>
		/// <param name="context">the application environment.</param>
		/// <param name="attrs">a collection of attributes.</param>
		/// <param name="defStyle">The default style to apply to this view.</param>
		public NumberPicker(android.content.Context context, android.util.AttributeSet attrs
			, int defStyle) : base(context, attrs, defStyle)
		{
			android.content.res.TypedArray attributesArray = context.obtainStyledAttributes(attrs
				, [email protected], defStyle, 0);
			mSolidColor = attributesArray.getColor([email protected]_solidColor
				, 0);
			mFlingable = attributesArray.getBoolean([email protected]_flingable
				, true);
			mSelectionDivider = attributesArray.getDrawable([email protected]_selectionDivider
				);
			int defSelectionDividerHeight = (int)android.util.TypedValue.applyDimension(android.util.TypedValue
				.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT, getResources().getDisplayMetrics
				());
			mSelectionDividerHeight = attributesArray.getDimensionPixelSize([email protected]
				.styleable.NumberPicker_selectionDividerHeight, defSelectionDividerHeight);
			attributesArray.recycle();
			mShowInputControlsAnimimationDuration = getResources().getInteger([email protected]
				.integer.config_longAnimTime);
			setWillNotDraw(false);
			setSelectorWheelState(SELECTOR_WHEEL_STATE_NONE);
			android.view.LayoutInflater inflater = (android.view.LayoutInflater)getContext().
				getSystemService(android.content.Context.LAYOUT_INFLATER_SERVICE);
			inflater.inflate([email protected]_picker, this, true);
			android.view.View.OnClickListener onClickListener = new _OnClickListener_537(this
				);
			android.view.View.OnLongClickListener onLongClickListener = new _OnLongClickListener_552
				(this);
			mIncrementButton = (android.widget.ImageButton)findViewById([email protected]
				.increment);
			mIncrementButton.setOnClickListener(onClickListener);
			mIncrementButton.setOnLongClickListener(onLongClickListener);
			mDecrementButton = (android.widget.ImageButton)findViewById([email protected]
				.decrement);
			mDecrementButton.setOnClickListener(onClickListener);
			mDecrementButton.setOnLongClickListener(onLongClickListener);
			mInputText = (android.widget.EditText)findViewById([email protected]_input
				);
			mInputText.setOnFocusChangeListener(new _OnFocusChangeListener_576(this));
			mInputText.setFilters(new android.text.InputFilter[] { new android.widget.NumberPicker
				.InputTextFilter(this) });
			mInputText.setRawInputType(android.text.InputTypeClass.TYPE_CLASS_NUMBER);
			mTouchSlop = android.view.ViewConfiguration.getTapTimeout();
			android.view.ViewConfiguration configuration = android.view.ViewConfiguration.get
				(context);
			mTouchSlop = configuration.getScaledTouchSlop();
			mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
			mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity() / SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT;
			mTextSize = (int)mInputText.getTextSize();
			android.graphics.Paint paint = new android.graphics.Paint();
			paint.setAntiAlias(true);
			paint.setTextAlign(android.graphics.Paint.Align.CENTER);
			paint.setTextSize(mTextSize);
			paint.setTypeface(mInputText.getTypeface());
			android.content.res.ColorStateList colors = mInputText.getTextColors();
			int color = colors.getColorForState(ENABLED_STATE_SET, android.graphics.Color.WHITE
				);
			paint.setColor(color);
			mSelectorWheelPaint = paint;
			mDimSelectorWheelAnimator = android.animation.ObjectAnimator.ofInt(this, PROPERTY_SELECTOR_PAINT_ALPHA
				, SELECTOR_WHEEL_BRIGHT_ALPHA, SELECTOR_WHEEL_DIM_ALPHA);
			android.animation.ObjectAnimator showIncrementButton = android.animation.ObjectAnimator
				.ofFloat(mIncrementButton, PROPERTY_BUTTON_ALPHA, BUTTON_ALPHA_TRANSPARENT, BUTTON_ALPHA_OPAQUE
				);
			android.animation.ObjectAnimator showDecrementButton = android.animation.ObjectAnimator
				.ofFloat(mDecrementButton, PROPERTY_BUTTON_ALPHA, BUTTON_ALPHA_TRANSPARENT, BUTTON_ALPHA_OPAQUE
				);
			mShowInputControlsAnimator = new android.animation.AnimatorSet();
			mShowInputControlsAnimator.playTogether(mDimSelectorWheelAnimator, showIncrementButton
				, showDecrementButton);
			mShowInputControlsAnimator.addListener(new _AnimatorListenerAdapter_626(this));
			// create the fling and adjust scrollers
			mFlingScroller = new android.widget.Scroller(getContext(), null, true);
			mAdjustScroller = new android.widget.Scroller(getContext(), new android.view.animation.DecelerateInterpolator
				(2.5f));
			updateInputTextView();
			updateIncrementAndDecrementButtonsVisibilityState();
			if (mFlingable)
			{
				if (isInEditMode())
				{
					setSelectorWheelState(SELECTOR_WHEEL_STATE_SMALL);
				}
				else
				{
					// Start with shown selector wheel and hidden controls. When made
					// visible hide the selector and fade-in the controls to suggest
					// fling interaction.
					setSelectorWheelState(SELECTOR_WHEEL_STATE_LARGE);
					hideInputControls();
				}
			}
		}
Example #8
0
		private void init(android.content.Context context)
		{
			// Get both the scrollbar states drawables
			android.content.res.TypedArray ta = context.getTheme().obtainStyledAttributes(ATTRS
				);
			useThumbDrawable(context, ta.getDrawable(THUMB_DRAWABLE));
			mTrackDrawable = ta.getDrawable(TRACK_DRAWABLE);
			mOverlayDrawableLeft = ta.getDrawable(PREVIEW_BACKGROUND_LEFT);
			mOverlayDrawableRight = ta.getDrawable(PREVIEW_BACKGROUND_RIGHT);
			mOverlayPosition = ta.getInt(OVERLAY_POSITION, OVERLAY_FLOATING);
			mScrollCompleted = true;
			getSectionsFromIndexer();
			mOverlaySize = context.getResources().getDimensionPixelSize([email protected]
				.fastscroll_overlay_size);
			mOverlayPos = new android.graphics.RectF();
			mScrollFade = new android.widget.FastScroller.ScrollFade(this);
			mPaint = new android.graphics.Paint();
			mPaint.setAntiAlias(true);
			mPaint.setTextAlign(android.graphics.Paint.Align.CENTER);
			mPaint.setTextSize(mOverlaySize / 2);
			android.content.res.ColorStateList textColor = ta.getColorStateList(TEXT_COLOR);
			int textColorNormal = textColor.getDefaultColor();
			mPaint.setColor(textColorNormal);
			mPaint.setStyle(android.graphics.Paint.Style.FILL_AND_STROKE);
			// to show mOverlayDrawable properly
			if (mList.getWidth() > 0 && mList.getHeight() > 0)
			{
				onSizeChanged(mList.getWidth(), mList.getHeight(), 0, 0);
			}
			mState = STATE_NONE;
			refreshDrawableState();
			ta.recycle();
			mScaledTouchSlop = android.view.ViewConfiguration.get(context).getScaledTouchSlop
				();
			mMatchDragPosition = context.getApplicationInfo().targetSdkVersion >= android.os.Build
				.VERSION_CODES.HONEYCOMB;
			setScrollbarPosition(mList.getVerticalScrollbarPosition());
		}