For #13473 - Adds pill_wraper to the search dialog
parent
95970dbfef
commit
d8f3050487
|
@ -16,8 +16,10 @@ import androidx.constraintlayout.widget.ConstraintProperties.TOP
|
||||||
import androidx.constraintlayout.widget.ConstraintSet
|
import androidx.constraintlayout.widget.ConstraintSet
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.navigation.fragment.navArgs
|
import androidx.navigation.fragment.navArgs
|
||||||
import kotlinx.android.synthetic.main.fragment_search.view.*
|
|
||||||
import kotlinx.android.synthetic.main.fragment_search_dialog.*
|
import kotlinx.android.synthetic.main.fragment_search_dialog.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_search_dialog.pill_wrapper
|
||||||
|
import kotlinx.android.synthetic.main.fragment_search_dialog.toolbar
|
||||||
|
import kotlinx.android.synthetic.main.fragment_search_dialog.view.*
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
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
|
||||||
|
@ -101,7 +103,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
|
||||||
awesomeBarView = AwesomeBarView(
|
awesomeBarView = AwesomeBarView(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
interactor,
|
interactor,
|
||||||
view.awesomeBar
|
view.awesome_bar
|
||||||
)
|
)
|
||||||
|
|
||||||
return view
|
return view
|
||||||
|
@ -118,10 +120,10 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
|
||||||
clear(toolbar.id, TOP)
|
clear(toolbar.id, TOP)
|
||||||
connect(toolbar.id, BOTTOM, PARENT_ID, BOTTOM)
|
connect(toolbar.id, BOTTOM, PARENT_ID, BOTTOM)
|
||||||
|
|
||||||
clear(awesomeBar.id, TOP)
|
clear(awesome_bar.id, TOP)
|
||||||
clear(awesomeBar.id, BOTTOM)
|
clear(pill_wrapper.id, BOTTOM)
|
||||||
connect(awesomeBar.id, TOP, PARENT_ID, TOP)
|
connect(awesome_bar.id, TOP, PARENT_ID, TOP)
|
||||||
connect(awesomeBar.id, BOTTOM, toolbar.id, TOP)
|
connect(pill_wrapper.id, BOTTOM, toolbar.id, TOP)
|
||||||
|
|
||||||
applyTo(search_wrapper)
|
applyTo(search_wrapper)
|
||||||
}
|
}
|
||||||
|
@ -133,7 +135,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
consumeFrom(store) {
|
consumeFrom(store) {
|
||||||
awesomeBar?.visibility = if (it.query.isEmpty()) View.INVISIBLE else View.VISIBLE
|
awesome_bar?.visibility = if (it.query.isEmpty()) View.INVISIBLE else View.VISIBLE
|
||||||
toolbarView.update(it)
|
toolbarView.update(it)
|
||||||
awesomeBarView.update(it)
|
awesomeBarView.update(it)
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
app:layout_constraintTop_toTopOf="parent"/>
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
<mozilla.components.browser.awesomebar.BrowserAwesomeBar
|
<mozilla.components.browser.awesomebar.BrowserAwesomeBar
|
||||||
xmlns:mozac="http://schemas.android.com/apk/res-auto"
|
xmlns:mozac="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/awesomeBar"
|
android:id="@+id/awesome_bar"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:fadingEdge="horizontal"
|
android:fadingEdge="horizontal"
|
||||||
|
@ -39,11 +39,40 @@
|
||||||
android:requiresFadingEdge="vertical"
|
android:requiresFadingEdge="vertical"
|
||||||
android:background="?attr/foundation"
|
android:background="?attr/foundation"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toTopOf="@+id/pill_wrapper"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
||||||
mozac:awesomeBarChipBackgroundColor="@color/photonGreen50"
|
mozac:awesomeBarChipBackgroundColor="@color/photonGreen50"
|
||||||
mozac:awesomeBarDescriptionTextColor="?secondaryText"
|
mozac:awesomeBarDescriptionTextColor="?secondaryText"
|
||||||
mozac:awesomeBarTitleTextColor="?primaryText" />
|
mozac:awesomeBarTitleTextColor="?primaryText" />
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/pill_wrapper"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/search_fragment_pill_height"
|
||||||
|
android:background="?foundation"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="@dimen/search_fragment_pill_padding_start"
|
||||||
|
android:paddingTop="@dimen/search_fragment_pill_padding_vertical"
|
||||||
|
android:paddingEnd="@dimen/search_fragment_pill_padding_end"
|
||||||
|
android:paddingBottom="@dimen/search_fragment_pill_padding_vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<ToggleButton
|
||||||
|
android:id="@+id/search_scan_button"
|
||||||
|
style="@style/search_pill"
|
||||||
|
android:layout_marginEnd="@dimen/search_fragment_scan_button_margin_end"
|
||||||
|
android:textOff="@string/search_scan_button"
|
||||||
|
android:textOn="@string/search_scan_button"
|
||||||
|
app:drawableStartCompat="@drawable/ic_qr" />
|
||||||
|
|
||||||
|
<ToggleButton
|
||||||
|
android:id="@+id/search_engines_shortcut_button"
|
||||||
|
style="@style/search_pill"
|
||||||
|
android:textOff="@string/search_engine_button"
|
||||||
|
android:textOn="@string/search_engine_button"
|
||||||
|
app:drawableStartCompat="@drawable/ic_search" />
|
||||||
|
</LinearLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
Loading…
Reference in New Issue