1
0
Fork 0

SearchView: Replace deprecated calls with recommended method

Resources#getDrawable(int) has been deprecated in favour
of Resources#getDrawable(int, Theme). Make the suitable changes
in SearchView class to reflect this.

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
master
Harsh Shandilya 2019-03-13 17:03:18 +05:30 committed by Jeff Boek
parent ecf21081af
commit 7132229b16
1 changed files with 11 additions and 6 deletions

View File

@ -14,13 +14,18 @@ class SearchView(context: Context, attrs: AttributeSet) : FrameLayout(context, a
var isPrivateModeEnabled = false var isPrivateModeEnabled = false
private val lightDrawable = resources.getDrawable(R.drawable.home_search_background_light) private val lightDrawable =
private val privateLightDrawable = resources.getDrawable(R.drawable.home_search_background_private) resources.getDrawable(R.drawable.home_search_background_light, context.theme)
private val darkDrawable = resources.getDrawable(R.drawable.home_search_background_dark) private val privateLightDrawable =
private val privateDarkDrawable = resources.getDrawable(R.drawable.home_search_background_private_dark) resources.getDrawable(R.drawable.home_search_background_private, context.theme)
private val darkNoBorderDrawable = resources.getDrawable(R.drawable.home_search_background_dark_no_border) private val darkDrawable =
resources.getDrawable(R.drawable.home_search_background_dark, context.theme)
private val privateDarkDrawable =
resources.getDrawable(R.drawable.home_search_background_private_dark, context.theme)
private val darkNoBorderDrawable =
resources.getDrawable(R.drawable.home_search_background_dark_no_border, context.theme)
private val privateDarkNoBorderDrawable = private val privateDarkNoBorderDrawable =
resources.getDrawable(R.drawable.home_search_background_private_dark_no_border) resources.getDrawable(R.drawable.home_search_background_private_dark_no_border, context.theme)
private val lightToDark = TransitionDrawable(arrayOf(lightDrawable, darkDrawable)) private val lightToDark = TransitionDrawable(arrayOf(lightDrawable, darkDrawable))
private val darkToNoBorder = TransitionDrawable(arrayOf(darkDrawable, darkNoBorderDrawable)) private val darkToNoBorder = TransitionDrawable(arrayOf(darkDrawable, darkNoBorderDrawable))