Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Fix spotless issues

Don Turnerc3f7870412b2
diff --git a/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt b/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt
index 0d00f6ed5..d7d092a26 100644
--- a/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt
+++ b/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt
@@ -204,7 +204,7 @@ class NavigationTest {
}
@Test
- fun whenSettingsDialogDismissed_previousScreenIsDisplayed(){
+ fun whenSettingsDialogDismissed_previousScreenIsDisplayed() {
composeTestRule.apply {
diff --git a/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt b/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt
index 533d5ce97..c15263d3b 100644
--- a/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt
+++ b/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt
@@ -420,7 +420,6 @@ fun TopicIcon(
)
}
-
@DevicePreviews
@Composable
fun ForYouScreenPopulatedFeed() {
diff --git a/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModel.kt b/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModel.kt
index 509087a9d..8cbf39c31 100644
--- a/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModel.kt
+++ b/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModel.kt
@@ -31,10 +31,6 @@ import com.google.samples.apps.nowinandroid.core.domain.GetFollowableTopicsStrea
import com.google.samples.apps.nowinandroid.core.domain.GetSaveableNewsResourcesStreamUseCase
import com.google.samples.apps.nowinandroid.core.domain.GetSortedFollowableAuthorsStreamUseCase
import com.google.samples.apps.nowinandroid.core.domain.model.SaveableNewsResource
-import com.google.samples.apps.nowinandroid.core.model.data.DarkThemeConfig
-import com.google.samples.apps.nowinandroid.core.model.data.DarkThemeConfig.FOLLOW_SYSTEM
-import com.google.samples.apps.nowinandroid.core.model.data.ThemeBrand
-import com.google.samples.apps.nowinandroid.core.model.data.ThemeBrand.DEFAULT
import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState
import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsUiState.FollowedInterests
import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsUiState.None
@@ -82,7 +78,6 @@ class ForYouViewModel @Inject constructor(
initialValue = Unknown
)
-
/**
* The in-progress set of topics to be selected, persisted through process death with a
* [SavedStateHandle].
@@ -231,8 +226,6 @@ class ForYouViewModel @Inject constructor(
}
}
}
-
-
}
private fun Flow<List<SaveableNewsResource>>.mapToFeedState(): Flow<NewsFeedUiState> =
diff --git a/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogTest.kt b/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogTest.kt
index edd281c89..71d6cceaa 100644
--- a/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogTest.kt
+++ b/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogTest.kt
@@ -1,17 +1,17 @@
/*
* Copyright 2022 The Android Open Source Project
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.google.samples.apps.nowinandroid.feature.settings
@@ -40,7 +40,7 @@ class SettingsDialogTest {
composeTestRule.setContent {
SettingsDialog(
settingsUiState = Loading,
- onDismiss = { },
+ onDismiss = { },
onChangeThemeBrand = {},
onChangeDarkThemeConfig = {}
)
@@ -52,7 +52,7 @@ class SettingsDialogTest {
}
@Test
- fun whenStateIsSuccess_allSettingsAreDisplayed(){
+ fun whenStateIsSuccess_allSettingsAreDisplayed() {
composeTestRule.setContent {
SettingsDialog(
settingsUiState = Success(
@@ -61,7 +61,7 @@ class SettingsDialogTest {
darkThemeConfig = DARK
)
),
- onDismiss = { },
+ onDismiss = { },
onChangeThemeBrand = {},
onChangeDarkThemeConfig = {}
)
@@ -80,4 +80,4 @@ class SettingsDialogTest {
composeTestRule.onNodeWithText(getString(R.string.brand_android)).assertIsSelected()
composeTestRule.onNodeWithText(getString(R.string.dark_mode_config_dark)).assertIsSelected()
}
-}
\ No newline at end of file
+}
diff --git a/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialog.kt b/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialog.kt
index 33ebd53b1..b51c5b6e7 100644
--- a/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialog.kt
+++ b/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialog.kt
@@ -1,17 +1,17 @@
/*
* Copyright 2022 The Android Open Source Project
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.google.samples.apps.nowinandroid.feature.settings
@@ -92,7 +92,7 @@ fun SettingsDialog(
},
text = {
Divider()
- Column (Modifier.verticalScroll(rememberScrollState())) {
+ Column(Modifier.verticalScroll(rememberScrollState())) {
when (settingsUiState) {
Loading -> {
Text(
@@ -199,7 +199,6 @@ fun SettingsDialogThemeChooserRow(
}
}
-
@Composable
private fun LegalPanel() {
Row(
@@ -273,4 +272,4 @@ fun PreviewSettingsDialogLoading() {
}
private const val PRIVACY_POLICY_URL = "https://policies.google.com/privacy"
-private const val LICENSES_URL = "https://github.com/android/nowinandroid/blob/main/app/LICENSES.md"
\ No newline at end of file
+private const val LICENSES_URL = "https://github.com/android/nowinandroid/blob/main/app/LICENSES.md"
diff --git a/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModel.kt b/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModel.kt
index 7ff9b0ca3..be2927546 100644
--- a/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModel.kt
+++ b/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModel.kt
@@ -1,17 +1,17 @@
/*
* Copyright 2022 The Android Open Source Project
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.google.samples.apps.nowinandroid.feature.settings
@@ -20,18 +20,16 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.google.samples.apps.nowinandroid.core.data.repository.UserDataRepository
import com.google.samples.apps.nowinandroid.core.model.data.DarkThemeConfig
-import com.google.samples.apps.nowinandroid.core.model.data.DarkThemeConfig.FOLLOW_SYSTEM
import com.google.samples.apps.nowinandroid.core.model.data.ThemeBrand
-import com.google.samples.apps.nowinandroid.core.model.data.ThemeBrand.DEFAULT
import com.google.samples.apps.nowinandroid.feature.settings.SettingsUiState.Loading
import com.google.samples.apps.nowinandroid.feature.settings.SettingsUiState.Success
import dagger.hilt.android.lifecycle.HiltViewModel
+import javax.inject.Inject
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
-import javax.inject.Inject
@HiltViewModel
class SettingsViewModel @Inject constructor(
@@ -74,4 +72,4 @@ data class UserEditableSettings(val brand: ThemeBrand, val darkThemeConfig: Dark
sealed interface SettingsUiState {
object Loading : SettingsUiState
data class Success(val settings: UserEditableSettings) : SettingsUiState
-}
\ No newline at end of file
+}
diff --git a/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/navigation/SettingsDestination.kt b/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/navigation/SettingsDestination.kt
index 82b5e400d..3eb9a6c92 100644
--- a/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/navigation/SettingsDestination.kt
+++ b/feature/settings/src/main/java/com/google/samples/apps/nowinandroid/feature/settings/navigation/SettingsDestination.kt
@@ -1,17 +1,17 @@
/*
* Copyright 2022 The Android Open Source Project
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.google.samples.apps.nowinandroid.feature.settings.navigation
@@ -28,7 +28,7 @@ object SettingsDestination : NiaNavigationDestination {
}
@OptIn(ExperimentalLifecycleComposeApi::class)
-fun NavGraphBuilder.settingsDialog(onDismiss : () -> Unit) {
+fun NavGraphBuilder.settingsDialog(onDismiss: () -> Unit) {
dialog(route = SettingsDestination.route) {
SettingsDialog(onDismiss = onDismiss)
}
diff --git a/feature/settings/src/test/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModelTest.kt b/feature/settings/src/test/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModelTest.kt
index a78cf14ab..b9df2fafd 100644
--- a/feature/settings/src/test/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModelTest.kt
+++ b/feature/settings/src/test/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModelTest.kt
@@ -1,17 +1,17 @@
/*
* Copyright 2022 The Android Open Source Project
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.google.samples.apps.nowinandroid.feature.settings
@@ -47,7 +47,7 @@ class SettingsViewModelTest {
@Test
fun stateIsInitiallyLoading() = runTest {
- assertEquals(Loading, viewModel.settingsUiState.value)
+ assertEquals(Loading, viewModel.settingsUiState.value)
}
@Test
@@ -66,8 +66,9 @@ class SettingsViewModelTest {
darkThemeConfig = DARK
)
),
- viewModel.settingsUiState.value)
+ viewModel.settingsUiState.value
+ )
collectJob.cancel()
}
-}
\ No newline at end of file
+}