Skip to content

Commit c471d2d

Browse files
committed
Fix style issues
1 parent 4ca17b9 commit c471d2d

13 files changed

Lines changed: 52 additions & 39 deletions

File tree

app/src/main/java/com/example/reply/MainActivity.kt

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,34 @@ class MainActivity : ComponentActivity() {
5151
@Composable
5252
fun ReplyAppCompactPreview() {
5353
ReplyTheme {
54-
ReplyApp(
55-
windowSize = WindowWidthSizeClass.Compact,
56-
)
54+
Surface {
55+
ReplyApp(
56+
windowSize = WindowWidthSizeClass.Compact,
57+
)
58+
}
5759
}
5860
}
5961

6062
@Preview(showBackground = true, widthDp = 700)
6163
@Composable
6264
fun ReplyAppMediumPreview() {
6365
ReplyTheme {
64-
ReplyApp(
65-
windowSize = WindowWidthSizeClass.Medium,
66-
)
66+
Surface {
67+
ReplyApp(
68+
windowSize = WindowWidthSizeClass.Medium,
69+
)
70+
}
6771
}
6872
}
6973

7074
@Preview(showBackground = true, widthDp = 1000)
7175
@Composable
7276
fun ReplyAppExpandedPreview() {
7377
ReplyTheme {
74-
ReplyApp(
75-
windowSize = WindowWidthSizeClass.Expanded,
76-
)
78+
Surface {
79+
ReplyApp(
80+
windowSize = WindowWidthSizeClass.Expanded,
81+
)
82+
}
7783
}
78-
}
84+
}

app/src/main/java/com/example/reply/data/Account.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package com.example.reply.data
1717

1818
import androidx.annotation.DrawableRes
19+
import androidx.annotation.StringRes
1920

2021
/**
2122
* A class which represents an account
@@ -24,14 +25,14 @@ data class Account(
2425
/** Unique ID of a user **/
2526
val id: Long,
2627
/** User's first name **/
27-
val firstName: Int,
28+
@StringRes val firstName: Int,
2829
/** User's last name **/
29-
val lastName: Int,
30+
@StringRes val lastName: Int,
3031
/** User's email address **/
31-
val email: Int,
32+
@StringRes val email: Int,
3233
/** User's avatar image resource id **/
3334
@DrawableRes val avatar: Int
3435
) {
3536
/** User's full name **/
3637
val fullName: String = "$firstName $lastName"
37-
}
38+
}

app/src/main/java/com/example/reply/data/Email.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package com.example.reply.data
1717

18+
import androidx.annotation.StringRes
19+
1820
/**
1921
* A simple data class to represent an Email
2022
*/
@@ -26,9 +28,9 @@ data class Email(
2628
/** Recipient(s) of the email **/
2729
val recipients: List<Account> = emptyList(),
2830
/** Title of the email **/
29-
val subject: Int = -1,
31+
@StringRes val subject: Int = -1,
3032
/** Content of the email **/
31-
val body: Int = -1,
33+
@StringRes val body: Int = -1,
3234
/** Which mailbox it is in **/
3335
var mailbox: MailboxType = MailboxType.Inbox,
3436
/**

app/src/main/java/com/example/reply/data/MailboxType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ package com.example.reply.data
2020
*/
2121
enum class MailboxType {
2222
Inbox, Drafts, Sent, Spam
23-
}
23+
}

app/src/main/java/com/example/reply/data/local/LocalAccountsDataProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,4 @@ object LocalAccountsDataProvider {
114114
return allUserContactAccounts.firstOrNull { it.id == accountId }
115115
?: allUserContactAccounts.first()
116116
}
117-
}
117+
}

app/src/main/java/com/example/reply/ui/ReplyApp.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ fun ReplyApp(
7171
},
7272
modifier = modifier
7373
)
74-
}
74+
}

