Skip to content

Commit

Permalink
make specific page url always visible
Browse files Browse the repository at this point in the history
as we have a whole screen for this setting we've decided to make the specific page url always visible

when the user selects specific page then we highlight all the text making it easier for them to delete it

we'll fix the fact that the url does not populate in the branch feature/mike/show-on-app-launch/add-persistence as this is where changes around observing state were made
  • Loading branch information
mikescamell committed Sep 12, 2024
1 parent cd4279d commit dbd89dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ package com.duckduckgo.app.generalsettings.showonapplaunch

import android.os.Bundle
import android.view.MenuItem
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
Expand All @@ -30,6 +28,7 @@ import com.duckduckgo.app.generalsettings.showonapplaunch.ShowOnAppLaunchViewMod
import com.duckduckgo.app.generalsettings.showonapplaunch.ShowOnAppLaunchViewModel.ShowOnAppLaunchOption.NewTabPage
import com.duckduckgo.app.generalsettings.showonapplaunch.ShowOnAppLaunchViewModel.ShowOnAppLaunchOption.SpecificPage
import com.duckduckgo.common.ui.DuckDuckGoActivity
import com.duckduckgo.common.ui.view.showKeyboard
import com.duckduckgo.common.ui.viewbinding.viewBinding
import com.duckduckgo.di.scopes.ActivityScope
import kotlinx.coroutines.flow.launchIn
Expand Down Expand Up @@ -93,8 +92,10 @@ class ShowOnAppLaunchActivity : DuckDuckGoActivity() {
is SpecificPage -> {
binding.specificPageCheckListItem.setChecked(true)
with(binding.specificPageUrlInput) {
isVisible = true
text = viewState.selectedOption.url
isEditable = true
setSelectAllOnFocus(true)
showKeyboard()
}
}
}
Expand All @@ -106,6 +107,6 @@ class ShowOnAppLaunchActivity : DuckDuckGoActivity() {
binding.lastOpenedTabCheckListItem.setChecked(false)
binding.newTabCheckListItem.setChecked(false)
binding.specificPageCheckListItem.setChecked(false)
binding.specificPageUrlInput.isGone = true
binding.specificPageUrlInput.isEditable = false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ interface TextInput {
@DrawableRes endIconRes: Int,
contentDescription: String? = null,
)
fun setSelectAllOnFocus(boolean: Boolean)

fun removeEndIcon()

Expand Down Expand Up @@ -257,6 +258,10 @@ class DaxTextInput @JvmOverloads constructor(
}
}

override fun setSelectAllOnFocus(boolean: Boolean) {
binding.internalEditText.setSelectAllOnFocus(boolean)
}

override fun removeEndIcon() {
binding.internalInputLayout.apply {
endIconMode = END_ICON_NONE
Expand Down

0 comments on commit dbd89dc

Please sign in to comment.