|
|
|
@ -208,8 +208,10 @@ class HomeFragment : Fragment() {
|
|
|
|
|
)
|
|
|
|
|
updateLayout(view)
|
|
|
|
|
setOffset(view)
|
|
|
|
|
sessionControlView = SessionControlView(homeFragmentStore,
|
|
|
|
|
view.sessionControlRecyclerView, sessionControlInteractor)
|
|
|
|
|
sessionControlView = SessionControlView(
|
|
|
|
|
homeFragmentStore,
|
|
|
|
|
view.sessionControlRecyclerView, sessionControlInteractor
|
|
|
|
|
)
|
|
|
|
|
activity.themeManager.applyStatusBarTheme(activity)
|
|
|
|
|
return view
|
|
|
|
|
}
|
|
|
|
@ -218,7 +220,10 @@ class HomeFragment : Fragment() {
|
|
|
|
|
val shouldUseBottomToolbar = view.context.settings().shouldUseBottomToolbar
|
|
|
|
|
|
|
|
|
|
if (!shouldUseBottomToolbar) {
|
|
|
|
|
view.toolbarLayout.layoutParams = CoordinatorLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT)
|
|
|
|
|
view.toolbarLayout.layoutParams = CoordinatorLayout.LayoutParams(
|
|
|
|
|
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
|
|
|
|
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
|
|
|
|
)
|
|
|
|
|
.apply {
|
|
|
|
|
gravity = Gravity.TOP
|
|
|
|
|
}
|
|
|
|
@ -238,6 +243,7 @@ class HomeFragment : Fragment() {
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ExperimentalCoroutinesApi
|
|
|
|
|
@SuppressWarnings("LongMethod")
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
@ -318,7 +324,8 @@ class HomeFragment : Fragment() {
|
|
|
|
|
|
|
|
|
|
if (onboarding.userHasBeenOnboarded()) {
|
|
|
|
|
homeFragmentStore.dispatch(
|
|
|
|
|
HomeFragmentAction.ModeChange(Mode.fromBrowsingMode(newMode)))
|
|
|
|
|
HomeFragmentAction.ModeChange(Mode.fromBrowsingMode(newMode))
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -337,12 +344,14 @@ class HomeFragment : Fragment() {
|
|
|
|
|
val context = requireContext()
|
|
|
|
|
val components = context.components
|
|
|
|
|
|
|
|
|
|
homeFragmentStore.dispatch(HomeFragmentAction.Change(
|
|
|
|
|
homeFragmentStore.dispatch(
|
|
|
|
|
HomeFragmentAction.Change(
|
|
|
|
|
collections = components.core.tabCollectionStorage.cachedTabCollections,
|
|
|
|
|
mode = currentMode.getCurrentMode(),
|
|
|
|
|
tabs = getListOfSessions().toTabs(),
|
|
|
|
|
topSites = components.core.topSiteStorage.cachedTopSites
|
|
|
|
|
))
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
requireComponents.backgroundServices.accountManager.register(currentMode, owner = this)
|
|
|
|
|
requireComponents.backgroundServices.accountManager.register(object : AccountObserver {
|
|
|
|
@ -359,7 +368,8 @@ class HomeFragment : Fragment() {
|
|
|
|
|
}, owner = this)
|
|
|
|
|
|
|
|
|
|
if (context.settings().showPrivateModeContextualFeatureRecommender &&
|
|
|
|
|
browsingModeManager.mode.isPrivate) {
|
|
|
|
|
browsingModeManager.mode.isPrivate
|
|
|
|
|
) {
|
|
|
|
|
recommendPrivateBrowsingShortcut()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -499,7 +509,8 @@ class HomeFragment : Fragment() {
|
|
|
|
|
// Otherwise, we will encounter an activity token error.
|
|
|
|
|
privateBrowsingButton.post {
|
|
|
|
|
privateBrowsingRecommend.showAsDropDown(
|
|
|
|
|
privateBrowsingButton, 0, CFR_Y_OFFSET, Gravity.TOP or Gravity.END)
|
|
|
|
|
privateBrowsingButton, 0, CFR_Y_OFFSET, Gravity.TOP or Gravity.END
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -510,7 +521,9 @@ class HomeFragment : Fragment() {
|
|
|
|
|
homeFragmentStore.dispatch(
|
|
|
|
|
HomeFragmentAction.ModeChange(
|
|
|
|
|
mode = currentMode.getCurrentMode(),
|
|
|
|
|
tabs = getListOfSessions().toTabs()))
|
|
|
|
|
tabs = getListOfSessions().toTabs()
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -754,8 +767,12 @@ class HomeFragment : Fragment() {
|
|
|
|
|
border?.visibility = View.GONE
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onAnimationStart(animation: Animator?) { /* noop */ }
|
|
|
|
|
override fun onAnimationRepeat(animation: Animator?) { /* noop */ }
|
|
|
|
|
override fun onAnimationStart(animation: Animator?) { /* noop */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onAnimationRepeat(animation: Animator?) { /* noop */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onAnimationEnd(animation: Animator?) {
|
|
|
|
|
border?.animate()?.alpha(0.0F)?.setStartDelay(ANIM_ON_SCREEN_DELAY)
|
|
|
|
|
?.setDuration(FADE_ANIM_DURATION)
|
|
|
|
@ -831,7 +848,8 @@ class HomeFragment : Fragment() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun createNewAppBarListener(margin: Float) {
|
|
|
|
|
homeAppBarOffSetListener = AppBarLayout.OnOffsetChangedListener { appBarLayout, verticalOffset ->
|
|
|
|
|
homeAppBarOffSetListener =
|
|
|
|
|
AppBarLayout.OnOffsetChangedListener { appBarLayout, verticalOffset ->
|
|
|
|
|
val reduceScrollRanged = appBarLayout.totalScrollRange.toFloat() - margin
|
|
|
|
|
appBarLayout.alpha = 1.0f - abs(verticalOffset / reduceScrollRanged)
|
|
|
|
|
}
|
|
|
|
|