| | |
| | | // 其他标签点击事件需要检查会员状态 |
| | | val memberOnlyTabs = mapOf( |
| | | tabIncome to { homeViewModel.loadIncomeData() }, |
| | | tabFlight to { homeViewModel.loadFlightData() }, |
| | | tabTrain to { homeViewModel.loadTrainData() } |
| | | // tabFlight to { homeViewModel.loadFlightData() }, |
| | | // tabTrain to { homeViewModel.loadTrainData() } |
| | | ) |
| | | |
| | | memberOnlyTabs.forEach { (tab, loadAction) -> |
| | |
| | | hideAllRecyclers() |
| | | when (tab) { |
| | | tabIncome -> incomeRecycler.visibility = View.VISIBLE |
| | | tabFlight -> flightRecycler.visibility = View.VISIBLE |
| | | tabTrain -> trainRecycler.visibility = View.VISIBLE |
| | | // tabFlight -> flightRecycler.visibility = View.VISIBLE |
| | | // tabTrain -> trainRecycler.visibility = View.VISIBLE |
| | | } |
| | | updateTabStyles(tab) |
| | | loadAction() |
| | |
| | | |
| | | private fun updateTabStyles(selectedTab: UnderlineTextView) { |
| | | binding.apply { |
| | | val tabs = listOf(tabExpress, tabFinance, tabIncome, tabFlight, tabTrain) |
| | | // val tabs = listOf(tabExpress, tabFinance, tabIncome, tabFlight, tabTrain) |
| | | val tabs = listOf(tabExpress, tabFinance, tabIncome) |
| | | tabs.forEach { tab -> |
| | | // 设置文字颜色为黑色或灰色 |
| | | tab.setTextColor(ContextCompat.getColor(requireContext(), |
| | |
| | | tabExpress.visibility = View.GONE |
| | | tabFinance.visibility = View.GONE |
| | | tabIncome.visibility = View.GONE |
| | | tabFlight.visibility = View.GONE |
| | | tabTrain.visibility = View.GONE |
| | | // tabFlight.visibility = View.GONE |
| | | // tabTrain.visibility = View.GONE |
| | | |
| | | // 获取用户信息判断是否是会员 |
| | | val savedPhone = PreferencesManager.getPhone() |
| | |
| | | tabIncome.visibility = if (category.isEnabled) View.VISIBLE else View.GONE |
| | | if (categories.indexOf(category) == 0 && category.isEnabled) tabIncome.performClick() |
| | | } |
| | | "航班" -> { |
| | | tabFlight.visibility = if (category.isEnabled) View.VISIBLE else View.GONE |
| | | if (categories.indexOf(category) == 0 && category.isEnabled) tabFlight.performClick() |
| | | } |
| | | "火车票" -> { |
| | | tabTrain.visibility = if (category.isEnabled) View.VISIBLE else View.GONE |
| | | if (categories.indexOf(category) == 0 && category.isEnabled) tabTrain.performClick() |
| | | } |
| | | // "航班" -> { |
| | | // tabFlight.visibility = if (category.isEnabled) View.VISIBLE else View.GONE |
| | | // if (categories.indexOf(category) == 0 && category.isEnabled) tabFlight.performClick() |
| | | // } |
| | | // "火车票" -> { |
| | | // tabTrain.visibility = if (category.isEnabled) View.VISIBLE else View.GONE |
| | | // if (categories.indexOf(category) == 0 && category.isEnabled) tabTrain.performClick() |
| | | // } |
| | | } |
| | | } |
| | | } |