From 0ef7f4527e150226efc5cbd013f68840aed058a0 Mon Sep 17 00:00:00 2001 From: Jose Alcerreca Date: Wed, 16 Dec 2020 11:04:04 +0100 Subject: [PATCH] [Jetchat] Enables --android flag in ktlint Change-Id: I864ef534aef0d29c6b18badf0cd49bb6fdc97cc1 --- .../com/example/compose/jetchat/NavigationTest.kt | 4 +++- .../com/example/compose/jetchat/UserInputTest.kt | 12 ++++++++---- .../compose/jetchat/components/JetchatDrawer.kt | 4 +++- .../jetchat/conversation/ConversationUiState.kt | 7 ++++++- Jetchat/build.gradle | 3 +-- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Jetchat/app/src/androidTest/java/com/example/compose/jetchat/NavigationTest.kt b/Jetchat/app/src/androidTest/java/com/example/compose/jetchat/NavigationTest.kt index 576e61b3da..b1abc7fabd 100644 --- a/Jetchat/app/src/androidTest/java/com/example/compose/jetchat/NavigationTest.kt +++ b/Jetchat/app/src/androidTest/java/com/example/compose/jetchat/NavigationTest.kt @@ -94,7 +94,9 @@ class NavigationTest { // Check profile is displayed assertEquals(navController.currentDestination?.id, R.id.nav_profile) // Extra UI check - composeTestRule.onNodeWithText(activity.getString(R.string.textfield_hint)).assertIsDisplayed() + composeTestRule + .onNodeWithText(activity.getString(R.string.textfield_hint)) + .assertIsDisplayed() // Press back Espresso.pressBack() diff --git a/Jetchat/app/src/androidTest/java/com/example/compose/jetchat/UserInputTest.kt b/Jetchat/app/src/androidTest/java/com/example/compose/jetchat/UserInputTest.kt index ce1c43ec14..509900e93d 100644 --- a/Jetchat/app/src/androidTest/java/com/example/compose/jetchat/UserInputTest.kt +++ b/Jetchat/app/src/androidTest/java/com/example/compose/jetchat/UserInputTest.kt @@ -138,19 +138,23 @@ class UserInputTest { } private fun clickOnTextField() = - composeTestRule.onNodeWithContentDescription(activity.getString(R.string.textfield_desc)) + composeTestRule + .onNodeWithContentDescription(activity.getString(R.string.textfield_desc)) .performClick() private fun openEmojiSelector() = - composeTestRule.onNodeWithContentDescription(activity.getString(R.string.emoji_selector_bt_desc)) + composeTestRule + .onNodeWithContentDescription(activity.getString(R.string.emoji_selector_bt_desc)) .performClick() private fun assertEmojiSelectorIsDisplayed() = - composeTestRule.onNodeWithContentDescription(activity.getString(R.string.emoji_selector_desc)) + composeTestRule + .onNodeWithContentDescription(activity.getString(R.string.emoji_selector_desc)) .assertIsDisplayed() private fun assertEmojiSelectorDoesNotExist() = - composeTestRule.onNodeWithContentDescription(activity.getString(R.string.emoji_selector_desc)) + composeTestRule + .onNodeWithContentDescription(activity.getString(R.string.emoji_selector_desc)) .assertDoesNotExist() private fun findSendButton() = composeTestRule.onNodeWithText(activity.getString(R.string.send)) diff --git a/Jetchat/app/src/main/java/com/example/compose/jetchat/components/JetchatDrawer.kt b/Jetchat/app/src/main/java/com/example/compose/jetchat/components/JetchatDrawer.kt index 7f5308a0c8..48ee88998d 100644 --- a/Jetchat/app/src/main/java/com/example/compose/jetchat/components/JetchatDrawer.kt +++ b/Jetchat/app/src/main/java/com/example/compose/jetchat/components/JetchatDrawer.kt @@ -66,7 +66,9 @@ fun ColumnScope.JetchatDrawer(onProfileClicked: (String) -> Unit, onChatClicked: ChatItem("droidcon-nyc", false) { onChatClicked("droidcon-nyc") } DrawerItemHeader("Recent Profiles") ProfileItem("Ali Conors (you)", meProfile.photo) { onProfileClicked(meProfile.userId) } - ProfileItem("Taylor Brooks", colleagueProfile.photo) { onProfileClicked(colleagueProfile.userId) } + ProfileItem("Taylor Brooks", colleagueProfile.photo) { + onProfileClicked(colleagueProfile.userId) + } } @Composable diff --git a/Jetchat/app/src/main/java/com/example/compose/jetchat/conversation/ConversationUiState.kt b/Jetchat/app/src/main/java/com/example/compose/jetchat/conversation/ConversationUiState.kt index 2d8b35782b..3d9baed149 100644 --- a/Jetchat/app/src/main/java/com/example/compose/jetchat/conversation/ConversationUiState.kt +++ b/Jetchat/app/src/main/java/com/example/compose/jetchat/conversation/ConversationUiState.kt @@ -34,4 +34,9 @@ class ConversationUiState( } @Immutable -data class Message(val author: String, val content: String, val timestamp: String, val image: Int? = null) +data class Message( + val author: String, + val content: String, + val timestamp: String, + val image: Int? = null +) diff --git a/Jetchat/build.gradle b/Jetchat/build.gradle index dfb7c9944e..4db919b9cd 100644 --- a/Jetchat/build.gradle +++ b/Jetchat/build.gradle @@ -53,8 +53,7 @@ subprojects { target '**/*.kt' targetExclude("$buildDir/**/*.kt") targetExclude('bin/**/*.kt') - - ktlint(Versions.ktlint) + ktlint(Versions.ktlint).userData([android: "true"]) licenseHeaderFile rootProject.file('spotless/copyright.kt') } }