diff --git a/app/src/main/java/com/duckduckgo/app/generalsettings/showonapplaunch/ShowOnAppLaunchActivity.kt b/app/src/main/java/com/duckduckgo/app/generalsettings/showonapplaunch/ShowOnAppLaunchActivity.kt index fb961325a72b..93adc56b674b 100644 --- a/app/src/main/java/com/duckduckgo/app/generalsettings/showonapplaunch/ShowOnAppLaunchActivity.kt +++ b/app/src/main/java/com/duckduckgo/app/generalsettings/showonapplaunch/ShowOnAppLaunchActivity.kt @@ -46,6 +46,8 @@ class ShowOnAppLaunchActivity : DuckDuckGoActivity() { setContentView(binding.root) setupToolbar(binding.includeToolbar.toolbar) + binding.specificPageUrlInput.setSelectAllOnFocus(true) + configureUiEventHandlers() observeViewModel() } @@ -78,6 +80,14 @@ class ShowOnAppLaunchActivity : DuckDuckGoActivity() { binding.specificPageCheckListItem.setOnClickListener { viewModel.onShowOnAppLaunchOptionChanged(SpecificPage(binding.specificPageUrlInput.text)) } + + binding.specificPageUrlInput.addFocusChangedListener { _, hasFocus -> + if (hasFocus) { + viewModel.onShowOnAppLaunchOptionChanged( + SpecificPage(binding.specificPageUrlInput.text), + ) + } + } } private fun observeViewModel() { @@ -99,10 +109,6 @@ class ShowOnAppLaunchActivity : DuckDuckGoActivity() { uncheckLastOpenedTabCheckListItem() uncheckNewTabCheckListItem() binding.specificPageCheckListItem.setChecked(true) - with(binding.specificPageUrlInput) { - isEditable = true - setSelectAllOnFocus(true) - } } } @@ -122,5 +128,6 @@ class ShowOnAppLaunchActivity : DuckDuckGoActivity() { private fun uncheckSpecificPageCheckListItem() { binding.specificPageCheckListItem.setChecked(false) binding.specificPageUrlInput.isEditable = false + binding.specificPageUrlInput.isEditable = true } }