mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-21 14:10:51 +01:00
display both day date and day letter at the top
This commit is contained in:
parent
a9ec849a03
commit
a0cc3910e5
@ -59,11 +59,24 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||||||
var curDay = Formatter.getDateTimeFromTS(mWeekTimestamp)
|
var curDay = Formatter.getDateTimeFromTS(mWeekTimestamp)
|
||||||
for (i in 0..6) {
|
for (i in 0..6) {
|
||||||
val view = mView.findViewById(mRes.getIdentifier("week_day_label_$i", "id", context.packageName)) as TextView
|
val view = mView.findViewById(mRes.getIdentifier("week_day_label_$i", "id", context.packageName)) as TextView
|
||||||
view.text = curDay.dayOfMonth.toString()
|
val dayLetter = getDayLetter(curDay.dayOfWeek)
|
||||||
|
view.text = "$dayLetter\n${curDay.dayOfMonth}"
|
||||||
curDay = curDay.plusDays(1)
|
curDay = curDay.plusDays(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getDayLetter(pos: Int): String {
|
||||||
|
return mRes.getString(when (pos) {
|
||||||
|
1 -> R.string.monday_letter
|
||||||
|
2 -> R.string.tuesday_letter
|
||||||
|
3 -> R.string.wednesday_letter
|
||||||
|
4 -> R.string.thursday_letter
|
||||||
|
5 -> R.string.friday_letter
|
||||||
|
6 -> R.string.saturday_letter
|
||||||
|
else -> R.string.sunday_letter
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
mCalendar.updateWeeklyCalendar(mWeekTimestamp)
|
mCalendar.updateWeeklyCalendar(mWeekTimestamp)
|
||||||
|
@ -9,9 +9,11 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/week_letters_holder"
|
android:id="@+id/week_letters_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/weekly_view_day_letters_height"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:paddingBottom="@dimen/tiny_margin"
|
||||||
|
android:paddingTop="@dimen/tiny_margin">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/week_day_label_0"
|
android:id="@+id/week_day_label_0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user