2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/561 - Removes the toolbar from the home screen

- Removes the menu button
- Fixes motionlayout animation with the wordmark/private browsing button
This commit is contained in:
Jeff Boek 2019-09-20 11:33:00 -07:00 committed by Sawyer Blatz
parent 12847eff30
commit d44abbcf93
3 changed files with 35 additions and 218 deletions

View File

@ -192,7 +192,7 @@ class HomeFragment : Fragment() {
view.homeLayout.applyConstraintSet {
sessionControlComponent.view {
connect(
TOP to BOTTOM of view.homeDivider,
TOP to BOTTOM of view.wordmark,
START to START of PARENT_ID,
END to END of PARENT_ID,
BOTTOM to BOTTOM of PARENT_ID
@ -235,32 +235,33 @@ class HomeFragment : Fragment() {
searchIcon.setBounds(0, 0, iconSize, iconSize)
withContext(Dispatchers.Main) {
search_engine_icon?.setImageDrawable(searchIcon)
// TODO: FIXME
// 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,
@ -278,9 +279,6 @@ class HomeFragment : Fragment() {
)
}
}
// We need the shadow to be above the components.
homeDividerShadow.bringToFront()
}
override fun onDestroyView() {

View File

@ -16,33 +16,23 @@
app:layoutDescription="@xml/home_scene"
tools:context=".home.HomeFragment">
<ImageButton
android:id="@+id/menuButton"
android:layout_width="@dimen/glyph_button_height"
android:layout_height="@dimen/glyph_button_height"
android:layout_marginTop="12dp"
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" />
<ImageButton
android:id="@+id/privateBrowsingButton"
android:layout_width="@dimen/glyph_button_height"
android:layout_height="@dimen/glyph_button_height"
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/content_description_private_browsing_button"
android:src="@drawable/private_browsing_button"
app:layout_constraintEnd_toStartOf="@id/menuButton"
app:layout_constraintTop_toTopOf="@id/menuButton" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/wordmark"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_marginTop="60dp"
android:adjustViewBounds="true"
android:clickable="false"
android:contentDescription="@string/app_name"
@ -50,71 +40,7 @@
android:importantForAccessibility="no"
android:src="?fenixLogo"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/menuButton" />
<org.mozilla.fenix.home.SearchView
android:id="@+id/toolbar_wrapper"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="16dp"
android:background="@drawable/home_search_background_normal"
android:clickable="true"
android:contentDescription="@string/search_hint"
android:elevation="@dimen/toolbar_elevation"
android:focusable="true"
android:transitionName="toolbar_wrapper_transition"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/wordmark">
<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>
<View
android:id="@+id/homeDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="40dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="40dp"
android:background="?neutralFaded"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar_wrapper" />
<View
android:id="@+id/homeDividerShadow"
android:layout_width="0dp"
android:layout_height="3dp"
android:alpha="0"
android:background="@drawable/home_header_shadow"
app:layout_constraintEnd_toEndOf="@+id/homeDivider"
app:layout_constraintStart_toStartOf="@+id/homeDivider"
app:layout_constraintTop_toBottomOf="@id/homeDivider" />
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.motion.widget.MotionLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -16,79 +16,14 @@
motion:onTouchUp="stop"/>
<KeyFrameSet>
<KeyPosition
motion:motionTarget="@id/wordmark"
motion:keyPositionType="pathRelative"
motion:framePosition="50"
motion:percentX="0.9" />
<KeyAttribute
motion:motionTarget="@id/wordmark"
motion:framePosition="50"
android:translationY="0dp"
android:alpha="1" />
<KeyAttribute
motion:motionTarget="@id/wordmark"
motion:framePosition="90"
android:alpha="0" />
<KeyAttribute
motion:motionTarget="@id/menuButton"
motion:framePosition="50"
android:translationY="0dp"
android:alpha="1" />
<KeyAttribute
motion:motionTarget="@id/menuButton"
motion:framePosition="90"
android:alpha="0" />
<KeyAttribute
motion:motionTarget="@id/menuButton"
motion:framePosition="90"
android:alpha="0" />
<KeyAttribute
motion:motionTarget="@id/privateBrowsingButton"
motion:framePosition="50"
android:translationY="0dp"
android:alpha="1" />
<KeyAttribute
motion:motionTarget="@id/privateBrowsingButton"
motion:framePosition="90"
android:alpha="0" />
<KeyAttribute
motion:motionTarget="@id/homeDivider"
motion:framePosition="92"
android:alpha="1" />
<KeyAttribute
motion:motionTarget="@id/homeDivider"
motion:framePosition="100"
android:alpha="0" />
<KeyAttribute
motion:motionTarget="@id/homeDividerShadow"
motion:framePosition="90"
android:alpha="0" />
<KeyAttribute
motion:motionTarget="@id/toolbar_wrapper"
motion:framePosition="0"
android:elevation="@dimen/toolbar_elevation" />
<KeyAttribute
motion:motionTarget="@id/toolbar_wrapper"
motion:framePosition="50"
android:elevation="0dp" />
<KeyTrigger
motion:motionTarget="@id/toolbar_wrapper"
motion:framePosition="55"
motion:onPositiveCross="transitionToDark"
motion:onNegativeCross="transitionToLight" />
<KeyTrigger
motion:motionTarget="@id/toolbar_wrapper"
motion:framePosition="90"
motion:onPositiveCross="transitionToDarkNoBorder"
motion:onNegativeCross="transitionToDarkFromNoBorder" />
</KeyFrameSet>
</Transition>
@ -99,64 +34,22 @@
<Constraint
android:id="@+id/wordmark"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:alpha="0"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:translationY="-10dp"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="@+id/toolbar_wrapper"
android:layout_marginTop="16dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
motion:layout_constraintTop_toTopOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
android:elevation="0dp" />
<Constraint
android:id="@+id/menuButton"
android:alpha="0"
android:visibility="invisible"
android:layout_marginTop="16dp"
android:translationY="-10dp"
android:layout_height="@dimen/glyph_button_height"
android:layout_width="@dimen/glyph_button_height"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"/>
motion:layout_constraintBottom_toTopOf="parent" />
<Constraint
android:id="@+id/privateBrowsingButton"
android:alpha="0"
android:visibility="invisible"
android:translationY="-10dp"
android:layout_height="@dimen/glyph_button_height"
android:layout_width="@dimen/glyph_button_height"
motion:layout_constraintEnd_toStartOf="@id/menuButton"
motion:layout_constraintTop_toTopOf="@id/menuButton"/>
<Constraint
android:id="@+id/homeDivider"
android:layout_height="1dp"
android:alpha="0"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:layout_marginTop="8dp"
motion:layout_constraintTop_toBottomOf="@id/toolbar_wrapper"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent" />
<Constraint
android:id="@+id/homeDividerShadow"
android:layout_height="3dp"
android:alpha="1"
motion:layout_constraintTop_toBottomOf="@id/homeDivider"
motion:layout_constraintStart_toStartOf="@+id/homeDivider"
motion:layout_constraintEnd_toEndOf="@+id/homeDivider" />
android:layout_height="@dimen/glyph_button_height"
android:layout_marginEnd="12dp"
android:translationY="-32dp"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"/>
</ConstraintSet>
</MotionScene>