Skip to content

Commit

Permalink
#212 Show in title if menu is today or tomorrow
Browse files Browse the repository at this point in the history
  • Loading branch information
wateralsie committed Apr 16, 2024
1 parent b179dbd commit 76d79fb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
7 changes: 6 additions & 1 deletion data/src/main/java/in/koreatech/koin/data/util/DiningUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@ fun DiningType.localized(context: Context) = when(this) {
DiningType.Breakfast -> context.getString(R.string.dining_breakfast)
DiningType.Lunch -> context.getString(R.string.dining_lunch)
DiningType.Dinner -> context.getString(R.string.dining_dinner)
DiningType.NextBreakfast -> context.getString(R.string.dining_next_breakfast)
else -> context.getString(R.string.dining_breakfast)
}

fun DiningType.todayOrTomorrow(context: Context) = when(this) {
DiningType.NextBreakfast -> context.getString(R.string.dining_tomorrow)
else -> context.getString(R.string.dining_today)
}
3 changes: 2 additions & 1 deletion data/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@
<string name="dining_breakfast">아침</string>
<string name="dining_lunch">점심</string>
<string name="dining_dinner">저녁</string>
<string name="dining_next_breakfast">내일 아침</string>
<string name="dining_today">오늘</string>
<string name="dining_tomorrow">내일</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
package `in`.koreatech.koin.ui.main.activity

import android.os.Bundle
import android.view.View
import androidx.activity.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import dagger.hilt.android.AndroidEntryPoint
import `in`.koreatech.koin.R
import `in`.koreatech.koin.core.recyclerview.RecyclerViewClickListener
import `in`.koreatech.koin.core.util.dataBinding
import `in`.koreatech.koin.core.viewpager.HorizontalMarginItemDecoration
import `in`.koreatech.koin.core.viewpager.ScaledViewPager2Transformation
import `in`.koreatech.koin.data.util.localized
import `in`.koreatech.koin.data.util.todayOrTomorrow
import `in`.koreatech.koin.databinding.ActivityMainBinding
import `in`.koreatech.koin.domain.model.dining.DiningPlace
import `in`.koreatech.koin.ui.main.StoreCategoryRecyclerAdapter
import `in`.koreatech.koin.ui.main.adapter.BusPagerAdapter
import `in`.koreatech.koin.ui.main.adapter.DiningContainerViewPager2Adapter
import `in`.koreatech.koin.ui.main.viewmodel.MainActivityViewModel
import `in`.koreatech.koin.ui.navigation.KoinNavigationDrawerActivity
import `in`.koreatech.koin.ui.navigation.state.MenuState
import `in`.koreatech.koin.util.ext.observeLiveData
import android.os.Bundle
import android.view.View
import androidx.activity.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import dagger.hilt.android.AndroidEntryPoint
import `in`.koreatech.koin.domain.model.dining.DiningPlace
import `in`.koreatech.koin.ui.main.adapter.DiningContainerViewPager2Adapter
import `in`.koreatech.koin.ui.store.contract.StoreActivityContract
import `in`.koreatech.koin.util.ext.observeLiveData

@AndroidEntryPoint
class MainActivity : KoinNavigationDrawerActivity() {
Expand Down Expand Up @@ -121,7 +121,7 @@ class MainActivity : KoinNavigationDrawerActivity() {
}

observeLiveData(selectedType) {
binding.textViewDiningTodayOrTomorrow.text = it.localized(this@MainActivity)
binding.textViewDiningTodayOrTomorrow.text = it.todayOrTomorrow(this@MainActivity)
}

observeLiveData(busTimer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,10 @@ class DiningContainerFragment : Fragment(R.layout.fragment_dining_container) {
super.onViewCreated(view, savedInstanceState)

initView()
addListener()
initViewModel()
}

private fun initView() {
place.apply {
// binding.textViewDiningContainer.text = this.toString()
}
}

private fun addListener() {

}

Expand Down

0 comments on commit 76d79fb

Please sign in to comment.