Minor cleanup

This commit is contained in:
Syer10
2021-11-07 14:59:21 -05:00
parent 299b32ec01
commit 95db01f4d0
3 changed files with 13 additions and 16 deletions

View File

@@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
@@ -27,18 +26,16 @@ fun ErrorScreen(
retryMessage: String = "Retry",
retry: (() -> Unit)? = null
) {
Surface(modifier) {
Box(Modifier.fillMaxSize()) {
Column(modifier = Modifier.align(Alignment.Center), horizontalAlignment = Alignment.CenterHorizontally) {
val errorFace = remember { getRandomErrorFace() }
Text(errorFace, fontSize = 36.sp, color = MaterialTheme.colors.onBackground)
if (errorMessage != null) {
Text(errorMessage, color = MaterialTheme.colors.onBackground)
}
if (retry != null) {
Button(retry) {
Text(retryMessage)
}
Box(modifier then Modifier.fillMaxSize()) {
Column(modifier = Modifier.align(Alignment.Center), horizontalAlignment = Alignment.CenterHorizontally) {
val errorFace = remember { getRandomErrorFace() }
Text(errorFace, fontSize = 36.sp, color = MaterialTheme.colors.onBackground)
if (errorMessage != null) {
Text(errorMessage, color = MaterialTheme.colors.onBackground)
}
if (retry != null) {
Button(retry) {
Text(retryMessage)
}
}
}

View File

@@ -14,7 +14,7 @@ import kotlinx.coroutines.launch
import javax.inject.Inject
class DebugOverlayViewModel @Inject constructor() : ViewModel() {
val runtime = Runtime.getRuntime()
val runtime: Runtime = Runtime.getRuntime()
val maxMemory = runtime.maxMemory().formatSize()
val usedMemoryFlow = MutableStateFlow(runtime.usedMemory().formatSize())

View File

@@ -52,7 +52,7 @@ fun SideMenu(modifier: Modifier, controller: MenuController) {
}
}
Spacer(Modifier.height(20.dp))
remember { TopLevelMenus.values().filter { it.top } }.forEach { topLevelMenu ->
remember { TopLevelMenus.values().filter(TopLevelMenus::top) }.forEach { topLevelMenu ->
SideMenuItem(
topLevelMenu.isSelected(controller.backStack),
topLevelMenu,
@@ -61,7 +61,7 @@ fun SideMenu(modifier: Modifier, controller: MenuController) {
}
Box(Modifier.fillMaxSize()) {
Column(Modifier.align(Alignment.BottomStart).padding(bottom = 8.dp)) {
remember { TopLevelMenus.values().filterNot { it.top } }.forEach { topLevelMenu ->
remember { TopLevelMenus.values().filterNot(TopLevelMenus::top) }.forEach { topLevelMenu ->
SideMenuItem(
topLevelMenu.isSelected(controller.backStack),
topLevelMenu,