properly show all-day tasks at the weekly view

This commit is contained in:
tibbi 2022-02-26 23:11:46 +01:00
parent 26c0a55d19
commit e558342cc9
3 changed files with 51 additions and 12 deletions

View File

@ -159,6 +159,8 @@ class TaskActivity : SimpleActivity() {
mEventTypeId = mTask.eventType
task_title.setText(mTask.title)
task_description.setText(mTask.description)
task_all_day.isChecked = mTask.getIsAllDay()
toggleAllDay(mTask.getIsAllDay())
setupMarkCompleteButton()
}

View File

@ -666,7 +666,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
@SuppressLint("NewApi")
private fun addAllDayEvent(event: Event) {
(inflater.inflate(R.layout.week_all_day_event_marker, null, false) as TextView).apply {
(inflater.inflate(R.layout.week_all_day_event_marker, null, false) as ConstraintLayout).apply {
var backgroundColor = eventTypeColors.get(event.eventType, primaryColor)
var textColor = backgroundColor.getContrastColor()
if (dimPastEvents && event.isPastEvent && !isPrintVersion) {
@ -675,9 +675,18 @@ class WeekFragment : Fragment(), WeeklyCalendar {
}
background = ColorDrawable(backgroundColor)
setTextColor(textColor)
text = event.title
contentDescription = text
week_event_label.apply {
setTextColor(textColor)
maxLines = if (event.isTask()) 1 else 2
text = event.title
checkViewStrikeThrough(event.isTaskCompleted())
contentDescription = text
}
week_event_task_image.beVisibleIf(event.isTask())
if (event.isTask()) {
week_event_task_image.applyColorFilter(textColor)
}
val startDateTime = Formatter.getDateTimeFromTS(event.startTS)
val endDateTime = Formatter.getDateTimeFromTS(event.endTS)

View File

@ -1,9 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="2"
android:padding="@dimen/tiny_margin"
android:textColor="@android:color/white"
android:textSize="@dimen/small_text_size" />
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/week_event_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/week_event_task_image"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:adjustViewBounds="true"
android:paddingStart="@dimen/one_dp"
android:paddingTop="@dimen/one_dp"
android:paddingBottom="@dimen/one_dp"
android:scaleType="fitStart"
android:src="@drawable/ic_task_vector"
app:layout_constraintBottom_toBottomOf="@+id/week_event_label"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/week_event_label" />
<TextView
android:id="@+id/week_event_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:paddingStart="@dimen/tiny_margin"
android:textColor="@android:color/white"
android:textSize="@dimen/small_text_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/week_event_task_image"
app:layout_constraintTop_toTopOf="parent"
tools:text="My event" />
</androidx.constraintlayout.widget.ConstraintLayout>