Skip to content

Commit 6b22ca6

Browse files
committed
Added posibility of using selectors as backgrounds for specific dates
1 parent 517203c commit 6b22ca6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

caldroid/src/main/java/com/roomorama/caldroid/CaldroidGridAdapter.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,14 @@ protected void setCustomResources(DateTime dateTime, View backgroundView,
220220
}
221221
}
222222

223+
View.OnLayoutChangeListener onLayoutChangeListener = new View.OnLayoutChangeListener() {
224+
@Override
225+
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
226+
v.setSelected(true);
227+
v.removeOnLayoutChangeListener(this);
228+
}
229+
};
230+
223231
/**
224232
* Customize colors of text and background based on states of the cell
225233
* (disabled, active, selected, etc)
@@ -280,6 +288,7 @@ protected void customizeTextView(int position, TextView cellView) {
280288
}
281289

282290
cellView.setTextColor(CaldroidFragment.selectedTextColor);
291+
cellView.addOnLayoutChangeListener(onLayoutChangeListener);
283292
} else {
284293
shouldResetSelectedView = true;
285294
}

0 commit comments

Comments
 (0)