Java 类android.graphics.drawable.shapes.RectShape 实例源码

项目:Ariana    文件:Ariana.java   
public static Drawable drawable(final int[] colorBoxes, final float[] position, final GradientAngle gradientAngle) {
    ShapeDrawable.ShaderFactory shaderFactory = new ShapeDrawable.ShaderFactory() {
        @Override
        public Shader resize(int width, int height) {
            AngleCoordinate ac = AngleCoordinate.getAngleCoordinate(gradientAngle, width, height);
            LinearGradient linearGradient = new LinearGradient(ac.x1, ac.y1, ac.x2, ac.y2,
                    colorBoxes,
                    position,
                    Shader.TileMode.REPEAT);
            return linearGradient;
        }
    };
    PaintDrawable paint = new PaintDrawable();
    paint.setShape(new RectShape());
    paint.setShaderFactory(shaderFactory);
    return paint;
}
项目:appinventor-extensions    文件:ButtonBase.java   
private void setShape() {
  ShapeDrawable drawable = new ShapeDrawable();
  // Set color of drawable.
  drawable.getPaint().setColor((backgroundColor == Component.COLOR_DEFAULT)
                               ? SHAPED_DEFAULT_BACKGROUND_COLOR : backgroundColor);
  // Set shape of drawable.
  switch (shape) {
    case Component.BUTTON_SHAPE_ROUNDED:
      drawable.setShape(new RoundRectShape(ROUNDED_CORNERS_ARRAY, null, null));
      break;
    case Component.BUTTON_SHAPE_RECT:
      drawable.setShape(new RectShape());
      break;
    case Component.BUTTON_SHAPE_OVAL:
      drawable.setShape(new OvalShape());
      break;
    default:
      throw new IllegalArgumentException();
  }
  // Set drawable to the background of the button.
  view.setBackgroundDrawable(drawable);
  view.invalidate();
}
项目:EventLock    文件:EventViewBuilder.java   
void setupColorImageView(int[] padding, String type, int[] manualDimensions, boolean[] isManualDimensions, int[] autoDimensions) {
    colorImageView = new ImageView(gismoContext);
    fullContainerRelativeLayout.addView(colorImageView);
    colorImageView.setTag(Enums.ItemTag.Image);
    GradientDrawable outlineDrawable = new GradientDrawable();
    ShapeDrawable shapeDrawable = new ShapeDrawable();
    if (type.equals("oval")) {
        shapeDrawable.setShape(new OvalShape());
        outlineDrawable.setShape(GradientDrawable.OVAL);
    } else {
        shapeDrawable.setShape(new RectShape());
        outlineDrawable.setShape(GradientDrawable.RECTANGLE);
    }
    shapeDrawable.setIntrinsicWidth(isManualDimensions[0] ? manualDimensions[0] : autoDimensions[0]);
    shapeDrawable.setIntrinsicHeight(isManualDimensions[1] ? manualDimensions[1] : autoDimensions[1]);
    colorImageView.setImageDrawable(new LayerDrawable(new Drawable[]{shapeDrawable, outlineDrawable}));
    colorImageView.getLayoutParams().height = RelativeLayout.LayoutParams.WRAP_CONTENT;
    colorImageView.getLayoutParams().width = RelativeLayout.LayoutParams.WRAP_CONTENT;
    colorImageView.setPadding(padding[0], padding[1], padding[2], padding[3]);
    colorImageView.setAdjustViewBounds(true);
}
项目:justwidgets    文件:RippleCompat.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public Drawable initBackgroundDrawable(View view, Drawable mBackgroundColorDrawable) {
    RippleDrawable mBackgroundRippleDrawable = new RippleDrawable(
            ColorStateList.valueOf(Color.TRANSPARENT),
            null,
            new ShapeDrawable(new RectShape())
    );

    view.setBackground(new LayerDrawable(new Drawable[] {
            mBackgroundColorDrawable,
            mBackgroundRippleDrawable
    }));

    return mBackgroundRippleDrawable;
}
项目:justwidgets    文件:RippleCompat.java   
@TargetApi(Build.VERSION_CODES.M)
@Override
public Drawable initBackgroundDrawable(View view, Drawable mBackgroundColorDrawable) {

    RippleDrawable mBackgroundRippleDrawable = new RippleDrawable(
            ColorStateList.valueOf(Color.TRANSPARENT),
            null,
            new ShapeDrawable(new RectShape())
    );

    view.setBackground(mBackgroundColorDrawable);
    view.setForeground(mBackgroundRippleDrawable);

    return mBackgroundRippleDrawable;

}
项目:FingerColoring-Android    文件:ColorPickerSeekBar.java   
/**
 * Initializes the color seekbar with the gradient
 */
