show a Task icon at tasks at some views
This commit is contained in:
parent
213c6e444b
commit
d4994d5ed4
|
@ -1,9 +1,9 @@
|
||||||
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 androidx.constraintlayout.widget.ConstraintLayout
|
||||||
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
|
||||||
|
@ -11,7 +11,9 @@ import com.simplemobiletools.calendar.pro.extensions.*
|
||||||
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.*
|
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||||
|
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
|
||||||
|
@ -25,6 +27,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
|
||||||
private val replaceDescriptionWithLocation = activity.config.replaceDescription
|
private val replaceDescriptionWithLocation = activity.config.replaceDescription
|
||||||
private val dimPastEvents = activity.config.dimPastEvents
|
private val dimPastEvents = activity.config.dimPastEvents
|
||||||
private var isPrintVersion = false
|
private var isPrintVersion = false
|
||||||
|
private val mediumMargin = activity.resources.getDimension(R.dimen.medium_margin).toInt()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setupDragListener(true)
|
setupDragListener(true)
|
||||||
|
@ -98,6 +101,15 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
|
||||||
event_item_time.setTextColor(newTextColor)
|
event_item_time.setTextColor(newTextColor)
|
||||||
event_item_title.setTextColor(newTextColor)
|
event_item_title.setTextColor(newTextColor)
|
||||||
event_item_description?.setTextColor(newTextColor)
|
event_item_description?.setTextColor(newTextColor)
|
||||||
|
event_item_task_image.applyColorFilter(newTextColor)
|
||||||
|
event_item_task_image.beVisibleIf(event.isTask())
|
||||||
|
|
||||||
|
val startMargin = if (event.isTask()) {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
mediumMargin
|
||||||
|
}
|
||||||
|
(event_item_title.layoutParams as ConstraintLayout.LayoutParams).marginStart = startMargin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.simplemobiletools.calendar.pro.adapters
|
||||||
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 androidx.constraintlayout.widget.ConstraintLayout
|
||||||
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
|
||||||
|
@ -38,6 +39,7 @@ class EventListAdapter(
|
||||||
private var use24HourFormat = activity.config.use24HourFormat
|
private var use24HourFormat = activity.config.use24HourFormat
|
||||||
private var currentItemsHash = listItems.hashCode()
|
private var currentItemsHash = listItems.hashCode()
|
||||||
private var isPrintVersion = false
|
private var isPrintVersion = false
|
||||||
|
private val mediumMargin = activity.resources.getDimension(R.dimen.medium_margin).toInt()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setupDragListener(true)
|
setupDragListener(true)
|
||||||
|
@ -165,6 +167,15 @@ class EventListAdapter(
|
||||||
event_item_time.setTextColor(newTextColor)
|
event_item_time.setTextColor(newTextColor)
|
||||||
event_item_title.setTextColor(newTextColor)
|
event_item_title.setTextColor(newTextColor)
|
||||||
event_item_description.setTextColor(newTextColor)
|
event_item_description.setTextColor(newTextColor)
|
||||||
|
event_item_task_image.applyColorFilter(newTextColor)
|
||||||
|
event_item_task_image.beVisibleIf(listEvent.isTask)
|
||||||
|
|
||||||
|
val startMargin = if (listEvent.isTask) {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
mediumMargin
|
||||||
|
}
|
||||||
|
(event_item_title.layoutParams as ConstraintLayout.LayoutParams).marginStart = startMargin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,22 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/event_item_title" />
|
app:layout_constraintTop_toTopOf="@id/event_item_title" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/event_item_task_image"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="@dimen/small_margin"
|
||||||
|
android:paddingTop="@dimen/small_margin"
|
||||||
|
android:paddingBottom="@dimen/small_margin"
|
||||||
|
android:src="@drawable/ic_task_vector"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/event_item_title"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/event_item_color_bar"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/event_item_title" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/event_item_title"
|
android:id="@+id/event_item_title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/medium_margin"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
@ -44,7 +55,7 @@
|
||||||
android:paddingBottom="@dimen/tiny_margin"
|
android:paddingBottom="@dimen/tiny_margin"
|
||||||
android:textSize="@dimen/day_text_size"
|
android:textSize="@dimen/day_text_size"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/event_item_color_bar"
|
app:layout_constraintStart_toEndOf="@+id/event_item_task_image"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="Event title" />
|
tools:text="Event title" />
|
||||||
|
|
||||||
|
@ -54,12 +65,13 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/event_item_title"
|
android:layout_below="@+id/event_item_title"
|
||||||
android:layout_alignStart="@+id/event_item_title"
|
android:layout_alignStart="@+id/event_item_title"
|
||||||
|
android:layout_marginStart="@dimen/medium_margin"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
android:paddingBottom="@dimen/small_margin"
|
android:paddingBottom="@dimen/small_margin"
|
||||||
android:textFontWeight="300"
|
android:textFontWeight="300"
|
||||||
android:textSize="@dimen/normal_text_size"
|
android:textSize="@dimen/normal_text_size"
|
||||||
app:layout_constraintStart_toStartOf="@+id/event_item_title"
|
app:layout_constraintStart_toEndOf="@+id/event_item_color_bar"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/event_item_title"
|
app:layout_constraintTop_toBottomOf="@+id/event_item_title"
|
||||||
tools:text="13:00" />
|
tools:text="13:00" />
|
||||||
|
|
||||||
|
@ -68,6 +80,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/event_item_title"
|
android:layout_below="@+id/event_item_title"
|
||||||
|
android:layout_marginStart="@dimen/medium_margin"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
|
@ -77,7 +90,7 @@
|
||||||
android:textFontWeight="300"
|
android:textFontWeight="300"
|
||||||
android:textSize="@dimen/normal_text_size"
|
android:textSize="@dimen/normal_text_size"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@+id/event_item_time"
|
app:layout_constraintStart_toEndOf="@+id/event_item_color_bar"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/event_item_time"
|
app:layout_constraintTop_toBottomOf="@+id/event_item_time"
|
||||||
tools:text="Event description" />
|
tools:text="Event description" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue