mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Fix hijacking of navigation bar color when opening emoji keyboard.
This commit is contained in:
@@ -25,6 +25,10 @@ import kotlin.reflect.KClass
|
||||
|
||||
class KeyboardPagerFragment : Fragment(), InputAwareConstraintLayout.InputFragment {
|
||||
|
||||
companion object {
|
||||
val ARG_SET_NAV_COLOR = "args.setNavColor"
|
||||
}
|
||||
|
||||
private lateinit var emojiButton: View
|
||||
private lateinit var stickerButton: View
|
||||
private lateinit var gifButton: View
|
||||
@@ -33,6 +37,9 @@ class KeyboardPagerFragment : Fragment(), InputAwareConstraintLayout.InputFragme
|
||||
private val fragments: MutableMap<KClass<*>, Fragment> = mutableMapOf()
|
||||
private var currentFragment: Fragment? = null
|
||||
|
||||
private val shouldSetNavColor: Boolean
|
||||
get() = arguments?.getBoolean(ARG_SET_NAV_COLOR) ?: true
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return themedInflate(R.layout.keyboard_pager_fragment, inflater, container)
|
||||
}
|
||||
@@ -59,11 +66,13 @@ class KeyboardPagerFragment : Fragment(), InputAwareConstraintLayout.InputFragme
|
||||
}
|
||||
|
||||
override fun onHiddenChanged(hidden: Boolean) {
|
||||
getWindow()?.let { window ->
|
||||
if (hidden) {
|
||||
WindowUtil.setNavigationBarColor(requireContext(), window, ThemeUtil.getThemedColor(requireContext(), android.R.attr.navigationBarColor))
|
||||
} else {
|
||||
WindowUtil.setNavigationBarColor(requireContext(), window, ThemeUtil.getThemedColor(requireContext(), R.attr.mediaKeyboardBottomBarBackgroundColor))
|
||||
if (shouldSetNavColor) {
|
||||
getWindow()?.let { window ->
|
||||
if (hidden) {
|
||||
WindowUtil.setNavigationBarColor(requireContext(), window, ThemeUtil.getThemedColor(requireContext(), android.R.attr.navigationBarColor))
|
||||
} else {
|
||||
WindowUtil.setNavigationBarColor(requireContext(), window, ThemeUtil.getThemedColor(requireContext(), R.attr.mediaKeyboardBottomBarBackgroundColor))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user