For #8949 - Removes old motionlayout code, fixes how shadow is drawn
parent
fc67747409
commit
74ce62b5c3
|
@ -91,9 +91,6 @@
|
||||||
# Keep code generated from Glean Metrics
|
# Keep code generated from Glean Metrics
|
||||||
-keep class org.mozilla.fenix.GleanMetrics.** { *; }
|
-keep class org.mozilla.fenix.GleanMetrics.** { *; }
|
||||||
|
|
||||||
# Keep methods that are called by MotionLayout
|
|
||||||
-keep class org.mozilla.fenix.home.SearchView { *; }
|
|
||||||
|
|
||||||
# Keep motionlayout internal methods
|
# Keep motionlayout internal methods
|
||||||
# https://github.com/mozilla-mobile/fenix/issues/2094
|
# https://github.com/mozilla-mobile/fenix/issues/2094
|
||||||
-keep class androidx.constraintlayout.** { *; }
|
-keep class androidx.constraintlayout.** { *; }
|
||||||
|
|
|
@ -21,6 +21,7 @@ import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.constraintlayout.widget.ConstraintSet
|
import androidx.constraintlayout.widget.ConstraintSet
|
||||||
import androidx.constraintlayout.widget.ConstraintSet.BOTTOM
|
import androidx.constraintlayout.widget.ConstraintSet.BOTTOM
|
||||||
|
import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID
|
||||||
import androidx.constraintlayout.widget.ConstraintSet.TOP
|
import androidx.constraintlayout.widget.ConstraintSet.TOP
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
@ -228,6 +229,7 @@ class HomeFragment : Fragment() {
|
||||||
clone(view.toolbarLayout)
|
clone(view.toolbarLayout)
|
||||||
clear(view.bottomBarShadow.id, BOTTOM)
|
clear(view.bottomBarShadow.id, BOTTOM)
|
||||||
connect(view.bottomBarShadow.id, TOP, view.bottom_bar.id, BOTTOM)
|
connect(view.bottomBarShadow.id, TOP, view.bottom_bar.id, BOTTOM)
|
||||||
|
connect(view.bottomBarShadow.id, BOTTOM, PARENT_ID, BOTTOM)
|
||||||
applyTo(view.toolbarLayout)
|
applyTo(view.toolbarLayout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
/* 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/. */
|
|
||||||
|
|
||||||
package org.mozilla.fenix.home
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.drawable.TransitionDrawable
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.widget.FrameLayout
|
|
||||||
import org.mozilla.fenix.R
|
|
||||||
|
|
||||||
class SearchView(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) {
|
|
||||||
private val lightDrawable =
|
|
||||||
resources.getDrawable(R.drawable.home_search_background_normal, context.theme)
|
|
||||||
private val darkDrawable =
|
|
||||||
resources.getDrawable(R.drawable.home_search_background_dark, context.theme)
|
|
||||||
private val darkNoBorderDrawable =
|
|
||||||
resources.getDrawable(R.drawable.home_search_background_dark_no_border, context.theme)
|
|
||||||
|
|
||||||
private val lightToDark = TransitionDrawable(arrayOf(lightDrawable, darkDrawable))
|
|
||||||
private val darkToNoBorder = TransitionDrawable(arrayOf(darkDrawable, darkNoBorderDrawable))
|
|
||||||
|
|
||||||
fun transitionToLight() {
|
|
||||||
background = lightToDark
|
|
||||||
lightToDark.reverseTransition(transitionDurationMs)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun transitionToDark() {
|
|
||||||
background = lightToDark
|
|
||||||
lightToDark.startTransition(transitionDurationMs)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun transitionToDarkFromNoBorder() {
|
|
||||||
background = darkToNoBorder
|
|
||||||
darkToNoBorder.reverseTransition(transitionDurationMs)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun transitionToDarkNoBorder() {
|
|
||||||
background = darkToNoBorder
|
|
||||||
darkToNoBorder.startTransition(transitionDurationMs)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val transitionDurationMs = 200
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,9 +9,9 @@
|
||||||
<solid android:color="@color/foundation_normal_theme" />
|
<solid android:color="@color/foundation_normal_theme" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
<item android:height="1dp">
|
<item android:bottom="-2dp" android:left="-2dp" android:right="-2dp">
|
||||||
<shape android:shape="rectangle">
|
<shape>
|
||||||
<solid android:color="#1AFFFFFF" />
|
<stroke android:width="1dp" android:color="#1AFFFFFF" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
<solid android:color="@color/foundation_normal_theme" />
|
<solid android:color="@color/foundation_normal_theme" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
<item android:height="1dp" android:gravity="bottom">
|
<item android:top="-2dp" android:left="-2dp" android:right="-2dp">
|
||||||
<shape android:shape="rectangle">
|
<shape>
|
||||||
<solid android:color="#1AFFFFFF" />
|
<stroke android:width="1dp" android:color="#1AFFFFFF" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-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/. -->
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<gradient
|
|
||||||
android:startColor="?shadow"
|
|
||||||
android:endColor="@android:color/transparent"
|
|
||||||
android:angle="270" />
|
|
||||||
</shape>
|
|
|
@ -4,6 +4,5 @@
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<solid android:color="?inset"/>
|
<solid android:color="?inset"/>
|
||||||
|
|
||||||
<corners android:radius="8dp"/>
|
<corners android:radius="8dp"/>
|
||||||
</shape>
|
</shape>
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-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/. -->
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<solid android:color="?inset"/>
|
|
||||||
|
|
||||||
<stroke android:width="1dp"
|
|
||||||
android:color="?inset"/>
|
|
||||||
|
|
||||||
<corners android:bottomRightRadius="8dp"
|
|
||||||
android:bottomLeftRadius="8dp"
|
|
||||||
android:topLeftRadius="8dp"
|
|
||||||
android:topRightRadius="8dp"/>
|
|
||||||
</shape>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-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/. -->
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<solid android:color="?inset"/>
|
|
||||||
|
|
||||||
<corners android:bottomRightRadius="8dp"
|
|
||||||
android:bottomLeftRadius="8dp"
|
|
||||||
android:topLeftRadius="8dp"
|
|
||||||
android:topRightRadius="8dp"/>
|
|
||||||
</shape>
|
|
|
@ -14,9 +14,9 @@
|
||||||
android:type="linear" />
|
android:type="linear" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
<item android:height="1dp">
|
<item android:bottom="-2dp" android:left="-2dp" android:right="-2dp">
|
||||||
<shape android:shape="rectangle">
|
<shape>
|
||||||
<solid android:color="#1AFFFFFF" />
|
<stroke android:width="1dp" android:color="#1AFFFFFF" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
android:type="linear" />
|
android:type="linear" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
<item android:height="1dp" android:gravity="bottom">
|
<item android:top="-2dp" android:left="-2dp" android:right="-2dp">
|
||||||
<shape android:shape="rectangle">
|
<shape>
|
||||||
<solid android:color="#1AFFFFFF" />
|
<stroke android:width="1dp" android:color="#1AFFFFFF" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
|
|
@ -82,24 +82,6 @@
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
tools:context=".home.HomeFragment">
|
tools:context=".home.HomeFragment">
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/bottomBarShadow"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="@color/bottom_bar_shadow"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/bottom_bar" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/bottomBarHighlight"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="@color/bottom_bar_shadow"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/bottom_bar" />
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/bottom_bar"
|
android:id="@+id/bottom_bar"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -110,13 +92,13 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<org.mozilla.fenix.home.SearchView
|
<FrameLayout
|
||||||
android:id="@+id/toolbar_wrapper"
|
android:id="@+id/toolbar_wrapper"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
android:background="@drawable/home_search_background_normal"
|
android:background="@drawable/home_search_background"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:contentDescription="@string/search_hint"
|
android:contentDescription="@string/search_hint"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
|
@ -149,7 +131,7 @@
|
||||||
android:text="@string/search_hint"
|
android:text="@string/search_hint"
|
||||||
android:textColor="?primaryText"
|
android:textColor="?primaryText"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
</org.mozilla.fenix.home.SearchView>
|
</FrameLayout>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/add_tab_button"
|
android:id="@+id/add_tab_button"
|
||||||
|
@ -171,6 +153,15 @@
|
||||||
app:layout_constraintTop_toTopOf="@id/bottom_bar"
|
app:layout_constraintTop_toTopOf="@id/bottom_bar"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/bottom_bar"/>
|
app:layout_constraintBottom_toBottomOf="@id/bottom_bar"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/bottomBarShadow"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/bottom_bar_shadow"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/bottom_bar" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
Loading…
Reference in New Issue