add colored dots to the widget list too

This commit is contained in:
tibbi 2017-08-24 12:13:41 +02:00
parent 00e7d46be2
commit 91aeeee2bc
3 changed files with 19 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import com.simplemobiletools.calendar.helpers.Formatter
import com.simplemobiletools.calendar.models.ListEvent
import com.simplemobiletools.calendar.models.ListItem
import com.simplemobiletools.calendar.models.ListSection
import com.simplemobiletools.commons.extensions.getColoredIcon
import org.joda.time.DateTime
import java.util.*
@ -39,6 +40,7 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
setTextViewText(R.id.event_item_title, item.title)
setTextViewText(R.id.event_item_description, item.description)
setTextViewText(R.id.event_item_start, if (item.isAllDay) allDayString else Formatter.getTimeFromTS(context, item.startTS))
setImageViewBitmap(R.id.event_item_color, context.resources.getColoredIcon(textColor, R.drawable.monthly_event_dot))
if (item.startTS == item.endTS) {
setViewVisibility(R.id.event_item_end, View.INVISIBLE)

View File

@ -1,11 +1,13 @@
package com.simplemobiletools.calendar.adapters
import android.content.Context
import android.graphics.PorterDuff
import android.graphics.drawable.Drawable
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.ImageView
import android.widget.TextView
import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.helpers.Formatter
@ -67,6 +69,7 @@ class EventListWidgetAdapterOld(val context: Context, val mEvents: List<ListItem
end?.setTextColor(mTextColor)
title.setTextColor(mTextColor)
description?.setTextColor(mTextColor)
color?.setColorFilter(mTextColor, PorterDuff.Mode.SRC_IN)
}
} else {
val item = mEvents[position] as ListSection
@ -100,5 +103,6 @@ class EventListWidgetAdapterOld(val context: Context, val mEvents: List<ListItem
val description: TextView? = view.event_item_description
val start: TextView? = view.event_item_start
val end: TextView? = view.event_item_end
val color: ImageView? = view.event_item_color
}
}

View File

@ -28,6 +28,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/big_margin"
android:layout_toLeftOf="@+id/event_item_color"
android:layout_toRightOf="@+id/event_item_start"
android:ellipsize="end"
android:maxLines="1"
@ -41,6 +42,7 @@
android:layout_height="wrap_content"
android:layout_below="@+id/event_item_title"
android:layout_marginLeft="@dimen/big_margin"
android:layout_toLeftOf="@+id/event_item_color"
android:layout_toRightOf="@+id/event_item_end"
android:alpha=".4"
android:ellipsize="end"
@ -49,4 +51,15 @@
android:textSize="@dimen/day_text_size"
tools:text="Event description"/>
<ImageView
android:id="@+id/event_item_color"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_item_title"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/event_item_title"
android:paddingRight="@dimen/activity_margin"
android:src="@drawable/monthly_event_dot"/>
</RelativeLayout>