Skip to content

Commit 56e5859

Browse files
author
Johann Blake
committed
Added button to dummy screen to terminate activity.
1 parent 9652c2a commit 56e5859

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ NavigationManager.addScreens(
8989
| navStackCount | ```navStackCount: Int```<br/><br/>The total number of screens on the navigation stack. This includes the hidden placeholder screen that is always placed at the end of the stack. There will always be at least two items on the stack - the first item will be the home screen and the last item will be the placeholder screen. |
9090
| totalScreensDisplayed | ```totalScreensDisplayed: Int```<br/><br/>The total number of screens on the navigation stack, minus one. This is essentially the same as navStackCount but doesn't include the placeholder screen. This is just a convenient way of knowing how many visible screens are currently being displayed. |
9191
| currentScreenNavInfo | ```currentScreenNavInfo: NavigationInfo```<br/><br/>Returns navigation information about the currently displayed screen. |
92-
| previousScreenNavInfo | previousScreenNavInfo: NavigationInfo?<br><br>Returns navigation information about the previous screen. Returns null if there is no previous screen, which would be the case if the current screen is the home screen. This is useful in a case such as when you want to return data to the previous screen before navigating back. You can access the previous screen's viewmodel and call a function on it to pass data back before returning to the previous screen. |
92+
| previousScreenNavInfo | ```previousScreenNavInfo: NavigationInfo?```<br><br>Returns navigation information about the previous screen. Returns null if there is no previous screen, which would be the case if the current screen is the home screen. This is useful in a case such as when you want to return data to the previous screen before navigating back. You can access the previous screen's viewmodel and call a function on it to pass data back before returning to the previous screen. |
9393

9494

9595
<br/><br/>

app/src/main/java/dev/wirespec/adoptme/ui/screens/dummy/DummyUI.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import androidx.compose.ui.Alignment
1010
import androidx.compose.ui.Modifier
1111
import androidx.compose.ui.unit.dp
1212
import androidx.compose.ui.unit.sp
13+
import dev.wirespec.adoptme.App
1314
import dev.wirespec.adoptme.ui.Screens
1415
import dev.wirespec.adoptme.ui.screens.ScreenGlobals
1516
import dev.wirespec.adoptme.ui.theme.AppColors
@@ -104,6 +105,19 @@ fun Dummy(
104105
modifier = modifier.padding(start = 10.dp, top = 7.dp, end = 10.dp, bottom = 7.dp)
105106
)
106107
}
108+
109+
Button(
110+
modifier = modifier.padding(bottom = 10.dp),
111+
colors = AppTheme.getButtonColors(),
112+
elevation = ButtonDefaults.elevation(5.dp),
113+
onClick = {
114+
App.context.currentActivity?.finish()
115+
}) {
116+
Text(
117+
text = "Terminate activity",
118+
modifier = modifier.padding(start = 10.dp, top = 7.dp, end = 10.dp, bottom = 7.dp)
119+
)
120+
}
107121
}
108122
}
109123
}

0 commit comments

Comments
 (0)