adding a list view under the monthly one

This commit is contained in:
tibbi 2021-02-21 23:49:06 +01:00
parent 01177ef0f9
commit 159f08d24c
3 changed files with 31 additions and 11 deletions

View File

@ -6,7 +6,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.RelativeLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.fragment.app.Fragment
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.extensions.config
@ -32,7 +32,7 @@ class MonthDayFragment : Fragment(), MonthlyCalendar {
var listener: NavigationListener? = null
lateinit var mRes: Resources
lateinit var mHolder: RelativeLayout
lateinit var mHolder: ConstraintLayout
lateinit var mConfig: Config
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {

View File

@ -216,12 +216,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
private fun measureDaySize(canvas: Canvas) {
dayWidth = (canvas.width - horizontalOffset) / 7f
dayHeight = if (isMonthDayView) {
weekDaysLetterHeight * 1.2f
} else {
(canvas.height - weekDaysLetterHeight) / ROW_COUNT.toFloat()
}
dayHeight = (canvas.height - weekDaysLetterHeight) / ROW_COUNT.toFloat()
val availableHeightForEvents = dayHeight.toInt() - weekDaysLetterHeight
maxEventsPerDay = availableHeightForEvents / eventTitleHeight
}

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/month_day_calendar_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -8,6 +9,30 @@
<com.simplemobiletools.calendar.pro.views.MonthViewWrapper
android:id="@+id/month_day_view_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/month_day_events_list"
app:layout_constraintHeight_percent="0.3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</RelativeLayout>
<include
android:id="@+id/month_day_view_divider"
layout="@layout/divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@+id/month_day_view_wrapper"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/month_day_view_wrapper" />
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/month_day_events_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clipToPadding="false"
android:overScrollMode="never"
android:scrollbars="vertical"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"
app:layout_constraintHeight_percent="0.7"
app:layout_constraintTop_toBottomOf="@+id/month_day_view_wrapper" />
</androidx.constraintlayout.widget.ConstraintLayout>