Решение к домашней работе Fragments#63
Решение к домашней работе Fragments#63dbulygin wants to merge 2 commits intoAndroid-Developer-Basic:masterfrom
Conversation
| ): View { | ||
| _binding = FragmentAaBinding.inflate(inflater, container, false) | ||
| val view = binding.root | ||
| binding.containerAA.setBackgroundColor(ColorGenerator.generateColor()) |
There was a problem hiding this comment.
Сейчас цвет генерируется внутри AA, а по заданию должен передаваться через аргументы при создании фрагмента в методе openFragmentAA фрагмента А. Используйте bundleOf для создания аргументов и получите его в АА
|
|
||
| private fun openFragmentAB() { | ||
| val fragmentAB = FragmentAB() | ||
| parentFragmentManager.beginTransaction() |
There was a problem hiding this comment.
Сейчас используется parent, что делает AB стблинг A, а не чайлд. Нужно использовать childFragmentManager, чтобы AB был чайлд А. Также цвет должен передаваться через аргументы, как в пункте выше.
There was a problem hiding this comment.
Исправил на childFragmentManager
|
|
||
| private fun openFragmentBB() { | ||
| val fragmentBB = FragmentBB() | ||
| childFragmentManager.beginTransaction() |
There was a problem hiding this comment.
Тут наоборот использовать parentFragmentManager, чтобы фрагменты были на одном уровне в иерархии
ТЗ: будет открываться FragmentBB, на том же уровне
иерархии, что и **FragmentBA
There was a problem hiding this comment.
Исправил на parentFragmentManager
| } | ||
| } | ||
|
|
||
| private fun openFragmentBA() { |
There was a problem hiding this comment.
После отправки цвета из BB нужно вернуться назад через popBackStack(), а не создавать новый BA
|
Исправления внесены. |
No description provided.