public void init() {
    LinearGradient colorGradient;
    if (Build.VERSION.SDK_INT >= 16) {
        colorGradient = new LinearGradient(0.f, 0.f, this.getMeasuredWidth() - this.getThumb().getIntrinsicWidth(), 0.f,
                new int[]{0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFF00FFFF,
                        0xFFFF0000, 0xFFFF00FF, 0xFFFFFF00, 0xFFFFFF},
                null, Shader.TileMode.CLAMP
        );
    } else {
        colorGradient = new LinearGradient(0.f, 0.f, this.getMeasuredWidth(), 0.f,
                new int[]{0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFF00FFFF,
                        0xFFFF0000, 0xFFFF00FF, 0xFFFFFF00, 0xFFFFFF},
                null, Shader.TileMode.CLAMP
        );
    }
    ShapeDrawable shape = new ShapeDrawable(new RectShape());
    shape.getPaint().setShader(colorGradient);
    this.setProgressDrawable(shape);
    this.setMax(256 * 7 - 1);
}
项目:CompoundLayout    文件:GradientRadioLayout.java   
/**
 * Update gradient parameters.
 */
private void updateGradientParameters() {
    // - Initialize gradient.
    mSideHypot = (int) Math.hypot(getWidth(), getHeight());
    ShapeDrawable mDrawable = new ShapeDrawable(new RectShape());
    final double radiansAngle = Math.toRadians(mDegreesAngle);
    mDrawable.getPaint().setShader(new LinearGradient(0, 0, (int) (mSideHypot * Math.cos(radiansAngle)), (int) (mSideHypot * Math.sin(radiansAngle)), mColorA, mColorB, Shader.TileMode.REPEAT));

    // - Initialize foreground gradient layout.
    if (mForegroundLayout == null) {
        mForegroundLayout = new FrameLayout(getContext());
        mForegroundLayout.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        addView(mForegroundLayout);
    }
    mForegroundLayout.setVisibility(isChecked() ? View.VISIBLE : View.INVISIBLE);
    mForegroundLayout.setForeground(mDrawable);
}
项目:FMTech    文件:PlayHighlightsBannerItemView.java   
public final void onLoaded(FifeImageView paramFifeImageView, Bitmap paramBitmap)
{
  if (this.mSwatchView != null)
  {
    int i = Bitmap.createScaledBitmap(Bitmap.createBitmap(paramBitmap, 0, 0, paramBitmap.getWidth(), Math.min(20, paramBitmap.getHeight())), 1, 1, false).getPixel(0, 0);
    int j = Color.argb(0, Color.red(i), Color.green(i), Color.blue(i));
    float f = this.mTotalHeight;
    int[] arrayOfInt = { i, i, j };
    float[] arrayOfFloat = new float[3];
    arrayOfFloat[0] = 0.0F;
    arrayOfFloat[1] = this.mBreakPoint;
    arrayOfFloat[2] = 1.0F;
    LinearGradient localLinearGradient = new LinearGradient(0.0F, 0.0F, 0.0F, f, arrayOfInt, arrayOfFloat, Shader.TileMode.CLAMP);
    ShapeDrawable localShapeDrawable = new ShapeDrawable(new RectShape());
    localShapeDrawable.getPaint().setShader(localLinearGradient);
    UiUtils.setBackground(this.mSwatchView, localShapeDrawable);
    UiUtils.setBackground(this.mBackground, new ColorDrawable(i));
  }
  if (this.mOnLoadedListener != null) {
    this.mOnLoadedListener.onLoaded(paramFifeImageView, paramBitmap);
  }
}
项目:FMTech    文件:kxi.java   
public kxi(Context paramContext)
{
  mbb localmbb = mbb.b(paramContext);
  Resources localResources = paramContext.getResources();
  if (efj.D(paramContext)) {}
  for (Object localObject = new ColorDrawable(1342177280);; localObject = localResources.getDrawable(aau.BY))
  {
    this.e = new ShapeDrawable(new RectShape());
    this.e.getPaint().setColor(localResources.getColor(aau.BX));
    this.f = new ColorDrawable(this.e.getPaint().getColor());
    Drawable[] arrayOfDrawable = new Drawable[2];
    arrayOfDrawable[0] = localObject;
    arrayOfDrawable[1] = this.f;
    this.g = new LayerDrawable(arrayOfDrawable);
    this.c = efj.y(paramContext);
    this.h = ((kwz)localmbb.b(kwz.class));
    ((gpl)localmbb.a(gpl.class)).a(this);
    return;
  }
}
项目:jayAndroid    文件:LayoutBlurActivity.java   
public static Bitmap getTransparentBitmap(View parent) {

        //create a bitmap
        if (parent.getWidth() == 0 || parent.getHeight() == 0) {
            return null;
        }
        int width = parent.getWidth();
        int height = parent.getHeight();
        Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);

        ShapeDrawable shapeDrawable = new ShapeDrawable(new RectShape());
        shapeDrawable.setAlpha(180);
        shapeDrawable.getPaint().setColor(0x66000000);
        shapeDrawable.setBounds(0, 0, width, height);
        shapeDrawable.draw(canvas);
        return bitmap;
    }
