Skip to content

Commit

Permalink
🐛 Fix weirdly appearing bottom bar
Browse files Browse the repository at this point in the history
  • Loading branch information
jheubuch committed Mar 5, 2024
1 parent 03d5b7f commit bf164d6
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ fun TraewelldroidNavHost(

Dashboard(
loggedInUserViewModel = loggedInUserViewModel,
bottomSearchViewModel = bottomSearchViewModel,
searchConnectionsAction = navToSearchConnections,
statusSelectedAction = navToStatusDetails,
userSelectedAction = navToUserProfile,
Expand Down Expand Up @@ -390,7 +391,8 @@ fun TraewelldroidNavHost(
)
shortcutManager.requestPinShortcut(shortcut, successCallback.intentSender)
}
}
},
bottomSearchViewModel = bottomSearchViewModel
)
onResetFloatingActionButton()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import de.hbch.traewelling.api.models.status.Status
import de.hbch.traewelling.shared.BottomSearchViewModel
import de.hbch.traewelling.shared.LoggedInUserViewModel
import de.hbch.traewelling.ui.composables.NotificationsAvailableHint
import de.hbch.traewelling.ui.include.cardSearchStation.CardSearch
Expand All @@ -32,6 +33,7 @@ import java.time.ZonedDateTime
@Composable
fun Dashboard(
loggedInUserViewModel: LoggedInUserViewModel,
bottomSearchViewModel: BottomSearchViewModel,
searchConnectionsAction: (String, ZonedDateTime?) -> Unit = { _, _ -> },
userSelectedAction: (String) -> Unit = { },
statusSelectedAction: (Int) -> Unit = { },
Expand Down Expand Up @@ -84,7 +86,8 @@ fun Dashboard(
recentStationsData = loggedInUserViewModel.lastVisitedStations,
onUserSelected = {
userSelectedAction(it.username)
}
},
bottomSearchViewModel = bottomSearchViewModel
)
}
if (!knowsAboutNotifications) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.LiveData
import de.hbch.traewelling.api.models.station.Station
import de.hbch.traewelling.api.models.user.User
import de.hbch.traewelling.shared.BottomSearchViewModel
import de.hbch.traewelling.theme.AppTypography
import de.hbch.traewelling.ui.search.Search
import de.hbch.traewelling.util.getGreeting
Expand All @@ -22,6 +23,7 @@ fun CardSearch(
modifier: Modifier = Modifier,
homelandStationData: LiveData<Station?>,
recentStationsData: LiveData<List<Station>?>,
bottomSearchViewModel: BottomSearchViewModel,
onStationSelected: (String) -> Unit = { },
onUserSelected: (User) -> Unit = { },
queryStations: Boolean = true,
Expand All @@ -48,7 +50,8 @@ fun CardSearch(
onUserSelected = onUserSelected,
queryStations = queryStations,
queryUsers = queryUsers,
modifier = Modifier.fillMaxWidth()
modifier = Modifier.fillMaxWidth(),
bottomSearchViewModel = bottomSearchViewModel
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,13 @@ fun TraewelldroidApp(
verticalAlignment = Alignment.CenterVertically
) {
if (userResults == null) {
Text("Ergebnisse werden geladen...")
Text(
text = stringResource(id = R.string.data_loading)
)
} else {
if (userResults.isEmpty()) {
Text(
text = "Keine Ergebnisse."
text = stringResource(id = R.string.no_results_found)
)
}
userResults.forEach {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/kotlin/de/hbch/traewelling/ui/search/Search.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import com.google.accompanist.permissions.rememberMultiplePermissionsState
import de.hbch.traewelling.R
import de.hbch.traewelling.api.models.station.Station
import de.hbch.traewelling.api.models.user.User
import de.hbch.traewelling.shared.BottomSearchViewModel
import de.hbch.traewelling.theme.AppTypography
import de.hbch.traewelling.ui.composables.ProfilePicture
import de.hbch.traewelling.util.getStationNameWithRL100
Expand All @@ -57,6 +58,7 @@ import kotlinx.coroutines.launch
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun Search(
bottomSearchViewModel: BottomSearchViewModel,
modifier: Modifier = Modifier,
initQuery: String = "",
queryStations: Boolean = true,
Expand All @@ -66,6 +68,7 @@ fun Search(
onStationSelected: (String) -> Unit = { },
onUserSelected: (User) -> Unit = { }
) {
bottomSearchViewModel.reset()
val searchInstruction =
if (queryStations && queryUsers)
stringResource(id = R.string.search_stop_users)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import de.hbch.traewelling.api.models.station.Station
import de.hbch.traewelling.api.models.trip.HafasLine
import de.hbch.traewelling.api.models.trip.HafasTrip
import de.hbch.traewelling.api.models.trip.ProductType
import de.hbch.traewelling.shared.BottomSearchViewModel
import de.hbch.traewelling.shared.CheckInViewModel
import de.hbch.traewelling.shared.LoggedInUserViewModel
import de.hbch.traewelling.theme.AppTypography
Expand All @@ -67,6 +68,7 @@ import java.time.ZoneId
fun SearchConnection(
loggedInUserViewModel: LoggedInUserViewModel,
checkInViewModel: CheckInViewModel,
bottomSearchViewModel: BottomSearchViewModel,
station: String,
currentSearchDate: ZonedDateTime,
onTripSelected: () -> Unit = { },
Expand Down Expand Up @@ -114,7 +116,8 @@ fun SearchConnection(
},
homelandStationData = loggedInUserViewModel.home,
recentStationsData = loggedInUserViewModel.lastVisitedStations,
queryUsers = false
queryUsers = false,
bottomSearchViewModel = bottomSearchViewModel
)
ElevatedCard {
Column {
Expand Down Expand Up @@ -313,7 +316,7 @@ fun SearchConnection(
FilterChipGroup(
modifier = itemModifier
.fillMaxWidth(),
chips = FilterType.values().associateWith {
chips = FilterType.entries.associateWith {
stringResource(id = it.stringId)
},
preSelection = appliedFilter,
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de-rDE/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,5 @@
<string name="travelynx_token">travelynx Travel-Token</string>
<string name="changes_saved">Änderungen wurden gespeichert</string>
<string name="checked_in_with">Eingecheckt mit %1$s</string>
<string name="no_results_found">Keine Ergebnisse gefunden.</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,5 @@
<string name="travelynx_token">travelynx travel token</string>
<string name="changes_saved">Changes have been saved</string>
<string name="checked_in_with">Checked in with %1$s</string>
<string name="no_results_found">No results found.</string>
</resources>

0 comments on commit bf164d6

Please sign in to comment.