|
@@ -19,6 +19,9 @@ class FighterFragment : Fragment() {
|
|
|
|
|
|
private val binding get() = _root!!
|
|
private val binding get() = _root!!
|
|
|
|
|
|
|
|
+ // Inside your Fragment:
|
|
|
|
+ var tabSelectionListener: TabSelectionListener? = null
|
|
|
|
+
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
super.onCreate(savedInstanceState)
|
|
}
|
|
}
|
|
@@ -29,6 +32,11 @@ class FighterFragment : Fragment() {
|
|
): View? {
|
|
): View? {
|
|
_root = inflater.inflate(R.layout.fragment_fighter, container, false)
|
|
_root = inflater.inflate(R.layout.fragment_fighter, container, false)
|
|
|
|
|
|
|
|
+ setTab()
|
|
|
|
+ return binding
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private fun setTab() {
|
|
val tabTitles = listOf("Fri 18 Aug", "Yesterday", "Today", "Tomorrow", "Tue 22 Aug")
|
|
val tabTitles = listOf("Fri 18 Aug", "Yesterday", "Today", "Tomorrow", "Tue 22 Aug")
|
|
|
|
|
|
// Populate TabLayout with dynamic tabs
|
|
// Populate TabLayout with dynamic tabs
|
|
@@ -56,7 +64,7 @@ class FighterFragment : Fragment() {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
- return binding
|
|
|
|
|
|
+ binding.tabLayout.getTabAt(2)?.select()
|
|
}
|
|
}
|
|
|
|
|
|
private fun setFighters() {
|
|
private fun setFighters() {
|
|
@@ -80,4 +88,12 @@ class FighterFragment : Fragment() {
|
|
// Add more card items as needed
|
|
// Add more card items as needed
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ interface TabSelectionListener {
|
|
|
|
+ fun onTabSelected(tabIndex: Int)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fun selectTab(tabIndex: Int) {
|
|
|
|
+ binding.tabLayout.getTabAt(tabIndex)?.select()
|
|
|
|
+ }
|
|
}
|
|
}
|