Revision 7018009a app/src/info/guardianproject/notepadbot/LinedEditText.java

View differences:

app/src/info/guardianproject/notepadbot/LinedEditText.java
13 13
public class LinedEditText extends EditText {
14 14
    private Rect mRect;
15 15
    private Paint mPaint;
16

  
16
    private boolean showLines;
17
    
17 18
    // we need this constructor for LayoutInflater
18 19
    public LinedEditText(Context context, AttributeSet attrs) {
19 20
        super(context, attrs);
......
22 23
        mPaint = new Paint();
23 24
        mPaint.setStyle(Paint.Style.STROKE);
24 25
        mPaint.setColor(getResources().getColor(R.color.gray));
26
        
27
        showLines = Settings.getNoteLinesOption(context);
25 28
    }
26 29
    
27 30
    @Override
......
29 32
        int height = canvas.getHeight();
30 33
        int curHeight = 0;
31 34
        int baseline = getLineBounds(0, mRect);
32
        for (curHeight = baseline + 3; curHeight < height; curHeight += getLineHeight()) {
33
            canvas.drawLine(mRect.left, curHeight, mRect.right, curHeight, mPaint);
35
        if(showLines) {
36
	        for (curHeight = baseline + 3; curHeight < height; curHeight += getLineHeight()) {
37
	            canvas.drawLine(mRect.left, curHeight, mRect.right, curHeight, mPaint);
38
	        }
34 39
        }
35 40
        super.onDraw(canvas);
36 41
    }

Also available in: Unified diff