项目:jayAndroid    文件:MyLayerDrawableView.java   
private void init() {
    ShapeDrawable bottomLayer = new ShapeDrawable(new RectShape());
    bottomLayer.getPaint().setColor(Color.BLUE);

    ShapeDrawable midLayer = new ShapeDrawable(new RectShape());
    midLayer.getPaint().setColor(Color.GREEN);
    midLayer.getPaint().setStyle(Paint.Style.STROKE);//空心,only display the border line and transparent content

    Drawable[] layer = new Drawable[] {
            bottomLayer,
            midLayer,
            getContext().getResources().getDrawable(R.drawable.ic_fab_star)
    };
    LayerDrawable layerDrawable = new LayerDrawable(layer);
    // left, top, right, bottom. the distance with outer border of whole layout.
    layerDrawable.setLayerInset(0, 10, 10, 10, 10);
    layerDrawable.setLayerInset(1, 20, 20, 20, 20);

    setBackgroundByVersion(layerDrawable);
}
项目:QuizUpWinner    文件:FeedbackView.java   
private static LayerDrawable ˊ(Context paramContext)
{
  int i = (int)(10.0F * paramContext.getResources().getDisplayMetrics().density);
  ShapeDrawable localShapeDrawable1 = new ShapeDrawable(new RectShape());
  Paint localPaint1 = localShapeDrawable1.getPaint();
  localPaint1.setColor(-1);
  localPaint1.setStyle(Paint.Style.FILL_AND_STROKE);
  localPaint1.setStrokeWidth(1.0F);
  localShapeDrawable1.setPadding(i, i, i, i);
  int j = (int)(1.5D * paramContext.getResources().getDisplayMetrics().density);
  ShapeDrawable localShapeDrawable2 = new ShapeDrawable(new RectShape());
  Paint localPaint2 = localShapeDrawable2.getPaint();
  localPaint2.setColor(-12303292);
  localPaint2.setStyle(Paint.Style.FILL_AND_STROKE);
  localPaint2.setStrokeWidth(1.0F);
  localShapeDrawable2.setPadding(0, 0, 0, j);
  return new LayerDrawable(new Drawable[] { localShapeDrawable2, localShapeDrawable1 });
}
项目:LimeLight    文件:ColorHueSlider.java   
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    LinearGradient gradient =
            new LinearGradient(0.0f, 0.0f, ((float) getWidth()), 0.0f,
                    new int[]{0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFF00FFFF,
                            0xFFFF0000, 0xFFFF00FF, 0xFFFFFF00, 0xFFFFFFFF},
                    null, Shader.TileMode.CLAMP);
    ShapeDrawable shape = new ShapeDrawable(new RectShape());
    shape.getPaint().setShader(gradient);

    Rect bounds = getProgressDrawable().getBounds();
    setProgressDrawable(shape);
    getProgressDrawable().setBounds(bounds);
}
项目:OttoFit    文件:RippleView.java   
public void init() {
  mPaint = new Paint();
  mPaint.setAlpha(100);
  setRippleColor(Color.BLACK, 0.2f);
  ShapeDrawable normal = new ShapeDrawable(new RectShape());
  normal.getPaint().setColor(Color.parseColor("#00FFFFFF"));
  StateListDrawable states = new StateListDrawable();

  states.addState(new int[] { android.R.attr.state_pressed, android.R.attr.state_enabled },
      normal);
  states.addState(new int[] { android.R.attr.state_focused, android.R.attr.state_enabled },
      normal);
  states.addState(new int[] { android.R.attr.state_enabled }, normal);
  states.addState(new int[] { -android.R.attr.state_enabled }, normal);
  setBackgroundDrawable(states);
}
项目:appdeck-android    文件:DefaultHeaderTransformer.java   
private void applyProgressBarSettings() {
    if (mHeaderProgressBar != null) {
        final int strokeWidth = mHeaderProgressBar.getResources()
                .getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);

        mHeaderProgressBar.setIndeterminateDrawable(
                new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
                        .color(mProgressDrawableColor)
                        .strokeWidth(strokeWidth)
                        .build());

        ShapeDrawable shape = new ShapeDrawable();
        shape.setShape(new RectShape());
        shape.getPaint().setColor(mProgressDrawableColor);
        ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);

        mHeaderProgressBar.setProgressDrawable(clipDrawable);
    }
}
项目:Klyph    文件:DefaultHeaderTransformer.java   
private void applyProgressBarSettings() {
    if (mHeaderProgressBar != null) {
        final int strokeWidth = mHeaderProgressBar.getResources()
                .getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);

        mHeaderProgressBar.setIndeterminateDrawable(
                new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
                        .color(mProgressDrawableColor)
                        .width(strokeWidth)
                        .build());

        ShapeDrawable shape = new ShapeDrawable();
        shape.setShape(new RectShape());
        shape.getPaint().setColor(mProgressDrawableColor);
        ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);

        mHeaderProgressBar.setProgressDrawable(clipDrawable);
    }
}
项目:Klyph    文件:ProfileImageView.java   
public BorderDrawable(String shapeType, final int borderColor, final int borderWidth)
{
    super();

    final Shape shape = shapeType.equals(RECT) ? new RectShape() : new OvalShape();

    final ShapeDrawable transparentShape = new ShapeDrawable(shape);
    transparentShape.getPaint().setColor(0x00000000);// Transparent

    final GradientDrawable shapeDrawable = new GradientDrawable();
    shapeDrawable.setShape(shapeType.equals(RECT) ? GradientDrawable.RECTANGLE : GradientDrawable.OVAL);
    shapeDrawable.setStroke(borderWidth, borderColor);

    addState(new int[] { android.R.attr.state_enabled, android.R.attr.state_focused, -android.R.attr.state_pressed }, shapeDrawable);
    addState(new int[] { android.R.attr.state_enabled, -android.R.attr.state_focused, android.R.attr.state_pressed }, shapeDrawable);
    addState(new int[] { android.R.attr.state_enabled, android.R.attr.state_focused, android.R.attr.state_pressed }, shapeDrawable);
    addState(new int[] {}, transparentShape);
}
项目:CodeLessDoMore    文件:DefaultHeaderTransformer.java   
private void applyProgressBarSettings() {
    if (mHeaderProgressBar != null) {
        final int strokeWidth = mHeaderProgressBar.getResources()
                .getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);

        mHeaderProgressBar.setIndeterminateDrawable(
                new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
                        .color(mProgressDrawableColor)

                        .build());

        ShapeDrawable shape = new ShapeDrawable();
        shape.setShape(new RectShape());
        shape.getPaint().setColor(mProgressDrawableColor);
        ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);

        mHeaderProgressBar.setProgressDrawable(clipDrawable);
    }
}
项目:mpd-control    文件:DefaultHeaderTransformer.java   
private void applyProgressBarSettings() {
    if (mHeaderProgressBar != null) {
        final int strokeWidth = mHeaderProgressBar.getResources()
                .getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);

        mHeaderProgressBar.setIndeterminateDrawable(
                new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
                        .color(mProgressDrawableColor)
                        .strokeWidth(strokeWidth)
                        .build());

        ShapeDrawable shape = new ShapeDrawable();
        shape.setShape(new RectShape());
        shape.getPaint().setColor(mProgressDrawableColor);
        ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);

        mHeaderProgressBar.setProgressDrawable(clipDrawable);
    }
}
项目:UltimateAndroid    文件:DefaultSectionAdapter.java   
@Override
@SuppressWarnings(value = { "deprecation" })
public View getItemView(int section, int position, View convertView, ViewGroup parent) {
    TextView tv = null;
    if (convertView != null) {
        tv = (TextView) convertView;
    } else {
        tv = new TextView(context);
        RectShape rs = new RectShape();
        ShapeDrawable sd = new  BottomBorderBackground(rs, Color.WHITE, Color.GRAY);
        tv.setBackgroundDrawable(sd);
        tv.setPadding(20, 0, 0, 0);
        tv.setGravity(Gravity.CENTER_VERTICAL);
    }
    tv.setLayoutParams(new LayoutParams(300, itemHeight));
    tv.setText("s" + section + " p" + position);
    return tv;
}
项目:UltimateAndroid    文件:DefaultSectionAdapter.java   
@Override
@SuppressWarnings(value = { "deprecation" })
public View getItemView(int section, int position, View convertView, ViewGroup parent) {
    TextView tv = null;
    if (convertView != null) {
        tv = (TextView) convertView;
    } else {
        tv = new TextView(context);
        RectShape rs = new RectShape();
        ShapeDrawable sd = new  BottomBorderBackground(rs, Color.WHITE, Color.GRAY);
        tv.setBackgroundDrawable(sd);
        tv.setPadding(20, 0, 0, 0);
        tv.setGravity(Gravity.CENTER_VERTICAL);
    }
    tv.setLayoutParams(new LayoutParams(300, itemHeight));
    tv.setText("s" + section + " p" + position);
    return tv;
}
项目:Team11Prototype    文件:DefaultHeaderTransformer.java   
private void applyProgressBarSettings() {
    if (mHeaderProgressBar != null) {
        final int strokeWidth = mHeaderProgressBar.getResources()
                .getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);

        mHeaderProgressBar.setIndeterminateDrawable(
                new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
                        .color(mProgressDrawableColor)
                        .strokeWidth(strokeWidth)
                        .build());

        ShapeDrawable shape = new ShapeDrawable();
        shape.setShape(new RectShape());
        shape.getPaint().setColor(mProgressDrawableColor);
        ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);

        mHeaderProgressBar.setProgressDrawable(clipDrawable);
    }
}
项目:mpdroid-2014    文件:DefaultHeaderTransformer.java   
private void applyProgressBarSettings() {
    if (mHeaderProgressBar != null) {
        final int strokeWidth = mHeaderProgressBar.getResources()
                .getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);

        mHeaderProgressBar.setIndeterminateDrawable(
                new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
                        .color(mProgressDrawableColor)
                        .width(strokeWidth)
                        .build());

        ShapeDrawable shape = new ShapeDrawable();
        shape.setShape(new RectShape());
        shape.getPaint().setColor(mProgressDrawableColor);
        ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);

        mHeaderProgressBar.setProgressDrawable(clipDrawable);
    }
}
项目:KlyphMessenger    文件:DefaultHeaderTransformer.java   
private void applyProgressBarSettings() {
    if (mHeaderProgressBar != null) {
        final int strokeWidth = mHeaderProgressBar.getResources()
                .getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);

        mHeaderProgressBar.setIndeterminateDrawable(
                new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
                        .color(mProgressDrawableColor)
                        .width(strokeWidth)
                        .build());

        ShapeDrawable shape = new ShapeDrawable();
        shape.setShape(new RectShape());
        shape.getPaint().setColor(mProgressDrawableColor);
        ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);

        mHeaderProgressBar.setProgressDrawable(clipDrawable);
    }
}
项目:KlyphMessenger    文件:ProfileImageView.java   
public BorderDrawable(String shapeType, final int borderColor, final int borderWidth)
{
    super();

    final Shape shape = shapeType.equals(RECT) ? new RectShape() : new OvalShape();

    final ShapeDrawable transparentShape = new ShapeDrawable(shape);
    transparentShape.getPaint().setColor(0x00000000);// Transparent

    final GradientDrawable shapeDrawable = new GradientDrawable();
    shapeDrawable.setShape(shapeType.equals(RECT) ? GradientDrawable.RECTANGLE : GradientDrawable.OVAL);
    shapeDrawable.setStroke(borderWidth, borderColor);

    addState(new int[] { android.R.attr.state_enabled, android.R.attr.state_focused, -android.R.attr.state_pressed }, shapeDrawable);
    addState(new int[] { android.R.attr.state_enabled, -android.R.attr.state_focused, android.R.attr.state_pressed }, shapeDrawable);
    addState(new int[] { android.R.attr.state_enabled, android.R.attr.state_focused, android.R.attr.state_pressed }, shapeDrawable);
    addState(new int[] {}, transparentShape);
}
项目:tnc1-android-config    文件:BarLevelDrawable.java   
private void drawBar(Canvas canvas) {
  int padding = 5; // Padding on both sides.
  int x = 0;
  int y = 10;

  int width = (int) (Math.floor(getWidth() / segmentColors.length))
      - (2 * padding);
  int height = 50;

  mDrawable = new ShapeDrawable(new RectShape());
  for (int i = 0; i < segmentColors.length; i++) {
    x = x + padding;
    if ((mLevel * segmentColors.length) > (i + 0.5)) {
      mDrawable.getPaint().setColor(segmentColors[i]);
    } else {
      mDrawable.getPaint().setColor(segmentOffColor);
    }
    mDrawable.setBounds(x, y, x + width, y + height);
    mDrawable.draw(canvas);
    x = x + width + padding;
  }
}
项目:overplayed    文件:ControlView.java   
/**
 * Generates bitmaps used for drawing joystick.
 */
