fix task displaying at the monthly widget config screen

This commit is contained in:
tibbi 2022-02-26 23:37:08 +01:00
parent e558342cc9
commit 2a6c7b650f
2 changed files with 54 additions and 17 deletions

View File

@ -21,6 +21,7 @@ import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.Toast
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.app.AlarmManagerCompat
import androidx.core.app.NotificationCompat
import androidx.print.PrintHelper
@ -40,6 +41,7 @@ import com.simplemobiletools.calendar.pro.receivers.NotificationReceiver
import com.simplemobiletools.calendar.pro.services.SnoozeService
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
import kotlinx.android.synthetic.main.day_monthly_event_view.view.*
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
import org.joda.time.LocalDate
@ -489,13 +491,22 @@ fun Context.addDayEvents(day: DayMonthly, linearLayout: LinearLayout, res: Resou
textColor = textColor.adjustAlpha(0.25f)
}
(View.inflate(applicationContext, R.layout.day_monthly_event_view, null) as TextView).apply {
setTextColor(textColor)
text = it.title.replace(" ", "\u00A0") // allow word break by char
(View.inflate(applicationContext, R.layout.day_monthly_event_view, null) as ConstraintLayout).apply {
background = backgroundDrawable
layoutParams = eventLayoutParams
contentDescription = it.title
linearLayout.addView(this)
day_monthly_event_id.apply {
setTextColor(textColor)
text = it.title.replace(" ", "\u00A0") // allow word break by char
checkViewStrikeThrough(it.isTaskCompleted())
contentDescription = it.title
}
day_monthly_task_image.beVisibleIf(it.isTask())
if (it.isTask()) {
day_monthly_task_image.applyColorFilter(textColor)
}
}
}
}

View File

@ -1,16 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
<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/day_monthly_event_id"
android:id="@+id/day_monthly_event_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="1dp"
android:ellipsize="none"
android:gravity="start"
android:hyphenationFrequency="none"
android:maxLines="1"
android:paddingStart="@dimen/tiny_margin"
android:paddingEnd="@dimen/tiny_margin"
android:textSize="@dimen/day_monthly_text_size"
tools:targetApi="m"
tools:text="1" />
android:layout_height="wrap_content">
<ImageView
android:id="@+id/day_monthly_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/day_monthly_event_id"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/day_monthly_event_id" />
<TextView
android:id="@+id/day_monthly_event_id"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="1dp"
android:layout_toEndOf="@+id/day_monthly_task_image"
android:ellipsize="none"
android:gravity="start"
android:hyphenationFrequency="none"
android:maxLines="1"
android:paddingStart="@dimen/tiny_margin"
android:paddingEnd="@dimen/tiny_margin"
android:textSize="@dimen/day_monthly_text_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/day_monthly_task_image"
app:layout_constraintTop_toTopOf="parent"
tools:targetApi="m"
tools:text="My event" />
</androidx.constraintlayout.widget.ConstraintLayout>