Пример #1
0
  public SimpleScroller(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final TypedArray attributes =
        context.obtainStyledAttributes(attrs, R.styleable.SimpleScroller, defStyleAttr, 0);

    try {
      mHandedness =
          Handedness.values()[attributes.getInt(R.styleable.SimpleScroller_handedness, 0)];

      mArrowHeight = attributes.getDimension(R.styleable.SimpleScroller_arrowHeight, 25f);
      mTicWidth = attributes.getDimension(R.styleable.SimpleScroller_ticWidth, 16f);
      mTextHorizontalMargin =
          attributes.getDimension(R.styleable.SimpleScroller_textHorizontalMargin, 23f);
      mTextVerticalMargin =
          attributes.getDimension(R.styleable.SimpleScroller_textVerticalMargin, 10f);

      mStrokeColor = new Paint();
      mStrokeColor.setAntiAlias(true);
      mStrokeColor.setStyle(Paint.Style.STROKE);
      mStrokeColor.setTextAlign(
          mHandedness == Handedness.LEFT ? Paint.Align.RIGHT : Paint.Align.LEFT);
      mStrokeColor.setStrokeWidth(DEFAULT_STROKE_WIDTH);
      mStrokeColor.setColor(
          attributes.getColor(R.styleable.SimpleScroller_strokeColor, Color.WHITE));
      mStrokeColor.setTextSize(
          attributes.getDimension(R.styleable.SimpleScroller_android_textSize, 25f));

      mArrowStrokeColor = new Paint();
      mArrowStrokeColor.setAntiAlias(true);
      mArrowStrokeColor.setStyle(Paint.Style.STROKE);
      mArrowStrokeColor.setStrokeWidth(DEFAULT_STROKE_WIDTH);
      mArrowStrokeColor.setColor(
          attributes.getColor(R.styleable.SimpleScroller_arrowStrokeColor, Color.WHITE));

      mArrowBgColor = new Paint();
      mArrowBgColor.setAntiAlias(true);
      mArrowBgColor.setStyle(Paint.Style.FILL);
      mArrowBgColor.setColor(
          attributes.getColor(R.styleable.SimpleScroller_arrowBgColor, Color.BLACK));

      mScrollTo = attributes.getFloat(R.styleable.SimpleScroller_scrollTo, 0);
      mScrollToRange = attributes.getFloat(R.styleable.SimpleScroller_scrollToRange, 26f);
    } finally {
      attributes.recycle();
    }
  }
Пример #2
0
package extern.nifti.alignstacks.align3tp;
Пример #3
0
 public void setHandedness(int handednessIndex) {
   mHandedness = Handedness.values()[handednessIndex];
   mStrokeColor.setTextAlign(
       mHandedness == Handedness.LEFT ? Paint.Align.RIGHT : Paint.Align.LEFT);
   invalidate();
 }
Пример #4
0
 public int getHandedness() {
   return mHandedness.ordinal();
 }