For #8949 - Removes old motionlayout code, fixes how shadow is drawn
parent
fc67747409
commit
74ce62b5c3
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
@ -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>
|
|
Loading…
Reference in New Issue