add a current time indicator at weekly view
This commit is contained in:
parent
af7e632431
commit
1a77566eb1
|
@ -42,6 +42,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
private var wasExtraHeightAdded = false
|
||||
private var clickStartTime = 0L
|
||||
private var selectedGrid: View? = null
|
||||
private var todayColumnIndex = -1
|
||||
|
||||
lateinit var inflater: LayoutInflater
|
||||
lateinit var mView: View
|
||||
|
@ -128,6 +129,8 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
(mView.findViewById(mRes.getIdentifier("week_day_label_$i", "id", context.packageName)) as TextView).apply {
|
||||
text = "$dayLetter\n${curDay.dayOfMonth}"
|
||||
setTextColor(if (todayCode == dayCode) primaryColor else textColor)
|
||||
if (todayCode == dayCode)
|
||||
todayColumnIndex = i
|
||||
}
|
||||
curDay = curDay.plusDays(1)
|
||||
}
|
||||
|
@ -252,6 +255,23 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
if (!hadAllDayEvent) {
|
||||
checkTopHolderHeight()
|
||||
}
|
||||
|
||||
if (todayColumnIndex != -1) {
|
||||
val minutes = DateTime().minuteOfDay
|
||||
val todayColumn = getColumnWithId(todayColumnIndex)
|
||||
inflater.inflate(R.layout.week_now_marker, null, false).apply {
|
||||
background = ColorDrawable(primaryColor)
|
||||
activity.runOnUiThread {
|
||||
mView.week_events_holder.addView(this)
|
||||
x = todayColumn.x
|
||||
y = minutes.toFloat()
|
||||
(layoutParams as RelativeLayout.LayoutParams).apply {
|
||||
width = todayColumn.width - 1
|
||||
height = resources.getDimension(R.dimen.weekly_view_now_height).toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkTopHolderHeight() {
|
||||
|
|
|
@ -206,7 +206,6 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_default_reminder_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -5,6 +5,12 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/week_vertical_grid_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"/>
|
||||
|
||||
<com.simplemobiletools.calendar.views.MyScrollView
|
||||
android:id="@+id/week_events_scrollview"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -75,16 +81,9 @@
|
|||
android:layout_weight="1"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</com.simplemobiletools.calendar.views.MyScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/week_vertical_grid_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/week_top_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
|
@ -8,6 +8,7 @@
|
|||
<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>
|
||||
<dimen name="weekly_view_now_height">5dp</dimen>
|
||||
|
||||
<dimen name="min_widget_width">250dp</dimen>
|
||||
<dimen name="min_widget_height">250dp</dimen>
|
||||
|
|
Loading…
Reference in New Issue