diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index ded4726..b58d1fc 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -22,7 +22,8 @@ android {
buildTypes {
release {
- isMinifyEnabled = false
+ isMinifyEnabled = true
+ isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
diff --git a/app/src/main/java/eu/steffo/twom/room/MemberListItem.kt b/app/src/main/java/eu/steffo/twom/room/MemberListItem.kt
index a039f68..ebfe572 100644
--- a/app/src/main/java/eu/steffo/twom/room/MemberListItem.kt
+++ b/app/src/main/java/eu/steffo/twom/room/MemberListItem.kt
@@ -11,7 +11,6 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
-import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.steffo.twom.R
@@ -21,10 +20,12 @@ import eu.steffo.twom.theme.colorRoleLater
import eu.steffo.twom.theme.colorRoleMaybe
import eu.steffo.twom.theme.colorRoleNoway
import eu.steffo.twom.theme.colorRoleSure
+import eu.steffo.twom.theme.colorRoleUnknown
import eu.steffo.twom.theme.iconRoleLater
import eu.steffo.twom.theme.iconRoleMaybe
import eu.steffo.twom.theme.iconRoleNoway
import eu.steffo.twom.theme.iconRoleSure
+import eu.steffo.twom.theme.iconRoleUnknown
import org.matrix.android.sdk.api.session.getUser
// TODO: Check this with brain on
@@ -41,18 +42,36 @@ fun MemberListItem(
val user = session?.getUser(memberId)
- // TODO: These are going to get cached many times...
- val crSure = colorRoleSure()
- val crLater = colorRoleLater()
- val crMaybe = colorRoleMaybe()
- val crNoway = colorRoleNoway()
+ val colorRole = when (rsvpAnswer) {
+ RSVPAnswer.SURE -> colorRoleSure()
+ RSVPAnswer.LATER -> colorRoleLater()
+ RSVPAnswer.MAYBE -> colorRoleMaybe()
+ RSVPAnswer.NOWAY -> colorRoleNoway()
+ null -> colorRoleUnknown()
+ }
+ val iconRole = when (rsvpAnswer) {
+ RSVPAnswer.SURE -> iconRoleSure
+ RSVPAnswer.LATER -> iconRoleLater
+ RSVPAnswer.MAYBE -> iconRoleMaybe
+ RSVPAnswer.NOWAY -> iconRoleNoway
+ null -> iconRoleUnknown
+ }
+ val iconDescription = when (rsvpAnswer) {
+ RSVPAnswer.SURE -> stringResource(R.string.room_rsvp_sure_response)
+ RSVPAnswer.LATER -> stringResource(R.string.room_rsvp_later_response)
+ RSVPAnswer.MAYBE -> stringResource(R.string.room_rsvp_maybe_response)
+ RSVPAnswer.NOWAY -> stringResource(R.string.room_rsvp_noway_response)
+ null -> stringResource(R.string.room_rsvp_unknown_response)
+ }
ListItem(
- modifier = Modifier.clickable {
+ modifier = modifier.clickable {
onClickMember(memberId)
},
headlineContent = {
- Text(user?.displayName ?: stringResource(R.string.user_unresolved_name))
+ Text(
+ text = user?.displayName ?: stringResource(R.string.user_unresolved_name),
+ )
},
leadingContent = {
Box(
@@ -67,53 +86,17 @@ fun MemberListItem(
}
},
trailingContent = {
- when (rsvpAnswer) {
- RSVPAnswer.SURE -> {
- Icon(
- imageVector = iconRoleSure,
- contentDescription = stringResource(R.string.room_rsvp_sure_label),
- tint = crSure.value,
- )
- }
-
- RSVPAnswer.LATER -> {
- Icon(
- imageVector = iconRoleLater,
- contentDescription = stringResource(R.string.room_rsvp_later_label),
- tint = crLater.value,
- )
- }
-
- RSVPAnswer.MAYBE -> {
- Icon(
- imageVector = iconRoleMaybe,
- contentDescription = stringResource(R.string.room_rsvp_maybe_label),
- tint = crMaybe.value,
- )
- }
-
- RSVPAnswer.NOWAY -> {
- Icon(
- imageVector = iconRoleNoway,
- contentDescription = stringResource(R.string.room_rsvp_later_label),
- tint = crNoway.value,
- )
- }
-
- null -> {}
- }
+ Icon(
+ imageVector = iconRole,
+ contentDescription = iconDescription,
+ tint = colorRole.value,
+ )
},
supportingContent = {
if (rsvpComment != "") {
Text(
text = rsvpComment,
- color = when (rsvpAnswer) {
- RSVPAnswer.SURE -> crSure.value
- RSVPAnswer.LATER -> crLater.value
- RSVPAnswer.MAYBE -> crMaybe.value
- RSVPAnswer.NOWAY -> crNoway.value
- null -> Color.Unspecified
- }
+ color = colorRole.value,
)
}
},
diff --git a/app/src/main/java/eu/steffo/twom/room/RoomActivityAnswerForm.kt b/app/src/main/java/eu/steffo/twom/room/RoomActivityAnswerForm.kt
new file mode 100644
index 0000000..fd74396
--- /dev/null
+++ b/app/src/main/java/eu/steffo/twom/room/RoomActivityAnswerForm.kt
@@ -0,0 +1,10 @@
+package eu.steffo.twom.room
+
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.tooling.preview.Preview
+
+@Composable
+@Preview
+fun RoomActivityAnswerForm() {
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/eu/steffo/twom/room/RoomActivityChip.kt b/app/src/main/java/eu/steffo/twom/room/RoomActivityChip.kt
index e912301..8f5e096 100644
--- a/app/src/main/java/eu/steffo/twom/room/RoomActivityChip.kt
+++ b/app/src/main/java/eu/steffo/twom/room/RoomActivityChip.kt
@@ -1,28 +1,27 @@
package eu.steffo.twom.room
-import androidx.compose.material3.ElevatedFilterChip
import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.FilterChip
import androidx.compose.material3.FilterChipDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.unit.dp
import eu.steffo.twom.theme.StaticColorRole
import eu.steffo.twom.theme.TwoMPadding
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun RoomActivityChip(
- modifier: Modifier = Modifier,
selected: Boolean = false,
onClick: () -> Unit = {},
text: String,
imageVector: ImageVector,
colorRole: StaticColorRole,
) {
- ElevatedFilterChip(
+ FilterChip(
modifier = TwoMPadding.chips,
selected = selected,
onClick = onClick,
@@ -35,15 +34,21 @@ fun RoomActivityChip(
label = {
Text(
text = text,
- style = MaterialTheme.typography.labelLarge,
+ style = MaterialTheme.typography.bodyLarge,
)
},
- colors = FilterChipDefaults.elevatedFilterChipColors(
+ colors = FilterChipDefaults.filterChipColors(
iconColor = colorRole.value,
labelColor = colorRole.value,
selectedContainerColor = colorRole.valueContainer,
selectedLeadingIconColor = colorRole.onValueContainer,
selectedLabelColor = colorRole.onValueContainer,
),
+ border = FilterChipDefaults.filterChipBorder(
+ borderColor = MaterialTheme.colorScheme.surfaceVariant,
+ selectedBorderColor = colorRole.onValueContainer,
+ borderWidth = 1.dp,
+ selectedBorderWidth = 1.dp,
+ )
)
}
\ No newline at end of file
diff --git a/app/src/main/java/eu/steffo/twom/room/RoomActivityCommentField.kt b/app/src/main/java/eu/steffo/twom/room/RoomActivityCommentField.kt
new file mode 100644
index 0000000..7847e23
--- /dev/null
+++ b/app/src/main/java/eu/steffo/twom/room/RoomActivityCommentField.kt
@@ -0,0 +1,70 @@
+package eu.steffo.twom.room
+
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.material3.LocalContentColor
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedTextField
+import androidx.compose.material3.OutlinedTextFieldDefaults
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.tooling.preview.Preview
+import eu.steffo.twom.R
+import eu.steffo.twom.theme.colorRoleLater
+import eu.steffo.twom.theme.colorRoleMaybe
+import eu.steffo.twom.theme.colorRoleNoway
+import eu.steffo.twom.theme.colorRoleSure
+import eu.steffo.twom.theme.colorRoleUnknown
+
+@Composable
+@Preview
+fun RoomActivityCommentField(
+ modifier: Modifier = Modifier,
+ value: String = "",
+ onValueChange: (value: String) -> Unit = {},
+ rsvpAnswer: RSVPAnswer? = null,
+) {
+ val colorRole = when (rsvpAnswer) {
+ RSVPAnswer.SURE -> colorRoleSure()
+ RSVPAnswer.LATER -> colorRoleLater()
+ RSVPAnswer.MAYBE -> colorRoleMaybe()
+ RSVPAnswer.NOWAY -> colorRoleNoway()
+ null -> colorRoleUnknown()
+ }
+
+ OutlinedTextField(
+ modifier = Modifier.fillMaxWidth(),
+ value = value,
+ onValueChange = onValueChange,
+ singleLine = true,
+ shape = MaterialTheme.shapes.small,
+ placeholder = {
+ Text(
+ text = when (rsvpAnswer) {
+ RSVPAnswer.SURE -> stringResource(R.string.room_rsvp_sure_placeholder)
+ RSVPAnswer.LATER -> stringResource(R.string.room_rsvp_later_placeholder)
+ RSVPAnswer.MAYBE -> stringResource(R.string.room_rsvp_maybe_placeholder)
+ RSVPAnswer.NOWAY -> stringResource(R.string.room_rsvp_noway_placeholder)
+ null -> stringResource(R.string.room_rsvp_unknown_placeholder)
+ }
+ )
+ },
+ colors = if (rsvpAnswer != null) {
+ OutlinedTextFieldDefaults.colors(
+ focusedContainerColor = colorRole.valueContainer,
+ unfocusedContainerColor = colorRole.valueContainer,
+ focusedTextColor = colorRole.onValueContainer,
+ unfocusedTextColor = colorRole.onValueContainer,
+ focusedBorderColor = colorRole.onValueContainer,
+ unfocusedBorderColor = colorRole.onValueContainer.copy(alpha = 0.3f),
+ cursorColor = colorRole.onValueContainer,
+ )
+ } else {
+ OutlinedTextFieldDefaults.colors(
+ focusedBorderColor = LocalContentColor.current,
+ unfocusedBorderColor = MaterialTheme.colorScheme.surfaceVariant,
+ )
+ },
+ )
+}
diff --git a/app/src/main/java/eu/steffo/twom/room/RoomActivityContent.kt b/app/src/main/java/eu/steffo/twom/room/RoomActivityContent.kt
index 25638ec..d7ef1b2 100644
--- a/app/src/main/java/eu/steffo/twom/room/RoomActivityContent.kt
+++ b/app/src/main/java/eu/steffo/twom/room/RoomActivityContent.kt
@@ -1,19 +1,17 @@
package eu.steffo.twom.room
+import RoomActivityUpdateButton
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
-import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.steffo.twom.R
@@ -37,7 +35,7 @@ fun RoomActivityContent(
Row(TwoMPadding.base) {
Text(
text = stringResource(R.string.room_topic_title),
- style = MaterialTheme.typography.titleMedium
+ style = MaterialTheme.typography.labelLarge,
)
}
Row(TwoMPadding.base) {
@@ -47,7 +45,7 @@ fun RoomActivityContent(
Row(TwoMPadding.base) {
Text(
text = stringResource(R.string.room_rsvp_title),
- style = MaterialTheme.typography.titleMedium
+ style = MaterialTheme.typography.labelLarge,
)
}
@@ -56,24 +54,25 @@ fun RoomActivityContent(
onChange = { rsvpAnswer = it }
)
- if (rsvpAnswer != null) {
- Row(Modifier.padding(start = 10.dp, end = 10.dp, bottom = 10.dp)) {
- TextField(
- modifier = Modifier.fillMaxWidth(),
- singleLine = true,
- value = rsvpComment,
- onValueChange = { rsvpComment = it },
- placeholder = {
- Text(LocalContext.current.getString(R.string.room_rsvp_comment_placeholder))
- },
- )
- }
+ Row(Modifier.padding(start = 10.dp, end = 10.dp)) {
+ RoomActivityCommentField(
+ value = rsvpComment,
+ onValueChange = { rsvpComment = it },
+ rsvpAnswer = rsvpAnswer,
+ )
+ }
+
+ Row(Modifier.padding(all = 10.dp)) {
+ RoomActivityUpdateButton(
+ onClick = {},
+ rsvpAnswer = rsvpAnswer,
+ )
}
Row(TwoMPadding.base) {
Text(
text = stringResource(R.string.room_invitees_title),
- style = MaterialTheme.typography.titleMedium
+ style = MaterialTheme.typography.labelLarge,
)
}
@@ -82,11 +81,7 @@ fun RoomActivityContent(
MemberListItem(
memberId = LocalSession.current!!.myUserId,
rsvpAnswer = rsvpAnswer,
- rsvpComment = if (rsvpAnswer != null) {
- rsvpComment
- } else {
- ""
- },
+ rsvpComment = rsvpComment,
)
roomSummary.otherMemberIds.forEach {
diff --git a/app/src/main/java/eu/steffo/twom/room/RoomActivityUpdateButton.kt b/app/src/main/java/eu/steffo/twom/room/RoomActivityUpdateButton.kt
new file mode 100644
index 0000000..9e1ee5c
--- /dev/null
+++ b/app/src/main/java/eu/steffo/twom/room/RoomActivityUpdateButton.kt
@@ -0,0 +1,27 @@
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.material3.Button
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.tooling.preview.Preview
+import eu.steffo.twom.R
+import eu.steffo.twom.room.RSVPAnswer
+
+@Composable
+@Preview
+fun RoomActivityUpdateButton(
+ onClick: () -> Unit = {},
+ rsvpAnswer: RSVPAnswer? = null,
+) {
+ Button(
+ modifier = Modifier.fillMaxWidth(),
+ onClick = onClick,
+ shape = MaterialTheme.shapes.small,
+ ) {
+ Text(
+ text = stringResource(R.string.room_update_label)
+ )
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/eu/steffo/twom/theme/colorRoleUnknown.kt b/app/src/main/java/eu/steffo/twom/theme/colorRoleUnknown.kt
new file mode 100644
index 0000000..1174dc3
--- /dev/null
+++ b/app/src/main/java/eu/steffo/twom/theme/colorRoleUnknown.kt
@@ -0,0 +1,14 @@
+package eu.steffo.twom.theme
+
+import androidx.compose.material3.LocalContentColor
+import androidx.compose.runtime.Composable
+
+@Composable
+fun colorRoleUnknown(): StaticColorRole {
+ return StaticColorRole(
+ value = LocalContentColor.current,
+ onValue = LocalContentColor.current,
+ valueContainer = LocalContentColor.current,
+ onValueContainer = LocalContentColor.current,
+ )
+}
diff --git a/app/src/main/java/eu/steffo/twom/theme/iconRoleUnknown.kt b/app/src/main/java/eu/steffo/twom/theme/iconRoleUnknown.kt
new file mode 100644
index 0000000..7c16def
--- /dev/null
+++ b/app/src/main/java/eu/steffo/twom/theme/iconRoleUnknown.kt
@@ -0,0 +1,6 @@
+package eu.steffo.twom.theme
+
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.outlined.Circle
+
+val iconRoleUnknown = Icons.Outlined.Circle
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index af007d5..1a938fb 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -23,7 +23,7 @@
My account
Logout
There are no rooms.
- Loading...
+ Loading…
New
Log into your Matrix account by clicking the icon on the top right of the screen.
Login
@@ -39,7 +39,7 @@
Invitees
Your reply
Sure!
- I\'ll be late...
+ I\'ll be late…
Maybe?
Nope.
About this party
@@ -48,5 +48,11 @@
Will arrive late
Will maybe partecipate
Won\'t be there
- Leave a comment...
+ Anything to add?
+ Why will you be late?
+ What will determine your partecipation?
+ Why won\'t you partecipate?
+ Hasn\'t answered yet
+ Leave a comment…
+ Update
\ No newline at end of file