mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-09 19:10:42 +00:00
* For #7254: Replace anko applyConstraintSet * Anko has been deprecated and will not be continued * Refactor ConstraintSet changes * Replace applyConstraintSet in SearchLayouts * Refactor HomeFragment ConstraintSet * Define anonymous ConstraintSet * Remove ConstraintSet prefix from PARENT_ID
This commit is contained in:
parent
c5a142aa14
commit
a40af5b134
@ -18,7 +18,12 @@ import android.widget.LinearLayout
|
|||||||
import android.widget.PopupWindow
|
import android.widget.PopupWindow
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID
|
import androidx.constraintlayout.widget.ConstraintSet
|
||||||
|
import androidx.constraintlayout.widget.ConstraintSet.BOTTOM
|
||||||
|
import androidx.constraintlayout.widget.ConstraintSet.TOP
|
||||||
|
import androidx.constraintlayout.widget.ConstraintSet.START
|
||||||
|
import androidx.constraintlayout.widget.ConstraintSet.END
|
||||||
|
import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
@ -53,11 +58,6 @@ import mozilla.components.feature.media.ext.getSession
|
|||||||
import mozilla.components.feature.media.state.MediaState
|
import mozilla.components.feature.media.state.MediaState
|
||||||
import mozilla.components.feature.media.state.MediaStateMachine
|
import mozilla.components.feature.media.state.MediaStateMachine
|
||||||
import mozilla.components.feature.tab.collections.TabCollection
|
import mozilla.components.feature.tab.collections.TabCollection
|
||||||
import org.jetbrains.anko.constraint.layout.ConstraintSetBuilder.Side.BOTTOM
|
|
||||||
import org.jetbrains.anko.constraint.layout.ConstraintSetBuilder.Side.END
|
|
||||||
import org.jetbrains.anko.constraint.layout.ConstraintSetBuilder.Side.START
|
|
||||||
import org.jetbrains.anko.constraint.layout.ConstraintSetBuilder.Side.TOP
|
|
||||||
import org.jetbrains.anko.constraint.layout.applyConstraintSet
|
|
||||||
import org.mozilla.fenix.BrowserDirection
|
import org.mozilla.fenix.BrowserDirection
|
||||||
import org.mozilla.fenix.HomeActivity
|
import org.mozilla.fenix.HomeActivity
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
@ -197,15 +197,13 @@ class HomeFragment : Fragment() {
|
|||||||
|
|
||||||
sessionControlView = SessionControlView(homeFragmentStore, view.homeLayout, sessionControlInteractor)
|
sessionControlView = SessionControlView(homeFragmentStore, view.homeLayout, sessionControlInteractor)
|
||||||
|
|
||||||
view.homeLayout.applyConstraintSet {
|
ConstraintSet().apply {
|
||||||
sessionControlView.view {
|
clone(view.homeLayout)
|
||||||
connect(
|
connect(sessionControlView.view.id, TOP, view.wordmark_spacer.id, BOTTOM)
|
||||||
TOP to BOTTOM of view.wordmark_spacer,
|
connect(sessionControlView.view.id, START, PARENT_ID, START)
|
||||||
START to START of PARENT_ID,
|
connect(sessionControlView.view.id, END, PARENT_ID, END)
|
||||||
END to END of PARENT_ID,
|
connect(sessionControlView.view.id, BOTTOM, view.bottom_bar.id, TOP)
|
||||||
BOTTOM to TOP of view.bottom_bar
|
applyTo(view.homeLayout)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.themeManager.applyStatusBarTheme(activity)
|
activity.themeManager.applyStatusBarTheme(activity)
|
||||||
|
@ -6,14 +6,13 @@ package org.mozilla.fenix.search
|
|||||||
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID
|
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.UNSET
|
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.TOP
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.BOTTOM
|
||||||
|
import androidx.constraintlayout.widget.ConstraintSet
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import kotlinx.android.synthetic.main.component_awesomebar.*
|
import kotlinx.android.synthetic.main.component_awesomebar.*
|
||||||
import kotlinx.android.synthetic.main.fragment_search.*
|
import kotlinx.android.synthetic.main.fragment_search.*
|
||||||
import mozilla.components.support.base.log.logger.Logger
|
import mozilla.components.support.base.log.logger.Logger
|
||||||
import org.jetbrains.anko.constraint.layout.ConstraintSetBuilder.Side.BOTTOM
|
|
||||||
import org.jetbrains.anko.constraint.layout.ConstraintSetBuilder.Side.TOP
|
|
||||||
import org.jetbrains.anko.constraint.layout.applyConstraintSet
|
|
||||||
import org.mozilla.fenix.Experiments.AATestDescriptor
|
import org.mozilla.fenix.Experiments.AATestDescriptor
|
||||||
import org.mozilla.fenix.isInExperiment
|
import org.mozilla.fenix.isInExperiment
|
||||||
|
|
||||||
@ -32,54 +31,43 @@ internal fun SearchFragment.layoutComponents(layout: ConstraintLayout) {
|
|||||||
|
|
||||||
internal fun SearchFragment.setInExperimentConstraints(layout: ConstraintLayout) {
|
internal fun SearchFragment.setInExperimentConstraints(layout: ConstraintLayout) {
|
||||||
Logger.debug("Loading in experiment constraints")
|
Logger.debug("Loading in experiment constraints")
|
||||||
layout.applyConstraintSet {
|
|
||||||
toolbar_wrapper {
|
ConstraintSet().apply {
|
||||||
connect(
|
clone(layout)
|
||||||
TOP to TOP of UNSET,
|
|
||||||
BOTTOM to TOP of pillWrapper
|
// Move the search bar to the bottom of the layout
|
||||||
)
|
clear(toolbar_wrapper.id, TOP)
|
||||||
}
|
connect(toolbar_wrapper.id, BOTTOM, pillWrapper.id, TOP)
|
||||||
awesomeBar {
|
|
||||||
connect(
|
connect(awesomeBar.id, TOP, PARENT_ID, TOP)
|
||||||
TOP to TOP of PARENT_ID,
|
connect(awesomeBar.id, BOTTOM, toolbar_wrapper.id, TOP)
|
||||||
BOTTOM to TOP of toolbar_wrapper
|
|
||||||
)
|
|
||||||
}
|
|
||||||
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = true
|
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = true
|
||||||
pillWrapper {
|
|
||||||
connect(
|
connect(pillWrapper.id, BOTTOM, PARENT_ID, BOTTOM)
|
||||||
BOTTOM to BOTTOM of PARENT_ID
|
|
||||||
)
|
applyTo(layout)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun SearchFragment.setOutOfExperimentConstraints(layout: ConstraintLayout) {
|
internal fun SearchFragment.setOutOfExperimentConstraints(layout: ConstraintLayout) {
|
||||||
Logger.debug("Loading out of experiment constraints")
|
Logger.debug("Loading out of experiment constraints")
|
||||||
layout.applyConstraintSet {
|
|
||||||
toolbar_wrapper {
|
ConstraintSet().apply {
|
||||||
connect(
|
clone(layout)
|
||||||
TOP to TOP of PARENT_ID,
|
|
||||||
BOTTOM to TOP of UNSET
|
// Move the search bar to the top of the layout
|
||||||
)
|
connect(toolbar_wrapper.id, TOP, PARENT_ID, TOP)
|
||||||
}
|
clear(toolbar_wrapper.id, BOTTOM)
|
||||||
fill_link_from_clipboard {
|
|
||||||
connect(
|
connect(fill_link_from_clipboard.id, TOP, toolbar_wrapper.id, BOTTOM)
|
||||||
TOP to BOTTOM of toolbar_wrapper
|
|
||||||
)
|
clear(awesomeBar.id, TOP)
|
||||||
}
|
connect(awesomeBar.id, TOP, search_with_shortcuts.id, BOTTOM)
|
||||||
awesomeBar {
|
connect(awesomeBar.id, BOTTOM, pillWrapper.id, TOP)
|
||||||
connect(
|
|
||||||
TOP to TOP of UNSET,
|
|
||||||
TOP to BOTTOM of search_with_shortcuts,
|
|
||||||
BOTTOM to TOP of pillWrapper
|
|
||||||
)
|
|
||||||
}
|
|
||||||
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = false
|
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = false
|
||||||
pillWrapper {
|
|
||||||
connect(
|
connect(pillWrapper.id, BOTTOM, PARENT_ID, BOTTOM)
|
||||||
BOTTOM to BOTTOM of PARENT_ID
|
|
||||||
)
|
applyTo(layout)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user