Skip to content

Commit

Permalink
Merge pull request #355 from joreilly/NavigationSuiteScaffold
Browse files Browse the repository at this point in the history
Use NavigationSuiteScaffold and ListDetailPaneScaffold
  • Loading branch information
joreilly authored Jun 18, 2024
2 parents 7b35f69 + c4d181c commit 2530fbc
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 322 deletions.
6 changes: 5 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ dependencies {
implementation(libs.androidx.compose.ui.tooling)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material3.windowSizeClass)
implementation(libs.androidx.compose.material3.adaptive)
implementation(libs.androidx.compose.material3.adaptive.layout)
implementation(libs.androidx.compose.material3.adaptive.navigation)
implementation(libs.androidx.compose.material3.adaptive.navigation.suite)


implementation(libs.coilCompose)
implementation(libs.glance.appwidget)
Expand Down

This file was deleted.

6 changes: 2 additions & 4 deletions app/src/main/java/com/surrus/peopleinspace/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ package com.surrus.peopleinspace
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass
import androidx.activity.enableEdgeToEdge
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import com.surrus.peopleinspace.ui.PeopleInSpaceApp


class MainActivity : ComponentActivity() {
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
Expand All @@ -21,7 +19,7 @@ class MainActivity : ComponentActivity() {
WindowCompat.setDecorFitsSystemWindows(window, false)

setContent {
PeopleInSpaceApp(calculateWindowSizeClass(this))
PeopleInSpaceApp()
}
}
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ import com.surrus.peopleinspace.ui.component.PeopleInSpaceGradientBackground


@Composable
fun PersonDetailsScreen(person: Assignment, popBack: () -> Unit) {
fun PersonDetailsScreen(person: Assignment, showBackButton: Boolean, popBack: () -> Unit) {
PeopleInSpaceGradientBackground {
Scaffold(
topBar = {
PersonDetailsTopAppBar(personName = person.name, popBack = popBack)
PersonDetailsTopAppBar(personName = person.name, showBackButton, popBack = popBack)
},
containerColor = Color.Transparent,
contentWindowInsets = WindowInsets(0, 0, 0, 0)
Expand All @@ -47,12 +47,14 @@ fun PersonDetailsScreen(person: Assignment, popBack: () -> Unit) {
}

@Composable
fun PersonDetailsTopAppBar(personName: String, popBack: () -> Unit) {
fun PersonDetailsTopAppBar(personName: String, showBackButton: Boolean, popBack: () -> Unit) {
CenterAlignedTopAppBar(
title = { Text(personName) },
navigationIcon = {
IconButton(onClick = { popBack() }) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
if (showBackButton) {
IconButton(onClick = { popBack() }) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
}
}
},
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
Expand Down
Loading

0 comments on commit 2530fbc

Please sign in to comment.