mirror of
https://github.com/gabehf/tempus.git
synced 2026-03-15 10:15:59 -07:00
Merge pull request #24 from jaime-grj/fix-albumpage
fix: hide unnecessary TextViews in AlbumPageFragment when there is no data, fixed incorrect album release date
This commit is contained in:
commit
76293af038
3 changed files with 30 additions and 9 deletions
|
|
@ -14,11 +14,20 @@ open class ItemDate : Parcelable {
|
|||
var month: Int? = null
|
||||
var day: Int? = null
|
||||
|
||||
fun getFormattedDate(): String {
|
||||
val calendar = Calendar.getInstance()
|
||||
val dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale.getDefault())
|
||||
fun getFormattedDate(): String? {
|
||||
if (year == null && month == null && day == null) return null
|
||||
|
||||
calendar.set(year ?: 0, month ?: 0, day ?: 0)
|
||||
val calendar = Calendar.getInstance()
|
||||
val dateFormat = if (month == null && day == null) {
|
||||
SimpleDateFormat("yyyy", Locale.getDefault())
|
||||
} else if (day == null) {
|
||||
SimpleDateFormat("MMMM yyyy", Locale.getDefault())
|
||||
}
|
||||
else{
|
||||
SimpleDateFormat("MMMM dd, yyyy", Locale.getDefault())
|
||||
}
|
||||
|
||||
calendar.set(year ?: 0, month ?: 1, day ?: 1)
|
||||
|
||||
return dateFormat.format(calendar.time)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue