Skip to content

Commit

Permalink
feat: Add "Open URL" action after clean (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
svenjacobs authored Nov 2, 2023
1 parent a3079cf commit aee8559
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ fun MainScreen(
(uiState.result as? Result.Success)?.let { result ->
when (uiState.actionAfterClean) {
ActionAfterClean.OpenShareMenu -> openShareMenu(result)
ActionAfterClean.OpenUrl -> openInDefaultApp(result)
ActionAfterClean.CopyToClipboard -> copyToClipboard(result)
ActionAfterClean.DoNothing -> {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ private fun Content(
},
)

DropdownMenuItem(
text = { Text(stringResource(R.string.open_url)) },
onClick = {
expanded = false
onActionAfterCleanClick(ActionAfterClean.OpenUrl)
},
)

DropdownMenuItem(
text = { Text(stringResource(R.string.copy_to_clipboard)) },
onClick = {
Expand Down Expand Up @@ -205,6 +213,7 @@ private fun Content(
private fun ActionAfterClean.text(): String = when (this) {
ActionAfterClean.DoNothing -> stringResource(R.string.do_nothing)
ActionAfterClean.OpenShareMenu -> stringResource(R.string.open_share_menu)
ActionAfterClean.OpenUrl -> stringResource(R.string.open_url)
ActionAfterClean.CopyToClipboard -> stringResource(R.string.copy_to_clipboard)
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
<string name="action_after_clean">Aktion nach Reinigung</string>
<string name="do_nothing">Nichts unternehmen</string>
<string name="open_share_menu">Teilenmenü öffnen</string>
<string name="open_url">URL öffnen</string>
<string name="copy_to_clipboard">In Zwischenablage kopieren</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
<string name="action_after_clean">Action after clean</string> <!-- TODO: translate -->
<string name="do_nothing">Do nothing</string> <!-- TODO: translate -->
<string name="open_share_menu">Open share menu</string> <!-- TODO: translate -->
<string name="open_url">Open URL</string>
<string name="copy_to_clipboard">Copy to clipboard</string> <!-- TODO: translate -->
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
<string name="action_after_clean">Action after clean</string> <!-- TODO: translate -->
<string name="do_nothing">Do nothing</string> <!-- TODO: translate -->
<string name="open_share_menu">Open share menu</string> <!-- TODO: translate -->
<string name="open_url">Open URL</string>
<string name="copy_to_clipboard">Copy to clipboard</string> <!-- TODO: translate -->
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@
<string name="action_after_clean">Action after clean</string>
<string name="do_nothing">Do nothing</string>
<string name="open_share_menu">Open share menu</string>
<string name="open_url">Open URL</string>
<string name="copy_to_clipboard">Copy to clipboard</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ enum class ActionAfterClean {
DoNothing,
OpenShareMenu,
CopyToClipboard,
OpenUrl,
}

0 comments on commit aee8559

Please sign in to comment.