Skip to content

Commit

Permalink
spotless: apply formatting for fixing format violations
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonlom committed Jan 10, 2025
1 parent a1ed5c0 commit 022442d
Show file tree
Hide file tree
Showing 39 changed files with 63 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ val Context.dataStore by preferencesDataStore("cappajv-preferences")
*
* @author marlonlom
*/
class CappajvApp : Application(), ImageLoaderFactory {
class CappajvApp :
Application(),
ImageLoaderFactory {

override fun onCreate() {
super.onCreate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ import kotlinx.coroutines.flow.combine
* @property isFavorite True/False if catalog product is marked as favorite.
* @property points Catalog product points list
*/
data class CatalogDetail(
val product: CatalogItem,
val isFavorite: Boolean,
val points: List<CatalogPunctuation>,
)
data class CatalogDetail(val product: CatalogItem, val isFavorite: Boolean, val points: List<CatalogPunctuation>)

/**
* Catalog details repository class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,5 @@ sealed class CatalogDetailUiState {
*
* @property detail Catalog item detailed information.
*/
data class Found(
val detail: CatalogDetail,
) : CatalogDetailUiState()
data class Found(val detail: CatalogDetail) : CatalogDetailUiState()
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import kotlinx.coroutines.flow.map
*
* @property localDataSource Local data source.
*/
class CatalogFavoritesRepository(
private val localDataSource: LocalDataSource,
) {
class CatalogFavoritesRepository(private val localDataSource: LocalDataSource) {

/** Returns Favorite catalog items list as flow. */
val favoritesListFlow: Flow<List<CatalogItemTuple>> = localDataSource.getFavorites().map { f ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch

class CatalogFavoritesViewModel(
private val repository: CatalogFavoritesRepository,
) : ViewModel() {
class CatalogFavoritesViewModel(private val repository: CatalogFavoritesRepository) : ViewModel() {

private val _favoritesListState = MutableStateFlow<CatalogFavoritesUiState>(Empty)
val favoritesListState = _favoritesListState.stateIn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,5 @@ sealed class CatalogListUiState {
*
* @property catalogMap Grouped catalog items.
*/
data class Listing(
val catalogMap: Map<String, List<CatalogItemTuple>>,
) : CatalogListUiState()
data class Listing(val catalogMap: Map<String, List<CatalogItemTuple>>) : CatalogListUiState()
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import timber.log.Timber
*
* @property repository catalog list repository dependency
*/
class CatalogListViewModel(
private val repository: CatalogListRepository,
) : ViewModel() {
class CatalogListViewModel(private val repository: CatalogListRepository) : ViewModel() {

private val _selectedCatalogId = MutableStateFlow(0L)
val selectedCatalogId: MutableStateFlow<Long> = _selectedCatalogId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import dev.marlonlom.cappajv.core.database.datasource.LocalDataSource
*
* @property localDataSource Local data source.
*/
class CatalogSearchRepository(
private val localDataSource: LocalDataSource,
) {
class CatalogSearchRepository(private val localDataSource: LocalDataSource) {

/**
* Perform search using provided text.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,5 @@ sealed class CatalogSearchUiState {
*
* @property results Catalog tuples result list.
*/
data class Success(
val results: List<CatalogItemTuple>,
) : CatalogSearchUiState()
data class Success(val results: List<CatalogItemTuple>) : CatalogSearchUiState()
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ import kotlinx.coroutines.launch
*
* @property repository Catalog search repository.
*/
class CatalogSearchViewModel(
private val repository: CatalogSearchRepository,
) : ViewModel() {
class CatalogSearchViewModel(private val repository: CatalogSearchRepository) : ViewModel() {
var queryText = mutableStateOf("")
private set

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import kotlinx.coroutines.launch
*
* @property repository User preferences repository.
*/
class SettingsViewModel(
private val repository: UserPreferencesRepository,
) : ViewModel() {
class SettingsViewModel(private val repository: UserPreferencesRepository) : ViewModel() {

/** User preferences ui state as Flow. */
val uiState: StateFlow<SettingsUiState> = repository.userPreferencesFlow
Expand Down Expand Up @@ -61,11 +59,7 @@ class SettingsViewModel(
* @property useDarkTheme True/False if using dark theme.
* @property useDynamicColor True/False if using dynamic colors.
*/
data class UserEditableSettings(
val useDarkTheme: Boolean,
val useDynamicColor: Boolean,
val isOnboarding: Boolean,
)
data class UserEditableSettings(val useDarkTheme: Boolean, val useDynamicColor: Boolean, val isOnboarding: Boolean)

/**
* Settings ui state sealed interface definition.
Expand All @@ -88,7 +82,5 @@ sealed interface SettingsUiState {
*
* @property settings User editable settings information.
*/
data class Success(
val settings: UserEditableSettings,
) : SettingsUiState
data class Success(val settings: UserEditableSettings) : SettingsUiState
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ import kotlinx.coroutines.launch
*
* @property repository User preferences repository.
*/
class MainActivityViewModel(
private val repository: UserPreferencesRepository,
) : ViewModel() {
class MainActivityViewModel(private val repository: UserPreferencesRepository) : ViewModel() {

val uiState: StateFlow<MainActivityUiState> = repository
.userPreferencesFlow
Expand Down Expand Up @@ -80,7 +78,5 @@ sealed interface MainActivityUiState {
*
* @property userData User settings data.
*/
data class Success(
val userData: UserSettings,
) : MainActivityUiState
data class Success(val userData: UserSettings) : MainActivityUiState
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ sealed interface ScaffoldContentType {
*
* @property hingeRatio Hinge ratio as percentage number.
*/
data class TwoPane(
val hingeRatio: Float = 0.5f,
) : ScaffoldContentType
data class TwoPane(val hingeRatio: Float = 0.5f) : ScaffoldContentType
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ import dev.marlonlom.cappajv.R
* @property title Destination title as string resource.
* @property icon Icon for destination
*/
sealed class CatalogDestination(
val route: String,
@StringRes val title: Int,
val icon: ImageVector,
) {
sealed class CatalogDestination(val route: String, @StringRes val title: Int, val icon: ImageVector) {

/**
* Catalog list destination data object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ import androidx.compose.ui.graphics.Color
* @property dark Dark color scheme.
*
*/
internal enum class CappajvColorContrasts(
val light: ColorScheme,
val dark: ColorScheme,
) {
internal enum class CappajvColorContrasts(val light: ColorScheme, val dark: ColorScheme) {
/** Default branded color contrast: Standard. */
STANDARD(
light = lightColorScheme(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import org.junit.runner.Description
* @author marlonlom
*/
@OptIn(ExperimentalCoroutinesApi::class)
class MainDispatcherRule(
private val testDispatcher: TestDispatcher = UnconfinedTestDispatcher(),
) : TestWatcher() {
class MainDispatcherRule(private val testDispatcher: TestDispatcher = UnconfinedTestDispatcher()) : TestWatcher() {
override fun starting(description: Description) {
Dispatchers.setMain(testDispatcher)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement

class RethrowingExceptionHandler : TestRule, Thread.UncaughtExceptionHandler {
class RethrowingExceptionHandler :
TestRule,
Thread.UncaughtExceptionHandler {
override fun uncaughtException(thread: Thread, throwable: Throwable): Nothing = throw UncaughtException(throwable)

override fun apply(base: Statement, description: Description): Statement {
return object : Statement() {
@Throws(Throwable::class)
override fun evaluate() {
}
override fun apply(base: Statement, description: Description): Statement = object : Statement() {
@Throws(Throwable::class)
override fun evaluate() {
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import org.koin.core.context.startKoin
import org.koin.core.logger.Level
import timber.log.Timber

class CappajvTvApp : Application(), ImageLoaderFactory {
class CappajvTvApp :
Application(),
ImageLoaderFactory {

override fun onCreate() {
super.onCreate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ import dev.marlonlom.cappajv.tv.R
* @param text Item text as string resource.
* @param icon Item icon as image vector.
*/
enum class CatalogBrowseMenuItems(
@StringRes val text: Int,
val icon: ImageVector,
) {
enum class CatalogBrowseMenuItems(@StringRes val text: Int, val icon: ImageVector) {

/** TV Browse menu items enum: Home */
HOME(R.string.text_menu_home, Icons.TwoTone.Home),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ import dev.marlonlom.cappajv.tv.R
* @property icon Item icon as image vector.
* @property text Item text as string resource.
*/
enum class CategoryEntries(
val icon: ImageVector,
@StringRes val text: Int,
) {
enum class CategoryEntries(val icon: ImageVector, @StringRes val text: Int) {

/** Category entry enum: Hot drinks. */
HOT(Icons.TwoTone.Coffee, R.string.text_category_hot),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal fun CatalogDetailInfoPointsSlot(points: List<CatalogPunctuation>) = Col
) { pt ->
CompactCard(
modifier = Modifier
.width(120.dp)
.width(160.dp)
.padding(horizontal = 10.dp),
onClick = {},
title = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ import kotlinx.coroutines.flow.combine
* @property isFavorite True/False if catalog product is marked as favorite.
* @property points Catalog product points list
*/
data class CatalogDetail(
val product: CatalogItem,
val isFavorite: Boolean,
val points: List<CatalogPunctuation>,
)
data class CatalogDetail(val product: CatalogItem, val isFavorite: Boolean, val points: List<CatalogPunctuation>)

/**
* Catalog details repository class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,5 @@ sealed class CatalogDetailUiState {
*
* @property detail Catalog item detailed information.
*/
data class Found(
val detail: CatalogDetail,
) : CatalogDetailUiState()
data class Found(val detail: CatalogDetail) : CatalogDetailUiState()
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import kotlinx.coroutines.flow.transform
*
* @property localDataSource Local data source.
*/
class CatalogFavoritesRepository(
private val localDataSource: LocalDataSource,
) {
class CatalogFavoritesRepository(private val localDataSource: LocalDataSource) {

/** Returns Favorite catalog items list as flow. */
val allFavorites: Flow<CatalogFavoritesUiState> = localDataSource.getFavorites()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import kotlinx.coroutines.launch
*
* @property repository catalog favorites repository dependency.
*/
class CatalogFavoritesViewModel(
private val repository: CatalogFavoritesRepository,
) : ViewModel() {
class CatalogFavoritesViewModel(private val repository: CatalogFavoritesRepository) : ViewModel() {

/** UI state object for view model */
val uiState = repository.allFavorites.stateIn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,5 @@ sealed class CatalogHomeUiState {
*
* @property catalogMap Grouped catalog items.
*/
data class Listing(
val catalogMap: Map<String, List<CatalogItemTuple>>,
) : CatalogHomeUiState()
data class Listing(val catalogMap: Map<String, List<CatalogItemTuple>>) : CatalogHomeUiState()
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ import timber.log.Timber
*
* @property repository catalog list repository dependency
*/
class CatalogHomeViewModel(
private val repository: CatalogHomeRepository,
) : ViewModel() {
class CatalogHomeViewModel(private val repository: CatalogHomeRepository) : ViewModel() {

/** UI state object for view model */
val uiState = repository.allProducts.stateIn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ import kotlinx.coroutines.flow.map
* @property navHostController Navigation host controller.
*/
@Stable
class CappajvTvUiState(
val navHostController: NavHostController,
) {
class CappajvTvUiState(val navHostController: NavHostController) {

var browseMenuIndex by mutableIntStateOf(0)
var homeCategoryIndex by mutableIntStateOf(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import kotlinx.serialization.Serializable
* @property route Screen route.
*/
@Serializable
sealed class TvScreenRoute(
val route: String,
) {
sealed class TvScreenRoute(val route: String) {

/**
* Catalog listings tv screen route object.
Expand All @@ -42,7 +40,5 @@ sealed class TvScreenRoute(
* @property itemId Catalog item id.
*/
@Serializable
data class Detail(
val itemId: String,
) : TvScreenRoute("details/$itemId")
data class Detail(val itemId: String) : TvScreenRoute("details/$itemId")
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ import androidx.tv.material3.lightColorScheme
* @property dark Dark color scheme.
*
*/
internal enum class CappajvColorSchemes(
val light: ColorScheme,
val dark: ColorScheme,
) {
internal enum class CappajvColorSchemes(val light: ColorScheme, val dark: ColorScheme) {

/** Default branded color contrast: Standard. */
STANDARD(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ import java.util.Locale
*
* @property language Selected language for fetching catalog data, default to english (en).
*/
class CatalogDataService(
private val language: String = Locale.ENGLISH.language,
) {
class CatalogDataService(private val language: String = Locale.ENGLISH.language) {

private var catalogJsonPath = if (language == "es") CATALOG_JSON_FILENAME else ENG_CATALOG_JSON_FILENAME

Expand Down
Loading

0 comments on commit 022442d

Please sign in to comment.