diff --git a/app/src/main/java/org/mozilla/fenix/search/awesomebar/ShortcutEngineManager.kt b/app/src/main/java/org/mozilla/fenix/search/awesomebar/ShortcutEngineManager.kt index 870b8b307..30c4e2f23 100644 --- a/app/src/main/java/org/mozilla/fenix/search/awesomebar/ShortcutEngineManager.kt +++ b/app/src/main/java/org/mozilla/fenix/search/awesomebar/ShortcutEngineManager.kt @@ -10,7 +10,6 @@ import androidx.navigation.Navigation import io.reactivex.Observer import kotlinx.android.synthetic.main.fragment_search.* import mozilla.components.browser.search.SearchEngine -import org.jetbrains.anko.textColor import org.mozilla.fenix.DefaultThemeManager import org.mozilla.fenix.R import org.mozilla.fenix.search.SearchFragmentDirections @@ -66,11 +65,14 @@ class ShortcutEngineManager( private fun showShortcutEnginePicker() { with(context) { - awesomeBarUIView.search_shortcuts_button.compoundDrawables[0].setTint(ContextCompat.getColor(this, - DefaultThemeManager.resolveAttribute(R.attr.pillWrapperBackground, this))) + awesomeBarUIView.search_shortcuts_button?.isChecked = true - awesomeBarUIView.search_shortcuts_button.textColor = ContextCompat.getColor(this, - DefaultThemeManager.resolveAttribute(R.attr.pillWrapperBackground, this)) + awesomeBarUIView.search_shortcuts_button.compoundDrawables[0]?.setTint( + ContextCompat.getColor( + this, + DefaultThemeManager.resolveAttribute(R.attr.pillWrapperBackground, this) + ) + ) awesomeBarUIView.view.removeAllProviders() awesomeBarUIView.view.addProviders(shortcutsEnginePickerProvider!!) @@ -79,11 +81,13 @@ class ShortcutEngineManager( private fun hideShortcutEnginePicker() { with(context) { - awesomeBarUIView.search_shortcuts_button.compoundDrawables[0].setTint(ContextCompat.getColor(this, - DefaultThemeManager.resolveAttribute(R.attr.searchShortcutsTextColor, this))) - - awesomeBarUIView.search_shortcuts_button.textColor = ContextCompat.getColor(this, - DefaultThemeManager.resolveAttribute(R.attr.searchShortcutsTextColor, this)) + awesomeBarUIView.search_shortcuts_button?.isChecked = false + awesomeBarUIView.search_shortcuts_button.compoundDrawables[0]?.setTint( + ContextCompat.getColor( + this, + DefaultThemeManager.resolveAttribute(R.attr.searchShortcutsTextColor, this) + ) + ) awesomeBarUIView.view.removeProviders(shortcutsEnginePickerProvider!!) } diff --git a/app/src/main/res/color/toggle_text_color.xml b/app/src/main/res/color/toggle_text_color.xml new file mode 100644 index 000000000..80d6ef0e1 --- /dev/null +++ b/app/src/main/res/color/toggle_text_color.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml index 5062c05b0..a3b00a6eb 100644 --- a/app/src/main/res/layout/fragment_search.xml +++ b/app/src/main/res/layout/fragment_search.xml @@ -79,7 +79,6 @@ style="@style/search_pill" android:layout_marginEnd="8dp" android:drawableStart="@drawable/ic_qr" - android:textColor="?attr/searchShortcutsTextColor" android:textOff="@string/search_scan_button" android:textOn="@string/search_scan_button" /> @@ -87,7 +86,6 @@ android:id="@+id/search_shortcuts_button" style="@style/search_pill" android:drawableStart="@drawable/ic_search" - android:textColor="?attr/searchShortcutsTextColor" android:textOff="@string/search_shortcuts_button" android:textOn="@string/search_shortcuts_button" /> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 8110e0bf6..c7cd9c647 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -2,7 +2,7 @@ - +