0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-19 19:42:17 +02:00

Change in card type gets reflected in the previewer

This commit ensures that if we change card on leading side then the previewer fragment will load and shows same card on trailing side
This commit is contained in:
SanjaySargam 2024-06-01 12:58:05 +05:30 committed by David Allison
parent 502ce7f4eb
commit a98bdd5f54

View File

@ -602,6 +602,15 @@ open class CardTemplateEditor : AnkiActivity(), DeckSelectionListener {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
initTabLayoutMediator()
templateEditor.slidingTabLayout?.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(p0: TabLayout.Tab?) {
templateEditor.loadTemplatePreviewerFragmentIfFragmented()
}
override fun onTabUnselected(p0: TabLayout.Tab?) {
}
override fun onTabReselected(p0: TabLayout.Tab?) {
}
})
parentFragmentManager.setFragmentResultListener(REQUEST_FIELD_INSERT, viewLifecycleOwner) { key, bundle ->
if (key == REQUEST_FIELD_INSERT) {
// this is guaranteed to be non null, as we put a non null value on the other side