mark tasks at the weekly view too
This commit is contained in:
parent
daf7f8cd70
commit
26c0a55d19
|
@ -14,6 +14,7 @@ import android.widget.ImageView
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.collection.LongSparseArray
|
import androidx.collection.LongSparseArray
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.simplemobiletools.calendar.pro.R
|
import com.simplemobiletools.calendar.pro.R
|
||||||
import com.simplemobiletools.calendar.pro.extensions.*
|
import com.simplemobiletools.calendar.pro.extensions.*
|
||||||
|
@ -31,6 +32,7 @@ import com.simplemobiletools.commons.models.RadioItem
|
||||||
import com.simplemobiletools.commons.views.MyTextView
|
import com.simplemobiletools.commons.views.MyTextView
|
||||||
import kotlinx.android.synthetic.main.fragment_week.*
|
import kotlinx.android.synthetic.main.fragment_week.*
|
||||||
import kotlinx.android.synthetic.main.fragment_week.view.*
|
import kotlinx.android.synthetic.main.fragment_week.view.*
|
||||||
|
import kotlinx.android.synthetic.main.week_event_marker.view.*
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
import org.joda.time.Days
|
import org.joda.time.Days
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -534,7 +536,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||||
}
|
}
|
||||||
|
|
||||||
val dayColumn = dayColumns[dayOfWeek]
|
val dayColumn = dayColumns[dayOfWeek]
|
||||||
(inflater.inflate(R.layout.week_event_marker, null, false) as TextView).apply {
|
(inflater.inflate(R.layout.week_event_marker, null, false) as ConstraintLayout).apply {
|
||||||
var backgroundColor = eventTypeColors.get(event.eventType, primaryColor)
|
var backgroundColor = eventTypeColors.get(event.eventType, primaryColor)
|
||||||
var textColor = backgroundColor.getContrastColor()
|
var textColor = backgroundColor.getContrastColor()
|
||||||
val currentEventWeeklyView = eventTimeRanges[currentDayCode]!!.get(event.id)
|
val currentEventWeeklyView = eventTimeRanges[currentDayCode]!!.get(event.id)
|
||||||
|
@ -544,12 +546,28 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||||
}
|
}
|
||||||
|
|
||||||
background = ColorDrawable(backgroundColor)
|
background = ColorDrawable(backgroundColor)
|
||||||
setTextColor(textColor)
|
|
||||||
text = event.title
|
|
||||||
checkViewStrikeThrough(event.isTaskCompleted())
|
|
||||||
contentDescription = text
|
|
||||||
dayColumn.addView(this)
|
dayColumn.addView(this)
|
||||||
y = currentEventWeeklyView!!.range.lower * minuteHeight
|
y = currentEventWeeklyView!!.range.lower * minuteHeight
|
||||||
|
|
||||||
|
week_event_task_image.beVisibleIf(event.isTask())
|
||||||
|
if (event.isTask()) {
|
||||||
|
week_event_task_image.applyColorFilter(textColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
week_event_label.apply {
|
||||||
|
setTextColor(textColor)
|
||||||
|
maxLines = if (event.isTask()) 1 else 3
|
||||||
|
text = event.title
|
||||||
|
checkViewStrikeThrough(event.isTaskCompleted())
|
||||||
|
contentDescription = text
|
||||||
|
|
||||||
|
minHeight = if (event.startTS == event.endTS) {
|
||||||
|
minimalHeight
|
||||||
|
} else {
|
||||||
|
((currentEventWeeklyView.range.upper - currentEventWeeklyView.range.lower) * minuteHeight).toInt() - 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
(layoutParams as RelativeLayout.LayoutParams).apply {
|
(layoutParams as RelativeLayout.LayoutParams).apply {
|
||||||
width = (dayColumn.width - 1) / currentEventWeeklyView.slot_max
|
width = (dayColumn.width - 1) / currentEventWeeklyView.slot_max
|
||||||
x = (width * (currentEventWeeklyView.slot - 1)).toFloat()
|
x = (width * (currentEventWeeklyView.slot - 1)).toFloat()
|
||||||
|
@ -557,12 +575,6 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||||
x += density
|
x += density
|
||||||
width -= density
|
width -= density
|
||||||
}
|
}
|
||||||
|
|
||||||
minHeight = if (event.startTS == event.endTS) {
|
|
||||||
minimalHeight
|
|
||||||
} else {
|
|
||||||
((currentEventWeeklyView.range.upper - currentEventWeeklyView.range.lower) * minuteHeight).toInt() - 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
|
|
|
@ -1,10 +1,37 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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/week_event_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="3"
|
<ImageView
|
||||||
android:paddingStart="@dimen/tiny_margin"
|
android:id="@+id/week_event_task_image"
|
||||||
android:paddingEnd="@dimen/tiny_margin"
|
android:layout_width="wrap_content"
|
||||||
android:textColor="@android:color/white"
|
android:layout_height="0dp"
|
||||||
android:textSize="@dimen/small_text_size" />
|
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="3"
|
||||||
|
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>
|
||||||
|
|
Loading…
Reference in New Issue