From 01177ef0f9593606916b748a7d0ef9f861f7edb8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 21 Feb 2021 23:29:04 +0100 Subject: [PATCH 01/52] shrink the monthly day view + make the background grid non clickable --- .../calendar/pro/fragments/MonthDayFragment.kt | 1 - .../simplemobiletools/calendar/pro/views/MonthView.kt | 7 ++++++- .../calendar/pro/views/MonthViewWrapper.kt | 10 +++++++--- app/src/main/res/layout/month_view.xml | 5 ++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt index 2fd34f026..36bae60fa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt @@ -9,7 +9,6 @@ import android.view.ViewGroup import android.widget.RelativeLayout import androidx.fragment.app.Fragment import com.simplemobiletools.calendar.pro.R -import com.simplemobiletools.calendar.pro.activities.MainActivity import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.helpers.Config import com.simplemobiletools.calendar.pro.helpers.DAY_CODE diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt index 0d6b229d5..4b8c2ee04 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt @@ -216,7 +216,12 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con private fun measureDaySize(canvas: Canvas) { dayWidth = (canvas.width - horizontalOffset) / 7f - dayHeight = (canvas.height - weekDaysLetterHeight) / ROW_COUNT.toFloat() + dayHeight = if (isMonthDayView) { + weekDaysLetterHeight * 1.2f + } else { + (canvas.height - weekDaysLetterHeight) / ROW_COUNT.toFloat() + } + val availableHeightForEvents = dayHeight.toInt() - weekDaysLetterHeight maxEventsPerDay = availableHeightForEvents / eventTitleHeight } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt index 187b6bd86..77cdcba68 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt @@ -36,7 +36,7 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F onGlobalLayout { if (!wereViewsAdded && days.isNotEmpty()) { measureSizes() - addViews() + addClickableBackgrounds() monthView.updateDays(days, isMonthDayView) } } @@ -48,7 +48,7 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F dayClickCallback = callback days = newDays if (dayWidth != 0f && dayHeight != 0f) { - addViews() + addClickableBackgrounds() } isMonthDayView = !addEvents @@ -69,7 +69,11 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F } } - private fun addViews() { + private fun addClickableBackgrounds() { + if (isMonthDayView) { + return + } + removeAllViews() monthView = inflater.inflate(R.layout.month_view, this).month_view wereViewsAdded = true diff --git a/app/src/main/res/layout/month_view.xml b/app/src/main/res/layout/month_view.xml index 4e2e595b5..5a861eaf2 100644 --- a/app/src/main/res/layout/month_view.xml +++ b/app/src/main/res/layout/month_view.xml @@ -1,6 +1,5 @@ - + android:layout_height="match_parent" /> From 159f08d24cd5ac83583cc25c4f3262b567d00e75 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 21 Feb 2021 23:49:06 +0100 Subject: [PATCH 02/52] adding a list view under the monthly one --- .../pro/fragments/MonthDayFragment.kt | 4 +-- .../calendar/pro/views/MonthView.kt | 7 +---- .../main/res/layout/fragment_month_day.xml | 31 +++++++++++++++++-- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt index 36bae60fa..597f09464 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt @@ -6,7 +6,7 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.RelativeLayout +import androidx.constraintlayout.widget.ConstraintLayout import androidx.fragment.app.Fragment import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.extensions.config @@ -32,7 +32,7 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { var listener: NavigationListener? = null lateinit var mRes: Resources - lateinit var mHolder: RelativeLayout + lateinit var mHolder: ConstraintLayout lateinit var mConfig: Config override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt index 4b8c2ee04..0d6b229d5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt @@ -216,12 +216,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con private fun measureDaySize(canvas: Canvas) { dayWidth = (canvas.width - horizontalOffset) / 7f - dayHeight = if (isMonthDayView) { - weekDaysLetterHeight * 1.2f - } else { - (canvas.height - weekDaysLetterHeight) / ROW_COUNT.toFloat() - } - + dayHeight = (canvas.height - weekDaysLetterHeight) / ROW_COUNT.toFloat() val availableHeightForEvents = dayHeight.toInt() - weekDaysLetterHeight maxEventsPerDay = availableHeightForEvents / eventTitleHeight } diff --git a/app/src/main/res/layout/fragment_month_day.xml b/app/src/main/res/layout/fragment_month_day.xml index f6fb1cb56..8c1e8b451 100644 --- a/app/src/main/res/layout/fragment_month_day.xml +++ b/app/src/main/res/layout/fragment_month_day.xml @@ -1,5 +1,6 @@ - + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@+id/month_day_events_list" + app:layout_constraintHeight_percent="0.3" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + + + + + From e545ff30ad59abb5425dbe96154b758491277c3f Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Feb 2021 18:29:38 +0100 Subject: [PATCH 03/52] populate the list view at month+day view too --- .../calendar/pro/extensions/Context.kt | 12 +++++-- .../pro/fragments/EventListFragment.kt | 10 +----- .../pro/fragments/MonthDayFragment.kt | 33 +++++++++++++------ 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt index f123326bb..cf3db368d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt @@ -456,7 +456,7 @@ fun Context.addDayEvents(day: DayMonthly, linearLayout: LinearLayout, res: Resou } } -fun Context.getEventListItems(events: List): ArrayList { +fun Context.getEventListItems(events: List, addSections: Boolean = true): ArrayList { val listItems = ArrayList(events.size) val replaceDescription = config.replaceDescription @@ -481,7 +481,7 @@ fun Context.getEventListItems(events: List): ArrayList { sorted.forEach { val code = Formatter.getDayCodeFromTS(it.startTS) - if (code != prevCode) { + if (code != prevCode && addSections) { val day = Formatter.getDayTitle(this, code) val isToday = day == today val listSection = ListSection(day, code, isToday, !isToday && it.startTS < now) @@ -553,3 +553,11 @@ fun Context.printBitmap(bitmap: Bitmap) { printHelper.orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT printHelper.printBitmap(getString(R.string.app_name), bitmap) } + +fun Context.editEvent(event: ListEvent) { + Intent(this, EventActivity::class.java).apply { + putExtra(EVENT_ID, event.id) + putExtra(EVENT_OCCURRENCE_TS, event.startTS) + startActivity(this) + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/EventListFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/EventListFragment.kt index 0c018af26..75faf387b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/EventListFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/EventListFragment.kt @@ -121,7 +121,7 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener { if (currAdapter == null || forceRecreation) { EventListAdapter(activity as SimpleActivity, listItems, true, this, mView.calendar_events_list) { if (it is ListEvent) { - editEvent(it) + context?.editEvent(it) } }.apply { mView.calendar_events_list.adapter = this @@ -169,14 +169,6 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener { mView.calendar_empty_list_placeholder.setTextColor(activity!!.config.textColor) } - private fun editEvent(event: ListEvent) { - Intent(context, EventActivity::class.java).apply { - putExtra(EVENT_ID, event.id) - putExtra(EVENT_OCCURRENCE_TS, event.startTS) - startActivity(this) - } - } - private fun fetchPreviousPeriod() { val lastPosition = (mView.calendar_events_list.layoutManager as MyLinearLayoutManager).findLastVisibleItemPosition() bottomItemAtRefresh = (mView.calendar_events_list.adapter as EventListAdapter).listItems[lastPosition] diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt index 597f09464..8e1fcb045 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt @@ -9,7 +9,9 @@ import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintLayout import androidx.fragment.app.Fragment import com.simplemobiletools.calendar.pro.R -import com.simplemobiletools.calendar.pro.extensions.config +import com.simplemobiletools.calendar.pro.activities.SimpleActivity +import com.simplemobiletools.calendar.pro.adapters.EventListAdapter +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 @@ -17,6 +19,8 @@ import com.simplemobiletools.calendar.pro.helpers.MonthlyCalendarImpl import com.simplemobiletools.calendar.pro.interfaces.MonthlyCalendar import com.simplemobiletools.calendar.pro.interfaces.NavigationListener import com.simplemobiletools.calendar.pro.models.DayMonthly +import com.simplemobiletools.calendar.pro.models.ListEvent +import kotlinx.android.synthetic.main.fragment_month_day.* import kotlinx.android.synthetic.main.fragment_month_day.view.* import org.joda.time.DateTime @@ -43,10 +47,8 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { mDayCode = arguments!!.getString(DAY_CODE)!! mConfig = context!!.config storeStateVariables() - setupButtons() mCalendar = MonthlyCalendarImpl(this, context!!) - return view } @@ -90,7 +92,24 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { mLastHash = newHash activity?.runOnUiThread { - updateDays(days) + mHolder.month_day_view_wrapper.updateDays(days, false) { + + } + } + + val startDateTime = Formatter.getLocalDateTimeFromCode(mDayCode).minusWeeks(1) + val endDateTime = startDateTime.plusWeeks(6) + context.eventsHelper.getEvents(startDateTime.seconds(), endDateTime.seconds()) { events -> + val listItems = context.getEventListItems(events, false) + activity?.runOnUiThread { + EventListAdapter(activity as SimpleActivity, listItems, true, null, month_day_events_list) { + if (it is ListEvent) { + context.editEvent(it) + } + }.apply { + month_day_events_list.adapter = this + } + } } } @@ -98,11 +117,5 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { mTextColor = mConfig.textColor } - private fun updateDays(days: ArrayList) { - mHolder.month_day_view_wrapper.updateDays(days, false) { -// (activity as MainActivity).openDayFromMonthly(Formatter.getDateTimeFromCode(it.code)) - } - } - fun printCurrentView() {} } From 20345e340525ab4ecd59871dec09b29bd5ece031 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Feb 2021 19:21:59 +0100 Subject: [PATCH 04/52] readding the background clickable views in monthly day view, just without ripple --- .../calendar/pro/views/MonthViewWrapper.kt | 8 ++++---- app/src/main/res/layout/month_view_background.xml | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt index 77cdcba68..44578970d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt @@ -70,10 +70,6 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F } private fun addClickableBackgrounds() { - if (isMonthDayView) { - return - } - removeAllViews() monthView = inflater.inflate(R.layout.month_view, this).month_view wereViewsAdded = true @@ -93,6 +89,10 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F private fun addViewBackground(xPos: Float, yPos: Float, day: DayMonthly) { inflater.inflate(R.layout.month_view_background, this, false).apply { + if (isMonthDayView) { + background = null + } + layoutParams.width = dayWidth.toInt() layoutParams.height = dayHeight.toInt() x = xPos diff --git a/app/src/main/res/layout/month_view_background.xml b/app/src/main/res/layout/month_view_background.xml index f7eb272d5..e9fad9058 100644 --- a/app/src/main/res/layout/month_view_background.xml +++ b/app/src/main/res/layout/month_view_background.xml @@ -1,7 +1,6 @@ - + android:background="?attr/selectableItemBackground" /> From 205128736596bf88b86d44f3a8928f6965583ae5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Feb 2021 20:10:02 +0100 Subject: [PATCH 05/52] show only the proper events at month/day view --- .../calendar/pro/activities/MainActivity.kt | 2 +- .../activities/WidgetListConfigureActivity.kt | 2 +- .../calendar/pro/adapters/EventListAdapter.kt | 4 +- .../pro/fragments/EventListFragment.kt | 2 +- .../pro/fragments/MonthDayFragment.kt | 39 ++++++++++++++----- 5 files changed, 35 insertions(+), 14 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt index c4c3c7013..96cac93db 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt @@ -955,7 +955,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { search_results_list.beVisibleIf(events.isNotEmpty()) search_placeholder.beVisibleIf(events.isEmpty()) val listItems = getEventListItems(events) - val eventsAdapter = EventListAdapter(this, listItems, true, this, search_results_list) { + val eventsAdapter = EventListAdapter(this, listItems, true, this, search_results_list, true) { if (it is ListEvent) { Intent(applicationContext, EventActivity::class.java).apply { putExtra(EVENT_ID, it.id) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetListConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetListConfigureActivity.kt index 29f2c8f50..72cc256e1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetListConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetListConfigureActivity.kt @@ -46,7 +46,7 @@ class WidgetListConfigureActivity : SimpleActivity() { finish() } - EventListAdapter(this, getListItems(), false, null, config_events_list) {}.apply { + EventListAdapter(this, getListItems(), false, null, config_events_list, true) {}.apply { updateTextColor(mTextColor) config_events_list.adapter = this } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt index 188e15212..9f05f928e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt @@ -28,7 +28,7 @@ import kotlinx.android.synthetic.main.event_list_section.view.* import java.util.* class EventListAdapter(activity: SimpleActivity, var listItems: ArrayList, val allowLongClick: Boolean, val listener: RefreshRecyclerViewListener?, - recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) { + recyclerView: MyRecyclerView, val tryDimPastEvents: Boolean, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) { private val topDivider = resources.getDrawable(R.drawable.divider_width) private val allDayString = resources.getString(R.string.all_day) @@ -176,7 +176,7 @@ class EventListAdapter(activity: SimpleActivity, var listItems: ArrayList() var listener: NavigationListener? = null @@ -45,6 +48,14 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { mPackageName = activity!!.packageName mHolder = view.month_day_calendar_holder mDayCode = arguments!!.getString(DAY_CODE)!! + + val shownMonthDateTime = Formatter.getDateTimeFromCode(mDayCode) + val todayCode = Formatter.getTodayCode() + val todayDateTime = Formatter.getDateTimeFromCode(todayCode) + if (todayDateTime.year == shownMonthDateTime.year && todayDateTime.monthOfYear == shownMonthDateTime.monthOfYear) { + mCurrentDayCode = todayCode + } + mConfig = context!!.config storeStateVariables() setupButtons() @@ -93,22 +104,32 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { activity?.runOnUiThread { mHolder.month_day_view_wrapper.updateDays(days, false) { - + mCurrentDayCode = it.code + updateVisibleEvents() } } val startDateTime = Formatter.getLocalDateTimeFromCode(mDayCode).minusWeeks(1) val endDateTime = startDateTime.plusWeeks(6) context.eventsHelper.getEvents(startDateTime.seconds(), endDateTime.seconds()) { events -> - val listItems = context.getEventListItems(events, false) - activity?.runOnUiThread { - EventListAdapter(activity as SimpleActivity, listItems, true, null, month_day_events_list) { - if (it is ListEvent) { - context.editEvent(it) - } - }.apply { - month_day_events_list.adapter = this + mListEvents = events + updateVisibleEvents() + } + } + + private fun updateVisibleEvents() { + val filtered = mListEvents.filter { + Formatter.getDayCodeFromTS(it.startTS) == mCurrentDayCode + } + + val listItems = context!!.getEventListItems(filtered, false) + activity?.runOnUiThread { + EventListAdapter(activity as SimpleActivity, listItems, true, null, month_day_events_list, false) { + if (it is ListEvent) { + activity?.editEvent(it) } + }.apply { + month_day_events_list.adapter = this } } } From 88a4ccfec5ad10ed1f76bd1703d5cb93d6d5585b Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Feb 2021 20:43:01 +0100 Subject: [PATCH 06/52] always show the proper events at the list of month/day view --- .../pro/fragments/MonthDayFragment.kt | 38 ++++++++++++------- .../main/res/layout/fragment_month_day.xml | 31 +++++++++++---- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt index 0d7567008..6e7571700 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt @@ -30,7 +30,7 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { private var mSundayFirst = false private var mShowWeekNumbers = false private var mDayCode = "" - private var mCurrentDayCode = "" + private var mSelectedDayCode = "" private var mPackageName = "" private var mLastHash = 0L private var mCalendar: MonthlyCalendarImpl? = null @@ -52,8 +52,10 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { val shownMonthDateTime = Formatter.getDateTimeFromCode(mDayCode) val todayCode = Formatter.getTodayCode() val todayDateTime = Formatter.getDateTimeFromCode(todayCode) - if (todayDateTime.year == shownMonthDateTime.year && todayDateTime.monthOfYear == shownMonthDateTime.monthOfYear) { - mCurrentDayCode = todayCode + mSelectedDayCode = if (todayDateTime.year == shownMonthDateTime.year && todayDateTime.monthOfYear == shownMonthDateTime.monthOfYear) { + todayCode + } else { + mDayCode } mConfig = context!!.config @@ -104,7 +106,7 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { activity?.runOnUiThread { mHolder.month_day_view_wrapper.updateDays(days, false) { - mCurrentDayCode = it.code + mSelectedDayCode = it.code updateVisibleEvents() } } @@ -113,23 +115,33 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { val endDateTime = startDateTime.plusWeeks(6) context.eventsHelper.getEvents(startDateTime.seconds(), endDateTime.seconds()) { events -> mListEvents = events - updateVisibleEvents() + activity?.runOnUiThread { + updateVisibleEvents() + } } } private fun updateVisibleEvents() { - val filtered = mListEvents.filter { - Formatter.getDayCodeFromTS(it.startTS) == mCurrentDayCode + if (activity == null) { + return } - val listItems = context!!.getEventListItems(filtered, false) + val filtered = mListEvents.filter { + Formatter.getDayCodeFromTS(it.startTS) == mSelectedDayCode + } + + val listItems = activity!!.getEventListItems(filtered, false) + month_day_selected_day_label.text = Formatter.getDateFromCode(activity!!, mSelectedDayCode, false) + activity?.runOnUiThread { - EventListAdapter(activity as SimpleActivity, listItems, true, null, month_day_events_list, false) { - if (it is ListEvent) { - activity?.editEvent(it) + if (activity != null) { + EventListAdapter(activity as SimpleActivity, listItems, true, null, month_day_events_list, false) { + if (it is ListEvent) { + activity?.editEvent(it) + } + }.apply { + month_day_events_list.adapter = this } - }.apply { - month_day_events_list.adapter = this } } } diff --git a/app/src/main/res/layout/fragment_month_day.xml b/app/src/main/res/layout/fragment_month_day.xml index 8c1e8b451..79631e804 100644 --- a/app/src/main/res/layout/fragment_month_day.xml +++ b/app/src/main/res/layout/fragment_month_day.xml @@ -1,6 +1,7 @@ - + app:layout_constraintTop_toBottomOf="@+id/month_day_view_divider"> + + + + + From b91cdf41163afe3fd46b7074e034855f1d96db2a Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Feb 2021 21:15:05 +0100 Subject: [PATCH 07/52] fetch the proper daycod for creating new events at month/day view --- .../calendar/pro/adapters/MyMonthDayPagerAdapter.kt | 2 ++ .../calendar/pro/fragments/MonthDayFragment.kt | 2 ++ .../calendar/pro/fragments/MonthDayFragmentsHolder.kt | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/MyMonthDayPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/MyMonthDayPagerAdapter.kt index 42cfd738e..99f332d2e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/MyMonthDayPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/MyMonthDayPagerAdapter.kt @@ -36,4 +36,6 @@ class MyMonthDayPagerAdapter(fm: FragmentManager, private val mCodes: List Date: Mon, 22 Feb 2021 21:37:41 +0100 Subject: [PATCH 08/52] show whole months events by default at month/day view --- .../pro/fragments/MonthDayFragment.kt | 27 ++++++++++++++++--- .../main/res/layout/fragment_month_day.xml | 6 ++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt index 6b5777bd3..39d4ddd26 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt @@ -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 { - Formatter.getDayCodeFromTS(it.startTS) == mSelectedDayCode + 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 + } } diff --git a/app/src/main/res/layout/fragment_month_day.xml b/app/src/main/res/layout/fragment_month_day.xml index 79631e804..3d48a9d06 100644 --- a/app/src/main/res/layout/fragment_month_day.xml +++ b/app/src/main/res/layout/fragment_month_day.xml @@ -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" /> Date: Mon, 22 Feb 2021 21:43:02 +0100 Subject: [PATCH 09/52] show the current months events by default, not just todays --- .../calendar/pro/fragments/MonthDayFragment.kt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt index 39d4ddd26..b6ce26411 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt @@ -51,14 +51,7 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { mDayCode = arguments!!.getString(DAY_CODE)!! val shownMonthDateTime = Formatter.getDateTimeFromCode(mDayCode) - val todayCode = Formatter.getTodayCode() - val todayDateTime = Formatter.getDateTimeFromCode(todayCode) - mSelectedDayCode = if (todayDateTime.year == shownMonthDateTime.year && todayDateTime.monthOfYear == shownMonthDateTime.monthOfYear) { - todayCode - } else { - mHolder.month_day_selected_day_label.text = getMonthLabel(shownMonthDateTime) - "" - } + mHolder.month_day_selected_day_label.text = getMonthLabel(shownMonthDateTime) mConfig = context!!.config storeStateVariables() From 5a015b21002d8fbb12204346feacf3b2d6ce27f0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Feb 2021 23:04:27 +0100 Subject: [PATCH 10/52] mark the currently selected day with a circle stroke --- .../calendar/pro/helpers/Constants.kt | 2 ++ .../calendar/pro/views/MonthView.kt | 33 +++++++++++++------ .../calendar/pro/views/MonthViewWrapper.kt | 16 +++++---- app/src/main/res/values/dimens.xml | 1 + 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index baba181e3..0e3898f2c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -3,6 +3,8 @@ package com.simplemobiletools.calendar.pro.helpers const val LOW_ALPHA = .3f const val MEDIUM_ALPHA = .6f const val STORED_LOCALLY_ONLY = 0 +const val ROW_COUNT = 6 +const val COLUMN_COUNT = 7 const val DAY_CODE = "day_code" const val YEAR_LABEL = "year" diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt index 0d6b229d5..91d2a0424 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.calendar.pro.views import android.content.Context import android.graphics.Canvas import android.graphics.Paint +import android.graphics.Point import android.graphics.RectF import android.text.TextPaint import android.text.TextUtils @@ -12,10 +13,7 @@ import android.view.View import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.extensions.seconds -import com.simplemobiletools.calendar.pro.helpers.Formatter -import com.simplemobiletools.calendar.pro.helpers.LOW_ALPHA -import com.simplemobiletools.calendar.pro.helpers.MEDIUM_ALPHA -import com.simplemobiletools.calendar.pro.helpers.isWeekend +import com.simplemobiletools.calendar.pro.helpers.* import com.simplemobiletools.calendar.pro.models.DayMonthly import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.calendar.pro.models.MonthViewEvent @@ -29,11 +27,11 @@ import org.joda.time.Days // used in the Monthly view fragment, 1 view per screen class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(context, attrs, defStyle) { private val BG_CORNER_RADIUS = 8f - private val ROW_COUNT = 6 private var textPaint: Paint private var eventTitlePaint: TextPaint private var gridPaint: Paint + private var circleStrokePaint: Paint private var config = context.config private var dayWidth = 0f private var dayHeight = 0f @@ -56,6 +54,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con private var dayLetters = ArrayList() private var days = ArrayList() private var dayVerticalOffsets = SparseIntArray() + private var selectedDayCoords = Point(-1, -1) constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0) @@ -81,6 +80,12 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con color = textColor.adjustAlpha(LOW_ALPHA) } + circleStrokePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { + style = Paint.Style.STROKE + strokeWidth = resources.getDimension(R.dimen.circle_stroke_width) + color = primaryColor + } + val smallerTextSize = resources.getDimensionPixelSize(R.dimen.smaller_text_size) eventTitleHeight = smallerTextSize eventTitlePaint = TextPaint(Paint.ANTI_ALIAS_FLAG).apply { @@ -142,7 +147,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con var curId = 0 for (y in 0 until ROW_COUNT) { - for (x in 0..6) { + for (x in 0 until COLUMN_COUNT) { val day = days.getOrNull(curId) if (day != null) { dayVerticalOffsets.put(day.indexOnMonthView, dayVerticalOffsets[day.indexOnMonthView] + weekDaysLetterHeight) @@ -150,7 +155,10 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con val xPos = x * dayWidth + horizontalOffset val yPos = y * dayHeight + verticalOffset val xPosCenter = xPos + dayWidth / 2 - if (day.isToday && !isPrintVersion) { + + if (selectedDayCoords.x != -1 && x == selectedDayCoords.x && y == selectedDayCoords.y) { + canvas.drawCircle(xPosCenter, yPos + textPaint.textSize * 0.7f, textPaint.textSize * 0.8f, circleStrokePaint) + } else if (day.isToday && !isPrintVersion) { canvas.drawCircle(xPosCenter, yPos + textPaint.textSize * 0.7f, textPaint.textSize * 0.75f, getCirclePaint(day)) } @@ -170,7 +178,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con private fun drawGrid(canvas: Canvas) { // vertical lines - for (i in 0..6) { + for (i in 0 until COLUMN_COUNT) { var lineX = i * dayWidth if (showWeekNumbers) { lineX += horizontalOffset @@ -180,13 +188,13 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con // horizontal lines canvas.drawLine(0f, 0f, canvas.width.toFloat(), 0f, gridPaint) - for (i in 0..5) { + for (i in 0 until ROW_COUNT) { canvas.drawLine(0f, i * dayHeight + weekDaysLetterHeight, canvas.width.toFloat(), i * dayHeight + weekDaysLetterHeight, gridPaint) } } private fun addWeekDayLetters(canvas: Canvas) { - for (i in 0..6) { + for (i in 0 until COLUMN_COUNT) { val xPos = horizontalOffset + (i + 1) * dayWidth - dayWidth / 2 var weekDayLetterPaint = textPaint if (i == currDayOfWeek && !isPrintVersion) { @@ -373,4 +381,9 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con invalidate() initWeekDayLetters() } + + fun updateCurrentlySelectedDay(x: Int, y: Int) { + selectedDayCoords = Point(x, y) + invalidate() + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt index 44578970d..7089ddb0f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt @@ -6,6 +6,8 @@ import android.view.LayoutInflater import android.widget.FrameLayout import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.extensions.config +import com.simplemobiletools.calendar.pro.helpers.COLUMN_COUNT +import com.simplemobiletools.calendar.pro.helpers.ROW_COUNT import com.simplemobiletools.calendar.pro.models.DayMonthly import com.simplemobiletools.commons.extensions.onGlobalLayout import kotlinx.android.synthetic.main.month_view.view.* @@ -74,20 +76,21 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F monthView = inflater.inflate(R.layout.month_view, this).month_view wereViewsAdded = true var curId = 0 - for (y in 0..5) { - for (x in 0..6) { + for (y in 0 until ROW_COUNT) { + for (x in 0 until COLUMN_COUNT) { val day = days.getOrNull(curId) if (day != null) { - val xPos = x * dayWidth + horizontalOffset - val yPos = y * dayHeight + weekDaysLetterHeight - addViewBackground(xPos, yPos, day) + addViewBackground(x, y, day) } curId++ } } } - private fun addViewBackground(xPos: Float, yPos: Float, day: DayMonthly) { + private fun addViewBackground(viewX: Int, viewY: Int, day: DayMonthly) { + val xPos = viewX * dayWidth + horizontalOffset + val yPos = viewY * dayHeight + weekDaysLetterHeight + inflater.inflate(R.layout.month_view_background, this, false).apply { if (isMonthDayView) { background = null @@ -99,6 +102,7 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F y = yPos setOnClickListener { dayClickCallback?.invoke(day) + monthView.updateCurrentlySelectedDay(viewX, viewY) } addView(this) } diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 221830c09..a8d9190b4 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -3,6 +3,7 @@ 10dp 3dp 6dp + 2dp 40dp From 0b8ab41368d7ef06bd5e9649e060663b1b8fcf20 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Feb 2021 23:12:17 +0100 Subject: [PATCH 11/52] show a date picker at clicking the top label --- .../calendar/pro/fragments/MonthDayFragment.kt | 8 +++++++- app/src/main/res/layout/fragment_month_day.xml | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt index b6ce26411..9ced088f8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt @@ -9,6 +9,7 @@ import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintLayout import androidx.fragment.app.Fragment import com.simplemobiletools.calendar.pro.R +import com.simplemobiletools.calendar.pro.activities.MainActivity import com.simplemobiletools.calendar.pro.activities.SimpleActivity import com.simplemobiletools.calendar.pro.adapters.EventListAdapter import com.simplemobiletools.calendar.pro.extensions.* @@ -51,7 +52,12 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { mDayCode = arguments!!.getString(DAY_CODE)!! val shownMonthDateTime = Formatter.getDateTimeFromCode(mDayCode) - mHolder.month_day_selected_day_label.text = getMonthLabel(shownMonthDateTime) + mHolder.month_day_selected_day_label.apply { + text = getMonthLabel(shownMonthDateTime) + setOnClickListener { + (activity as MainActivity).showGoToDateDialog() + } + } mConfig = context!!.config storeStateVariables() diff --git a/app/src/main/res/layout/fragment_month_day.xml b/app/src/main/res/layout/fragment_month_day.xml index 3d48a9d06..0866b5cdc 100644 --- a/app/src/main/res/layout/fragment_month_day.xml +++ b/app/src/main/res/layout/fragment_month_day.xml @@ -37,7 +37,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" - android:paddingTop="@dimen/normal_margin" + android:background="?attr/selectableItemBackground" + android:padding="@dimen/normal_margin" android:textSize="@dimen/actionbar_text_size" tools:text="8/5/2021" /> From a6ccc02de9ce81e44a6219a4943008e9ed2a3302 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Feb 2021 23:16:52 +0100 Subject: [PATCH 12/52] show a placeholder if no events are found --- .../calendar/pro/fragments/MonthDayFragment.kt | 2 ++ app/src/main/res/layout/fragment_month_day.xml | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt index 9ced088f8..63099cc27 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt @@ -23,6 +23,7 @@ import com.simplemobiletools.calendar.pro.interfaces.NavigationListener import com.simplemobiletools.calendar.pro.models.DayMonthly import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.calendar.pro.models.ListEvent +import com.simplemobiletools.commons.extensions.beVisibleIf import kotlinx.android.synthetic.main.fragment_month_day.* import kotlinx.android.synthetic.main.fragment_month_day.view.* import org.joda.time.DateTime @@ -144,6 +145,7 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { activity?.runOnUiThread { if (activity != null) { + mHolder.month_day_no_events_placeholder.beVisibleIf(listItems.isEmpty()) EventListAdapter(activity as SimpleActivity, listItems, true, null, month_day_events_list, false) { if (it is ListEvent) { activity?.editEvent(it) diff --git a/app/src/main/res/layout/fragment_month_day.xml b/app/src/main/res/layout/fragment_month_day.xml index 0866b5cdc..43144360a 100644 --- a/app/src/main/res/layout/fragment_month_day.xml +++ b/app/src/main/res/layout/fragment_month_day.xml @@ -42,6 +42,21 @@ android:textSize="@dimen/actionbar_text_size" tools:text="8/5/2021" /> + + Date: Mon, 22 Feb 2021 23:25:20 +0100 Subject: [PATCH 13/52] handle updating text colors at the monthly/daily view --- .../calendar/pro/fragments/MonthDayFragment.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt index 63099cc27..3eac369df 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt @@ -29,7 +29,6 @@ import kotlinx.android.synthetic.main.fragment_month_day.view.* import org.joda.time.DateTime class MonthDayFragment : Fragment(), MonthlyCalendar { - private var mTextColor = 0 private var mSundayFirst = false private var mShowWeekNumbers = false private var mDayCode = "" @@ -158,7 +157,11 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { } private fun setupButtons() { - mTextColor = mConfig.textColor + val textColor = mConfig.textColor + mHolder.apply { + month_day_selected_day_label.setTextColor(textColor) + month_day_no_events_placeholder.setTextColor(textColor) + } } fun printCurrentView() {} From 47f601bd216292220c8d3883e4f2098464460650 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Feb 2021 23:25:31 +0100 Subject: [PATCH 14/52] do not circle selected days at the old monthly view --- .../simplemobiletools/calendar/pro/views/MonthViewWrapper.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt index 7089ddb0f..3712013d2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthViewWrapper.kt @@ -102,7 +102,10 @@ class MonthViewWrapper(context: Context, attrs: AttributeSet, defStyle: Int) : F y = yPos setOnClickListener { dayClickCallback?.invoke(day) - monthView.updateCurrentlySelectedDay(viewX, viewY) + + if (isMonthDayView) { + monthView.updateCurrentlySelectedDay(viewX, viewY) + } } addView(this) } From f53aaa857e543a2e0af538de912c60f2fbf6670b Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Feb 2021 23:35:39 +0100 Subject: [PATCH 15/52] refresh the daily events list if something gets deleted --- .../pro/fragments/MonthDayFragment.kt | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt index 3eac369df..edb199540 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt @@ -24,11 +24,12 @@ import com.simplemobiletools.calendar.pro.models.DayMonthly import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.calendar.pro.models.ListEvent import com.simplemobiletools.commons.extensions.beVisibleIf +import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import kotlinx.android.synthetic.main.fragment_month_day.* import kotlinx.android.synthetic.main.fragment_month_day.view.* import org.joda.time.DateTime -class MonthDayFragment : Fragment(), MonthlyCalendar { +class MonthDayFragment : Fragment(), MonthlyCalendar, RefreshRecyclerViewListener { private var mSundayFirst = false private var mShowWeekNumbers = false private var mDayCode = "" @@ -112,14 +113,7 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { } } - val startDateTime = Formatter.getLocalDateTimeFromCode(mDayCode).minusWeeks(1) - val endDateTime = startDateTime.plusWeeks(6) - context.eventsHelper.getEvents(startDateTime.seconds(), endDateTime.seconds()) { events -> - mListEvents = events - activity?.runOnUiThread { - updateVisibleEvents() - } - } + refreshItems() } private fun updateVisibleEvents() { @@ -145,12 +139,18 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { activity?.runOnUiThread { if (activity != null) { mHolder.month_day_no_events_placeholder.beVisibleIf(listItems.isEmpty()) - EventListAdapter(activity as SimpleActivity, listItems, true, null, month_day_events_list, false) { - if (it is ListEvent) { - activity?.editEvent(it) + + val currAdapter = mHolder.month_day_events_list.adapter + if (currAdapter == null) { + EventListAdapter(activity as SimpleActivity, listItems, true, this, month_day_events_list, false) { + if (it is ListEvent) { + activity?.editEvent(it) + } + }.apply { + month_day_events_list.adapter = this } - }.apply { - month_day_events_list.adapter = this + } else { + (currAdapter as EventListAdapter).updateListItems(listItems) } } } @@ -176,4 +176,15 @@ class MonthDayFragment : Fragment(), MonthlyCalendar { } return month } + + override fun refreshItems() { + val startDateTime = Formatter.getLocalDateTimeFromCode(mDayCode).minusWeeks(1) + val endDateTime = startDateTime.plusWeeks(6) + activity?.eventsHelper?.getEvents(startDateTime.seconds(), endDateTime.seconds()) { events -> + mListEvents = events + activity?.runOnUiThread { + updateVisibleEvents() + } + } + } } From 92b8a521d201e6bcb1051b9a8653278d066b82d0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 22 Feb 2021 23:55:24 +0100 Subject: [PATCH 16/52] mark days with events with a dot at the monthly/daily view --- .../calendar/pro/views/MonthView.kt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt index 91d2a0424..1ea82d20b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt @@ -1,10 +1,7 @@ package com.simplemobiletools.calendar.pro.views import android.content.Context -import android.graphics.Canvas -import android.graphics.Paint -import android.graphics.Point -import android.graphics.RectF +import android.graphics.* import android.text.TextPaint import android.text.TextUtils import android.util.AttributeSet @@ -51,6 +48,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con private var isMonthDayView = false private var allEvents = ArrayList() private var bgRectF = RectF() + private var dayTextRect = Rect() private var dayLetters = ArrayList() private var days = ArrayList() private var dayVerticalOffsets = SparseIntArray() @@ -155,14 +153,22 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con val xPos = x * dayWidth + horizontalOffset val yPos = y * dayHeight + verticalOffset val xPosCenter = xPos + dayWidth / 2 + val dayNumber = day.value.toString() if (selectedDayCoords.x != -1 && x == selectedDayCoords.x && y == selectedDayCoords.y) { canvas.drawCircle(xPosCenter, yPos + textPaint.textSize * 0.7f, textPaint.textSize * 0.8f, circleStrokePaint) } else if (day.isToday && !isPrintVersion) { - canvas.drawCircle(xPosCenter, yPos + textPaint.textSize * 0.7f, textPaint.textSize * 0.75f, getCirclePaint(day)) + canvas.drawCircle(xPosCenter, yPos + textPaint.textSize * 0.7f, textPaint.textSize * 0.8f, getCirclePaint(day)) } - canvas.drawText(day.value.toString(), xPosCenter, yPos + textPaint.textSize, getTextPaint(day)) + // mark days with events with a dot + if (isMonthDayView && day.dayEvents.isNotEmpty()) { + getCirclePaint(day).getTextBounds(dayNumber, 0, dayNumber.length, dayTextRect) + val height = dayTextRect.height() * 1.15f + canvas.drawCircle(xPosCenter, yPos + height + textPaint.textSize / 2, textPaint.textSize * 0.15f, getCirclePaint(day)) + } + + canvas.drawText(dayNumber, xPosCenter, yPos + textPaint.textSize, getTextPaint(day)) dayVerticalOffsets.put(day.indexOnMonthView, (verticalOffset + textPaint.textSize * 2).toInt()) } curId++ From 77e4fcde1eb9b1f288b9c6cc1c477d2131d1ea6b Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 23 Feb 2021 09:56:44 +0100 Subject: [PATCH 17/52] use the first events color at the monthly daily views dot --- .../calendar/pro/fragments/EventListFragment.kt | 4 ---- .../com/simplemobiletools/calendar/pro/views/MonthView.kt | 8 +++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/EventListFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/EventListFragment.kt index 6699ae264..bca17c990 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/EventListFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/EventListFragment.kt @@ -1,6 +1,5 @@ package com.simplemobiletools.calendar.pro.fragments -import android.content.Intent import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.os.Handler @@ -10,13 +9,10 @@ import android.view.ViewGroup import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.simplemobiletools.calendar.pro.R -import com.simplemobiletools.calendar.pro.activities.EventActivity import com.simplemobiletools.calendar.pro.activities.MainActivity import com.simplemobiletools.calendar.pro.activities.SimpleActivity import com.simplemobiletools.calendar.pro.adapters.EventListAdapter import com.simplemobiletools.calendar.pro.extensions.* -import com.simplemobiletools.calendar.pro.helpers.EVENT_ID -import com.simplemobiletools.calendar.pro.helpers.EVENT_OCCURRENCE_TS import com.simplemobiletools.calendar.pro.helpers.Formatter import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.calendar.pro.models.ListEvent diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt index 1ea82d20b..c9a34de3d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt @@ -165,7 +165,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con if (isMonthDayView && day.dayEvents.isNotEmpty()) { getCirclePaint(day).getTextBounds(dayNumber, 0, dayNumber.length, dayTextRect) val height = dayTextRect.height() * 1.15f - canvas.drawCircle(xPosCenter, yPos + height + textPaint.textSize / 2, textPaint.textSize * 0.15f, getCirclePaint(day)) + canvas.drawCircle(xPosCenter, yPos + height + textPaint.textSize / 2, textPaint.textSize * 0.15f, getDayEventColor(day.dayEvents.first())) } canvas.drawText(dayNumber, xPosCenter, yPos + textPaint.textSize, getTextPaint(day)) @@ -329,6 +329,12 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con return curPaint } + private fun getDayEventColor(event: Event): Paint { + val curPaint = Paint(Paint.ANTI_ALIAS_FLAG) + curPaint.color = event.color + return curPaint + } + private fun initWeekDayLetters() { dayLetters = context.resources.getStringArray(R.array.week_day_letters).toMutableList() as ArrayList if (config.isSundayFirst) { From 7a335e5e1e1d73592cdd382cc92fa9f00d72bb9c Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 23 Feb 2021 09:59:41 +0100 Subject: [PATCH 18/52] show overscroll mode at the monthly daily views list --- .../simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt | 1 + app/src/main/res/layout/fragment_month_day.xml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt index edb199540..6e312e36c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthDayFragment.kt @@ -138,6 +138,7 @@ class MonthDayFragment : Fragment(), MonthlyCalendar, RefreshRecyclerViewListene activity?.runOnUiThread { if (activity != null) { + mHolder.month_day_events_list.beVisibleIf(listItems.isNotEmpty()) mHolder.month_day_no_events_placeholder.beVisibleIf(listItems.isEmpty()) val currAdapter = mHolder.month_day_events_list.adapter diff --git a/app/src/main/res/layout/fragment_month_day.xml b/app/src/main/res/layout/fragment_month_day.xml index 43144360a..0b77d674b 100644 --- a/app/src/main/res/layout/fragment_month_day.xml +++ b/app/src/main/res/layout/fragment_month_day.xml @@ -63,7 +63,6 @@ android:layout_height="match_parent" android:layout_below="@+id/month_day_selected_day_label" android:clipToPadding="false" - android:overScrollMode="never" android:scrollbars="vertical" app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" /> From ac8fc24906ec48b1384154c1ba500c5330ed89e6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 23 Feb 2021 14:23:40 +0100 Subject: [PATCH 19/52] avoid updating the CalDAV calendar too frequently --- .../calendar/pro/helpers/CalDAVHelper.kt | 121 +++++++++--------- .../calendar/pro/jobs/CalDAVUpdateListener.kt | 6 +- 2 files changed, 62 insertions(+), 65 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt index 55a561460..335b36188 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt @@ -13,8 +13,7 @@ import com.simplemobiletools.calendar.pro.extensions.* import com.simplemobiletools.calendar.pro.models.* import com.simplemobiletools.calendar.pro.objects.States.isUpdatingCalDAV import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.commons.helpers.PERMISSION_READ_CALENDAR -import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CALENDAR +import com.simplemobiletools.commons.helpers.* import org.joda.time.DateTimeZone import org.joda.time.format.DateTimeFormat import java.util.* @@ -43,6 +42,7 @@ class CalDAVHelper(val context: Context) { fetchCalDAVCalendarEvents(calendar.id, localEventType.id!!, showToasts) } + context.scheduleCalDAVSync(true) callback() } finally { @@ -59,13 +59,13 @@ class CalDAVHelper(val context: Context) { val uri = Calendars.CONTENT_URI val projection = arrayOf( - Calendars._ID, - Calendars.CALENDAR_DISPLAY_NAME, - Calendars.ACCOUNT_NAME, - Calendars.ACCOUNT_TYPE, - Calendars.OWNER_ACCOUNT, - Calendars.CALENDAR_COLOR, - Calendars.CALENDAR_ACCESS_LEVEL) + Calendars._ID, + Calendars.CALENDAR_DISPLAY_NAME, + Calendars.ACCOUNT_NAME, + Calendars.ACCOUNT_TYPE, + Calendars.OWNER_ACCOUNT, + Calendars.CALENDAR_COLOR, + Calendars.CALENDAR_ACCESS_LEVEL) val selection = if (ids.trim().isNotEmpty()) "${Calendars._ID} IN ($ids)" else null context.queryCursor(uri, projection, selection, showErrors = showToasts) { cursor -> @@ -83,39 +83,38 @@ class CalDAVHelper(val context: Context) { return calendars } + // check if the calendars color or title has changed fun updateCalDAVCalendar(eventType: EventType) { val uri = Calendars.CONTENT_URI - val values = fillCalendarContentValues(eventType) val newUri = ContentUris.withAppendedId(uri, eventType.caldavCalendarId.toLong()) - try { - context.contentResolver.update(newUri, values, null, null) - } catch (e: IllegalArgumentException) { - } - } + val projection = arrayOf( + Calendars.CALENDAR_COLOR_KEY, + Calendars.CALENDAR_COLOR, + Calendars.CALENDAR_DISPLAY_NAME + ) - private fun fillCalendarContentValues(eventType: EventType): ContentValues { - val colorKey = getEventTypeColorKey(eventType) - return ContentValues().apply { - put(Calendars.CALENDAR_COLOR_KEY, colorKey) - put(Calendars.CALENDAR_DISPLAY_NAME, eventType.title) - } - } - - @SuppressLint("MissingPermission") - private fun getEventTypeColorKey(eventType: EventType): Int { - val uri = Colors.CONTENT_URI - val projection = arrayOf(Colors.COLOR_KEY) - val selection = "${Colors.COLOR_TYPE} = ? AND ${Colors.COLOR} = ? AND ${Colors.ACCOUNT_NAME} = ?" - val selectionArgs = arrayOf(Colors.TYPE_CALENDAR.toString(), eventType.color.toString(), eventType.caldavEmail) - - val cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null) - cursor?.use { - if (cursor.moveToFirst()) { - return cursor.getStringValue(Colors.COLOR_KEY).toInt() + context.queryCursor(newUri, projection) { cursor -> + val properColorKey = cursor.getIntValue(Calendars.CALENDAR_COLOR_KEY) + val properColor = cursor.getIntValue(Calendars.CALENDAR_COLOR) + val displayName = cursor.getStringValue(Calendars.CALENDAR_DISPLAY_NAME) + if (eventType.color != properColor || displayName != eventType.title) { + val values = fillCalendarContentValues(properColorKey, displayName) + try { + context.contentResolver.update(newUri, values, null, null) + eventType.color = properColor + eventType.title = displayName + context.eventTypesDB.insertOrUpdate(eventType) + } catch (e: IllegalArgumentException) { + } } } + } - return -1 + private fun fillCalendarContentValues(colorKey: Int, title: String): ContentValues { + return ContentValues().apply { + put(Calendars.CALENDAR_COLOR_KEY, colorKey) + put(Calendars.CALENDAR_DISPLAY_NAME, title) + } } @SuppressLint("MissingPermission") @@ -157,21 +156,21 @@ class CalDAVHelper(val context: Context) { val uri = Events.CONTENT_URI val projection = arrayOf( - Events._ID, - Events.TITLE, - Events.DESCRIPTION, - Events.DTSTART, - Events.DTEND, - Events.DURATION, - Events.EXDATE, - Events.ALL_DAY, - Events.RRULE, - Events.ORIGINAL_ID, - Events.ORIGINAL_INSTANCE_TIME, - Events.EVENT_LOCATION, - Events.EVENT_TIMEZONE, - Events.CALENDAR_TIME_ZONE, - Events.DELETED) + Events._ID, + Events.TITLE, + Events.DESCRIPTION, + Events.DTSTART, + Events.DTEND, + Events.DURATION, + Events.EXDATE, + Events.ALL_DAY, + Events.RRULE, + Events.ORIGINAL_ID, + Events.ORIGINAL_INSTANCE_TIME, + Events.EVENT_LOCATION, + Events.EVENT_TIMEZONE, + Events.CALENDAR_TIME_ZONE, + Events.DELETED) val selection = "${Events.CALENDAR_ID} = $calendarId" context.queryCursor(uri, projection, selection, showErrors = showToasts) { cursor -> @@ -203,15 +202,15 @@ class CalDAVHelper(val context: Context) { val reminder3 = reminders.getOrNull(2) val importId = getCalDAVEventImportId(calendarId, id) val eventTimeZone = cursor.getStringValue(Events.EVENT_TIMEZONE) - ?: cursor.getStringValue(Events.CALENDAR_TIME_ZONE) ?: DateTimeZone.getDefault().id + ?: cursor.getStringValue(Events.CALENDAR_TIME_ZONE) ?: DateTimeZone.getDefault().id val source = "$CALDAV-$calendarId" val repeatRule = Parser().parseRepeatInterval(rrule, startTS) val event = Event(null, startTS, endTS, title, location, description, reminder1?.minutes ?: REMINDER_OFF, - reminder2?.minutes ?: REMINDER_OFF, reminder3?.minutes ?: REMINDER_OFF, reminder1?.type - ?: REMINDER_NOTIFICATION, reminder2?.type ?: REMINDER_NOTIFICATION, reminder3?.type - ?: REMINDER_NOTIFICATION, repeatRule.repeatInterval, repeatRule.repeatRule, - repeatRule.repeatLimit, ArrayList(), attendees, importId, eventTimeZone, allDay, eventTypeId, source = source) + reminder2?.minutes ?: REMINDER_OFF, reminder3?.minutes ?: REMINDER_OFF, reminder1?.type + ?: REMINDER_NOTIFICATION, reminder2?.type ?: REMINDER_NOTIFICATION, reminder3?.type + ?: REMINDER_NOTIFICATION, repeatRule.repeatInterval, repeatRule.repeatRule, + repeatRule.repeatLimit, ArrayList(), attendees, importId, eventTimeZone, allDay, eventTypeId, source = source) if (event.getIsAllDay()) { event.startTS = Formatter.getShiftedImportTimestamp(event.startTS) @@ -469,8 +468,8 @@ class CalDAVHelper(val context: Context) { val reminders = ArrayList() val uri = Reminders.CONTENT_URI val projection = arrayOf( - Reminders.MINUTES, - Reminders.METHOD) + Reminders.MINUTES, + Reminders.METHOD) val selection = "${Reminders.EVENT_ID} = $eventId" context.queryCursor(uri, projection, selection) { cursor -> @@ -490,10 +489,10 @@ class CalDAVHelper(val context: Context) { val attendees = ArrayList() val uri = Attendees.CONTENT_URI val projection = arrayOf( - Attendees.ATTENDEE_NAME, - Attendees.ATTENDEE_EMAIL, - Attendees.ATTENDEE_STATUS, - Attendees.ATTENDEE_RELATIONSHIP) + Attendees.ATTENDEE_NAME, + Attendees.ATTENDEE_EMAIL, + Attendees.ATTENDEE_STATUS, + Attendees.ATTENDEE_RELATIONSHIP) val selection = "${Attendees.EVENT_ID} = $eventId" context.queryCursor(uri, projection, selection) { cursor -> val name = cursor.getStringValue(Attendees.ATTENDEE_NAME) ?: "" diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/jobs/CalDAVUpdateListener.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/jobs/CalDAVUpdateListener.kt index d6d45abb5..123a197e6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/jobs/CalDAVUpdateListener.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/jobs/CalDAVUpdateListener.kt @@ -10,9 +10,7 @@ import android.content.Context import android.os.Build import android.os.Handler import android.provider.CalendarContract -import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.extensions.recheckCalDAVCalendars -import com.simplemobiletools.calendar.pro.extensions.refreshCalDAVCalendars // based on https://developer.android.com/reference/android/app/job/JobInfo.Builder.html#addTriggerContentUri(android.app.job.JobInfo.TriggerContentUri) @TargetApi(Build.VERSION_CODES.N) @@ -34,13 +32,13 @@ class CalDAVUpdateListener : JobService() { val uri = CalendarContract.Calendars.CONTENT_URI JobInfo.Builder(CALDAV_EVENT_CONTENT_JOB, componentName).apply { addTriggerContentUri(JobInfo.TriggerContentUri(uri, JobInfo.TriggerContentUri.FLAG_NOTIFY_FOR_DESCENDANTS)) - context.getSystemService(JobScheduler::class.java).schedule(build()) + (context.getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler).schedule(build()) } } fun isScheduled(context: Context): Boolean { val jobScheduler = context.getSystemService(JobScheduler::class.java) - val jobs = jobScheduler.allPendingJobs ?: return false + val jobs = jobScheduler.allPendingJobs return jobs.any { it.id == CALDAV_EVENT_CONTENT_JOB } } From 47c4564cf07c79aab12940690f4e730f1f41dc20 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 23 Feb 2021 14:31:04 +0100 Subject: [PATCH 20/52] fix #1272, add a settings button for customizing the notifications --- .../pro/activities/SettingsActivity.kt | 18 +++++++++++----- app/src/main/res/layout/activity_settings.xml | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt index 9e7f352af..13b658c72 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt @@ -43,6 +43,7 @@ class SettingsActivity : SimpleActivity() { private fun setupSettingItems() { setupCustomizeColors() + setupCustomizeNotifications() setupUseEnglish() setupManageEventTypes() setupHourFormat() @@ -139,6 +140,13 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupCustomizeNotifications() { + settings_customize_notifications_holder.beVisibleIf(isOreoPlus()) + settings_customize_notifications_holder.setOnClickListener { + launchCustomizeNotificationsIntent() + } + } + private fun setupUseEnglish() { settings_use_english_holder.beVisibleIf(config.wasUseEnglishToggled || Locale.getDefault().language != "en") settings_use_english.isChecked = config.useEnglish @@ -340,11 +348,11 @@ class SettingsActivity : SimpleActivity() { updateReminderSound(it) } }, onAlarmSoundDeleted = { - if (it.uri == config.reminderSoundUri) { - val defaultAlarm = getDefaultAlarmSound(RingtoneManager.TYPE_NOTIFICATION) - updateReminderSound(defaultAlarm) - } - }) + if (it.uri == config.reminderSoundUri) { + val defaultAlarm = getDefaultAlarmSound(RingtoneManager.TYPE_NOTIFICATION) + updateReminderSound(defaultAlarm) + } + }) } } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index fc2f5110b..f7b2940d8 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -32,6 +32,27 @@ + + + + + + Date: Tue, 23 Feb 2021 14:39:06 +0100 Subject: [PATCH 21/52] fix #1264, properly handle importing from file, if alarm is before event --- .../com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt index a837e72c9..a442ba033 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt @@ -152,6 +152,7 @@ class IcsImporter(val activity: SimpleActivity) { curReminderMinutes.add(curReminderTriggerMinutes) curReminderActions.add(curReminderTriggerAction) } + isNotificationDescription = false } else if (line == END_EVENT) { isParsingEvent = false if (curStart != -1L && curEnd == -1L) { From c2b31a8de4918484c5d722f326fce25e2487cb27 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 23 Feb 2021 15:12:24 +0100 Subject: [PATCH 22/52] fix #1258, properly handle importing events, if exdates are split by line --- .../calendar/pro/helpers/IcsImporter.kt | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt index a442ba033..047be8a6b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt @@ -134,7 +134,13 @@ class IcsImporter(val activity: SimpleActivity) { value = value.substring(0, value.length - 1) } - curRepeatExceptions.add(Formatter.getDayCodeFromTS(getTimestamp(value))) + if (value.contains(",")) { + value.split(",").forEach { exdate -> + curRepeatExceptions.add(Formatter.getDayCodeFromTS(getTimestamp(exdate))) + } + } else { + curRepeatExceptions.add(Formatter.getDayCodeFromTS(getTimestamp(value))) + } } else if (line.startsWith(LOCATION)) { curLocation = getLocation(line.substring(LOCATION.length).replace("\\,", ",")) if (curLocation.trim().isEmpty()) { @@ -247,17 +253,19 @@ class IcsImporter(val activity: SimpleActivity) { private fun getTimestamp(fullString: String): Long { return try { - if (fullString.startsWith(';')) { - val value = fullString.substring(fullString.lastIndexOf(':') + 1).replace(" ", "") - if (value.isEmpty()) { - return 0 - } else if (!value.contains("T")) { - curFlags = curFlags or FLAG_ALL_DAY - } + when { + fullString.startsWith(';') -> { + val value = fullString.substring(fullString.lastIndexOf(':') + 1).replace(" ", "") + if (value.isEmpty()) { + return 0 + } else if (!value.contains("T")) { + curFlags = curFlags or FLAG_ALL_DAY + } - Parser().parseDateTimeValue(value) - } else { - Parser().parseDateTimeValue(fullString.substring(1)) + Parser().parseDateTimeValue(value) + } + fullString.startsWith(":") -> Parser().parseDateTimeValue(fullString.substring(1)) + else -> Parser().parseDateTimeValue(fullString) } } catch (e: Exception) { activity.showErrorToast(e) From 92342d927c69c70e61816d1a98bac3b9de3877de Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 23 Feb 2021 15:56:25 +0100 Subject: [PATCH 23/52] fix #1150, remove the Manual flag at caldav syncing --- .../com/simplemobiletools/calendar/pro/extensions/Context.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt index cf3db368d..d87c1c093 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt @@ -521,7 +521,6 @@ fun Context.refreshCalDAVCalendars(ids: String, showToasts: Boolean) { } Bundle().apply { - putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true) putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true) accounts.forEach { ContentResolver.requestSync(it, uri.authority, this) From e73b7fcb729a27ebf6d158166d27dc3207619427 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 23 Feb 2021 16:40:34 +0100 Subject: [PATCH 24/52] fixing some light theme coloring issues --- .../simplemobiletools/calendar/pro/views/MonthView.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt index c9a34de3d..707615521 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt @@ -155,8 +155,12 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con val xPosCenter = xPos + dayWidth / 2 val dayNumber = day.value.toString() + val textPaint = getTextPaint(day) if (selectedDayCoords.x != -1 && x == selectedDayCoords.x && y == selectedDayCoords.y) { canvas.drawCircle(xPosCenter, yPos + textPaint.textSize * 0.7f, textPaint.textSize * 0.8f, circleStrokePaint) + if (day.isToday) { + textPaint.color = textColor + } } else if (day.isToday && !isPrintVersion) { canvas.drawCircle(xPosCenter, yPos + textPaint.textSize * 0.7f, textPaint.textSize * 0.8f, getCirclePaint(day)) } @@ -168,7 +172,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con canvas.drawCircle(xPosCenter, yPos + height + textPaint.textSize / 2, textPaint.textSize * 0.15f, getDayEventColor(day.dayEvents.first())) } - canvas.drawText(dayNumber, xPosCenter, yPos + textPaint.textSize, getTextPaint(day)) + canvas.drawText(dayNumber, xPosCenter, yPos + textPaint.textSize, textPaint) dayVerticalOffsets.put(day.indexOnMonthView, (verticalOffset + textPaint.textSize * 2).toInt()) } curId++ @@ -245,7 +249,9 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con val xPosCenter = xPos + dayWidth / 2 if (verticalOffset - eventTitleHeight * 2 > dayHeight) { - canvas.drawText("...", xPosCenter, yPos + verticalOffset - eventTitleHeight / 2, getTextPaint(days[event.startDayIndex])) + val paint = getTextPaint(days[event.startDayIndex]) + paint.color = textColor + canvas.drawText("...", xPosCenter, yPos + verticalOffset - eventTitleHeight / 2, paint) return } From 344e0c73d2d7339c6671c70660a9ae683d638040 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 23 Feb 2021 16:43:37 +0100 Subject: [PATCH 25/52] do not allow printing the new view yet, until fully implemented --- .../simplemobiletools/calendar/pro/activities/MainActivity.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt index 96cac93db..dcb642785 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt @@ -172,6 +172,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { shouldGoToTodayBeVisible = currentFragments.last().shouldGoToTodayBeVisible() menu.apply { goToTodayButton = findItem(R.id.go_to_today) + findItem(R.id.print).isVisible = config.storedView != MONTHLY_DAILY_VIEW findItem(R.id.filter).isVisible = mShouldFilterBeVisible findItem(R.id.go_to_today).isVisible = shouldGoToTodayBeVisible && !mIsSearchOpen findItem(R.id.go_to_date).isVisible = config.storedView != EVENTS_LIST_VIEW From a69a96502d23b674744382d28daf514567593167 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 23 Feb 2021 17:04:18 +0100 Subject: [PATCH 26/52] some tweaks to the monthly daily view --- .../com/simplemobiletools/calendar/pro/views/MonthView.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt index 707615521..f1d9d0d55 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt @@ -168,8 +168,8 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con // mark days with events with a dot if (isMonthDayView && day.dayEvents.isNotEmpty()) { getCirclePaint(day).getTextBounds(dayNumber, 0, dayNumber.length, dayTextRect) - val height = dayTextRect.height() * 1.15f - canvas.drawCircle(xPosCenter, yPos + height + textPaint.textSize / 2, textPaint.textSize * 0.15f, getDayEventColor(day.dayEvents.first())) + val height = dayTextRect.height() * 1.25f + canvas.drawCircle(xPosCenter, yPos + height + textPaint.textSize / 2, textPaint.textSize * 0.2f, getDayEventColor(day.dayEvents.first())) } canvas.drawText(dayNumber, xPosCenter, yPos + textPaint.textSize, textPaint) From f1fb463d8a38505a059eb7e16ef8a20dd209eded Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 23 Feb 2021 17:07:14 +0100 Subject: [PATCH 27/52] update version to 6.13.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 861cb94d7..297aac3be 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -18,8 +18,8 @@ android { applicationId "com.simplemobiletools.calendar.pro" minSdkVersion 21 targetSdkVersion 29 - versionCode 191 - versionName "6.12.0" + versionCode 192 + versionName "6.13.0" multiDexEnabled true setProperty("archivesBaseName", "calendar") vectorDrawables.useSupportLibrary = true From 7a6d8f6882c1255f18d1a7619e7d9e06330c9f64 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 23 Feb 2021 17:07:21 +0100 Subject: [PATCH 28/52] updating changelog --- CHANGELOG.md | 10 ++++++++++ fastlane/metadata/android/en-US/changelogs/192.txt | 6 ++++++ 2 files changed, 16 insertions(+) create mode 100644 fastlane/metadata/android/en-US/changelogs/192.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index ad56b7624..6bc9ee53d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ Changelog ========== +Version 6.13.0 *(2021-02-23)* +---------------------------- + + * Added a new combination of monthly + daily view + * Fixed too big background activity with CalDAV sync enabled + * Fixed some glitches at importing .ics files + * Fixed a glitch at new events having wrong date set by default in some cases + * Added a setting item for quick notification customizing on Android 8+ + * Added some translation and stability improvements + Version 6.12.0 *(2021-02-13)* ---------------------------- diff --git a/fastlane/metadata/android/en-US/changelogs/192.txt b/fastlane/metadata/android/en-US/changelogs/192.txt new file mode 100644 index 000000000..18dcc0aeb --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/192.txt @@ -0,0 +1,6 @@ + * Added a new combination of monthly + daily view + * Fixed too big background activity with CalDAV sync enabled + * Fixed some glitches at importing .ics files + * Fixed a glitch at new events having wrong date set by default in some cases + * Added a setting item for quick notification customizing on Android 8+ + * Added some translation and stability improvements From a4abfedf2840c927b909822b667a9dadcad56880 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 25 Feb 2021 21:54:27 +0100 Subject: [PATCH 29/52] trim some lines at importing checks --- .../simplemobiletools/calendar/pro/helpers/IcsImporter.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt index 047be8a6b..765021b96 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt @@ -73,7 +73,7 @@ class IcsImporter(val activity: SimpleActivity) { continue } - if (line == BEGIN_EVENT) { + if (line.trim() == BEGIN_EVENT) { resetValues() curEventTypeId = defaultEventTypeId isParsingEvent = true @@ -151,15 +151,15 @@ class IcsImporter(val activity: SimpleActivity) { curRecurrenceDayCode = Formatter.getDayCodeFromTS(timestamp) } else if (line.startsWith(SEQUENCE)) { isSequence = true - } else if (line == BEGIN_ALARM) { + } else if (line.trim() == BEGIN_ALARM) { isNotificationDescription = true - } else if (line == END_ALARM) { + } else if (line.trim() == END_ALARM) { if (isProperReminderAction && curReminderTriggerMinutes != REMINDER_OFF) { curReminderMinutes.add(curReminderTriggerMinutes) curReminderActions.add(curReminderTriggerAction) } isNotificationDescription = false - } else if (line == END_EVENT) { + } else if (line.trim() == END_EVENT) { isParsingEvent = false if (curStart != -1L && curEnd == -1L) { curEnd = curStart From 5831c95ed8f70d947f9f8ffce392a6a47df70517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Sun, 28 Feb 2021 19:33:41 +0000 Subject: [PATCH 30/52] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 127b1e7c3..cf7d1df3d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -6,10 +6,10 @@ Vista diária Vista semanal Vista mensal - Monthly + daily view + Mensal + vista diária Vista anual Lista de eventos - Parece que você não tem eventos para breve + Parece que não existem eventos para breve Ir para hoje Ir para data Olá,\n\nparece que você utilizou a opção de atualização existente na versão antiga. Tem que migrar os eventos locais através de exportação para um ficheiro .ics e posterior importação. Pode encontrar os botões de exportação/importação no ecrã do menu principal.\n\nDepois já poderá desinstalar a aplicação antiga. Também terá que repor as predefinições da aplicação.\n\nObrigado! @@ -144,7 +144,7 @@ Selecione um tipo de evento Mover eventos afetados para o tipo de evento padrão Remover permanentemente os eventos afetados - Para remover um calendário CalDAV, tem que cancelar a sua sincronização + Para remover um calendário CalDAV, tem que cancelar a sincronização Feriados @@ -189,7 +189,7 @@ Última utilizada Novo evento Hora inicial padrão - Próxima hora + 1 hora Duração padrão Última utilizada Outra From 2367b63c207b0903fecbb875f10b6c5967d8b48c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Thu, 4 Mar 2021 19:00:44 +0000 Subject: [PATCH 31/52] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index cf7d1df3d..90774bfd3 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -189,7 +189,7 @@ Última utilizada Novo evento Hora inicial padrão - 1 hora + Próxima hora Duração padrão Última utilizada Outra From 3a1cd5bc1f033eab5e248e807f8a118f805eab88 Mon Sep 17 00:00:00 2001 From: Mohit Soni <59525097+mohitsoni-dev@users.noreply.github.com> Date: Sat, 6 Mar 2021 21:05:00 +0530 Subject: [PATCH 32/52] For #1296 - Corrected major Indian holidays dates As Indian holiday follow hindu calendar, india.ics file needs to be updated yearly. I have corrected most of the major dates that I could. Thanks. --- app/src/main/assets/india.ics | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/app/src/main/assets/india.ics b/app/src/main/assets/india.ics index 2bccbe76b..7e6b3000e 100644 --- a/app/src/main/assets/india.ics +++ b/app/src/main/assets/india.ics @@ -67,8 +67,8 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Bhogi UID:ind_9 -DTSTART;VALUE=DATE:20160114 -DTEND;VALUE=DATE:20160115 +DTSTART;VALUE=DATE:20220113 +DTEND;VALUE=DATE:20220114 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 EXDATE:20180113} @@ -92,8 +92,8 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Maha Shivaratri UID:ind_12 -DTSTART;VALUE=DATE:20160226 -DTEND;VALUE=DATE:20160227 +DTSTART;VALUE=DATE:20220301 +DTEND;VALUE=DATE:20220302 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 EXDATE:20170225} @@ -109,8 +109,8 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Holi UID:ind_14 -DTSTART;VALUE=DATE:20160323 -DTEND;VALUE=DATE:20160324 +DTSTART;VALUE=DATE:20210328 +DTEND;VALUE=DATE:20210329 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 END:VEVENT @@ -182,16 +182,16 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Sri Ram navami UID:ind_23 -DTSTART;VALUE=DATE:20160415 -DTEND;VALUE=DATE:20160416 +DTSTART;VALUE=DATE:20160421 +DTEND;VALUE=DATE:20160422 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 END:VEVENT BEGIN:VEVENT SUMMARY:Mahavir Jayanti UID:ind_24 -DTSTART;VALUE=DATE:20160419 -DTEND;VALUE=DATE:20160420 +DTSTART;VALUE=DATE:20210425 +DTEND;VALUE=DATE:20210426 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 EXDATE:20180420} @@ -215,8 +215,8 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Buddha Purnima UID:ind_27 -DTSTART;VALUE=DATE:20160521 -DTEND;VALUE=DATE:20160522 +DTSTART;VALUE=DATE:20210526 +DTEND;VALUE=DATE:20210527 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 EXDATE:20170522} @@ -224,8 +224,8 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Raksha Bandhan UID:ind_28 -DTSTART;VALUE=DATE:20160705 -DTEND;VALUE=DATE:20160706 +DTSTART;VALUE=DATE:20210822 +DTEND;VALUE=DATE:20210823 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 EXDATE:20170706} @@ -233,8 +233,8 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Parsi New Year UID:ind_29 -DTSTART;VALUE=DATE:20160817 -DTEND;VALUE=DATE:20160818 +DTSTART;VALUE=DATE:20220819 +DTEND;VALUE=DATE:20220820 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 EXDATE:20180818} @@ -242,8 +242,8 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Janmashtami UID:ind_30 -DTSTART;VALUE=DATE:20160825 -DTEND;VALUE=DATE:20160826 +DTSTART;VALUE=DATE:20210831 +DTEND;VALUE=DATE:20210901 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 EXDATE:20170826} @@ -251,24 +251,24 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Solar Eclipse [Annular] UID:ind_31 -DTSTART:20160901T070800Z -DTEND:20160901T071200Z +DTSTART;VALUE=DATE:20160901 +DTEND;VALUE=DATE:20160901 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 END:VEVENT BEGIN:VEVENT SUMMARY:Ganesh Chaturthi UID:ind_32 -DTSTART;VALUE=DATE:20160905 -DTEND;VALUE=DATE:20160906 +DTSTART;VALUE=DATE:20210910 +DTEND;VALUE=DATE:20210911 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 END:VEVENT BEGIN:VEVENT SUMMARY:Onam UID:ind_33 -DTSTART;VALUE=DATE:20160913 -DTEND;VALUE=DATE:20160914 +DTSTART;VALUE=DATE:20220907 +DTEND;VALUE=DATE:20220908 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 END:VEVENT From a27cec95405e142b19f8038f12a60a6a72030bdf Mon Sep 17 00:00:00 2001 From: Mohit Soni <59525097+mohitsoni-dev@users.noreply.github.com> Date: Sun, 7 Mar 2021 10:53:56 +0530 Subject: [PATCH 33/52] Updated Solar Eclipse dates --- app/src/main/assets/india.ics | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/assets/india.ics b/app/src/main/assets/india.ics index 7e6b3000e..75a9231e5 100644 --- a/app/src/main/assets/india.ics +++ b/app/src/main/assets/india.ics @@ -101,8 +101,8 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Solar Eclipse [Total] UID:ind_13 -DTSTART:20160309T005800Z -DTEND:20160309T010200Z +DTSTART:20211204 +DTEND:20211204 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 END:VEVENT @@ -251,8 +251,8 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Solar Eclipse [Annular] UID:ind_31 -DTSTART;VALUE=DATE:20160901 -DTEND;VALUE=DATE:20160901 +DTSTART:20210610 +DTEND:20210611 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 END:VEVENT From 375e1ab88b3beb1b9eb2bbc26d5017911375d5fb Mon Sep 17 00:00:00 2001 From: Mohit Soni <59525097+mohitsoni-dev@users.noreply.github.com> Date: Sun, 7 Mar 2021 10:58:11 +0530 Subject: [PATCH 34/52] Updated Solar Eclipse dates --- app/src/main/assets/india.ics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/assets/india.ics b/app/src/main/assets/india.ics index 75a9231e5..d5631a67d 100644 --- a/app/src/main/assets/india.ics +++ b/app/src/main/assets/india.ics @@ -102,7 +102,7 @@ BEGIN:VEVENT SUMMARY:Solar Eclipse [Total] UID:ind_13 DTSTART:20211204 -DTEND:20211204 +DTEND:20211205 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 END:VEVENT From bcce0c1b3fa73cb1ea0310b4b00f31b6fde7947b Mon Sep 17 00:00:00 2001 From: Mohit Soni <59525097+mohitsoni-dev@users.noreply.github.com> Date: Sun, 7 Mar 2021 11:02:01 +0530 Subject: [PATCH 35/52] Final edits Solar Eclipse Dates Sorry for the unnecessary commit. I'm new in open source. --- app/src/main/assets/india.ics | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/assets/india.ics b/app/src/main/assets/india.ics index d5631a67d..81f369071 100644 --- a/app/src/main/assets/india.ics +++ b/app/src/main/assets/india.ics @@ -101,8 +101,8 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Solar Eclipse [Total] UID:ind_13 -DTSTART:20211204 -DTEND:20211205 +DTSTART;VALUE=DATE:20211204 +DTEND;VALUE=DATE:20211205 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 END:VEVENT @@ -251,8 +251,8 @@ END:VEVENT BEGIN:VEVENT SUMMARY:Solar Eclipse [Annular] UID:ind_31 -DTSTART:20210610 -DTEND:20210611 +DTSTART;VALUE=DATE:20210610 +DTEND;VALUE=DATE:20210611 STATUS:CONFIRMED RRULE:FREQ=YEARLY;INTERVAL=1 END:VEVENT From 79f9b5d158a3b4c03615bdd2ad35d0d9dcf5a37e Mon Sep 17 00:00:00 2001 From: Kazuhiro Ito Date: Sun, 7 Mar 2021 14:56:54 +0900 Subject: [PATCH 36/52] update Japanese holiday --- app/src/main/assets/japan.ics | 107 +++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 2 deletions(-) diff --git a/app/src/main/assets/japan.ics b/app/src/main/assets/japan.ics index 0adaf3952..3418a5245 100644 --- a/app/src/main/assets/japan.ics +++ b/app/src/main/assets/japan.ics @@ -70,12 +70,13 @@ SUMMARY:海の日 / Umi no hi / Marine Day RRULE:FREQ=MONTHLY;INTERVAL=12;BYDAY=3MO DTSTART;VALUE=DATE:20070716 DTEND;VALUE=DATE:20070717 +EXDATE:20200720,20210719 END:VEVENT BEGIN:VEVENT STATUS:CONFIRMED UID:jap_10 SUMMARY:体育の日 / Taiiku no hi / Health-Sports Day -RRULE:FREQ=MONTHLY;INTERVAL=12;BYDAY=2MO +RRULE:FREQ=MONTHLY;INTERVAL=12;BYDAY=2MO;UNTIL=20191231 DTSTART;VALUE=DATE:20071008 DTEND;VALUE=DATE:20071009 END:VEVENT @@ -99,7 +100,7 @@ BEGIN:VEVENT STATUS:CONFIRMED UID:jap_13 SUMMARY:天皇誕生日 / Tennō tanjōbi / Emperor Akihito's Birthday -RRULE:FREQ=YEARLY;INTERVAL=1 +RRULE:FREQ=YEARLY;INTERVAL=1;UNTIL=20190430 DTSTART;VALUE=DATE:20071223 DTEND;VALUE=DATE:20071224 END:VEVENT @@ -370,6 +371,7 @@ SUMMARY:山の日 / Yama no hi / Mountain Day RRULE:FREQ=YEARLY;INTERVAL=1 DTSTART;VALUE=DATE:20160811 DTEND;VALUE=DATE:20160812 +EXDATE:20200811,20210811 END:VEVENT BEGIN:VEVENT STATUS:CONFIRMED @@ -378,4 +380,105 @@ SUMMARY:振替休日 / Furikae kyūjitsu / Substitute Holiday DTSTART;VALUE=DATE:20190812 DTEND;VALUE=DATE:20190813 END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_52 +SUMMARY:振替休日 / Furikae kyūjitsu / Substitute Holiday +DTSTART;VALUE=DATE:20200224 +DTEND;VALUE=DATE:20200225 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_53 +SUMMARY:振替休日 / Furikae kyūjitsu / Substitute Holiday +DTSTART;VALUE=DATE:20210809 +DTEND;VALUE=DATE:20210810 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_54 +SUMMARY:国民の休日 / Kokumin no kyūjitsu / National Holiday +DTSTART;VALUE=DATE:20190430 +DTEND;VALUE=DATE:20190501 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_55 +SUMMARY:国民の休日 / Kokumin no kyūjitsu / National Holiday +DTSTART;VALUE=DATE:20190502 +DTEND;VALUE=DATE:20190503 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_56 +SUMMARY:即位礼正殿の儀 / Sokuireiseiden no gi +DTSTART;VALUE=DATE:20191022 +DTEND;VALUE=DATE:20191023 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_57 +SUMMARY:即位の日 / Sokui no hi / Emperor Naruhito's Enthronement Day +DTSTART;VALUE=DATE:20190501 +DTEND;VALUE=DATE:20190502 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_58 +SUMMARY:天皇誕生日 / Tennō tanjōbi / Emperor Naruhito's Birthday +RRULE:FREQ=YEARLY;INTERVAL=1 +DTSTART;VALUE=DATE:20200223 +DTEND;VALUE=DATE:20200224 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_59 +SUMMARY:海の日 / Umi no hi / Marine Day +DTSTART;VALUE=DATE:20200723 +DTEND;VALUE=DATE:20200724 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_60 +SUMMARY:海の日 / Umi no hi / Marine Day +DTSTART;VALUE=DATE:20210722 +DTEND;VALUE=DATE:20210723 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_61 +SUMMARY:山の日 / Yama no hi / Mountain Day +DTSTART;VALUE=DATE:20200810 +DTEND;VALUE=DATE:20200811 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_62 +SUMMARY:山の日 / Yama no hi / Mountain Day +DTSTART;VALUE=DATE:20210808 +DTEND;VALUE=DATE:20210809 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_63 +SUMMARY:スポーツの日 / Supōtu o hi / Sports Day +RRULE:FREQ=MONTHLY;INTERVAL=12;BYDAY=2MO +DTSTART;VALUE=DATE:20201012 +DTEND;VALUE=DATE:20201013 +EXDATE:20201012,20211011 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_64 +SUMMARY:スポーツの日 / Supōtu o hi / Sports Day +DTSTART;VALUE=DATE:20200724 +DTEND;VALUE=DATE:20200725 +END:VEVENT +BEGIN:VEVENT +STATUS:CONFIRMED +UID:jap_65 +SUMMARY:スポーツの日 / Supōtu o hi / Sports Day +DTSTART;VALUE=DATE:20210723 +DTEND;VALUE=DATE:20210724 +END:VEVENT END:VCALENDAR From 217649c9f4c381c6436e1b5bc1b035acfd863885 Mon Sep 17 00:00:00 2001 From: Kazuhiro Ito Date: Tue, 9 Mar 2021 17:40:18 +0900 Subject: [PATCH 37/52] fix #1201, support 5th weekday recurring events --- .../calendar/pro/activities/EventActivity.kt | 26 +++++-------------- .../calendar/pro/models/Event.kt | 19 +++++++------- app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt index 8be539d17..2fdffa672 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt @@ -644,17 +644,9 @@ class EventActivity : SimpleActivity() { private fun getAvailableMonthlyRepetitionRules(): ArrayList { val items = arrayListOf(RadioItem(REPEAT_SAME_DAY, getString(R.string.repeat_on_the_same_day_monthly))) - // split Every Last Sunday and Every Fourth Sunday of the month, if the month has 4 sundays + items.add(RadioItem(REPEAT_ORDER_WEEKDAY, getRepeatXthDayString(true, REPEAT_ORDER_WEEKDAY))) if (isLastWeekDayOfMonth()) { - val order = (mEventStartDateTime.dayOfMonth - 1) / 7 + 1 - if (order == 4) { - items.add(RadioItem(REPEAT_ORDER_WEEKDAY, getRepeatXthDayString(true, REPEAT_ORDER_WEEKDAY))) - items.add(RadioItem(REPEAT_ORDER_WEEKDAY_USE_LAST, getRepeatXthDayString(true, REPEAT_ORDER_WEEKDAY_USE_LAST))) - } else if (order == 5) { - items.add(RadioItem(REPEAT_ORDER_WEEKDAY_USE_LAST, getRepeatXthDayString(true, REPEAT_ORDER_WEEKDAY_USE_LAST))) - } - } else { - items.add(RadioItem(REPEAT_ORDER_WEEKDAY, getRepeatXthDayString(true, REPEAT_ORDER_WEEKDAY))) + items.add(RadioItem(REPEAT_ORDER_WEEKDAY_USE_LAST, getRepeatXthDayString(true, REPEAT_ORDER_WEEKDAY_USE_LAST))) } if (isLastDayOfTheMonth()) { @@ -666,16 +658,9 @@ class EventActivity : SimpleActivity() { private fun getAvailableYearlyRepetitionRules(): ArrayList { val items = arrayListOf(RadioItem(REPEAT_SAME_DAY, getString(R.string.repeat_on_the_same_day_yearly))) + items.add(RadioItem(REPEAT_ORDER_WEEKDAY, getRepeatXthDayInMonthString(true, REPEAT_ORDER_WEEKDAY))) if (isLastWeekDayOfMonth()) { - val order = (mEventStartDateTime.dayOfMonth - 1) / 7 + 1 - if (order == 4) { - items.add(RadioItem(REPEAT_ORDER_WEEKDAY, getRepeatXthDayInMonthString(true, REPEAT_ORDER_WEEKDAY))) - items.add(RadioItem(REPEAT_ORDER_WEEKDAY_USE_LAST, getRepeatXthDayInMonthString(true, REPEAT_ORDER_WEEKDAY_USE_LAST))) - } else if (order == 5) { - items.add(RadioItem(REPEAT_ORDER_WEEKDAY_USE_LAST, getRepeatXthDayInMonthString(true, REPEAT_ORDER_WEEKDAY_USE_LAST))) - } - } else { - items.add(RadioItem(REPEAT_ORDER_WEEKDAY, getRepeatXthDayInMonthString(true, REPEAT_ORDER_WEEKDAY))) + items.add(RadioItem(REPEAT_ORDER_WEEKDAY_USE_LAST, getRepeatXthDayInMonthString(true, REPEAT_ORDER_WEEKDAY_USE_LAST))) } return items @@ -711,7 +696,7 @@ class EventActivity : SimpleActivity() { private fun getOrderString(repeatRule: Int): String { val dayOfMonth = mEventStartDateTime.dayOfMonth var order = (dayOfMonth - 1) / 7 + 1 - if (order == 4 && isLastWeekDayOfMonth() && repeatRule == REPEAT_ORDER_WEEKDAY_USE_LAST) { + if (isLastWeekDayOfMonth() && repeatRule == REPEAT_ORDER_WEEKDAY_USE_LAST) { order = -1 } @@ -721,6 +706,7 @@ class EventActivity : SimpleActivity() { 2 -> if (isMale) R.string.second_m else R.string.second_f 3 -> if (isMale) R.string.third_m else R.string.third_f 4 -> if (isMale) R.string.fourth_m else R.string.fourth_f + 5 -> if (isMale) R.string.fifth_m else R.string.fifth_f else -> if (isMale) R.string.last_m else R.string.last_f }) } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt index 8ed5898ac..3f2febe65 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt @@ -99,10 +99,8 @@ data class Event( private fun addXthDayInterval(currStart: DateTime, original: Event, forceLastWeekday: Boolean): DateTime { val day = currStart.dayOfWeek var order = (currStart.dayOfMonth - 1) / 7 - val properMonth = currStart.withDayOfMonth(7).plusMonths(repeatInterval / MONTH).withDayOfWeek(day) - var firstProperDay = properMonth.dayOfMonth % 7 - if (firstProperDay == 0) - firstProperDay = properMonth.dayOfMonth + var properMonth = currStart.withDayOfMonth(7).plusMonths(repeatInterval / MONTH).withDayOfWeek(day) + var wantedDay: Int // check if it should be for example Fourth Monday, or Last Monday if (forceLastWeekday && (order == 3 || order == 4)) { @@ -112,13 +110,14 @@ data class Event( order = -1 } - val daysCnt = properMonth.dayOfMonth().maximumValue - var wantedDay = firstProperDay + order * 7 - if (wantedDay > daysCnt) - wantedDay -= 7 - if (order == -1) { - wantedDay = firstProperDay + ((daysCnt - firstProperDay) / 7) * 7 + wantedDay = properMonth.dayOfMonth + ((properMonth.dayOfMonth().maximumValue - properMonth.dayOfMonth) / 7) * 7 + } else { + wantedDay = properMonth.dayOfMonth + (order - (properMonth.dayOfMonth - 1) / 7) * 7 + while (properMonth.dayOfMonth().maximumValue < wantedDay) { + properMonth = properMonth.withDayOfMonth(7).plusMonths(repeatInterval / MONTH).withDayOfWeek(day) + wantedDay = properMonth.dayOfMonth + (order - (properMonth.dayOfMonth - 1) / 7) * 7 + } } return properMonth.withDayOfMonth(wantedDay) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index aec412c77..745853f80 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -71,6 +71,7 @@ second third fourth + fifth last @@ -81,6 +82,7 @@ second third fourth + fifth last From 079409676e01c87e2dd270f6735283f3ea2f02a7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 9 Mar 2021 22:36:41 +0100 Subject: [PATCH 38/52] adding the new string in other languages too --- app/src/main/res/values-ar/strings.xml | 2 ++ app/src/main/res/values-az/strings.xml | 2 ++ app/src/main/res/values-bn/strings.xml | 2 ++ app/src/main/res/values-br/strings.xml | 2 ++ app/src/main/res/values-cs/strings.xml | 2 ++ app/src/main/res/values-da/strings.xml | 2 ++ app/src/main/res/values-de/strings.xml | 2 ++ app/src/main/res/values-el/strings.xml | 2 ++ app/src/main/res/values-es/strings.xml | 2 ++ app/src/main/res/values-eu/strings.xml | 2 ++ app/src/main/res/values-fi/strings.xml | 2 ++ app/src/main/res/values-fr/strings.xml | 2 ++ app/src/main/res/values-gl/strings.xml | 2 ++ app/src/main/res/values-he/strings.xml | 2 ++ app/src/main/res/values-hi-rIN/strings.xml | 2 ++ app/src/main/res/values-hr/strings.xml | 2 ++ app/src/main/res/values-hu/strings.xml | 2 ++ app/src/main/res/values-id/strings.xml | 2 ++ app/src/main/res/values-in/strings.xml | 2 ++ app/src/main/res/values-it/strings.xml | 2 ++ app/src/main/res/values-iw/strings.xml | 2 ++ app/src/main/res/values-ja/strings.xml | 2 ++ app/src/main/res/values-ko/strings.xml | 2 ++ app/src/main/res/values-lt/strings.xml | 2 ++ app/src/main/res/values-lv/strings.xml | 2 ++ app/src/main/res/values-nb/strings.xml | 2 ++ app/src/main/res/values-nl/strings.xml | 2 ++ app/src/main/res/values-no/strings.xml | 2 ++ app/src/main/res/values-pl/strings.xml | 2 ++ app/src/main/res/values-pt-rBR/strings.xml | 2 ++ app/src/main/res/values-pt/strings.xml | 2 ++ app/src/main/res/values-ro/strings.xml | 2 ++ app/src/main/res/values-ru/strings.xml | 2 ++ app/src/main/res/values-sk/strings.xml | 2 ++ app/src/main/res/values-sv/strings.xml | 2 ++ app/src/main/res/values-tr/strings.xml | 2 ++ app/src/main/res/values-uk/strings.xml | 2 ++ app/src/main/res/values-zh-rCN/strings.xml | 2 ++ app/src/main/res/values-zh-rHK/strings.xml | 2 ++ app/src/main/res/values-zh-rTW/strings.xml | 2 ++ 40 files changed, 80 insertions(+) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 2b4b999cd..82cddc031 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -71,6 +71,7 @@ ثاني ثالث رابع + fifth أخير @@ -81,6 +82,7 @@ ثاني ثالث رابع + fifth أخير diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index 287e767a5..70a213a04 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -71,6 +71,7 @@ ikinci üçüncü dördüncü + fifth sonuncu @@ -81,6 +82,7 @@ ikinci üçüncü dördüncü + fifth sonuncu diff --git a/app/src/main/res/values-bn/strings.xml b/app/src/main/res/values-bn/strings.xml index f6884cac7..af5c64e54 100644 --- a/app/src/main/res/values-bn/strings.xml +++ b/app/src/main/res/values-bn/strings.xml @@ -75,6 +75,7 @@ দ্বিতীয় তৃতীয় চতুর্থ + fifth শেষ @@ -85,6 +86,7 @@ দ্বিতীয় তৃতীয় চতুর্থ + fifth শেষ diff --git a/app/src/main/res/values-br/strings.xml b/app/src/main/res/values-br/strings.xml index 977154bb1..9e0869d3a 100644 --- a/app/src/main/res/values-br/strings.xml +++ b/app/src/main/res/values-br/strings.xml @@ -71,6 +71,7 @@ eil trede pevare + fifth diwezhañ @@ -81,6 +82,7 @@ eil trede pevare + fifth diwezhañ diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index c9b6489e0..27a7c9311 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -71,6 +71,7 @@ druhý třetí čtvrtý + fifth poslední @@ -81,6 +82,7 @@ druhou třetí čtvrtou + fifth poslední diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index b5b3fab86..49ebe310d 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -71,6 +71,7 @@ anden tredje fjerde + fifth sidste @@ -81,6 +82,7 @@ anden tredje fjerde + fifth sidste diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 2c3898598..8122247b8 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -71,6 +71,7 @@ zweiten dritten vierten + fifth letzten @@ -81,6 +82,7 @@ zweiten dritten vierten + fifth letzten diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index f033eb6d6..99f1f6ba9 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -71,6 +71,7 @@ δεύτερη τρίτη τέταρτη + fifth τελευταία @@ -81,6 +82,7 @@ δεύτερη τρίτη τέταρτη + fifth τελευταία diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 07a20ee7b..674edf05c 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -71,6 +71,7 @@ segundo tercero cuarto + fifth último @@ -81,6 +82,7 @@ segundo tercer cuarto + fifth último diff --git a/app/src/main/res/values-eu/strings.xml b/app/src/main/res/values-eu/strings.xml index 45d3e031f..1469b2ac8 100644 --- a/app/src/main/res/values-eu/strings.xml +++ b/app/src/main/res/values-eu/strings.xml @@ -71,6 +71,7 @@ bigarren hirugarren laugarren + fifth azken @@ -81,6 +82,7 @@ bigarren hirugarren laugarren + fifth azken diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index f7e7bc1bd..ef0902208 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -71,6 +71,7 @@ toinen kolmas neljäs + fifth viimeinen @@ -81,6 +82,7 @@ toisena kolmantena neljäntenä + fifth viimeisenä diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index f46be900b..de592efa2 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -72,6 +72,7 @@ deuxième troisième quatrième + fifth dernier @@ -82,6 +83,7 @@ deuxième troisième quatrième + fifth dernier diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 8fd78d709..9598753cd 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -71,6 +71,7 @@ segundo terceiro cuarto + fifth último @@ -81,6 +82,7 @@ segundo terceiro cuarto + fifth último diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index 3a5d44af5..483d103a6 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -71,6 +71,7 @@ שני שלישי רביעי + fifth אחרון @@ -81,6 +82,7 @@ שניה שלישית רביעית + fifth אחרונה diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml index bbbe2ed5f..6a762ad92 100644 --- a/app/src/main/res/values-hi-rIN/strings.xml +++ b/app/src/main/res/values-hi-rIN/strings.xml @@ -71,6 +71,7 @@ second third fourth + fifth last @@ -81,6 +82,7 @@ second third fourth + fifth last diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index cb0db7c0c..d0c959272 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -71,6 +71,7 @@ drugi treći četvrti + fifth peti @@ -81,6 +82,7 @@ drugi treći četvrti + fifth peti diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 18ef34027..aad876d21 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -71,6 +71,7 @@ second third fourth + fifth last @@ -81,6 +82,7 @@ second third fourth + fifth last diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 8fe9ea8b8..100c7c96b 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -71,6 +71,7 @@ kedua ketiga keempat + fifth terakhir @@ -81,6 +82,7 @@ kedua ketiga keempat + fifth terakhir diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 8fe9ea8b8..100c7c96b 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -71,6 +71,7 @@ kedua ketiga keempat + fifth terakhir @@ -81,6 +82,7 @@ kedua ketiga keempat + fifth terakhir diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 6cfda87ad..6badf2385 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -71,6 +71,7 @@ secondo terzo quarto + fifth ultimo @@ -81,6 +82,7 @@ secondo terzo quarto + fifth ultimo diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index 96f5da76d..432cb0aea 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -71,6 +71,7 @@ שני שלישי רביעי + fifth אחרון @@ -81,6 +82,7 @@ שניה שלישית רביעית + fifth אחרונה diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 6d5ce371a..ba0f3f373 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -71,6 +71,7 @@ second third fourth + fifth last @@ -81,6 +82,7 @@ second third fourth + fifth last diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index ef2fa5447..8238e4b35 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -71,6 +71,7 @@ 두 번째 세 번째 네 번째 + fifth 마지막 @@ -81,6 +82,7 @@ 두 번째 세 번째 네 번째 + fifth 마지막 diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 27a10430d..8c4b5348b 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -71,6 +71,7 @@ Antrą Trečią Ketvirtą + fifth Paskutinę @@ -81,6 +82,7 @@ Antrą Trečią Ketvirtą + fifth Paskutinę diff --git a/app/src/main/res/values-lv/strings.xml b/app/src/main/res/values-lv/strings.xml index 7e40b6a80..4badfcba7 100644 --- a/app/src/main/res/values-lv/strings.xml +++ b/app/src/main/res/values-lv/strings.xml @@ -71,6 +71,7 @@ 2. 3. 4. + fifth pēdēj. @@ -81,6 +82,7 @@ 2. 3. 4. + fifth pēdēj. diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 248fb1405..0d6b02bb2 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -71,6 +71,7 @@ andre tredje fjerde + fifth siste @@ -81,6 +82,7 @@ andre tredje fjerde + fifth siste diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 78ef5ea29..6bfdd2ef1 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -71,6 +71,7 @@ tweede derde vierde + fifth laatste @@ -81,6 +82,7 @@ tweede derde vierde + fifth laatste diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index 8b0438676..2d774fbf4 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -71,6 +71,7 @@ andre tredje fjerde + fifth siste @@ -81,6 +82,7 @@ andre tredje fjerde + fifth siste diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index a3f51bd8b..0e1920a66 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -71,6 +71,7 @@ drugi(ą) trzeci(ą) czwarty(ą) + fifth ostatni(ą) @@ -81,6 +82,7 @@ drugi(ą) trzeci(ą) czwarty(ą) + fifth ostatni(ą) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index aa80126f2..93d2155b5 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -71,6 +71,7 @@ segundo terceiro quarto + fifth último @@ -81,6 +82,7 @@ segundo terceiro quarto + fifth ultimo diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 90774bfd3..f7d81f6f1 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -71,6 +71,7 @@ segunda terceira quarta + fifth última @@ -81,6 +82,7 @@ segundo terceiro quarto + fifth último diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 5e0180173..7306dc38e 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -71,6 +71,7 @@ a doua a treia a patra + fifth ultima @@ -81,6 +82,7 @@ a doua a treia a patra + fifth ultima diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 2133e6917..487378018 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -71,6 +71,7 @@ второй третий четвёртый + fifth последний @@ -81,6 +82,7 @@ вторую третью четвёртую + fifth последнюю diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index c5117e19e..f1de7b292 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -71,6 +71,7 @@ druhý tretí štvrtý + piaty posledný @@ -81,6 +82,7 @@ druhú tretiu štvrtú + piatu poslednú diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index ac52f9fd0..00f8b6e56 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -71,6 +71,7 @@ andra tredje fjärde + fifth sista @@ -81,6 +82,7 @@ andra tredje fjärde + fifth sista diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 5ec245c53..c4b0e3f7c 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -71,6 +71,7 @@ ikinci üçüncü dördüncü + fifth son @@ -81,6 +82,7 @@ ikinci üçüncü dördüncü + fifth son diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 4a12eebd2..e07d920e1 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -71,6 +71,7 @@ другий третій четвертий + fifth останній @@ -81,6 +82,7 @@ другий третій четвертий + fifth останній diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index d75222e11..389dcb0c4 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -71,6 +71,7 @@     第二个     第三个     第四个 + fifth     最后的      @@ -81,6 +82,7 @@     第二个     第三个     第四个 + fifth     最后的      diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 41c217dc8..1e5edc8f6 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -71,6 +71,7 @@ 第二個 第三個 第四個 + fifth 最後的 @@ -81,6 +82,7 @@ 第二個 第三個 第四個 + fifth 最後的 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 93c090198..1c0c00a76 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -71,6 +71,7 @@ 第二個 第三個 第四個 + fifth 最後的 @@ -81,6 +82,7 @@ 第二個 第三個 第四個 + fifth 最後的 From e322a65fc7600b378e8e2629ebc4dbf530e681d5 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Tue, 9 Mar 2021 23:33:02 +0100 Subject: [PATCH 39/52] Dutch --- app/src/main/res/values-nl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 6bfdd2ef1..615d4f0a8 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -71,7 +71,7 @@ tweede derde vierde - fifth + vijfde laatste From 5cc68c38fe738506004fae25a5938e5ff8dead13 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Wed, 10 Mar 2021 03:20:44 +0100 Subject: [PATCH 40/52] Dutch --- app/src/main/res/values-nl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 615d4f0a8..fe54a8b35 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -82,7 +82,7 @@ tweede derde vierde - fifth + vijfde laatste From 5819760b55a28c1ff9725d6815a74368c86e39b9 Mon Sep 17 00:00:00 2001 From: Kazuhiro Ito Date: Wed, 10 Mar 2021 21:24:57 +0900 Subject: [PATCH 41/52] fix second sutarday and sunday are not highlighted in weekly view --- .../com/simplemobiletools/calendar/pro/helpers/Constants.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index 0e3898f2c..3b234d088 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -164,9 +164,5 @@ const val REMINDER_EMAIL = 1 fun getNowSeconds() = System.currentTimeMillis() / 1000L fun isWeekend(i: Int, isSundayFirst: Boolean): Boolean { - return if (isSundayFirst) { - i == 0 || i == 6 - } else { - i == 5 || i == 6 - } + return (i + if (isSundayFirst) 6 else 0) % 7 > 4 } From 525716d832abee468e97d20119a5ad2cd16c2262 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Wed, 10 Mar 2021 15:51:29 +0100 Subject: [PATCH 42/52] making the weekend check more readable --- .../com/simplemobiletools/calendar/pro/helpers/Constants.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index 3b234d088..5f6d96d57 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -164,5 +164,9 @@ const val REMINDER_EMAIL = 1 fun getNowSeconds() = System.currentTimeMillis() / 1000L fun isWeekend(i: Int, isSundayFirst: Boolean): Boolean { - return (i + if (isSundayFirst) 6 else 0) % 7 > 4 + return if (isSundayFirst) { + i == 0 || i == 6 || i == 7 || i == 13 + } else { + i == 5 || i == 6 || i == 12 || i == 13 + } } From 263dec79df20ea491a154808de9c68e0a06a5755 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 10 Mar 2021 16:18:11 +0100 Subject: [PATCH 43/52] fix some glitches at parsing CalDAV synced Exdates --- .../com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt index 335b36188..f00ce3da5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt @@ -240,12 +240,13 @@ class CalDAVHelper(val context: Context) { } // some calendars add repeatable event exceptions with using the "exdate" field, not by creating a child event that is an exception + // exdate can be stored as "20190216T230000Z", but also as "Europe/Madrid;20201208T000000Z" val exdate = cursor.getStringValue(Events.EXDATE) ?: "" if (exdate.length > 8) { val lines = exdate.split("\n") for (line in lines) { val dates = line.split(",") - dates.forEach { + dates.filter { it.isNotEmpty() && it[0].isDigit() }.forEach { if (it.endsWith("Z")) { // convert for example "20190216T230000Z" to "20190217000000" in Slovakia in a weird way val formatter = DateTimeFormat.forPattern("yyyyMMdd'T'HHmmss'Z'") From 2e33b4f63f2c43acabdfd251a2ea353efc15298e Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 10 Mar 2021 16:47:38 +0100 Subject: [PATCH 44/52] updating commons to 5.34.21 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 297aac3be..a25eb2d5a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -64,8 +64,8 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.33.35' - implementation 'joda-time:joda-time:2.10.1' + implementation 'com.simplemobiletools:commons:5.34.21' + implementation 'joda-time:joda-time:2.10.3' implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' From db4d27b0dbddd2d43fc4286c8b24a25f9b513d00 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 10 Mar 2021 16:50:50 +0100 Subject: [PATCH 45/52] Revert "do not reduce text alpha of past events, keep it readable" This reverts commit 5ce9971fb0995270d0cd495190d966be664cf060. --- .../calendar/pro/fragments/WeekFragment.kt | 6 ++++-- .../calendar/pro/views/MonthView.kt | 15 ++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt index 89ced9500..9948b5759 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt @@ -449,9 +449,10 @@ class WeekFragment : Fragment(), WeeklyCalendar { val dayColumn = dayColumns[dayOfWeek] (inflater.inflate(R.layout.week_event_marker, null, false) as TextView).apply { var backgroundColor = eventTypeColors.get(event.eventType, primaryColor) - val textColor = backgroundColor.getContrastColor() + var textColor = backgroundColor.getContrastColor() if (dimPastEvents && event.isPastEvent && !isPrintVersion) { backgroundColor = backgroundColor.adjustAlpha(LOW_ALPHA) + textColor = textColor.adjustAlpha(LOW_ALPHA) } background = ColorDrawable(backgroundColor) @@ -555,9 +556,10 @@ class WeekFragment : Fragment(), WeeklyCalendar { private fun addAllDayEvent(event: Event) { (inflater.inflate(R.layout.week_all_day_event_marker, null, false) as TextView).apply { var backgroundColor = eventTypeColors.get(event.eventType, primaryColor) - val textColor = backgroundColor.getContrastColor() + var textColor = backgroundColor.getContrastColor() if (dimPastEvents && event.isPastEvent && !isPrintVersion) { backgroundColor = backgroundColor.adjustAlpha(LOW_ALPHA) + textColor = textColor.adjustAlpha(LOW_ALPHA) } background = ColorDrawable(backgroundColor) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt index f1d9d0d55..b56479865 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt @@ -275,16 +275,16 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con bgRectF.set(bgLeft, bgTop, bgRight, bgBottom) canvas.drawRoundRect(bgRectF, BG_CORNER_RADIUS, BG_CORNER_RADIUS, getEventBackgroundColor(event, startDayIndex, endDayIndex)) - drawEventTitle(event, canvas, xPos, yPos + verticalOffset, bgRight - bgLeft - smallPadding) + drawEventTitle(event, canvas, xPos, yPos + verticalOffset, bgRight - bgLeft - smallPadding, startDayIndex, endDayIndex) for (i in 0 until Math.min(event.daysCnt, 7 - event.startDayIndex % 7)) { dayVerticalOffsets.put(event.startDayIndex + i, verticalOffset + eventTitleHeight + smallPadding * 2) } } - private fun drawEventTitle(event: MonthViewEvent, canvas: Canvas, x: Float, y: Float, availableWidth: Float) { + private fun drawEventTitle(event: MonthViewEvent, canvas: Canvas, x: Float, y: Float, availableWidth: Float, startDay: DayMonthly, endDay: DayMonthly) { val ellipsized = TextUtils.ellipsize(event.title, eventTitlePaint, availableWidth - smallPadding, TextUtils.TruncateAt.END) - canvas.drawText(event.title, 0, ellipsized.length, x + smallPadding * 2, y, getEventTitlePaint(event)) + canvas.drawText(event.title, 0, ellipsized.length, x + smallPadding * 2, y, getEventTitlePaint(event, startDay, endDay)) } private fun getTextPaint(startDay: DayMonthly): Paint { @@ -319,9 +319,14 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con return getColoredPaint(paintColor) } - private fun getEventTitlePaint(event: MonthViewEvent): Paint { + private fun getEventTitlePaint(event: MonthViewEvent, startDay: DayMonthly, endDay: DayMonthly): Paint { + var paintColor = event.color.getContrastColor() + if ((!startDay.isThisMonth && !endDay.isThisMonth) || (dimPastEvents && event.isPastEvent && !isPrintVersion)) { + paintColor = paintColor.adjustAlpha(MEDIUM_ALPHA) + } + val curPaint = Paint(eventTitlePaint) - curPaint.color = event.color.getContrastColor() + curPaint.color = paintColor return curPaint } From 89ecc7404298b3d374aced8d3dc7da7044895fea Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 10 Mar 2021 16:55:40 +0100 Subject: [PATCH 46/52] use a bit higher alpha for dimmed event titles --- .../pro/activities/WidgetDateConfigureActivity.kt | 4 ++-- .../pro/activities/WidgetMonthlyConfigureActivity.kt | 4 ++-- .../calendar/pro/adapters/DayEventsAdapter.kt | 4 ++-- .../calendar/pro/adapters/EventListAdapter.kt | 7 ++++--- .../calendar/pro/adapters/EventListWidgetAdapter.kt | 5 +++-- .../calendar/pro/extensions/Context.kt | 2 +- .../calendar/pro/fragments/WeekFragment.kt | 10 ++++++---- .../calendar/pro/helpers/Constants.kt | 2 -- .../calendar/pro/helpers/MyWidgetMonthlyProvider.kt | 1 + .../simplemobiletools/calendar/pro/views/MonthView.kt | 9 ++++++--- .../calendar/pro/views/SmallMonthView.kt | 2 +- 11 files changed, 28 insertions(+), 22 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetDateConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetDateConfigureActivity.kt index 8852bb13d..31fba1baa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetDateConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetDateConfigureActivity.kt @@ -9,12 +9,12 @@ import android.widget.SeekBar import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.extensions.config import com.simplemobiletools.calendar.pro.helpers.Formatter -import com.simplemobiletools.calendar.pro.helpers.LOW_ALPHA import com.simplemobiletools.calendar.pro.helpers.MyWidgetDateProvider import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.applyColorFilter import com.simplemobiletools.commons.extensions.setFillWithStroke +import com.simplemobiletools.commons.helpers.LOWER_ALPHA import kotlinx.android.synthetic.main.widget_config_date.* class WidgetDateConfigureActivity : SimpleActivity() { @@ -112,7 +112,7 @@ class WidgetDateConfigureActivity : SimpleActivity() { private fun updateColors() { mTextColor = mTextColorWithoutTransparency - mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOW_ALPHA) + mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOWER_ALPHA) mPrimaryColor = config.primaryColor config_text_color.setFillWithStroke(mTextColor, Color.BLACK) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetMonthlyConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetMonthlyConfigureActivity.kt index 1b0302585..9171af04c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetMonthlyConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/WidgetMonthlyConfigureActivity.kt @@ -13,7 +13,6 @@ import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.extensions.addDayEvents import com.simplemobiletools.calendar.pro.extensions.addDayNumber import com.simplemobiletools.calendar.pro.extensions.config -import com.simplemobiletools.calendar.pro.helpers.LOW_ALPHA import com.simplemobiletools.calendar.pro.helpers.MonthlyCalendarImpl import com.simplemobiletools.calendar.pro.helpers.MyWidgetMonthlyProvider import com.simplemobiletools.calendar.pro.interfaces.MonthlyCalendar @@ -23,6 +22,7 @@ import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.applyColorFilter import com.simplemobiletools.commons.extensions.beVisible import com.simplemobiletools.commons.extensions.setFillWithStroke +import com.simplemobiletools.commons.helpers.LOWER_ALPHA import kotlinx.android.synthetic.main.first_row.* import kotlinx.android.synthetic.main.top_navigation.* import kotlinx.android.synthetic.main.widget_config_monthly.* @@ -127,7 +127,7 @@ class WidgetMonthlyConfigureActivity : SimpleActivity(), MonthlyCalendar { private fun updateColors() { mTextColor = mTextColorWithoutTransparency - mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOW_ALPHA) + mWeakTextColor = mTextColorWithoutTransparency.adjustAlpha(LOWER_ALPHA) mPrimaryColor = config.primaryColor top_left_arrow.applyColorFilter(mTextColor) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt index 36cdfd449..225f3c7c5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt @@ -13,13 +13,13 @@ import com.simplemobiletools.calendar.pro.extensions.shareEvents import com.simplemobiletools.calendar.pro.helpers.Formatter import com.simplemobiletools.calendar.pro.helpers.ITEM_EVENT import com.simplemobiletools.calendar.pro.helpers.ITEM_EVENT_SIMPLE -import com.simplemobiletools.calendar.pro.helpers.LOW_ALPHA import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.applyColorFilter import com.simplemobiletools.commons.extensions.beInvisible import com.simplemobiletools.commons.extensions.beInvisibleIf +import com.simplemobiletools.commons.helpers.LOWER_ALPHA import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.views.MyRecyclerView import kotlinx.android.synthetic.main.event_item_day_view.view.* @@ -136,7 +136,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList, r var newTextColor = textColor if (dimPastEvents && event.isPastEvent && !isPrintVersion) { - newTextColor = newTextColor.adjustAlpha(LOW_ALPHA) + newTextColor = newTextColor.adjustAlpha(LOWER_ALPHA) } event_item_start.setTextColor(newTextColor) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt index 9f05f928e..e27d10b0b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt @@ -20,6 +20,7 @@ import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.applyColorFilter import com.simplemobiletools.commons.extensions.beInvisible import com.simplemobiletools.commons.extensions.beInvisibleIf +import com.simplemobiletools.commons.helpers.LOWER_ALPHA import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.commons.views.MyRecyclerView @@ -177,8 +178,8 @@ class EventListAdapter(activity: SimpleActivity, var listItems: ArrayList= now && !isPrintVersion) { startTextColor = adjustedPrimaryColor @@ -197,7 +198,7 @@ class EventListAdapter(activity: SimpleActivity, var listItems: ArrayList() private var textColor = context.config.widgetTextColor - private var weakTextColor = textColor.adjustAlpha(LOW_ALPHA) + private var weakTextColor = textColor.adjustAlpha(LOWER_ALPHA) private val replaceDescription = context.config.replaceDescription private val dimPastEvents = context.config.dimPastEvents private var mediumFontSize = context.getWidgetFontSize() @@ -157,7 +158,7 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi override fun onDataSetChanged() { textColor = context.config.widgetTextColor - weakTextColor = textColor.adjustAlpha(LOW_ALPHA) + weakTextColor = textColor.adjustAlpha(LOWER_ALPHA) mediumFontSize = context.getWidgetFontSize() val fromTS = DateTime().seconds() - context.config.displayPastEvents * 60 val toTS = DateTime().plusYears(1).seconds() diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt index d87c1c093..2438795fa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt @@ -389,7 +389,7 @@ fun Context.scheduleCalDAVSync(activate: Boolean) { fun Context.addDayNumber(rawTextColor: Int, day: DayMonthly, linearLayout: LinearLayout, dayLabelHeight: Int, callback: (Int) -> Unit) { var textColor = rawTextColor if (!day.isThisMonth) - textColor = textColor.adjustAlpha(LOW_ALPHA) + textColor = textColor.adjustAlpha(LOWER_ALPHA) (View.inflate(applicationContext, R.layout.day_monthly_number_view, null) as TextView).apply { setTextColor(textColor) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt index 9948b5759..adfc76663 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt @@ -25,6 +25,8 @@ import com.simplemobiletools.calendar.pro.models.EventWeeklyView import com.simplemobiletools.calendar.pro.views.MyScrollView import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.DAY_SECONDS +import com.simplemobiletools.commons.helpers.HIGHER_ALPHA +import com.simplemobiletools.commons.helpers.LOWER_ALPHA import com.simplemobiletools.commons.helpers.WEEK_SECONDS import com.simplemobiletools.commons.views.MyTextView import kotlinx.android.synthetic.main.fragment_week.* @@ -451,8 +453,8 @@ class WeekFragment : Fragment(), WeeklyCalendar { var backgroundColor = eventTypeColors.get(event.eventType, primaryColor) var textColor = backgroundColor.getContrastColor() if (dimPastEvents && event.isPastEvent && !isPrintVersion) { - backgroundColor = backgroundColor.adjustAlpha(LOW_ALPHA) - textColor = textColor.adjustAlpha(LOW_ALPHA) + backgroundColor = backgroundColor.adjustAlpha(LOWER_ALPHA) + textColor = textColor.adjustAlpha(HIGHER_ALPHA) } background = ColorDrawable(backgroundColor) @@ -558,8 +560,8 @@ class WeekFragment : Fragment(), WeeklyCalendar { var backgroundColor = eventTypeColors.get(event.eventType, primaryColor) var textColor = backgroundColor.getContrastColor() if (dimPastEvents && event.isPastEvent && !isPrintVersion) { - backgroundColor = backgroundColor.adjustAlpha(LOW_ALPHA) - textColor = textColor.adjustAlpha(LOW_ALPHA) + backgroundColor = backgroundColor.adjustAlpha(LOWER_ALPHA) + textColor = textColor.adjustAlpha(HIGHER_ALPHA) } background = ColorDrawable(backgroundColor) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index 5f6d96d57..020b69644 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -1,7 +1,5 @@ package com.simplemobiletools.calendar.pro.helpers -const val LOW_ALPHA = .3f -const val MEDIUM_ALPHA = .6f const val STORED_LOCALLY_ONLY = 0 const val ROW_COUNT = 6 const val COLUMN_COUNT = 7 diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetMonthlyProvider.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetMonthlyProvider.kt index ebda2b729..fc456a3f2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetMonthlyProvider.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/MyWidgetMonthlyProvider.kt @@ -18,6 +18,7 @@ import com.simplemobiletools.calendar.pro.interfaces.MonthlyCalendar import com.simplemobiletools.calendar.pro.models.DayMonthly import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA import org.joda.time.DateTime class MyWidgetMonthlyProvider : AppWidgetProvider() { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt index b56479865..b63d83475 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/MonthView.kt @@ -18,6 +18,9 @@ import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor import com.simplemobiletools.commons.extensions.getContrastColor import com.simplemobiletools.commons.extensions.moveLastItemToFront +import com.simplemobiletools.commons.helpers.HIGHER_ALPHA +import com.simplemobiletools.commons.helpers.LOWER_ALPHA +import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA import org.joda.time.DateTime import org.joda.time.Days @@ -75,7 +78,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con } gridPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { - color = textColor.adjustAlpha(LOW_ALPHA) + color = textColor.adjustAlpha(LOWER_ALPHA) } circleStrokePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { @@ -322,7 +325,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con private fun getEventTitlePaint(event: MonthViewEvent, startDay: DayMonthly, endDay: DayMonthly): Paint { var paintColor = event.color.getContrastColor() if ((!startDay.isThisMonth && !endDay.isThisMonth) || (dimPastEvents && event.isPastEvent && !isPrintVersion)) { - paintColor = paintColor.adjustAlpha(MEDIUM_ALPHA) + paintColor = paintColor.adjustAlpha(HIGHER_ALPHA) } val curPaint = Paint(eventTitlePaint) @@ -400,7 +403,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con } textPaint.color = textColor - gridPaint.color = textColor.adjustAlpha(LOW_ALPHA) + gridPaint.color = textColor.adjustAlpha(LOWER_ALPHA) invalidate() initWeekDayLetters() } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt index f17072f58..ee8e37d09 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/SmallMonthView.kt @@ -8,11 +8,11 @@ import android.util.AttributeSet import android.view.View import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.extensions.config -import com.simplemobiletools.calendar.pro.helpers.MEDIUM_ALPHA import com.simplemobiletools.calendar.pro.helpers.isWeekend import com.simplemobiletools.calendar.pro.models.DayYearly import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor +import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA import java.util.* // used for displaying months at Yearly view From 28de3c6eb8ddf1a41d961ffa8a5d6e4563cf942a Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 10 Mar 2021 16:59:26 +0100 Subject: [PATCH 47/52] reordering some FAQ items --- .../calendar/pro/activities/MainActivity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt index dcb642785..50efdff78 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt @@ -934,11 +934,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { val licenses = LICENSE_JODA val faqItems = arrayListOf( - FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons), - FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons), - FAQItem(R.string.faq_1_title, R.string.faq_1_text), FAQItem(R.string.faq_2_title, R.string.faq_2_text), FAQItem(R.string.faq_3_title, R.string.faq_3_text), + FAQItem(R.string.faq_1_title, R.string.faq_1_text), + FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons), + FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons), FAQItem(R.string.faq_4_title, R.string.faq_4_text), FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons), FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons), From ec955d0ef4973ec55d944b84812db685f41ae375 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 10 Mar 2021 18:20:33 +0100 Subject: [PATCH 48/52] small code shortening --- .../simplemobiletools/calendar/pro/activities/EventActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt index 2fdffa672..7f2c320b7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt @@ -256,7 +256,8 @@ class EventActivity : SimpleActivity() { 0 } else { val original = if (mOriginalTimeZone.isEmpty()) DateTimeZone.getDefault().id else mOriginalTimeZone - (DateTimeZone.forID(mEvent.getTimeZoneString()).getOffset(System.currentTimeMillis()) - DateTimeZone.forID(original).getOffset(System.currentTimeMillis())) / 1000L + val millis = System.currentTimeMillis() + (DateTimeZone.forID(mEvent.getTimeZoneString()).getOffset(millis) - DateTimeZone.forID(original).getOffset(millis)) / 1000L } val newStartTS = mEventStartDateTime.withSecondOfMinute(0).withMillisOfSecond(0).seconds() - offset From f26fbcb75a99331da9f32b89ff6f93ea229c08e0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 10 Mar 2021 19:02:04 +0100 Subject: [PATCH 49/52] do not trim some fields at searching changes before discarding --- .../calendar/pro/activities/EventActivity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt index 7f2c320b7..c1b05bb43 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt @@ -290,9 +290,9 @@ class EventActivity : SimpleActivity() { } val reminders = getReminders() - if (event_title.value != mEvent.title || - event_location.value != mEvent.location || - event_description.value != mEvent.description || + if (event_title.text.toString() != mEvent.title || + event_location.text.toString() != mEvent.location || + event_description.text.toString() != mEvent.description || event_time_zone.text != mEvent.getTimeZoneString() || reminders != mEvent.getReminders() || mRepeatInterval != mEvent.repeatInterval || From a984a0923d6d42c2cf3b401a9d627aa3f0b704ad Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 10 Mar 2021 19:12:06 +0100 Subject: [PATCH 50/52] updating target SDK to 30 --- app/build.gradle | 5 ++--- build.gradle | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a25eb2d5a..8e907b3c3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,13 +11,12 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 29 - buildToolsVersion "29.0.3" + compileSdkVersion 30 defaultConfig { applicationId "com.simplemobiletools.calendar.pro" minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 30 versionCode 192 versionName "6.13.0" multiDexEnabled true diff --git a/build.gradle b/build.gradle index ce2f58d09..0ea14ab23 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.4.30' + ext.kotlin_version = '1.4.31' repositories { google() From bb64e65e3d6aed27fcc7b23cd26b308d93c10f86 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 10 Mar 2021 19:16:08 +0100 Subject: [PATCH 51/52] update version to 6.13.1 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8e907b3c3..39dc15323 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -17,8 +17,8 @@ android { applicationId "com.simplemobiletools.calendar.pro" minSdkVersion 21 targetSdkVersion 30 - versionCode 192 - versionName "6.13.0" + versionCode 193 + versionName "6.13.1" multiDexEnabled true setProperty("archivesBaseName", "calendar") vectorDrawables.useSupportLibrary = true From 3f41d6f0fbef60464b38bffecf0cc7894a8a3421 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 10 Mar 2021 19:16:14 +0100 Subject: [PATCH 52/52] updating changelog --- CHANGELOG.md | 7 +++++++ fastlane/metadata/android/en-US/changelogs/193.txt | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 fastlane/metadata/android/en-US/changelogs/193.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bc9ee53d..c627c7e24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========== +Version 6.13.1 *(2021-03-10)* +---------------------------- + + * Allow repeating events every fifth weekday + * Properly highlight weekends on widgets, if selected so + * Fixed some CalDAV syncing and .ics file importing issues + Version 6.13.0 *(2021-02-23)* ---------------------------- diff --git a/fastlane/metadata/android/en-US/changelogs/193.txt b/fastlane/metadata/android/en-US/changelogs/193.txt new file mode 100644 index 000000000..3d1732ed6 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/193.txt @@ -0,0 +1,3 @@ + * Allow repeating events every fifth weekday + * Properly highlight weekends on widgets, if selected so + * Fixed some CalDAV syncing and .ics file importing issues