Skip to content

Commit

Permalink
Merge pull request #153 from joreilly/shared_compose
Browse files Browse the repository at this point in the history
common player details compose code including graph
  • Loading branch information
joreilly authored Sep 6, 2023
2 parents f8fcd85 + e910e4e commit eb3dd5b
Show file tree
Hide file tree
Showing 15 changed files with 417 additions and 594 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v1
with:
java-version: 17
Expand Down
4 changes: 0 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ dependencies {
implementation(libs.koin.android)
implementation(libs.koin.androidx.compose)

//implementation("io.github.koalaplot:koalaplot-core:0.1.0-SNAPSHOT")
implementation("com.patrykandpatryk.vico:compose:1.11.2")

testImplementation(libs.junit)
testImplementation(libs.koin.test)
androidTestImplementation(platform(libs.androidx.compose.bom))
Expand All @@ -86,7 +83,6 @@ dependencies {
debugImplementation(libs.androidx.compose.ui.test.manifest)



testImplementation("androidx.test:core:1.5.0")
testImplementation("org.robolectric:robolectric:4.10.3")
androidTestImplementation("androidx.test:runner:1.5.2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navArgument
import dev.johnoreilly.common.data.repository.FantasyPremierLeagueRepository
import dev.johnoreilly.fantasypremierleague.presentation.FantasyPremierLeagueViewModel
import dev.johnoreilly.fantasypremierleague.presentation.Screen
import dev.johnoreilly.fantasypremierleague.presentation.bottomNavigationItems
Expand All @@ -32,9 +33,10 @@ import dev.johnoreilly.fantasypremierleague.presentation.fixtures.FixtureDetails
import dev.johnoreilly.fantasypremierleague.presentation.global.FantasyPremierLeagueTheme
import dev.johnoreilly.fantasypremierleague.presentation.leagues.LeagueListView
import dev.johnoreilly.fantasypremierleague.presentation.players.PlayerListView
import dev.johnoreilly.fantasypremierleague.presentation.players.PlayerDetails.PlayerDetailsView
import dev.johnoreilly.fantasypremierleague.presentation.players.playerDetails.PlayerDetailsView
import dev.johnoreilly.fantasypremierleague.presentation.settings.SettingsView
import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.compose.koinInject

class MainActivity : ComponentActivity() {
private val fantasyPremierLeagueViewModel: FantasyPremierLeagueViewModel by viewModel()
Expand All @@ -61,6 +63,8 @@ class MainActivity : ComponentActivity() {
fun MainLayout(viewModel: FantasyPremierLeagueViewModel) {
val navController = rememberNavController()

val repository: FantasyPremierLeagueRepository = koinInject()

Scaffold(
bottomBar = { FantasyPremierLeagueBottomNavigation(navController) },
contentWindowInsets = WindowInsets(0, 0, 0, 0),
Expand All @@ -87,7 +91,7 @@ fun MainLayout(viewModel: FantasyPremierLeagueViewModel) {
val player = viewModel.getPlayer(playerId)
player?.let {
PlayerDetailsView(
viewModel,
repository,
player,
popBackStack = { navController.popBackStack() })
}
Expand Down Expand Up @@ -133,18 +137,18 @@ private fun FantasyPremierLeagueBottomNavigation(navController: NavHostControlle
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentRoute = navBackStackEntry?.destination?.route

bottomNavigationItems.forEach { bottomNavigationitem ->
bottomNavigationItems.forEach { bottomNavigationItem ->

NavigationBarItem(
icon = {
Icon(
bottomNavigationitem.icon,
contentDescription = bottomNavigationitem.iconContentDescription
bottomNavigationItem.icon,
contentDescription = bottomNavigationItem.iconContentDescription
)
},
selected = currentRoute == bottomNavigationitem.route,
selected = currentRoute == bottomNavigationItem.route,
onClick = {
navController.navigate(bottomNavigationitem.route) {
navController.navigate(bottomNavigationItem.route) {
popUpTo(navController.graph.id)
launchSingleTop = true
}
Expand Down
Loading

0 comments on commit eb3dd5b

Please sign in to comment.