1
0
Fork 0

For #561 - Adds add tab and menu button to bottom bar

- Adds space between wordmark and session control component
master
Jeff Boek 2019-09-20 12:11:28 -07:00 committed by Sawyer Blatz
parent abbb310ce3
commit b16754d78a
5 changed files with 118 additions and 46 deletions

View File

@ -192,10 +192,10 @@ class HomeFragment : Fragment() {
view.homeLayout.applyConstraintSet {
sessionControlComponent.view {
connect(
TOP to BOTTOM of view.wordmark,
TOP to BOTTOM of view.wordmark_spacer,
START to START of PARENT_ID,
END to END of PARENT_ID,
BOTTOM to BOTTOM of PARENT_ID
BOTTOM to TOP of view.bottom_bar
)
}
}
@ -235,33 +235,32 @@ class HomeFragment : Fragment() {
searchIcon.setBounds(0, 0, iconSize, iconSize)
withContext(Dispatchers.Main) {
// TODO: FIXME
// search_engine_icon?.setImageDrawable(searchIcon)
search_engine_icon?.setImageDrawable(searchIcon)
}
}
// view.menuButton.setOnClickListener {
// homeMenu?.menuBuilder?.build(requireContext())?.show(
// anchor = it,
// orientation = BrowserMenu.Orientation.DOWN
// )
// }
// view.toolbar.compoundDrawablePadding =
view.menuButton.setOnClickListener {
homeMenu?.menuBuilder?.build(requireContext())?.show(
anchor = it,
orientation = BrowserMenu.Orientation.DOWN
)
}
view.toolbar.compoundDrawablePadding =
view.resources.getDimensionPixelSize(R.dimen.search_bar_search_engine_icon_padding)
// view.toolbar_wrapper.setOnClickListener {
// invokePendingDeleteJobs()
// onboarding.finish()
// val directions = HomeFragmentDirections.actionHomeFragmentToSearchFragment(
// sessionId = null,
// showShortcutEnginePicker = true
// )
// val extras =
// FragmentNavigator.Extras.Builder()
// .addSharedElement(toolbar_wrapper, "toolbar_wrapper_transition")
// .build()
// nav(R.id.homeFragment, directions, extras)
// requireComponents.analytics.metrics.track(Event.SearchBarTapped(Event.SearchBarTapped.Source.HOME))
// }
view.toolbar_wrapper.setOnClickListener {
invokePendingDeleteJobs()
onboarding.finish()
val directions = HomeFragmentDirections.actionHomeFragmentToSearchFragment(
sessionId = null,
showShortcutEnginePicker = true
)
val extras =
FragmentNavigator.Extras.Builder()
.addSharedElement(toolbar_wrapper, "toolbar_wrapper_transition")
.build()
nav(R.id.homeFragment, directions, extras)
requireComponents.analytics.metrics.track(Event.SearchBarTapped(Event.SearchBarTapped.Source.HOME))
}
PrivateBrowsingButtonView(
privateBrowsingButton,

View File

@ -41,12 +41,6 @@ class TabHeaderViewHolder(
}
view.apply {
add_tab_button.run {
setOnClickListener {
actionEmitter.onNext(TabAction.Add)
}
}
share_tabs_button.run {
setOnClickListener {
actionEmitter.onNext(TabAction.ShareTabs)

View File

@ -2,7 +2,8 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -33,6 +34,7 @@
android:layout_height="80dp"
android:layout_marginStart="16dp"
android:layout_marginTop="60dp"
android:layout_marginBottom="32dp"
android:adjustViewBounds="true"
android:clickable="false"
android:contentDescription="@string/app_name"
@ -42,5 +44,93 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/wordmark_spacer"
android:layout_marginTop="32dp"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/wordmark"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="?homeBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<org.mozilla.fenix.home.SearchView
android:id="@+id/toolbar_wrapper"
android:transitionName="toolbar_wrapper_transition"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="8dp"
android:background="@drawable/home_search_background_normal"
android:clickable="true"
android:contentDescription="@string/search_hint"
android:focusable="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/add_tab_button"
app:layout_constraintStart_toStartOf="parent">
<ImageView
android:id="@+id/search_engine_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="12dp"
android:clickable="false"
android:focusable="false"
android:importantForAccessibility="no" />
<TextView
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="47dp"
android:clickable="false"
android:focusable="false"
android:importantForAccessibility="no"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/search_hint"
android:textColor="?primaryText"
android:textSize="15sp" />
</org.mozilla.fenix.home.SearchView>
<ImageButton
android:id="@+id/add_tab_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/add_tab"
android:src="@drawable/ic_new"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/menuButton"
app:layout_constraintStart_toEndOf="@id/toolbar_wrapper"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/menuButton"
android:layout_width="@dimen/glyph_button_height"
android:layout_height="@dimen/glyph_button_height"
android:layout_marginEnd="16dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/content_description_menu"
android:src="@drawable/ic_menu"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.motion.widget.MotionLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -18,22 +18,10 @@
android:text="@string/tab_header_label"
android:textAppearance="@style/HeaderTextStyle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/add_tab_button"
app:layout_constraintEnd_toStartOf="@id/share_tabs_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/add_tab_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/add_tab"
android:src="@drawable/ic_new"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/share_tabs_button"
app:layout_constraintStart_toEndOf="@id/header_text"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/share_tabs_button"
android:layout_width="48dp"
@ -43,7 +31,7 @@
android:src="@drawable/ic_hollow_share"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/close_tabs_button"
app:layout_constraintStart_toEndOf="@+id/add_tab_button"
app:layout_constraintStart_toEndOf="@+id/header_text"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton

View File

@ -34,6 +34,7 @@
<Constraint
android:id="@+id/wordmark"
android:layout_marginStart="16dp"
android:layout_marginBottom="32dp"
android:alpha="0"
android:layout_width="wrap_content"
android:layout_height="80dp"