GridBtMonthViewProvider.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:BonetCalendarView 作者:
public GridBtMonthViewProvider(Context context, BtMonth month) {
    super(month);

    mContext = context;

    Log.d("", "Criando DayGridAdapter");
    mAdapter = new DayGridAdapter(context,month,getMinDate(),getMaxDate());

    mMonthDisplay = new MonthDisplayHelper(month.getYear(), month.getMonth());

    mGridItemClickedListener = new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapter, View arg1, int position,
                long arg3) {

            int fp = mMonthDisplay.getRowOf(1)*7+mMonthDisplay.getColumnOf(1);
            int lp = fp+ mMonthDisplay.getNumberOfDaysInMonth();

            // Checks to see if the position selected represents a date within the month
            if(position >= fp && position <lp) {

                BtDate day;
                // Checks to see if the selected date is within the defined bounds
                if( (day = getMonth().getDate(position+1-fp)).isWithinBounds(getMinDate(),getMaxDate()))
                    selectDay(day);

            }
        }
    };

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号