-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OverwriteFiles setting introduced by #578
- Loading branch information
Showing
15 changed files
with
219 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...ru/tech/imageresizershrinker/domain/use_case/edit_settings/ToggleOverwriteFilesUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package ru.tech.imageresizershrinker.domain.use_case.edit_settings | ||
|
||
import ru.tech.imageresizershrinker.domain.repository.SettingsRepository | ||
import javax.inject.Inject | ||
|
||
class ToggleOverwriteFilesUseCase @Inject constructor( | ||
private val settingsRepository: SettingsRepository | ||
) { | ||
suspend operator fun invoke() = settingsRepository.toggleAddOriginalFilename() | ||
} |
45 changes: 45 additions & 0 deletions
45
...resizershrinker/presentation/main_screen/components/settings/OverwriteFilesSettingItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package ru.tech.imageresizershrinker.presentation.main_screen.components.settings | ||
|
||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.outlined.Architecture | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Shape | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import ru.tech.imageresizershrinker.R | ||
import ru.tech.imageresizershrinker.presentation.root.widget.modifier.ContainerShapeDefaults | ||
import ru.tech.imageresizershrinker.presentation.root.widget.preferences.PreferenceRowSwitch | ||
import ru.tech.imageresizershrinker.presentation.root.widget.utils.LocalSettingsState | ||
|
||
@Composable | ||
fun OverwriteFilesSettingItem( | ||
onClick: (Boolean) -> Unit, | ||
shape: Shape = ContainerShapeDefaults.centerShape, | ||
modifier: Modifier = Modifier.padding(start = 8.dp, end = 8.dp) | ||
) { | ||
val settingsState = LocalSettingsState.current | ||
PreferenceRowSwitch( | ||
shape = shape, | ||
modifier = modifier, | ||
applyHorPadding = false, | ||
onClick = onClick, | ||
enabled = !settingsState.randomizeFilename, | ||
title = stringResource(R.string.overwrite_files), | ||
subtitle = stringResource(R.string.overwrite_files_sub), | ||
checked = settingsState.addSequenceNumber, | ||
resultModifier = Modifier.padding( | ||
horizontal = 16.dp, | ||
vertical = 8.dp | ||
), | ||
startContent = { | ||
Icon( | ||
imageVector = Icons.Outlined.Architecture, | ||
contentDescription = null, | ||
modifier = Modifier.padding(end = 16.dp) | ||
) | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.