void generateBitmap() {
    // Size and shape of joystick gate
    ShapeDrawable squareShape = new ShapeDrawable();
    squareShape.setShape(new RectShape());
    squareShape.setBounds(0, 0, (int) radius * 2, (int) radius * 2);

    // Create joystick gate bitmap and render shape
    handlesBitmap = Bitmap.createBitmap((int) radius * 2, (int) radius * 2, Bitmap.Config.ARGB_4444);
    Canvas handlesCanvas = new Canvas(handlesBitmap);
    squareShape.getPaint().set(parent.blackPaint);
    squareShape.draw(handlesCanvas);
    parent.strokePaint.setStrokeWidth(standardRadius * .1f);
    squareShape.getPaint().set(parent.strokePaint);
    squareShape.draw(handlesCanvas);
    handlesCanvas.rotate(45, radius, radius);
    squareShape.getPaint().set(parent.clearPaint);
    squareShape.draw(handlesCanvas);
    parent.strokePaint.setStrokeWidth(standardRadius * .05f);
    squareShape.getPaint().set(parent.strokePaint);
    squareShape.draw(handlesCanvas);
}
项目:FreeFlow    文件:DefaultSectionAdapter.java   
@Override
@SuppressWarnings(value = { "deprecation" })
public View getItemView(int section, int position, View convertView, ViewGroup parent) {
    TextView tv = null;
    if (convertView != null) {
        tv = (TextView) convertView;
    } else {
        tv = new TextView(context);
        RectShape rs = new RectShape();
        ShapeDrawable sd = new  BottomBorderBackground(rs, Color.WHITE, Color.GRAY);
        tv.setBackgroundDrawable(sd);
        tv.setPadding(20, 0, 0, 0);
        tv.setGravity(Gravity.CENTER_VERTICAL);
    }
    tv.setLayoutParams(new LayoutParams(300, itemHeight));
    tv.setText("s" + section + " p" + position);
    return tv;
}
项目:XERUNG    文件:TextDrawable.java   
private Builder() {
    text = "";
    color = Color.GRAY;
    textColor = Color.WHITE;
    borderThickness = 0;
    width = -1;
    height = -1;
    shape = new RectShape();
    font = Typeface.create("sans-serif-light", Typeface.NORMAL);
    fontSize = -1;
    isBold = false;
    toUpperCase = false;
}
项目:XERUNG    文件:TextDrawable.java   
private Builder() {
    text = "";
    color = Color.GRAY;
    textColor = Color.WHITE;
    borderThickness = 0;
    width = -1;
    height = -1;
    shape = new RectShape();
    font = Typeface.create("sans-serif-light", Typeface.NORMAL);
    fontSize = -1;
    isBold = false;
    toUpperCase = false;
}
项目:Hello-Music-droid    文件:TextDrawable.java   
private Builder() {
    text = "";
    color = Color.GRAY;
    textColor = Color.WHITE;
    borderThickness = 0;
    width = -1;
    height = -1;
    shape = new RectShape();
    font = Typeface.create("sans-serif-light", Typeface.NORMAL);
    fontSize = -1;
    isBold = false;
    toUpperCase = false;
}
项目:EasyAndroid    文件:NewAuthEditText.java   
/**
 * 创建 TextView 背景 {@link android.graphics.drawable.Drawable}
 *
 * @return {@link ShapeDrawable}
 */
