show whole months events by default at month/day view
This commit is contained in:
parent
b91cdf4116
commit
f97d59b14a
|
@ -15,6 +15,7 @@ import com.simplemobiletools.calendar.pro.extensions.*
|
|||
import com.simplemobiletools.calendar.pro.helpers.Config
|
||||
import com.simplemobiletools.calendar.pro.helpers.DAY_CODE
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.pro.helpers.Formatter.YEAR_PATTERN
|
||||
import com.simplemobiletools.calendar.pro.helpers.MonthlyCalendarImpl
|
||||
import com.simplemobiletools.calendar.pro.interfaces.MonthlyCalendar
|
||||
import com.simplemobiletools.calendar.pro.interfaces.NavigationListener
|
||||
|
@ -55,7 +56,8 @@ class MonthDayFragment : Fragment(), MonthlyCalendar {
|
|||
mSelectedDayCode = if (todayDateTime.year == shownMonthDateTime.year && todayDateTime.monthOfYear == shownMonthDateTime.monthOfYear) {
|
||||
todayCode
|
||||
} else {
|
||||
mDayCode
|
||||
mHolder.month_day_selected_day_label.text = getMonthLabel(shownMonthDateTime)
|
||||
""
|
||||
}
|
||||
|
||||
mConfig = context!!.config
|
||||
|
@ -127,11 +129,19 @@ class MonthDayFragment : Fragment(), MonthlyCalendar {
|
|||
}
|
||||
|
||||
val filtered = mListEvents.filter {
|
||||
if (mSelectedDayCode.isEmpty()) {
|
||||
val shownMonthDateTime = Formatter.getDateTimeFromCode(mDayCode)
|
||||
val startDateTime = Formatter.getDateTimeFromTS(it.startTS)
|
||||
shownMonthDateTime.year == startDateTime.year && shownMonthDateTime.monthOfYear == startDateTime.monthOfYear
|
||||
} else {
|
||||
Formatter.getDayCodeFromTS(it.startTS) == mSelectedDayCode
|
||||
}
|
||||
}
|
||||
|
||||
val listItems = activity!!.getEventListItems(filtered, false)
|
||||
month_day_selected_day_label.text = Formatter.getDateFromCode(activity!!, mSelectedDayCode, false)
|
||||
if (mSelectedDayCode.isNotEmpty()) {
|
||||
mHolder.month_day_selected_day_label.text = Formatter.getDateFromCode(activity!!, mSelectedDayCode, false)
|
||||
}
|
||||
|
||||
activity?.runOnUiThread {
|
||||
if (activity != null) {
|
||||
|
@ -152,5 +162,14 @@ class MonthDayFragment : Fragment(), MonthlyCalendar {
|
|||
|
||||
fun printCurrentView() {}
|
||||
|
||||
fun getNewEventDayCode() = mSelectedDayCode
|
||||
fun getNewEventDayCode() = if (mSelectedDayCode.isEmpty()) mDayCode else mSelectedDayCode
|
||||
|
||||
private fun getMonthLabel(shownMonthDateTime: DateTime): String {
|
||||
var month = Formatter.getMonthName(activity!!, shownMonthDateTime.monthOfYear)
|
||||
val targetYear = shownMonthDateTime.toString(YEAR_PATTERN)
|
||||
if (targetYear != DateTime().toString(YEAR_PATTERN)) {
|
||||
month += " $targetYear"
|
||||
}
|
||||
return month
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
android:id="@+id/month_day_view_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/month_day_events_list"
|
||||
app:layout_constraintBottom_toTopOf="@+id/month_day_list_holder"
|
||||
app:layout_constraintHeight_percent="0.3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
@ -37,8 +37,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
android:paddingTop="@dimen/normal_margin"
|
||||
android:textSize="@dimen/actionbar_text_size"
|
||||
tools:text="8/5/2021" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
||||
|
|
Loading…
Reference in New Issue