Android Open Source - android-placeholder Cross Drawable






From Project

Back to project page android-placeholder.

License

The source code is released under:

Apache License

If you think the Android project android-placeholder listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package se.lightside.placeholder.graphics.drawable;
/* w  w  w .ja v  a2 s.  c  o  m*/
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.view.View;
import android.widget.ImageView;

import se.lightside.placeholder.util.ViewCompat;

/**
 * A simple placeholder that draws a cross on between its corners
 */
public class CrossDrawable extends AbstractPlaceholderDrawable {

    public CrossDrawable() {
        super();

        Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
        p.setStyle(Paint.Style.STROKE);
        p.setColor(Color.DKGRAY);
        p.setStrokeWidth(1);

        setPaint(p);
    }

    @Override
    public void draw(Canvas canvas) {
        RectF rect  = new RectF(getBounds());
        canvas.drawRect(rect, getPaint());
        canvas.drawLine(rect.left, rect.top, rect.right, rect.bottom, getPaint());
        canvas.drawLine(rect.left, rect.bottom, rect.right, rect.top, getPaint());
    }

}




Java Source Code List

se.lightside.placeholder.ApplicationTest.java
se.lightside.placeholder.PlaceholderBuilder.java
se.lightside.placeholder.graphics.drawable.AbstractPlaceholderDrawable.java
se.lightside.placeholder.graphics.drawable.CrossDrawable.java
se.lightside.placeholder.graphics.drawable.DimensionsDrawable.java
se.lightside.placeholder.graphics.drawable.GridDrawable.java
se.lightside.placeholder.sample.DemoFragment.java
se.lightside.placeholder.sample.DemoHostActivity.java
se.lightside.placeholder.text.method.BlockTransformationMethod.java
se.lightside.placeholder.util.MetricsConverter.java
se.lightside.placeholder.util.ViewCompat.java
se.lightside.placeholder.view.RatioLineOverlay.java
se.lightside.placeholder.view.RatioLine.java
se.lightside.placeholder.widget.BlockedOutTextView.java
se.lightside.placeholder.widget.PlaceholderView.java