diff --git a/.idea/misc.xml b/.idea/misc.xml index c7b43db..aa87b0a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -30,6 +30,7 @@ + diff --git a/app/src/main/java/eu/toldi/balazs/anotherfeedreader/MainActivity.kt b/app/src/main/java/eu/toldi/balazs/anotherfeedreader/MainActivity.kt index bb0a198..989dfeb 100644 --- a/app/src/main/java/eu/toldi/balazs/anotherfeedreader/MainActivity.kt +++ b/app/src/main/java/eu/toldi/balazs/anotherfeedreader/MainActivity.kt @@ -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