Revision 7018009a
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 |
} |
app/src/info/guardianproject/notepadbot/Settings.java | ||
---|---|---|
9 | 9 |
import android.os.Bundle; |
10 | 10 |
import android.preference.Preference; |
11 | 11 |
import android.preference.PreferenceFragment; |
12 |
import android.preference.PreferenceManager; |
|
12 | 13 |
import android.support.v4.app.NavUtils; |
13 | 14 |
|
14 | 15 |
import com.actionbarsherlock.app.SherlockPreferenceActivity; |
... | ... | |
77 | 78 |
|
78 | 79 |
return true; |
79 | 80 |
} |
80 |
}; |
|
81 |
}; |
|
82 |
|
|
83 |
public static final boolean getNoteLinesOption(Context context) { |
|
84 |
boolean defValue = context.getResources().getBoolean(R.bool.notecipher_uselines_default); |
|
85 |
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(NConstants.SHARED_PREFS_NOTELINES, defValue); |
|
86 |
} |
|
81 | 87 |
} |
Also available in: Unified diff