1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
public View getView(int position, View convertView, ViewGroup parent)
{
if(convertView == null) {
convertView = inflater.inflate(R.layout.calendrier_case, null);
}
final TextView textview = (TextView) convertView.findViewById(R.id.case_cal);
textview.setGravity(Gravity.CENTER);
textview.setText(this.items.get(position));
//Récupération de la date en fonction de la case cliqué
int[] date = this.calendar.getDateFromPos(position);
if(position <= 6) // Jour de la semaine
textview.setTextColor(R.color.bleu_nuit);
else
{
textview.setTextColor(Color.rgb(44, 54, 66));
}
if(date != null)
{
textview.setHeight(this.metrics.widthPixels /7); // Permet d'avoir des cases carré
if(date[1] != this.calendar.getMonth())
{
textview.setBackgroundColor(Color.rgb(175, 174, 177));
textview.setTextColor(Color.rgb(117, 122, 126));
textview.setOnClickListener(this.onClicOtherDate(position,date));
}
else
{
textview.setBackgroundColor(Color.rgb(218, 217, 223));
textview.setOnClickListener(this.onClicThisMonthDate(position));
}
if(this.calendar.isToday(date))
textview.setTextColor(Color.rgb(245, 45, 12));
}
else
{
//Ligne des jours
textview.setBackgroundColor(Color.rgb(202,202,207));
textview.setHeight(30);
}
return convertView;
} |
Partager