set up the weekly view hour height dynamically too
This commit is contained in:
parent
7062cc3b49
commit
def42889dc
|
@ -62,6 +62,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||
private fun setupFragment() {
|
||||
val weekTSs = getWeekTimestamps(currentWeekTS)
|
||||
val weeklyAdapter = MyWeekPagerAdapter(activity!!.supportFragmentManager, weekTSs, this)
|
||||
val itemHeight = context!!.config.weeklyViewItemHeight.toInt()
|
||||
|
||||
val textColor = context!!.config.textColor
|
||||
weekHolder!!.week_view_hours_holder.removeAllViews()
|
||||
|
@ -71,6 +72,7 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||
(layoutInflater.inflate(R.layout.weekly_view_hour_textview, null, false) as TextView).apply {
|
||||
text = formattedHours
|
||||
setTextColor(textColor)
|
||||
height = itemHeight
|
||||
weekHolder!!.week_view_hours_holder.addView(this)
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +109,14 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||
updateActionBarTitle()
|
||||
}
|
||||
|
||||
private fun updateRowHeight() {
|
||||
val childCnt = weekHolder!!.week_view_hours_holder.childCount
|
||||
for (i in 0..childCnt) {
|
||||
val textView = weekHolder!!.week_view_hours_holder.getChildAt(i) as? TextView ?: continue
|
||||
textView.layoutParams.height = context!!.config.weeklyViewItemHeight.toInt()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getWeekTimestamps(targetSeconds: Long): List<Long> {
|
||||
val weekTSs = ArrayList<Long>(PREFILLED_WEEKS)
|
||||
val dateTime = Formatter.getDateTimeFromTS(targetSeconds)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:minHeight="@dimen/weekly_view_row_height"
|
||||
android:paddingStart="@dimen/small_margin"
|
||||
android:paddingEnd="@dimen/small_margin"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
|
|
Loading…
Reference in New Issue