Fixed date alignment and preview
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Balazs Toldi <balazs@toldi.eu>
This commit is contained in:
Balazs Toldi 2021-10-24 16:18:07 +02:00
parent d295eae730
commit 1257055704
Signed by: Bazsalanszky
GPG key ID: 933820884952BE27
2 changed files with 29 additions and 17 deletions

View file

@ -30,6 +30,7 @@
<entry key="../../../../../layout/compose-model-1634049671897.xml" value="0.2777777777777778" />
<entry key="../../../../../layout/compose-model-1634139145792.xml" value="0.8684834123222749" />
<entry key="../../../../../layout/compose-model-1635019781952.xml" value="0.5435185185185185" />
<entry key="../../../../../layout/compose-model-1635084830227.xml" value="0.67" />
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.21458333333333332" />
</map>
</option>

View file

@ -29,6 +29,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil.compose.rememberImagePainter
@ -41,6 +42,7 @@ import eu.toldi.balazs.anotherfeedreader.ui.theme.AnotherFeedReaderTheme
import eu.toldi.balazs.anotherfeedreader.viewmodel.FeedViewModel
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
@ -304,7 +306,9 @@ class MainActivity : ComponentActivity() {
) {
Column {
Row(
modifier = Modifier.padding(horizontal = 3.dp, vertical = 6.dp),
modifier = Modifier
.padding(horizontal = 3.dp, vertical = 6.dp)
.fillMaxWidth(),
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.CenterVertically
) {
@ -340,18 +344,22 @@ class MainActivity : ComponentActivity() {
}).invoke(),
fontSize = 11.sp,
textAlign = TextAlign.Center,
modifier = Modifier.padding(horizontal = 10.dp),
modifier = Modifier.padding(horizontal = 2.dp),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
article.pubDate?.let {
Text(
it.format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM)),
fontSize = 11.sp,
textAlign = TextAlign.Right,
//modifier = Modifier.width(350.dp)
)
Column(
horizontalAlignment = Alignment.End,
modifier = Modifier.fillMaxWidth()
) {
Text(
it.format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM)),
fontSize = 11.sp,
textAlign = TextAlign.Right,
)
}
}
}
if (article.imageURL != null) {
@ -498,31 +506,34 @@ class MainActivity : ComponentActivity() {
}, content = content)
}
/*
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
AnotherFeedReaderTheme {
Column() {
MenuBar({})
val article = Article(null,
val feed = Feed("Test 1")
val article = Article(
null,
title = "Teszt Article",
description = "Ez az cikk azért létezik, hogy kipróbájam a cikkek megjelenítését.",
author = "Toldi Balázs",
pubDate_stamp = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC),
feed = Feed("Test 1")
pubDate_stamp = ZonedDateTime.now().toEpochSecond(),
feed = feed
)
Column(
modifier = Modifier.padding(horizontal = 1.dp)
) {
showArticle(article)
showArticle(feed, article)
showArticle(
Article(null,
feed,
Article(
null,
title = "Teszt Article #2",
description = "Ez egy másik megjelenítést tesztelő cikk. Ebben egy nagyon hosszú szöveget akarok ábrázolni, aminek nem szabad egyben kiférnie. Legfeljebb 2 sort jeleníthet meg",
author = "Toldi Balázs",
pubDate_stamp = LocalDateTime.now().plusDays(-1).toEpochSecond(
ZoneOffset.UTC),
pubDate_stamp = ZonedDateTime.now().plusDays(-1).toEpochSecond(),
feed = Feed("Test 1")
)
)
@ -530,7 +541,7 @@ class MainActivity : ComponentActivity() {
}
}
}*/
}
fun openArticle(articleURL: String, feedName: String) {
WebView.webURL = articleURL
WebView.barTitle = feedName