mirror of
				https://github.com/SimpleMobileTools/Simple-Calendar.git
				synced 2025-06-05 21:59:17 +02:00 
			
		
		
		
	do not show events at the month part of month/day view
This commit is contained in:
		| @@ -100,8 +100,8 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { | ||||
|     } | ||||
|  | ||||
|     private fun updateDays(days: ArrayList<DayMonthly>) { | ||||
|         mHolder.month_day_view_wrapper.updateDays(days) { | ||||
|             (activity as MainActivity).openDayFromMonthly(Formatter.getDateTimeFromCode(it.code)) | ||||
|         mHolder.month_day_view_wrapper.updateDays(days, false) { | ||||
| //            (activity as MainActivity).openDayFromMonthly(Formatter.getDateTimeFromCode(it.code)) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -142,7 +142,7 @@ class MonthFragment : Fragment(), MonthlyCalendar { | ||||
|     } | ||||
|  | ||||
|     private fun updateDays(days: ArrayList<DayMonthly>) { | ||||
|         mHolder.month_view_wrapper.updateDays(days) { | ||||
|         mHolder.month_view_wrapper.updateDays(days, true) { | ||||
|             (activity as MainActivity).openDayFromMonthly(Formatter.getDateTimeFromCode(it.code)) | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -50,6 +50,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con | ||||
|     private var dimPastEvents = true | ||||
|     private var highlightWeekends = false | ||||
|     private var isPrintVersion = false | ||||
|     private var isMonthDayView = false | ||||
|     private var allEvents = ArrayList<MonthViewEvent>() | ||||
|     private var bgRectF = RectF() | ||||
|     private var dayLetters = ArrayList<String>() | ||||
| @@ -92,7 +93,8 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con | ||||
|         setupCurrentDayOfWeekIndex() | ||||
|     } | ||||
|  | ||||
|     fun updateDays(newDays: ArrayList<DayMonthly>) { | ||||
|     fun updateDays(newDays: ArrayList<DayMonthly>, isMonthDayView: Boolean) { | ||||
|         this.isMonthDayView = isMonthDayView | ||||
|         days = newDays | ||||
|         showWeekNumbers = config.showWeekNumbers | ||||
|         horizontalOffset = if (showWeekNumbers) eventTitleHeight * 2 else 0 | ||||
| @@ -129,7 +131,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con | ||||
|         dayVerticalOffsets.clear() | ||||
|         measureDaySize(canvas) | ||||
|  | ||||
|         if (config.showGrid) { | ||||
|         if (config.showGrid && !isMonthDayView) { | ||||
|             drawGrid(canvas) | ||||
|         } | ||||
|  | ||||
| @@ -159,8 +161,10 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         for (event in allEvents) { | ||||
|             drawEvent(event, canvas) | ||||
|         if (!isMonthDayView) { | ||||
|             for (event in allEvents) { | ||||
|                 drawEvent(event, canvas) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -17,6 +17,7 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F | ||||
|     private var weekDaysLetterHeight = 0 | ||||
|     private var horizontalOffset = 0 | ||||
|     private var wereViewsAdded = false | ||||
|     private var isMonthDayView = true | ||||
|     private var days = ArrayList<DayMonthly>() | ||||
|     private var inflater: LayoutInflater | ||||
|     private var monthView: MonthView | ||||
| @@ -36,12 +37,12 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F | ||||
|             if (!wereViewsAdded && days.isNotEmpty()) { | ||||
|                 measureSizes() | ||||
|                 addViews() | ||||
|                 monthView.updateDays(days) | ||||
|                 monthView.updateDays(days, isMonthDayView) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     fun updateDays(newDays: ArrayList<DayMonthly>, callback: ((DayMonthly) -> Unit)? = null) { | ||||
|     fun updateDays(newDays: ArrayList<DayMonthly>, addEvents: Boolean, callback: ((DayMonthly) -> Unit)? = null) { | ||||
|         setupHorizontalOffset() | ||||
|         measureSizes() | ||||
|         dayClickCallback = callback | ||||
| @@ -49,7 +50,9 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F | ||||
|         if (dayWidth != 0f && dayHeight != 0f) { | ||||
|             addViews() | ||||
|         } | ||||
|         monthView.updateDays(days) | ||||
|  | ||||
|         isMonthDayView = !addEvents | ||||
|         monthView.updateDays(days, isMonthDayView) | ||||
|     } | ||||
|  | ||||
|     private fun setupHorizontalOffset() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user