private ShapeDrawable createFrameDrawableBg()
{
    ShapeDrawable shape = new ShapeDrawable(new RectShape());
    Paint paint = shape.getPaint();
    paint.setColor(frameColor);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(frameWidth);
    return shape;
}
项目:EasyAndroid    文件:AuthEditText.java   
/**
 * 初始化默认的Drawable,{@link #defaultDrawable}
 */
private void initDefaultDrawable()
{
    defaultDrawable = new ShapeDrawable(new RectShape());
    Paint paint = defaultDrawable.getPaint();
    paint.setColor(frameColor);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(strokeWidth);
    setTextViewDrawable(defaultDrawable);
}
项目:ShangHanLun    文件:ATableViewPlainFooterDrawable.java   
public ATableViewPlainFooterDrawable(ATableView tableView, int rowHeight) {
    super(new RectShape());

    Resources res = tableView.getResources();

    mStrokeWidth = DrawableUtils.getStrokeWidth(res);
    mStrokeOffset = (float) Math.ceil(rowHeight * res.getDisplayMetrics().density) + mStrokeWidth;

    // stroke.
    mStrokePaint = new Paint();
    mStrokePaint.setStyle(Paint.Style.STROKE);
    mStrokePaint.setStrokeWidth(mStrokeWidth);
    mStrokePaint.setColor(DrawableUtils.getSeparatorColor(tableView));
}
项目:Excuser    文件:TextDrawable.java   
private Builder() {
    text = "";
    color = Color.GRAY;
    textColor = Color.WHITE;
    borderThickness = 0;
    width = -1;
    height = -1;
    shape = new RectShape();
    font = Typeface.create("sans-serif-light", Typeface.NORMAL);
    fontSize = -1;
    isBold = false;
    toUpperCase = false;
}
项目:MusicX-music-player    文件:TextDrawable.java   
private Builder() {
    text = "";
    color = Color.GRAY;
    textColor = Color.WHITE;
    borderThickness = 0;
    width = -1;
    height = -1;
    shape = new RectShape();
    font = Typeface.create("sans-serif-light", Typeface.NORMAL);
    fontSize = -1;
    isBold = false;
    toUpperCase = false;
}
项目:RLibrary    文件:TextDrawable.java   
private Builder() {
    text = "";
    color = Color.GRAY;
    textColor = Color.WHITE;
    borderThickness = 0;
    width = -1;
    height = -1;
    shape = new RectShape();
    font = Typeface.create("sans-serif-light", Typeface.NORMAL);
    fontSize = -1;
    isBold = false;
    toUpperCase = false;
}
项目:RLibrary    文件:TabLayoutUtil.java   
public static void setCommonTabDivider(CommonTabLayout tabLayout, @ColorInt int color, int showDividers, int padding) {
    LinearLayout linearLayout = (LinearLayout) tabLayout.getChildAt(0);
    linearLayout.setDividerPadding(padding);
    RectShape rectShape = new RectShape();
    float density = tabLayout.getResources().getDisplayMetrics().density;
    ShapeDrawable shapeDrawable = new ShapeDrawable(rectShape);
    shapeDrawable.setIntrinsicWidth((int) density);
    shapeDrawable.setIntrinsicHeight((int) density);
    shapeDrawable.getPaint().setColor(color);
    shapeDrawable.getPaint().setStyle(Paint.Style.STROKE);
    linearLayout.setDividerDrawable(shapeDrawable);
    linearLayout.setShowDividers(showDividers);
}
项目:templated-messaging    文件:ContactBadge.java   
private void initSquare(Context context) {
    if (mTriangle == null) {
        TypedValue typedValue = new TypedValue();
        Theme theme = context.getTheme();

        // triangle
        Path chipPath = new Path();
        chipPath.moveTo(500f, 0f);
        chipPath.lineTo(500f, 500f);
        chipPath.lineTo(0f, 500f);
        chipPath.close();
        mTriangle = new ShapeDrawable(new PathShape(chipPath, 500f, 500f));
        mTriangle.setDither(true);
        int triangleColor = Color.parseColor("#cc1f1f1f");
        if (theme.resolveAttribute(R.attr.cp_badgeTriangleColor, typedValue, true)) {
            triangleColor = typedValue.data;
        }
        mTriangle.getPaint().setColor(triangleColor);

        // line
        mLinePaint = new Paint();
        int lineColor = Color.parseColor("#ffffffff");
        if (theme.resolveAttribute(R.attr.cp_badgeLineColor, typedValue, true)) {
            lineColor = typedValue.data;
        }
        mLinePaint.setColor(lineColor);
        mOffset = 1.5f * mDensity;
        mLinePaint.setStrokeWidth(mOffset);
    }

    initOverlay(context, new RectShape());
}
项目:BlendedBackground    文件:Gradient.java   
private Drawable createDrawableFrom(ShapeDrawable.ShaderFactory sf) {
    PaintDrawable p = new PaintDrawable();
    p.setShape(new RectShape());
    p.setShaderFactory(sf);

    return p;
}