2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00
This commit is contained in:
Michael Debertol 2020-09-01 01:59:33 +02:00 committed by GitHub
parent 2c4a2f2224
commit 662d7cdddf

View File

@ -40,6 +40,7 @@ import mozilla.components.feature.qr.QrFeature
import mozilla.components.lib.state.ext.consumeFrom import mozilla.components.lib.state.ext.consumeFrom
import mozilla.components.support.base.feature.UserInteractionHandler import mozilla.components.support.base.feature.UserInteractionHandler
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
import mozilla.components.support.ktx.android.content.getColorFromAttr
import mozilla.components.support.ktx.android.content.hasCamera import mozilla.components.support.ktx.android.content.hasCamera
import mozilla.components.support.ktx.android.content.res.getSpanned import mozilla.components.support.ktx.android.content.res.getSpanned
import mozilla.components.support.ktx.android.view.hideKeyboard import mozilla.components.support.ktx.android.view.hideKeyboard
@ -254,6 +255,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
updateSearchSuggestionsHintVisibility(it) updateSearchSuggestionsHintVisibility(it)
updateClipboardSuggestion(it, requireContext().components.clipboardHandler.url) updateClipboardSuggestion(it, requireContext().components.clipboardHandler.url)
updateToolbarContentDescription(it) updateToolbarContentDescription(it)
updateSearchShortcutsIcon(it)
toolbarView.update(it) toolbarView.update(it)
awesomeBarView.update(it) awesomeBarView.update(it)
firstUpdate = false firstUpdate = false
@ -416,6 +418,20 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
urlView?.importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO urlView?.importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
} }
private fun updateSearchShortcutsIcon(searchState: SearchFragmentState) {
view?.apply {
search_engines_shortcut_button.isVisible = searchState.areShortcutsAvailable
val showShortcuts = searchState.showSearchShortcuts
search_engines_shortcut_button.isChecked = showShortcuts
val color = if (showShortcuts) R.attr.contrastText else R.attr.primaryText
search_engines_shortcut_button.compoundDrawables[0]?.setTint(
requireContext().getColorFromAttr(color)
)
}
}
companion object { companion object {
private const val REQUEST_CODE_CAMERA_PERMISSIONS = 1 private const val REQUEST_CODE_CAMERA_PERMISSIONS = 1
} }