From 380f69a3f4fc91a99b629b86b7504b666e6a35bf Mon Sep 17 00:00:00 2001 From: wateralsie Date: Tue, 16 Apr 2024 07:25:19 +0900 Subject: [PATCH] #212 Add dining tab --- .../koreatech/koin/domain/util/DiningUtil.kt | 1 + .../koin/ui/main/activity/MainActivity.kt | 100 ++++---- koin/src/main/res/layout/activity_main.xml | 214 +----------------- 3 files changed, 62 insertions(+), 253 deletions(-) diff --git a/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt b/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt index bdda26a05..804abdcac 100644 --- a/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt +++ b/domain/src/main/java/in/koreatech/koin/domain/util/DiningUtil.kt @@ -7,6 +7,7 @@ import `in`.koreatech.koin.domain.util.ext.typeFilter object DiningUtil { private val diningEndTime = listOf("09:00", "13:30", "18:30", "23:59") + val diningPlace = listOf("A코너", "B코너", "C코너", "능수관" ) fun typeFiltering(diningList: List, type: DiningType): List = diningList.typeFilter(type).arrange() diff --git a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt index 2c05a43df..d7b073b35 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/main/activity/MainActivity.kt @@ -104,18 +104,22 @@ class MainActivity : KoinNavigationDrawerActivity() { adapter = storeCategoryRecyclerAdapter } - recyclerViewDiningType.apply { - layoutManager = - LinearLayoutManager(this@MainActivity, RecyclerView.HORIZONTAL, false) - adapter = diningTypeAdapter - } +// recyclerViewDiningType.apply { +// layoutManager = +// LinearLayoutManager(this@MainActivity, RecyclerView.HORIZONTAL, false) +// adapter = diningTypeAdapter +// } mainSwipeRefreshLayout.setOnRefreshListener { mainActivityViewModel.updateDining() } - diningContainer.setOnClickListener { - callDrawerItem(R.id.navi_item_dining) +// diningContainer.setOnClickListener { +// callDrawerItem(R.id.navi_item_dining) +// } + + DiningUtil.diningPlace.forEach { place -> + tabDining.addTab(tabDining.newTab().setText(place)) } } @@ -165,46 +169,46 @@ class MainActivity : KoinNavigationDrawerActivity() { } ) - if (list.isEmpty() || position >= diningArranged.size) { - binding.viewEmptyDining.emptyDiningListFrameLayout.isVisible = true - return - } - - binding.viewEmptyDining.emptyDiningListFrameLayout.isVisible = false - - listOf( - binding.textViewCardDiningMenu0, - binding.textViewCardDiningMenu2, - binding.textViewCardDiningMenu4, - binding.textViewCardDiningMenu6, - binding.textViewCardDiningMenu8, - binding.textViewCardDiningMenu1, - binding.textViewCardDiningMenu3, - binding.textViewCardDiningMenu5, - binding.textViewCardDiningMenu7, - binding.textViewCardDiningMenu9 - ).zip(diningArranged[position].menu).forEach { (textView, menu) -> - textView.text = menu - } - - val isSoldOut = diningArranged[position].soldoutAt.isNotEmpty() - val isChanged = diningArranged[position].changedAt.isNotEmpty() - with (binding.textViewDiningStatus) { - when { - isSoldOut -> { - text = context.getString(R.string.dining_soldout) - setTextColor(ContextCompat.getColor(context, R.color.dining_soldout_text)) - background = ContextCompat.getDrawable(context, R.drawable.dining_soldout_fill_radius_4) - } - isChanged -> { - text = context.getString(R.string.dining_changed) - setTextColor(ContextCompat.getColor(context, R.color.dining_changed_text)) - background = ContextCompat.getDrawable(context, R.drawable.dining_changed_fill_radius_4) - } - else -> { - visibility = View.INVISIBLE - } - } - } +// if (list.isEmpty() || position >= diningArranged.size) { +// binding.viewEmptyDining.emptyDiningListFrameLayout.isVisible = true +// return +// } + +// binding.viewEmptyDining.emptyDiningListFrameLayout.isVisible = false +// +// listOf( +// binding.textViewCardDiningMenu0, +// binding.textViewCardDiningMenu2, +// binding.textViewCardDiningMenu4, +// binding.textViewCardDiningMenu6, +// binding.textViewCardDiningMenu8, +// binding.textViewCardDiningMenu1, +// binding.textViewCardDiningMenu3, +// binding.textViewCardDiningMenu5, +// binding.textViewCardDiningMenu7, +// binding.textViewCardDiningMenu9 +// ).zip(diningArranged[position].menu).forEach { (textView, menu) -> +// textView.text = menu +// } + +// val isSoldOut = diningArranged[position].soldoutAt.isNotEmpty() +// val isChanged = diningArranged[position].changedAt.isNotEmpty() +// with (binding.textViewDiningStatus) { +// when { +// isSoldOut -> { +// text = context.getString(R.string.dining_soldout) +// setTextColor(ContextCompat.getColor(context, R.color.dining_soldout_text)) +// background = ContextCompat.getDrawable(context, R.drawable.dining_soldout_fill_radius_4) +// } +// isChanged -> { +// text = context.getString(R.string.dining_changed) +// setTextColor(ContextCompat.getColor(context, R.color.dining_changed_text)) +// background = ContextCompat.getDrawable(context, R.drawable.dining_changed_fill_radius_4) +// } +// else -> { +// visibility = View.INVISIBLE +// } +// } +// } } } diff --git a/koin/src/main/res/layout/activity_main.xml b/koin/src/main/res/layout/activity_main.xml index 0b6f6e7cd..bda749328 100644 --- a/koin/src/main/res/layout/activity_main.xml +++ b/koin/src/main/res/layout/activity_main.xml @@ -151,215 +151,19 @@ - + android:layout_marginHorizontal="24dp" + app:tabMode="scrollable" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + -