Skip to content

Commit

Permalink
Add ktlint
Browse files Browse the repository at this point in the history
(Recommendation: add `./gradlew ktlintFormat` to your commit hook`)
  • Loading branch information
mariobodemann committed Jul 12, 2024
1 parent b5c52c2 commit 8f4006c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ private fun AllEgosView(
columns = GridCells.Adaptive(200.dp),
) {
items(state.users) { user ->
Box(modifier = Modifier.clickable {
viewModel.userClicked(user.uuid)
}) {
Box(
modifier = Modifier.clickable {
viewModel.userClicked(user.uuid)
},
) {
AsyncImage(
modifier = Modifier.size(200.dp),
model = user.smallPngUrl,
Expand All @@ -104,7 +106,7 @@ private fun AllEgosView(
modifier = Modifier
.fillMaxWidth()
.background(Color(0, 0, 0, 128))
.padding(vertical = 2.dp)
.padding(vertical = 2.dp),
)
}
}
Expand All @@ -119,14 +121,14 @@ private fun EmptyView(paddingValues: PaddingValues) {
.padding(top = paddingValues.calculateTopPadding()),
) {
Spacer(
modifier = Modifier.weight(1.0f)
modifier = Modifier.weight(1.0f),
)
Text(
style = MaterialTheme.typography.headlineLarge,
text = "Please wait, talking to ZeServer.",
)
Spacer(
modifier = Modifier.weight(1.0f)
modifier = Modifier.weight(1.0f),
)
}
}
Expand All @@ -136,7 +138,7 @@ private fun EmptyView(paddingValues: PaddingValues) {
private fun DetailedUserView(
paddingValues: PaddingValues,
user: User = User("UUID", "NAME", "PNG", "SMPNG", "DESC", "PHRASE"),
clicked: () -> Unit = {}
clicked: () -> Unit = {},
) {
Column(
modifier = Modifier
Expand All @@ -146,15 +148,15 @@ private fun DetailedUserView(
top = paddingValues.calculateTopPadding() + 16.dp,
bottom = paddingValues.calculateBottomPadding() + 16.dp,
)
.clickable { clicked() }
.clickable { clicked() },
) {
SubcomposeAsyncImage(
modifier = Modifier.fillMaxWidth().padding(16.dp),
model = user.pngUrl,
loading = {
AsyncImage(
model = user.smallPngUrl,
contentDescription = "please wait"
contentDescription = "please wait",
)
},
contentDescription = user.description,
Expand All @@ -165,13 +167,13 @@ private fun DetailedUserView(
Column(
modifier = Modifier
.verticalScroll(rememberScrollState())
.padding(horizontal = 16.dp)
.padding(horizontal = 16.dp),
) {
Text(
text = user.name,
style = MaterialTheme.typography.titleLarge,
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp)
modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp),
)

Text(
Expand All @@ -187,6 +189,5 @@ private fun DetailedUserView(
textAlign = TextAlign.Right,
)
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import de.berlindroid.zeapp.zeservices.ZeUserApi
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import javax.inject.Inject

data class User(
val uuid: String,
Expand Down Expand Up @@ -43,7 +43,7 @@ class AlterEgosVm @Inject constructor(
fun userClicked(uuid: String?) {
_uiState.update { old ->
old.copy(
selectedUser = old.users.firstOrNull { it.uuid == uuid }
selectedUser = old.users.firstOrNull { it.uuid == uuid },
)
}
}
Expand All @@ -63,7 +63,7 @@ class AlterEgosVm @Inject constructor(
description = apiUser.description,
chatPhrase = apiUser.chatPhrase,
)
} ?: emptyList()
} ?: emptyList(),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package de.berlindroid.zeapp.zeservices

import de.berlindroid.zeapp.zedi.ZeServerBaseUrl
import javax.inject.Inject
import kotlinx.serialization.Serializable
import retrofit2.http.GET
import retrofit2.http.Path
import javax.inject.Inject

@Serializable
data class User(
Expand Down

0 comments on commit 8f4006c

Please sign in to comment.