replace underlining at monthly view with dot

This commit is contained in:
tibbi 2017-02-05 19:15:57 +01:00
parent 4a42e7baef
commit 2af5850de6
12 changed files with 88 additions and 47 deletions

View File

@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.fragments
import android.content.Intent
import android.content.res.Resources
import android.graphics.Paint
import android.graphics.PorterDuff
import android.os.Bundle
import android.support.v4.app.Fragment
@ -21,7 +20,10 @@ import com.simplemobiletools.calendar.helpers.*
import com.simplemobiletools.calendar.interfaces.MonthlyCalendar
import com.simplemobiletools.calendar.interfaces.NavigationListener
import com.simplemobiletools.calendar.models.Day
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.adjustAlpha
import com.simplemobiletools.commons.extensions.beGone
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.setupDialogStuff
import kotlinx.android.synthetic.main.first_row.*
import kotlinx.android.synthetic.main.fragment_month.view.*
import kotlinx.android.synthetic.main.top_navigation.view.*
@ -168,8 +170,15 @@ class MonthFragment : Fragment(), MonthlyCalendar {
}
}
val weakerText = mTextColor.adjustAlpha(MEDIUM_ALPHA)
val todayCircle = resources.getDrawable(R.drawable.circle_empty)
todayCircle.setColorFilter(mTextColor, PorterDuff.Mode.SRC_IN)
todayCircle.setColorFilter(weakerText, PorterDuff.Mode.SRC_IN)
val eventDot = resources.getDrawable(R.drawable.monthly_day_dot)
eventDot.setColorFilter(weakerText, PorterDuff.Mode.SRC_IN)
val todayWithEvent = resources.getDrawable(R.drawable.monthly_day_with_event_today)
todayWithEvent.setColorFilter(weakerText, PorterDuff.Mode.SRC_IN)
for (i in 0..len - 1) {
val day = days[i]
@ -184,8 +193,17 @@ class MonthFragment : Fragment(), MonthlyCalendar {
setTextColor(curTextColor)
setOnClickListener { openDay(day.code) }
paintFlags = if (day.hasEvent) (paintFlags or Paint.UNDERLINE_TEXT_FLAG) else (paintFlags.removeFlag(Paint.UNDERLINE_TEXT_FLAG))
background = if (day.isToday) todayCircle else null
background = if (!day.isThisMonth) {
null
} else if (day.isToday && day.hasEvent) {
todayWithEvent
} else if (day.isToday) {
todayCircle
} else if (day.hasEvent) {
eventDot
} else {
null
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="bottom|center_horizontal"
android:src="@drawable/monthly_event_dot"
android:tileMode="disabled"/>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/monthly_event_dot"
android:gravity="bottom|center_horizontal"/>
</layer-list>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/monthly_day_dot"
android:gravity="bottom|center_horizontal"/>
<item android:drawable="@drawable/circle_empty"/>
</layer-list>

View File

@ -39,49 +39,49 @@
android:id="@+id/day_0"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_1"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_2"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_3"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_4"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_5"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_6"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
</LinearLayout>
@ -103,49 +103,49 @@
android:id="@+id/day_7"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_8"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_9"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_10"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_11"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_12"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_13"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
</LinearLayout>
@ -167,49 +167,49 @@
android:id="@+id/day_14"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_15"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_16"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_17"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_18"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_19"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_20"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
</LinearLayout>
@ -231,49 +231,49 @@
android:id="@+id/day_21"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_22"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_23"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_24"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_25"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_26"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_27"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
</LinearLayout>
@ -295,49 +295,49 @@
android:id="@+id/day_28"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_29"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_30"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_31"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_32"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_33"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_34"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
</LinearLayout>
@ -359,49 +359,49 @@
android:id="@+id/day_35"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_36"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_37"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_38"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_39"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_40"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/day_41"
style="@style/DayView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="@dimen/monthly_day_height"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>

View File

@ -2,6 +2,8 @@
<dimen name="min_widget_width">320dp</dimen>
<dimen name="min_widget_height">320dp</dimen>
<dimen name="monthly_day_height">60dp</dimen>
<dimen name="weekly_view_row_height">90dp</dimen>
<dimen name="weekly_view_row_minus_one_height">89dp</dimen>
<dimen name="weekly_view_events_height">2160dp</dimen> <!-- weekly_view_row_height * 24 hours -->

View File

@ -3,6 +3,8 @@
<dimen name="yearly_padding_half">3dp</dimen>
<dimen name="yearly_padding_full">6dp</dimen>
<dimen name="monthly_day_height">40dp</dimen>
<dimen name="weekly_view_row_height">60dp</dimen>
<dimen name="weekly_view_events_height">1440dp</dimen> <!-- weekly_view_row_height * 24 hours -->
<dimen name="weekly_view_minimal_event_height">10dp</dimen>