app/src/main/java/com/example/reply/ui/ReplyDetailsScreen.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ import com.example.reply.data.MailboxType
5454
@Composable
5555
fun ReplyDetailsScreen(
5656
replyUiState: ReplyUiState,
57+
onBackPressed: () -> Unit,
5758
modifier: Modifier = Modifier,
58-
onBackPressed: () -> Unit = {},
5959
isFullScreen: Boolean = false
6060
) {
6161
BackHandler {
@@ -83,10 +83,11 @@ fun ReplyDetailsScreen(
8383
email = replyUiState.currentSelectedEmail,
8484
mailboxType = replyUiState.currentMailbox,
8585
isFullScreen = isFullScreen,
86-
modifier = if (isFullScreen)
86+
modifier = if (isFullScreen) {
8787
Modifier.padding(horizontal = dimensionResource(R.dimen.detail_card_outer_padding_horizontal))
88-
else
88+
} else {
8989
Modifier.padding(end = dimensionResource(R.dimen.detail_card_outer_padding_horizontal))
90+
}
9091
)
9192
}
9293
}
@@ -287,17 +288,20 @@ private fun ActionButton(
287288
.padding(vertical = dimensionResource(R.dimen.detail_action_button_padding_vertical)),
288289
colors = ButtonDefaults.buttonColors(
289290
containerColor =
290-
if (!containIrreversibleAction)
291+
if (!containIrreversibleAction) {
291292
MaterialTheme.colorScheme.primaryContainer
292-
else MaterialTheme.colorScheme.onErrorContainer
293+
} else {
294+
MaterialTheme.colorScheme.onErrorContainer
295+
}
293296
)
294297
) {
295298
Text(
296299
text = text,
297-
color =
298-
if (!containIrreversibleAction)
300+
color = if (!containIrreversibleAction) {
299301
MaterialTheme.colorScheme.onSurfaceVariant
300-
else MaterialTheme.colorScheme.onError
302+
} else {
303+
MaterialTheme.colorScheme.onError
304+
}
301305
)
302306
}
303307
}

app/src/main/java/com/example/reply/ui/ReplyHomeContent.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,11 @@ fun ReplyEmailListItem(
130130
Card(
131131
modifier = modifier,
132132
colors = CardDefaults.cardColors(
133-
containerColor = if (selected)
133+
containerColor = if (selected) {
134134
MaterialTheme.colorScheme.primaryContainer
135-
else
135+
} else {
136136
MaterialTheme.colorScheme.secondaryContainer
137+
}
137138
),
138139
onClick = onCardClick
139140
) {

app/src/main/java/com/example/reply/ui/ReplyHomeScreen.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import androidx.compose.material.icons.filled.Drafts
3333
import androidx.compose.material.icons.filled.Inbox
3434
import androidx.compose.material.icons.filled.Report
3535
import androidx.compose.material.icons.filled.Send
36-
import androidx.compose.material3.ExperimentalMaterial3Api
3736
import androidx.compose.material3.Icon
3837
import androidx.compose.material3.MaterialTheme
3938
import androidx.compose.material3.NavigationBar
@@ -60,7 +59,6 @@ import com.example.reply.data.local.LocalAccountsDataProvider
6059
import com.example.reply.ui.utils.ReplyContentType
6160
import com.example.reply.ui.utils.ReplyNavigationType
6261

63-
@OptIn(ExperimentalMaterial3Api::class)
6462
@Composable
6563
fun ReplyHomeScreen(
6664
navigationType: ReplyNavigationType,
@@ -252,7 +250,6 @@ private fun ReplyBottomNavigationBar(
252250
}
253251
}
254252

255-
@OptIn(ExperimentalMaterial3Api::class)
256253
@Composable
257254
private fun NavigationDrawerContent(
258255
selectedDestination: MailboxType,
@@ -313,4 +310,4 @@ private data class NavigationItemContent(
313310
val mailboxType: MailboxType,
314311
val icon: ImageVector,
315312
val text: String
316-
)
313+
)

app/src/main/java/com/example/reply/ui/ReplyViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ class ReplyViewModel : ViewModel() {
6969
)
7070
}
7171
}
72-
}
72+
}

0 commit comments

Comments
 (0)