Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ class SiteCreationDomainsViewModel @Inject constructor(
searchInputUiState = createSearchInputUiState(
showProgress = state is Loading,
showClearButton = isNonEmptyUserQuery,
showDivider = state.data.isNotEmpty()
showDivider = state.data.isNotEmpty(),
showKeyboard = true
),
contentState = createDomainsUiContentState(query, state),
createSiteButtonContainerVisibility = selectedDomain != null
Expand Down Expand Up @@ -298,13 +299,15 @@ class SiteCreationDomainsViewModel @Inject constructor(
private fun createSearchInputUiState(
showProgress: Boolean,
showClearButton: Boolean,
showDivider: Boolean
showDivider: Boolean,
showKeyboard: Boolean
): SiteCreationSearchInputUiState {
return SiteCreationSearchInputUiState(
hint = UiStringRes(R.string.new_site_creation_search_domain_input_hint),
showProgress = showProgress,
showClearButton = showClearButton,
showDivider = showDivider
showDivider = showDivider,
showKeyboard = showKeyboard
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.widget.EditText
import android.widget.TextView
import org.wordpress.android.R
import org.wordpress.android.ui.utils.UiHelpers
import org.wordpress.android.util.ActivityUtils

class SearchInputWithHeader(private val uiHelpers: UiHelpers, rootView: View, onClear: () -> Unit) {
private val headerLayout = rootView.findViewById<ViewGroup>(R.id.header_layout)
Expand Down Expand Up @@ -61,5 +62,13 @@ class SearchInputWithHeader(private val uiHelpers: UiHelpers, rootView: View, on
uiHelpers.updateVisibility(progressBar, uiState.showProgress)
uiHelpers.updateVisibility(clearAllLayout, uiState.showClearButton)
uiHelpers.updateVisibility(divider, uiState.showDivider)
showKeyboard(uiState.showKeyboard)
}

private fun showKeyboard(shouldShow: Boolean) {
if (shouldShow) {
searchInput.requestFocus()
ActivityUtils.showKeyboard(searchInput)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ data class SiteCreationSearchInputUiState(
val hint: UiString,
val showProgress: Boolean,
val showClearButton: Boolean,
val showDivider: Boolean
val showDivider: Boolean,
val showKeyboard: Boolean
)