Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change time text color independently to headerColumnTextColor #87

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions library/src/main/java/com/alamkanak/weekview/WeekView.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ private enum Direction {
private int mTextSize = 12;
private int mHeaderColumnPadding = 10;
private int mHeaderColumnTextColor = Color.BLACK;
private int mHeaderLineTextColor = Color.BLACK;
private int mNumberOfVisibleDays = 3;
private int mHeaderRowPadding = 10;
private int mHeaderRowBackgroundColor = Color.WHITE;
Expand Down Expand Up @@ -447,6 +448,7 @@ public WeekView(Context context, AttributeSet attrs, int defStyleAttr) {
mHeaderColumnPadding = a.getDimensionPixelSize(R.styleable.WeekView_headerColumnPadding, mHeaderColumnPadding);
mColumnGap = a.getDimensionPixelSize(R.styleable.WeekView_columnGap, mColumnGap);
mHeaderColumnTextColor = a.getColor(R.styleable.WeekView_headerColumnTextColor, mHeaderColumnTextColor);
mHeaderLineTextColor = a.getColor(R.styleable.WeekView_headerLineTextColor, mHeaderLineTextColor);
mNumberOfVisibleDays = a.getInteger(R.styleable.WeekView_noOfVisibleDays, mNumberOfVisibleDays);
mShowFirstDayOfWeekFirst = a.getBoolean(R.styleable.WeekView_showFirstDayOfWeekFirst, mShowFirstDayOfWeekFirst);
mHeaderRowPadding = a.getDimensionPixelSize(R.styleable.WeekView_headerRowPadding, mHeaderRowPadding);
Expand Down Expand Up @@ -515,7 +517,7 @@ private void init() {
mTimeTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTimeTextPaint.setTextAlign(Paint.Align.RIGHT);
mTimeTextPaint.setTextSize(mTextSize);
mTimeTextPaint.setColor(mHeaderColumnTextColor);
mTimeTextPaint.setColor(mHeaderLineTextColor);

Rect rect = new Rect();
final String exampleTime = (mTimeColumnResolution % 60 != 0) ? "00:00 PM" : "00 PM";
Expand Down Expand Up @@ -1785,7 +1787,16 @@ public int getHeaderColumnTextColor() {
public void setHeaderColumnTextColor(int headerColumnTextColor) {
mHeaderColumnTextColor = headerColumnTextColor;
mHeaderTextPaint.setColor(mHeaderColumnTextColor);
mTimeTextPaint.setColor(mHeaderColumnTextColor);
invalidate();
}

public int getHeaderLineTextColor() {
return mHeaderLineTextColor;
}

public void setHeaderLineTextColor(int headerLineTextColor) {
mHeaderLineTextColor = headerLineTextColor;
mTimeTextPaint.setColor(mHeaderLineTextColor);
invalidate();
}

Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<attr name="headerColumnBackground" format="color" />
<attr name="headerColumnPadding" format="dimension" />
<attr name="headerColumnTextColor" format="color" />
<attr name="headerLineTextColor" format="color" />
<attr name="headerRowBackgroundColor" format="color" />
<attr name="headerRowPadding" format="dimension" />
<attr name="horizontalFlingEnabled" format="boolean" />
Expand Down