2022-07-18 10:17:40 +08:00
|
|
|
package eu.kanade.presentation.components
|
2022-06-19 02:55:58 +08:00
|
|
|
|
|
|
|
import androidx.compose.runtime.Composable
|
2022-06-28 06:33:57 +08:00
|
|
|
import androidx.compose.runtime.remember
|
2022-06-19 02:55:58 +08:00
|
|
|
import androidx.compose.ui.Modifier
|
|
|
|
import androidx.compose.ui.platform.LocalContext
|
|
|
|
import eu.kanade.tachiyomi.util.lang.toRelativeString
|
2023-02-19 05:33:03 +08:00
|
|
|
import tachiyomi.presentation.core.components.ListGroupHeader
|
2022-06-19 02:55:58 +08:00
|
|
|
import java.text.DateFormat
|
|
|
|
import java.util.Date
|
|
|
|
|
|
|
|
@Composable
|
2022-07-18 10:17:40 +08:00
|
|
|
fun RelativeDateHeader(
|
2022-06-19 02:55:58 +08:00
|
|
|
modifier: Modifier = Modifier,
|
|
|
|
date: Date,
|
|
|
|
relativeTime: Int,
|
|
|
|
dateFormat: DateFormat,
|
|
|
|
) {
|
2022-06-28 06:33:57 +08:00
|
|
|
val context = LocalContext.current
|
2022-11-23 22:22:20 +08:00
|
|
|
ListGroupHeader(
|
|
|
|
modifier = modifier,
|
2022-06-28 06:33:57 +08:00
|
|
|
text = remember {
|
|
|
|
date.toRelativeString(
|
|
|
|
context,
|
|
|
|
relativeTime,
|
|
|
|
dateFormat,
|
|
|
|
)
|
|
|
|
},
|
2022-06-19 02:55:58 +08:00
|
|
|
)
|
|
|
|
}
|