Skip to content

Commit 66b31bf

Browse files
committed
Show day of week in match date item decoration
1 parent 1c7d0f3 commit 66b31bf

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

core/src/main/java/com/ricknout/rugbyranker/core/util/DateUtils.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ object DateUtils {
5050
const val DATE_FORMAT_YYYY_MM_DD = "yyyy-MM-dd"
5151
const val DATE_FORMAT_D_MMM_YYYY = "d MMM, yyyy"
5252
const val DATE_FORMAT_D_MMM = "d MMM"
53-
const val DATE_FORMAT_YYYY = "yyyy"
53+
const val DATE_FORMAT_E_YYYY = "E, yyyy"
5454
const val DATE_FORMAT_HH_MM = "HH:mm"
5555

5656
const val DAY_MILLIS = 1000L * 60L * 60L * 24L

core/src/main/res/values/attrs.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<attr name="android:fontFamily" />
1111
<attr name="datePaddingTop" format="dimension" />
1212
<attr name="dayMonthTextSize" format="dimension" />
13-
<attr name="yearTextSize" format="dimension" />
13+
<attr name="dayYearTextSize" format="dimension" />
1414
</declare-styleable>
1515

1616
<declare-styleable name="SpaceItemDecoration">

core/src/main/res/values/dimens.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<dimen name="text_size_headline_6">18sp</dimen>
2424
<dimen name="text_size_world_rugby_match_date_header_day_month">@dimen/text_size_headline_6</dimen>
25-
<dimen name="text_size_world_rugby_match_date_header_year">12sp</dimen>
25+
<dimen name="text_size_world_rugby_match_date_header_day_year">12sp</dimen>
2626

2727
<!-- Using a large value to ensure all content is shown on first show -->
2828
<dimen name="peek_height_bottom_sheet_modal">1000dp</dimen>

core/src/main/res/values/styles.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<item name="android:fontFamily">@font/rajdhani</item>
6464
<item name="datePaddingTop">@dimen/spacing_double</item>
6565
<item name="dayMonthTextSize">@dimen/text_size_world_rugby_match_date_header_day_month</item>
66-
<item name="yearTextSize">@dimen/text_size_world_rugby_match_date_header_year</item>
66+
<item name="dayYearTextSize">@dimen/text_size_world_rugby_match_date_header_day_year</item>
6767
</style>
6868

6969
<style name="ItemDecoration.RugbyRanker.Space" parent="">

matches/src/main/java/com/ricknout/rugbyranker/matches/ui/WorldRugbyMatchDateItemDecoration.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class WorldRugbyMatchDateItemDecoration(context: Context) : RecyclerView.ItemDec
4747
private var paddingEnd: Int = 0
4848
private var datePaddingTop: Int = 0
4949
private var dayMonthTextSize: Int = 0
50-
private var yearTextSize: Int = 0
50+
private var dayYearTextSize: Int = 0
5151

5252
private val today by lazy { context.getString(R.string.text_today) }
5353

@@ -73,7 +73,7 @@ class WorldRugbyMatchDateItemDecoration(context: Context) : RecyclerView.ItemDec
7373
paddingEnd = getDimensionPixelSizeOrThrow(R.styleable.WorldRugbyMatchDateItemDecoration_android_paddingEnd)
7474
datePaddingTop = getDimensionPixelSizeOrThrow(R.styleable.WorldRugbyMatchDateItemDecoration_datePaddingTop)
7575
dayMonthTextSize = getDimensionPixelSizeOrThrow(R.styleable.WorldRugbyMatchDateItemDecoration_dayMonthTextSize)
76-
yearTextSize = getDimensionPixelSizeOrThrow(R.styleable.WorldRugbyMatchDateItemDecoration_yearTextSize)
76+
dayYearTextSize = getDimensionPixelSizeOrThrow(R.styleable.WorldRugbyMatchDateItemDecoration_dayYearTextSize)
7777
}
7878
}
7979

@@ -138,9 +138,9 @@ class WorldRugbyMatchDateItemDecoration(context: Context) : RecyclerView.ItemDec
138138
}
139139
if (isCurrentDay) return@apply
140140
append(System.lineSeparator())
141-
inSpans(AbsoluteSizeSpan(yearTextSize)) {
142-
val year = DateUtils.getDate(DateUtils.DATE_FORMAT_YYYY, millis)
143-
append(year)
141+
inSpans(AbsoluteSizeSpan(dayYearTextSize)) {
142+
val dayYear = DateUtils.getDate(DateUtils.DATE_FORMAT_E_YYYY, millis)
143+
append(dayYear)
144144
}
145145
}
146146
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {

0 commit comments

Comments
 (0)