update the top weekly labels depending on the available width

This commit is contained in:
tibbi 2020-06-08 22:36:43 +02:00
parent f6132d53f9
commit 31d334ab1f
2 changed files with 11 additions and 1 deletions

View File

@ -199,10 +199,19 @@ class WeekFragment : Fragment(), WeeklyCalendar {
var curDay = Formatter.getDateTimeFromTS(weekTimestamp)
val textColor = config.textColor
val todayCode = Formatter.getDayCodeFromDateTime(DateTime())
val dayWidth = context!!.usableScreenSize.x / config.weeklyViewDays
val useLongerDayLabels = dayWidth > res.getDimension(R.dimen.weekly_view_min_day_label)
mView.week_letters_holder.removeAllViews()
for (i in 0 until config.weeklyViewDays) {
val dayCode = Formatter.getDayCodeFromDateTime(curDay)
val dayLetters = res.getStringArray(R.array.week_day_letters).toMutableList() as ArrayList<String>
val labelIDs = if (useLongerDayLabels) {
R.array.week_days_short
} else {
R.array.week_day_letters
}
val dayLetters = res.getStringArray(labelIDs).toMutableList() as ArrayList<String>
val dayLetter = dayLetters[curDay.dayOfWeek - 1]
val label = inflater.inflate(R.layout.weekly_view_day_letter, mView.week_letters_holder, false) as MyTextView

View File

@ -9,6 +9,7 @@
<dimen name="weekly_view_row_height">60dp</dimen>
<dimen name="weekly_view_minimal_event_height">10dp</dimen>
<dimen name="weekly_view_now_height">10dp</dimen>
<dimen name="weekly_view_min_day_label">60dp</dimen>
<dimen name="min_widget_width">250dp</dimen>
<dimen name="min_widget_height">250dp</dimen>