strike through completed tasks at all views
This commit is contained in:
parent
ee64a90b35
commit
f4c97b5e1e
|
@ -233,6 +233,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -249,6 +250,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -271,6 +273,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -287,6 +290,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -303,6 +307,7 @@ class WidgetListConfigureActivity : SimpleActivity() {
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
package com.simplemobiletools.calendar.pro.adapters
|
package com.simplemobiletools.calendar.pro.adapters
|
||||||
|
|
||||||
|
import android.graphics.Paint
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.simplemobiletools.calendar.pro.R
|
import com.simplemobiletools.calendar.pro.R
|
||||||
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
|
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
|
||||||
import com.simplemobiletools.calendar.pro.dialogs.DeleteEventDialog
|
import com.simplemobiletools.calendar.pro.dialogs.DeleteEventDialog
|
||||||
import com.simplemobiletools.calendar.pro.extensions.config
|
import com.simplemobiletools.calendar.pro.extensions.*
|
||||||
import com.simplemobiletools.calendar.pro.extensions.eventsHelper
|
|
||||||
import com.simplemobiletools.calendar.pro.extensions.handleEventDeleting
|
|
||||||
import com.simplemobiletools.calendar.pro.extensions.shareEvents
|
|
||||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||||
import com.simplemobiletools.calendar.pro.models.Event
|
import com.simplemobiletools.calendar.pro.models.Event
|
||||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
|
||||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
|
||||||
import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA
|
import com.simplemobiletools.commons.helpers.MEDIUM_ALPHA
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
|
@ -84,6 +80,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
|
||||||
event_item_holder.isSelected = selectedKeys.contains(event.id?.toInt())
|
event_item_holder.isSelected = selectedKeys.contains(event.id?.toInt())
|
||||||
event_item_holder.background.applyColorFilter(textColor)
|
event_item_holder.background.applyColorFilter(textColor)
|
||||||
event_item_title.text = event.title
|
event_item_title.text = event.title
|
||||||
|
event_item_title.checkViewStrikeThrough(event.isTaskCompleted())
|
||||||
event_item_time.text = if (event.getIsAllDay()) allDayString else Formatter.getTimeFromTS(context, event.startTS)
|
event_item_time.text = if (event.getIsAllDay()) allDayString else Formatter.getTimeFromTS(context, event.startTS)
|
||||||
if (event.startTS != event.endTS && !event.getIsAllDay()) {
|
if (event.startTS != event.endTS && !event.getIsAllDay()) {
|
||||||
event_item_time.text = "${event_item_time.text} - ${Formatter.getTimeFromTS(context, event.endTS)}"
|
event_item_time.text = "${event_item_time.text} - ${Formatter.getTimeFromTS(context, event.endTS)}"
|
||||||
|
|
|
@ -6,10 +6,7 @@ import android.view.ViewGroup
|
||||||
import com.simplemobiletools.calendar.pro.R
|
import com.simplemobiletools.calendar.pro.R
|
||||||
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
|
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
|
||||||
import com.simplemobiletools.calendar.pro.dialogs.DeleteEventDialog
|
import com.simplemobiletools.calendar.pro.dialogs.DeleteEventDialog
|
||||||
import com.simplemobiletools.calendar.pro.extensions.config
|
import com.simplemobiletools.calendar.pro.extensions.*
|
||||||
import com.simplemobiletools.calendar.pro.extensions.eventsHelper
|
|
||||||
import com.simplemobiletools.calendar.pro.extensions.handleEventDeleting
|
|
||||||
import com.simplemobiletools.calendar.pro.extensions.shareEvents
|
|
||||||
import com.simplemobiletools.calendar.pro.helpers.*
|
import com.simplemobiletools.calendar.pro.helpers.*
|
||||||
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
import com.simplemobiletools.calendar.pro.helpers.Formatter
|
||||||
import com.simplemobiletools.calendar.pro.models.ListEvent
|
import com.simplemobiletools.calendar.pro.models.ListEvent
|
||||||
|
@ -134,6 +131,7 @@ class EventListAdapter(
|
||||||
event_item_holder.isSelected = selectedKeys.contains(listEvent.hashCode())
|
event_item_holder.isSelected = selectedKeys.contains(listEvent.hashCode())
|
||||||
event_item_holder.background.applyColorFilter(textColor)
|
event_item_holder.background.applyColorFilter(textColor)
|
||||||
event_item_title.text = listEvent.title
|
event_item_title.text = listEvent.title
|
||||||
|
event_item_title.checkViewStrikeThrough(listEvent.isTaskCompleted)
|
||||||
event_item_time.text = if (listEvent.isAllDay) allDayString else Formatter.getTimeFromTS(context, listEvent.startTS)
|
event_item_time.text = if (listEvent.isAllDay) allDayString else Formatter.getTimeFromTS(context, listEvent.startTS)
|
||||||
if (listEvent.startTS != listEvent.endTS) {
|
if (listEvent.startTS != listEvent.endTS) {
|
||||||
if (!listEvent.isAllDay) {
|
if (!listEvent.isAllDay) {
|
||||||
|
|
|
@ -217,7 +217,8 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
|
||||||
it.location,
|
it.location,
|
||||||
it.isPastEvent,
|
it.isPastEvent,
|
||||||
it.repeatInterval > 0,
|
it.repeatInterval > 0,
|
||||||
it.isTask()
|
it.isTask(),
|
||||||
|
it.isTaskCompleted()
|
||||||
)
|
)
|
||||||
listItems.add(listEvent)
|
listItems.add(listEvent)
|
||||||
}
|
}
|
||||||
|
|
|
@ -555,7 +555,8 @@ fun Context.getEventListItems(events: List<Event>, addSectionDays: Boolean = tru
|
||||||
it.location,
|
it.location,
|
||||||
it.isPastEvent,
|
it.isPastEvent,
|
||||||
it.repeatInterval > 0,
|
it.repeatInterval > 0,
|
||||||
it.isTask()
|
it.isTask(),
|
||||||
|
it.isTaskCompleted()
|
||||||
)
|
)
|
||||||
listItems.add(listEvent)
|
listItems.add(listEvent)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package com.simplemobiletools.calendar.pro.extensions
|
package com.simplemobiletools.calendar.pro.extensions
|
||||||
|
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
|
import android.graphics.Paint
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.graphics.drawable.toBitmap
|
import androidx.core.graphics.drawable.toBitmap
|
||||||
|
import com.simplemobiletools.commons.extensions.addBit
|
||||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||||
|
import com.simplemobiletools.commons.extensions.removeBit
|
||||||
|
|
||||||
fun TextView.addResizedBackgroundDrawable(res: Resources, drawableHeight: Int, primaryColor: Int, drawableId: Int) {
|
fun TextView.addResizedBackgroundDrawable(res: Resources, drawableHeight: Int, primaryColor: Int, drawableId: Int) {
|
||||||
val baseDrawable = res.getDrawable(drawableId).toBitmap(drawableHeight, drawableHeight)
|
val baseDrawable = res.getDrawable(drawableId).toBitmap(drawableHeight, drawableHeight)
|
||||||
|
@ -12,3 +15,11 @@ fun TextView.addResizedBackgroundDrawable(res: Resources, drawableHeight: Int, p
|
||||||
scaledDrawable.applyColorFilter(primaryColor)
|
scaledDrawable.applyColorFilter(primaryColor)
|
||||||
background = scaledDrawable
|
background = scaledDrawable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun TextView.checkViewStrikeThrough(addFlag: Boolean) {
|
||||||
|
paintFlags = if (addFlag) {
|
||||||
|
paintFlags.addBit(Paint.STRIKE_THRU_TEXT_FLAG)
|
||||||
|
} else {
|
||||||
|
paintFlags.removeBit(Paint.STRIKE_THRU_TEXT_FLAG)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -546,6 +546,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||||
background = ColorDrawable(backgroundColor)
|
background = ColorDrawable(backgroundColor)
|
||||||
setTextColor(textColor)
|
setTextColor(textColor)
|
||||||
text = event.title
|
text = event.title
|
||||||
|
checkViewStrikeThrough(event.isTaskCompleted())
|
||||||
contentDescription = text
|
contentDescription = text
|
||||||
dayColumn.addView(this)
|
dayColumn.addView(this)
|
||||||
y = currentEventWeeklyView!!.range.lower * minuteHeight
|
y = currentEventWeeklyView!!.range.lower * minuteHeight
|
||||||
|
|
|
@ -142,7 +142,7 @@ data class Event(
|
||||||
fun getIsAllDay() = flags and FLAG_ALL_DAY != 0
|
fun getIsAllDay() = flags and FLAG_ALL_DAY != 0
|
||||||
fun hasMissingYear() = flags and FLAG_MISSING_YEAR != 0
|
fun hasMissingYear() = flags and FLAG_MISSING_YEAR != 0
|
||||||
fun isTask() = type == TYPE_TASK
|
fun isTask() = type == TYPE_TASK
|
||||||
fun isTaskCompleted() = flags and FLAG_TASK_COMPLETED != 0
|
fun isTaskCompleted() = isTask() && flags and FLAG_TASK_COMPLETED != 0
|
||||||
|
|
||||||
fun getReminders() = listOf(
|
fun getReminders() = listOf(
|
||||||
Reminder(reminder1Minutes, reminder1Type),
|
Reminder(reminder1Minutes, reminder1Type),
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
package com.simplemobiletools.calendar.pro.models
|
package com.simplemobiletools.calendar.pro.models
|
||||||
|
|
||||||
data class ListEvent(var id: Long, var startTS: Long, var endTS: Long, var title: String, var description: String, var isAllDay: Boolean, var color: Int,
|
data class ListEvent(
|
||||||
var location: String, var isPastEvent: Boolean, var isRepeatable: Boolean, var isTask: Boolean) : ListItem()
|
var id: Long, var startTS: Long, var endTS: Long, var title: String, var description: String, var isAllDay: Boolean, var color: Int,
|
||||||
|
var location: String, var isPastEvent: Boolean, var isRepeatable: Boolean, var isTask: Boolean, var isTaskCompleted: Boolean
|
||||||
|
) : ListItem()
|
||||||
|
|
|
@ -1,4 +1,16 @@
|
||||||
package com.simplemobiletools.calendar.pro.models
|
package com.simplemobiletools.calendar.pro.models
|
||||||
|
|
||||||
data class MonthViewEvent(val id: Long, val title: String, val startTS: Long, val endTS: Long, val color: Int, val startDayIndex: Int, val daysCnt: Int, val originalStartDayIndex: Int,
|
data class MonthViewEvent(
|
||||||
val isAllDay: Boolean, val isPastEvent: Boolean)
|
val id: Long,
|
||||||
|
val title: String,
|
||||||
|
val startTS: Long,
|
||||||
|
val endTS: Long,
|
||||||
|
val color: Int,
|
||||||
|
val startDayIndex: Int,
|
||||||
|
val daysCnt: Int,
|
||||||
|
val originalStartDayIndex: Int,
|
||||||
|
val isAllDay: Boolean,
|
||||||
|
val isPastEvent: Boolean,
|
||||||
|
val isTask: Boolean,
|
||||||
|
val isTaskCompleted: Boolean
|
||||||
|
)
|
||||||
|
|
|
@ -122,7 +122,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
||||||
val validDayEvent = isDayValid(event, day.code)
|
val validDayEvent = isDayValid(event, day.code)
|
||||||
if ((lastEvent == null || lastEvent.startDayIndex + daysCnt <= day.indexOnMonthView) && !validDayEvent) {
|
if ((lastEvent == null || lastEvent.startDayIndex + daysCnt <= day.indexOnMonthView) && !validDayEvent) {
|
||||||
val monthViewEvent = MonthViewEvent(event.id!!, event.title, event.startTS, event.endTS, event.color, day.indexOnMonthView,
|
val monthViewEvent = MonthViewEvent(event.id!!, event.title, event.startTS, event.endTS, event.color, day.indexOnMonthView,
|
||||||
daysCnt, day.indexOnMonthView, event.getIsAllDay(), event.isPastEvent)
|
daysCnt, day.indexOnMonthView, event.getIsAllDay(), event.isPastEvent, event.isTask(), event.isTaskCompleted())
|
||||||
allEvents.add(monthViewEvent)
|
allEvents.add(monthViewEvent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,6 +331,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
||||||
|
|
||||||
val curPaint = Paint(eventTitlePaint)
|
val curPaint = Paint(eventTitlePaint)
|
||||||
curPaint.color = paintColor
|
curPaint.color = paintColor
|
||||||
|
curPaint.isStrikeThruText = event.isTaskCompleted
|
||||||
return curPaint
|
return curPaint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue