Fix spotless issues

pull/330/head
Don Turner 3 years ago
parent 56c0645816
commit c3f7870412

@ -204,7 +204,7 @@ class NavigationTest {
} }
@Test @Test
fun whenSettingsDialogDismissed_previousScreenIsDisplayed(){ fun whenSettingsDialogDismissed_previousScreenIsDisplayed() {
composeTestRule.apply { composeTestRule.apply {

@ -420,7 +420,6 @@ fun TopicIcon(
) )
} }
@DevicePreviews @DevicePreviews
@Composable @Composable
fun ForYouScreenPopulatedFeed() { fun ForYouScreenPopulatedFeed() {

@ -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.GetSaveableNewsResourcesStreamUseCase
import com.google.samples.apps.nowinandroid.core.domain.GetSortedFollowableAuthorsStreamUseCase 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.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.core.ui.NewsFeedUiState
import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsUiState.FollowedInterests import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsUiState.FollowedInterests
import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsUiState.None import com.google.samples.apps.nowinandroid.feature.foryou.FollowedInterestsUiState.None
@ -82,7 +78,6 @@ class ForYouViewModel @Inject constructor(
initialValue = Unknown initialValue = Unknown
) )
/** /**
* The in-progress set of topics to be selected, persisted through process death with a * The in-progress set of topics to be selected, persisted through process death with a
* [SavedStateHandle]. * [SavedStateHandle].
@ -231,8 +226,6 @@ class ForYouViewModel @Inject constructor(
} }
} }
} }
} }
private fun Flow<List<SaveableNewsResource>>.mapToFeedState(): Flow<NewsFeedUiState> = private fun Flow<List<SaveableNewsResource>>.mapToFeedState(): Flow<NewsFeedUiState> =

@ -1,17 +1,17 @@
/* /*
* Copyright 2022 The Android Open Source Project * Copyright 2022 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.samples.apps.nowinandroid.feature.settings package com.google.samples.apps.nowinandroid.feature.settings
@ -40,7 +40,7 @@ class SettingsDialogTest {
composeTestRule.setContent { composeTestRule.setContent {
SettingsDialog( SettingsDialog(
settingsUiState = Loading, settingsUiState = Loading,
onDismiss = { }, onDismiss = { },
onChangeThemeBrand = {}, onChangeThemeBrand = {},
onChangeDarkThemeConfig = {} onChangeDarkThemeConfig = {}
) )
@ -52,7 +52,7 @@ class SettingsDialogTest {
} }
@Test @Test
fun whenStateIsSuccess_allSettingsAreDisplayed(){ fun whenStateIsSuccess_allSettingsAreDisplayed() {
composeTestRule.setContent { composeTestRule.setContent {
SettingsDialog( SettingsDialog(
settingsUiState = Success( settingsUiState = Success(
@ -61,7 +61,7 @@ class SettingsDialogTest {
darkThemeConfig = DARK darkThemeConfig = DARK
) )
), ),
onDismiss = { }, onDismiss = { },
onChangeThemeBrand = {}, onChangeThemeBrand = {},
onChangeDarkThemeConfig = {} onChangeDarkThemeConfig = {}
) )
@ -80,4 +80,4 @@ class SettingsDialogTest {
composeTestRule.onNodeWithText(getString(R.string.brand_android)).assertIsSelected() composeTestRule.onNodeWithText(getString(R.string.brand_android)).assertIsSelected()
composeTestRule.onNodeWithText(getString(R.string.dark_mode_config_dark)).assertIsSelected() composeTestRule.onNodeWithText(getString(R.string.dark_mode_config_dark)).assertIsSelected()
} }
} }

@ -1,17 +1,17 @@
/* /*
* Copyright 2022 The Android Open Source Project * Copyright 2022 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.samples.apps.nowinandroid.feature.settings package com.google.samples.apps.nowinandroid.feature.settings
@ -92,7 +92,7 @@ fun SettingsDialog(
}, },
text = { text = {
Divider() Divider()
Column (Modifier.verticalScroll(rememberScrollState())) { Column(Modifier.verticalScroll(rememberScrollState())) {
when (settingsUiState) { when (settingsUiState) {
Loading -> { Loading -> {
Text( Text(
@ -199,7 +199,6 @@ fun SettingsDialogThemeChooserRow(
} }
} }
@Composable @Composable
private fun LegalPanel() { private fun LegalPanel() {
Row( Row(
@ -273,4 +272,4 @@ fun PreviewSettingsDialogLoading() {
} }
private const val PRIVACY_POLICY_URL = "https://policies.google.com/privacy" 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" private const val LICENSES_URL = "https://github.com/android/nowinandroid/blob/main/app/LICENSES.md"

@ -1,17 +1,17 @@
/* /*
* Copyright 2022 The Android Open Source Project * Copyright 2022 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.samples.apps.nowinandroid.feature.settings package com.google.samples.apps.nowinandroid.feature.settings
@ -20,18 +20,16 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.google.samples.apps.nowinandroid.core.data.repository.UserDataRepository 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
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
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.Loading
import com.google.samples.apps.nowinandroid.feature.settings.SettingsUiState.Success import com.google.samples.apps.nowinandroid.feature.settings.SettingsUiState.Success
import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import javax.inject.Inject
@HiltViewModel @HiltViewModel
class SettingsViewModel @Inject constructor( class SettingsViewModel @Inject constructor(
@ -74,4 +72,4 @@ data class UserEditableSettings(val brand: ThemeBrand, val darkThemeConfig: Dark
sealed interface SettingsUiState { sealed interface SettingsUiState {
object Loading : SettingsUiState object Loading : SettingsUiState
data class Success(val settings: UserEditableSettings) : SettingsUiState data class Success(val settings: UserEditableSettings) : SettingsUiState
} }

@ -1,17 +1,17 @@
/* /*
* Copyright 2022 The Android Open Source Project * Copyright 2022 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.samples.apps.nowinandroid.feature.settings.navigation package com.google.samples.apps.nowinandroid.feature.settings.navigation
@ -28,7 +28,7 @@ object SettingsDestination : NiaNavigationDestination {
} }
@OptIn(ExperimentalLifecycleComposeApi::class) @OptIn(ExperimentalLifecycleComposeApi::class)
fun NavGraphBuilder.settingsDialog(onDismiss : () -> Unit) { fun NavGraphBuilder.settingsDialog(onDismiss: () -> Unit) {
dialog(route = SettingsDestination.route) { dialog(route = SettingsDestination.route) {
SettingsDialog(onDismiss = onDismiss) SettingsDialog(onDismiss = onDismiss)
} }

@ -1,17 +1,17 @@
/* /*
* Copyright 2022 The Android Open Source Project * Copyright 2022 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.samples.apps.nowinandroid.feature.settings package com.google.samples.apps.nowinandroid.feature.settings
@ -47,7 +47,7 @@ class SettingsViewModelTest {
@Test @Test
fun stateIsInitiallyLoading() = runTest { fun stateIsInitiallyLoading() = runTest {
assertEquals(Loading, viewModel.settingsUiState.value) assertEquals(Loading, viewModel.settingsUiState.value)
} }
@Test @Test
@ -66,8 +66,9 @@ class SettingsViewModelTest {
darkThemeConfig = DARK darkThemeConfig = DARK
) )
), ),
viewModel.settingsUiState.value) viewModel.settingsUiState.value
)
collectJob.cancel() collectJob.cancel()
} }
} }

Loading…
Cancel
Save