replace the event type color dot with a bar on the left side

This commit is contained in:
tibbi
2018-09-10 16:13:16 +02:00
parent d9f3a350cd
commit 62f6aa0d18
14 changed files with 87 additions and 74 deletions

View File

@ -71,7 +71,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
event_item_description.text = if (replaceDescriptionWithLocation) event.location else event.description
event_item_start.text = if (event.getIsAllDay()) allDayString else Formatter.getTimeFromTS(context, event.startTS)
event_item_end.beInvisibleIf(event.startTS == event.endTS)
event_item_color.applyColorFilter(event.color)
event_item_color_bar.background.applyColorFilter(event.color)
if (event.startTS != event.endTS) {
val startCode = Formatter.getDayCodeFromTS(event.startTS)

View File

@ -136,7 +136,7 @@ class EventListAdapter(activity: SimpleActivity, var listItems: ArrayList<ListIt
event_item_description?.text = if (replaceDescription) listEvent.location else listEvent.description
event_item_start.text = if (listEvent.isAllDay) allDayString else Formatter.getTimeFromTS(context, listEvent.startTS)
event_item_end?.beInvisibleIf(listEvent.startTS == listEvent.endTS)
event_item_color.applyColorFilter(listEvent.color)
event_item_color_bar.background.applyColorFilter(listEvent.color)
if (listEvent.startTS != listEvent.endTS) {
event_item_end?.apply {

View File

@ -17,7 +17,7 @@ import com.simplemobiletools.calendar.models.ListEvent
import com.simplemobiletools.calendar.models.ListItem
import com.simplemobiletools.calendar.models.ListSection
import com.simplemobiletools.commons.extensions.adjustAlpha
import com.simplemobiletools.commons.extensions.getColoredBitmap
import com.simplemobiletools.commons.extensions.setBackgroundColor
import com.simplemobiletools.commons.extensions.setText
import com.simplemobiletools.commons.extensions.setTextSize
import org.joda.time.DateTime
@ -59,7 +59,7 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
setText(R.id.event_item_title, item.title)
setText(R.id.event_item_description, if (replaceDescription) item.location else item.description)
setText(R.id.event_item_start, if (item.isAllDay) allDayString else Formatter.getTimeFromTS(context, item.startTS))
setImageViewBitmap(R.id.event_item_color, context.resources.getColoredBitmap(R.drawable.monthly_event_dot, item.color))
setBackgroundColor(R.id.event_item_color_bar, item.color)
if (item.startTS == item.endTS) {
setViewVisibility(R.id.event_item_end, View.INVISIBLE)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 437 B

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="@dimen/event_color_bar_width"
android:height="@dimen/event_color_bar_height"/>
<solid
android:color="@color/white"/>
<corners android:radius="@dimen/small_margin"/>
</shape>

View File

@ -18,10 +18,22 @@
android:paddingBottom="@dimen/medium_margin"
android:paddingTop="@dimen/medium_margin">
<ImageView
android:id="@+id/event_item_color_bar"
android:layout_width="@dimen/event_color_bar_width"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_item_description"
android:layout_alignTop="@+id/event_item_title"
android:layout_marginRight="@dimen/small_margin"
android:background="@drawable/event_list_color_bar"
android:paddingBottom="@dimen/tiny_margin"
android:paddingTop="@dimen/tiny_margin"/>
<TextView
android:id="@+id/event_item_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/event_item_color_bar"
android:textSize="@dimen/day_text_size"
tools:text="13:00"/>
@ -30,6 +42,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_item_start"
android:layout_toRightOf="@+id/event_item_color_bar"
android:text="15:00"
android:textSize="@dimen/day_text_size"/>
@ -38,7 +51,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_margin"
android:layout_toLeftOf="@+id/event_item_color"
android:layout_toRightOf="@+id/event_item_start"
android:ellipsize="end"
android:maxLines="1"
@ -52,7 +64,6 @@
android:layout_height="wrap_content"
android:layout_below="@+id/event_item_title"
android:layout_marginLeft="@dimen/activity_margin"
android:layout_toLeftOf="@+id/event_item_color"
android:layout_toRightOf="@+id/event_item_end"
android:ellipsize="end"
android:maxLines="1"
@ -60,16 +71,5 @@
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>
</FrameLayout>

View File

@ -16,14 +16,25 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/medium_margin"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/small_margin">
<ImageView
android:id="@+id/event_item_color_bar"
android:layout_width="@dimen/event_color_bar_width"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_item_end"
android:layout_alignTop="@+id/event_item_start"
android:layout_marginRight="@dimen/small_margin"
android:background="@drawable/event_list_color_bar"
android:paddingBottom="@dimen/tiny_margin"
android:paddingTop="@dimen/tiny_margin"/>
<TextView
android:id="@+id/event_item_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/event_item_color_bar"
android:textSize="@dimen/day_text_size"
tools:text="13:00"/>
@ -32,6 +43,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_item_start"
android:layout_toRightOf="@+id/event_item_color_bar"
android:includeFontPadding="false"
android:text="15:00"
android:textSize="@dimen/day_text_size"/>
@ -41,7 +53,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_margin"
android:layout_toLeftOf="@+id/event_item_color"
android:layout_toRightOf="@+id/event_item_start"
android:ellipsize="end"
android:maxLines="1"
@ -55,7 +66,6 @@
android:layout_height="wrap_content"
android:layout_below="@+id/event_item_title"
android:layout_marginLeft="@dimen/activity_margin"
android:layout_toLeftOf="@+id/event_item_color"
android:layout_toRightOf="@+id/event_item_end"
android:ellipsize="end"
android:includeFontPadding="false"
@ -64,16 +74,5 @@
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/medium_margin"
android:src="@drawable/monthly_event_dot"/>
</RelativeLayout>
</FrameLayout>

View File

@ -16,14 +16,25 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/medium_margin"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/small_margin">
<ImageView
android:id="@+id/event_item_color_bar"
android:layout_width="@dimen/event_color_bar_width"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_item_start"
android:layout_alignTop="@+id/event_item_start"
android:layout_marginRight="@dimen/small_margin"
android:background="@drawable/event_list_color_bar"
android:paddingBottom="@dimen/tiny_margin"
android:paddingTop="@dimen/tiny_margin"/>
<TextView
android:id="@+id/event_item_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/event_item_color_bar"
android:textSize="@dimen/day_text_size"
tools:text="13:00"/>
@ -32,7 +43,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_margin"
android:layout_toLeftOf="@+id/event_item_color"
android:layout_toRightOf="@+id/event_item_start"
android:ellipsize="end"
android:maxLines="1"
@ -40,16 +50,5 @@
android:textSize="@dimen/day_text_size"
tools:text="Event title"/>
<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/medium_margin"
android:src="@drawable/monthly_event_dot"/>
</RelativeLayout>
</FrameLayout>

View File

@ -7,20 +7,31 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/medium_margin">
<ImageView
android:id="@+id/event_item_color_bar"
android:layout_width="@dimen/event_color_bar_width"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_item_end"
android:layout_alignTop="@+id/event_item_start"
android:layout_marginRight="@dimen/small_margin"
android:background="@drawable/event_list_color_bar"
android:paddingBottom="@dimen/tiny_margin"
android:paddingTop="@dimen/tiny_margin"/>
<TextView
android:id="@+id/event_item_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/medium_margin"
android:textSize="@dimen/day_text_size"
tools:text="13:00"/>
android:layout_toRightOf="@+id/event_item_color_bar"
android:text="13:00"
android:textSize="@dimen/day_text_size"/>
<TextView
android:id="@+id/event_item_end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_item_start"
android:layout_marginLeft="@dimen/medium_margin"
android:layout_toRightOf="@+id/event_item_color_bar"
android:includeFontPadding="false"
android:text="15:00"
android:textSize="@dimen/day_text_size"/>
@ -30,7 +41,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/normal_margin"
android:layout_toLeftOf="@+id/event_item_color"
android:layout_toRightOf="@+id/event_item_start"
android:ellipsize="end"
android:maxLines="1"
@ -44,7 +54,6 @@
android:layout_height="wrap_content"
android:layout_below="@+id/event_item_title"
android:layout_marginLeft="@dimen/normal_margin"
android:layout_toLeftOf="@+id/event_item_color"
android:layout_toRightOf="@+id/event_item_end"
android:ellipsize="end"
android:includeFontPadding="false"
@ -53,15 +62,4 @@
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/medium_margin"
android:src="@drawable/monthly_event_dot"/>
</RelativeLayout>

View File

@ -7,11 +7,22 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/medium_margin">
<ImageView
android:id="@+id/event_item_color_bar"
android:layout_width="@dimen/event_color_bar_width"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_item_start"
android:layout_alignTop="@+id/event_item_start"
android:layout_marginRight="@dimen/small_margin"
android:background="@drawable/event_list_color_bar"
android:paddingBottom="@dimen/tiny_margin"
android:paddingTop="@dimen/tiny_margin"/>
<TextView
android:id="@+id/event_item_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/medium_margin"
android:layout_toRightOf="@+id/event_item_color_bar"
android:textSize="@dimen/day_text_size"
tools:text="13:00"/>
@ -20,7 +31,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/normal_margin"
android:layout_toLeftOf="@+id/event_item_color"
android:layout_toRightOf="@+id/event_item_start"
android:ellipsize="end"
android:maxLines="1"
@ -28,15 +38,4 @@
android:textSize="@dimen/day_text_size"
tools:text="Event title"/>
<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/medium_margin"
android:src="@drawable/monthly_event_dot"/>
</RelativeLayout>

View File

@ -25,4 +25,7 @@
<dimen name="month_text_size">22sp</dimen>
<dimen name="year_view_day_text_size">8sp</dimen>
<dimen name="event_color_bar_width">4dp</dimen>
<dimen name="event_color_bar_height">100dp</dimen>
</resources>