Skip to content

Commit

Permalink
Apply statusbarspadding
Browse files Browse the repository at this point in the history
  • Loading branch information
ksharma-xyz committed Oct 29, 2024
1 parent 949ae6f commit 335704a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ object DateTimeHelper {
val formattedDifference = when {
totalMinutes < 0 -> "${totalMinutes.absoluteValue} mins ago"
totalMinutes == 0L -> "Now"
hours == 1L -> "in ${hours.absoluteValue}h ${partialMinutes.absoluteValue}m"
hours >= 2 -> "in ${hours.absoluteValue} hrs"
else -> "in ${totalMinutes.absoluteValue} ${if (totalMinutes.absoluteValue == 1L) "min" else "mins"}"
hours == 1L -> "In ${hours.absoluteValue}h ${partialMinutes.absoluteValue}m"
hours >= 2 -> "In ${hours.absoluteValue} h"
else -> "In ${totalMinutes.absoluteValue} ${if (totalMinutes.absoluteValue == 1L) "min" else "mins"}"
}
Timber.d("\t minutes: $partialMinutes, hours: $hours, formattedDifference: $formattedDifference -> originTime")
return formattedDifference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package xyz.ksharma.krail.trip.planner.ui.savedtrips

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -40,41 +42,42 @@ fun SavedTripsScreen(
Box(
modifier = modifier
.fillMaxSize()
.background(color = KrailTheme.colors.background),
.background(color = KrailTheme.colors.background)
.statusBarsPadding(),
) {
LazyColumn(modifier = Modifier, contentPadding = PaddingValues(bottom = 300.dp)) {
item {
TitleBar(title = {
Text(text = stringResource(R.string.saved_trips_screen_title))
})
}
Column {
TitleBar(title = {
Text(text = stringResource(R.string.saved_trips_screen_title))
})

item {
Spacer(modifier = Modifier.height(12.dp))
}
LazyColumn(contentPadding = PaddingValues(bottom = 300.dp)) {
item {
Spacer(modifier = Modifier.height(12.dp))
}

items(
items = savedTripsState.savedTrips,
key = { it.fromStopId + it.toStopId },
) { trip ->
SavedTripCard(
trip = trip,
onStarClick = { onEvent(SavedTripUiEvent.DeleteSavedTrip(trip)) },
onCardClick = {
onSearchButtonClick(
StopItem(
stopId = trip.fromStopId,
stopName = trip.fromStopName,
),
StopItem(
stopId = trip.toStopId,
stopName = trip.toStopName,
),
)
},
modifier = Modifier.padding(horizontal = 16.dp),
)
Spacer(modifier = Modifier.height(12.dp))
items(
items = savedTripsState.savedTrips,
key = { it.fromStopId + it.toStopId },
) { trip ->
SavedTripCard(
trip = trip,
onStarClick = { onEvent(SavedTripUiEvent.DeleteSavedTrip(trip)) },
onCardClick = {
onSearchButtonClick(
StopItem(
stopId = trip.fromStopId,
stopName = trip.fromStopName,
),
StopItem(
stopId = trip.toStopId,
stopName = trip.toStopName,
),
)
},
modifier = Modifier.padding(horizontal = 16.dp),
)
Spacer(modifier = Modifier.height(12.dp))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ package xyz.ksharma.krail.trip.planner.ui.timetable
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
Expand All @@ -34,16 +37,19 @@ fun TimeTableScreen(
onEvent: (TimeTableUiEvent) -> Unit,
modifier: Modifier = Modifier,
) {
LazyColumn(
Column(
modifier = modifier
.background(color = KrailTheme.colors.background),
contentPadding = PaddingValues(vertical = 16.dp),
.fillMaxSize()
.background(color = KrailTheme.colors.background)
.statusBarsPadding()
) {
item {
TitleBar(title = {
Text(text = stringResource(R.string.time_table_screen_title))
})
}

TitleBar(title = {
Text(text = stringResource(R.string.time_table_screen_title))
})
}

LazyColumn(contentPadding = PaddingValues(vertical = 16.dp),) {

if (timeTableState.isLoading) {
item {
Expand Down

0 comments on commit 335704a

Please sign in to comment.