Skip to content

Commit

Permalink
Log dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland Meyer committed Mar 22, 2022
1 parent 780902e commit 5c23cfd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ abstract class BaseActivity : AppCompatActivity() {
if (currentDialogState == dialogState) {
return
}
logInfo("Setting dialog state: ${dialogState?.let { it.id ?: "no-id" } ?: "no dialog"}")
currentDialog?.dismiss()
currentDialogState = dialogState
currentDialog = dialogState?.createDialog(context, viewModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ abstract class BaseFragment<Binding : ViewBinding> : Fragment() {
if (currentDialogState == dialogState) {
return
}
logInfo("Setting dialog state: ${dialogState?.let { it.id ?: "no-id" } ?: "no dialog"}")
currentDialog?.dismiss()
currentDialogState = dialogState
currentDialog = dialogState?.createDialog(requireContext(), viewModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class GetContextMenuDialogUseCase {

@CheckResult
operator fun invoke(shortcutId: String, title: String, isPending: Boolean, isMovable: Boolean, viewModel: ShortcutListViewModel) =
DialogState.create {
DialogState.create(DIALOG_ID) {
title(title)
.item(R.string.action_place) {
viewModel.onPlaceOnHomeScreenOptionSelected(shortcutId)
Expand Down Expand Up @@ -47,4 +47,8 @@ class GetContextMenuDialogUseCase {
}
.build()
}

companion object {
private const val DIALOG_ID = "shortcut-context-menu"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.afollestad.materialdialogs.callbacks.onShow
class GetCurlExportDialogUseCase {

operator fun invoke(title: String, command: CurlCommand): DialogState =
DialogState.create {
DialogState.create(DIALOG_ID) {
val curlCommand = CurlConstructor.toCurlCommandString(command)
this
.title(title)
Expand All @@ -34,4 +34,8 @@ class GetCurlExportDialogUseCase {
private fun copyCurlExport(context: Context, curlCommand: String) {
ClipboardUtil.copyToClipboard(context, curlCommand)
}

companion object {
private const val DIALOG_ID = "curl-export"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class GetShortcutCreationDialogUseCase {

@CheckResult
operator fun invoke(viewModel: MainViewModel): DialogState =
DialogState.create {
DialogState.create(DIALOG_ID) {
title(R.string.title_create_new_shortcut_options_dialog)
.item(R.string.button_create_new) {
viewModel.onCreationDialogOptionSelected(ShortcutExecutionType.APP)
Expand Down Expand Up @@ -42,4 +42,8 @@ class GetShortcutCreationDialogUseCase {
}
.build()
}

companion object {
private const val DIALOG_ID = "shortcut-creation"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class GetChangeLogDialogUseCase(
}

companion object {
const val DIALOG_ID = "change_log"
const val DIALOG_ID = "change-log"

private const val CHANGELOG_ASSET_URL = "file:///android_asset/changelog.html"
}
Expand Down

0 comments on commit 5c23cfd

Please sign in to comment.