diff --git a/data/src/main/java/in/koreatech/koin/data/mapper/DiningMapper.kt b/data/src/main/java/in/koreatech/koin/data/mapper/DiningMapper.kt index 2664493e6..36192ed03 100644 --- a/data/src/main/java/in/koreatech/koin/data/mapper/DiningMapper.kt +++ b/data/src/main/java/in/koreatech/koin/data/mapper/DiningMapper.kt @@ -15,10 +15,8 @@ fun DiningResponse.toDining() = Dining( this.imageUrl ?: "", this.createdAt, this.updatedAt, - this.isSoldOut, - // TODO: sold_out 품절 시각으로 변경시 대응 -// this.soldOutAt ?: "" - this.isChanged, + this.soldoutAt ?: "", + this.changedAt ?: "", this.error ?: "" ) diff --git a/data/src/main/java/in/koreatech/koin/data/response/DiningResponse.kt b/data/src/main/java/in/koreatech/koin/data/response/DiningResponse.kt index 7e674b97c..cdf32d190 100644 --- a/data/src/main/java/in/koreatech/koin/data/response/DiningResponse.kt +++ b/data/src/main/java/in/koreatech/koin/data/response/DiningResponse.kt @@ -14,9 +14,7 @@ data class DiningResponse( @SerializedName("image_url") val imageUrl: String?, @SerializedName("created_at") val createdAt: String, @SerializedName("updated_at") val updatedAt: String, - @SerializedName("sold_out") val isSoldOut: Boolean, - // TODO: sold_out 품절 시각으로 변경시 대응 -// @SerializedName("sold_out") val soldOutAt: String?, - @SerializedName("is_changed") val isChanged: Boolean, + @SerializedName("soldout_at") val soldoutAt: String?, + @SerializedName("changed_at") val changedAt: String?, @SerializedName("error") val error: String? ) \ No newline at end of file diff --git a/data/src/main/java/in/koreatech/koin/data/util/DiningUtil.kt b/data/src/main/java/in/koreatech/koin/data/util/DiningUtil.kt index 11e3ec5da..d8352345d 100644 --- a/data/src/main/java/in/koreatech/koin/data/util/DiningUtil.kt +++ b/data/src/main/java/in/koreatech/koin/data/util/DiningUtil.kt @@ -8,4 +8,5 @@ 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) } \ No newline at end of file diff --git a/data/src/main/res/values/strings.xml b/data/src/main/res/values/strings.xml index 1ef5d86af..b51abd41f 100644 --- a/data/src/main/res/values/strings.xml +++ b/data/src/main/res/values/strings.xml @@ -61,4 +61,5 @@ 아침 점심 저녁 + 내일 아침 \ No newline at end of file diff --git a/domain/src/main/java/in/koreatech/koin/domain/model/dining/Dining.kt b/domain/src/main/java/in/koreatech/koin/domain/model/dining/Dining.kt index da0fbcea2..cdca8eaaf 100644 --- a/domain/src/main/java/in/koreatech/koin/domain/model/dining/Dining.kt +++ b/domain/src/main/java/in/koreatech/koin/domain/model/dining/Dining.kt @@ -12,9 +12,7 @@ data class Dining( val imageUrl: String, val createdAt: String, val updatedAt: String, - val isSoldOut: Boolean, - // TODO: sold_out 품절 시각으로 변경시 대응 -// val soldOutAt: String, - val isChanged: Boolean, + val soldoutAt: String, + val changedAt: String, val error: String ) diff --git a/domain/src/main/java/in/koreatech/koin/domain/model/dining/DiningType.kt b/domain/src/main/java/in/koreatech/koin/domain/model/dining/DiningType.kt index ef7e22a32..911bf1bfe 100644 --- a/domain/src/main/java/in/koreatech/koin/domain/model/dining/DiningType.kt +++ b/domain/src/main/java/in/koreatech/koin/domain/model/dining/DiningType.kt @@ -10,5 +10,6 @@ enum class DiningType( ) { Breakfast (BREAKFAST, "아침"), Lunch (LUNCH, "점심"), - Dinner (DINNER, "저녁"); + Dinner (DINNER, "저녁"), + NextBreakfast (BREAKFAST, "내일 아침"); } \ No newline at end of file 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 d4c7f1ba6..bdda26a05 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 @@ -6,19 +6,26 @@ import `in`.koreatech.koin.domain.util.ext.arrange import `in`.koreatech.koin.domain.util.ext.typeFilter object DiningUtil { - private val diningEndTime = listOf("09:00", "13:30", "18:30") + private val diningEndTime = listOf("09:00", "13:30", "18:30", "23:59") fun typeFiltering(diningList: List, type: DiningType): List = diningList.typeFilter(type).arrange() - fun getCurrentType() = if (TimeUtil.compareWithCurrentTime(diningEndTime[0]) >= 0) { - DiningType.Breakfast - } else if (TimeUtil.compareWithCurrentTime(diningEndTime[1]) >= 0) { - DiningType.Lunch - } else if (TimeUtil.compareWithCurrentTime(diningEndTime[2]) >= 0) { - DiningType.Dinner - } else { - DiningType.Breakfast + fun getCurrentType(): DiningType { + var currentType = DiningType.Breakfast + diningEndTime.forEachIndexed { index, time -> + if (TimeUtil.compareWithCurrentTime(time) >= 0) { + currentType = when (index) { + 0 -> DiningType.Breakfast + 1 -> DiningType.Lunch + 2 -> DiningType.Dinner + 3 -> DiningType.NextBreakfast + else -> DiningType.Breakfast + } + return currentType + } + } + return currentType } fun isNextDay() = TimeUtil.compareWithCurrentTime(diningEndTime[2]) < 0 diff --git a/gradle.properties b/gradle.properties index 3c70c8aab..eac905184 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,10 @@ # The setting is particularly useful for tweaking memory settings. android.enableJetifier=true android.useAndroidX=true -org.gradle.jvmargs=-Xmx1536m +org.gradle.jvmargs=-Xmx1536m \ +--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ +--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \ +--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED #Enable daemon org.gradle.daemon=true @@ -22,7 +25,6 @@ org.gradle.parallel=true org.gradle.configureondemand=true - # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/koin/src/main/java/in/koreatech/koin/ui/dining/DiningActivity.kt b/koin/src/main/java/in/koreatech/koin/ui/dining/DiningActivity.kt index 82a335ab6..c52d06744 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/dining/DiningActivity.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/dining/DiningActivity.kt @@ -80,6 +80,7 @@ class DiningActivity : KoinNavigationDrawerActivity() { DiningType.Breakfast -> tabsDiningTime.selectTab(tabsDiningTime.getTabAt(0)) DiningType.Lunch -> tabsDiningTime.selectTab(tabsDiningTime.getTabAt(1)) DiningType.Dinner -> tabsDiningTime.selectTab(tabsDiningTime.getTabAt(2)) + DiningType.NextBreakfast -> tabsDiningTime.selectTab(tabsDiningTime.getTabAt(0)) } } } diff --git a/koin/src/main/java/in/koreatech/koin/ui/dining/adapter/DiningAdapter.kt b/koin/src/main/java/in/koreatech/koin/ui/dining/adapter/DiningAdapter.kt index e96c2eb64..ee794b114 100644 --- a/koin/src/main/java/in/koreatech/koin/ui/dining/adapter/DiningAdapter.kt +++ b/koin/src/main/java/in/koreatech/koin/ui/dining/adapter/DiningAdapter.kt @@ -62,7 +62,7 @@ class DiningAdapter : ListAdapter(diffCallback) } } - if(dining.isSoldOut) { + if(dining.soldoutAt.isNotEmpty()) { groupSoldOut.visibility = View.VISIBLE textViewDiningSoldOut.visibility = View.VISIBLE } else { @@ -70,7 +70,7 @@ class DiningAdapter : ListAdapter(diffCallback) textViewDiningSoldOut.visibility = View.INVISIBLE } - if(dining.isChanged) { + if(dining.changedAt.isNotEmpty()) { textViewDiningChanged.visibility = View.VISIBLE } else { textViewDiningChanged.visibility = View.INVISIBLE 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 4b9b5bba1..0bc739a2b 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 @@ -24,6 +24,7 @@ import android.os.Bundle import android.view.View import android.view.WindowManager import androidx.activity.viewModels +import androidx.core.content.ContextCompat import androidx.core.view.isVisible import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -134,7 +135,7 @@ class MainActivity : KoinNavigationDrawerActivity() { } observeLiveData(selectedType) { - binding.textViewCardDiningTime.text = it.localized(this@MainActivity) + binding.textViewDiningTime.text = it.localized(this@MainActivity) } observeLiveData(busTimer) { @@ -173,17 +174,37 @@ class MainActivity : KoinNavigationDrawerActivity() { listOf( binding.textViewCardDiningMenu0, - binding.textViewCardDiningMenu1, binding.textViewCardDiningMenu2, - binding.textViewCardDiningMenu3, binding.textViewCardDiningMenu4, - binding.textViewCardDiningMenu5, binding.textViewCardDiningMenu6, - binding.textViewCardDiningMenu7, 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/drawable/dining_changed_fill_radius_4.xml b/koin/src/main/res/drawable/dining_changed_fill_radius_4.xml new file mode 100644 index 000000000..70159ccec --- /dev/null +++ b/koin/src/main/res/drawable/dining_changed_fill_radius_4.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/koin/src/main/res/drawable/dining_soldout_fill_radius_4.xml b/koin/src/main/res/drawable/dining_soldout_fill_radius_4.xml new file mode 100644 index 000000000..be92ae5a9 --- /dev/null +++ b/koin/src/main/res/drawable/dining_soldout_fill_radius_4.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/koin/src/main/res/layout/activity_main.xml b/koin/src/main/res/layout/activity_main.xml index 9f28e2ef0..0b6f6e7cd 100644 --- a/koin/src/main/res/layout/activity_main.xml +++ b/koin/src/main/res/layout/activity_main.xml @@ -9,13 +9,16 @@ android:layout_height="match_parent" android:fitsSystemWindows="true" tools:ignore="MissingPrefix"> + + + + + + + + + + + + + tools:paddingStart="40dp" + tools:paddingTop="8dp" /> + + - + + + + + + + + + app:cardCornerRadius="0dp"> + app:layout_constraintTop_toTopOf="parent" + tools:background="@drawable/dining_soldout_fill_radius_4" + tools:text="@string/dining_soldout" + tools:textColor="@color/dining_soldout_text" /> - + + android:textSize="12sp" + tools:text="메뉴1" /> + android:textSize="12sp" + tools:text="메뉴2" /> - + + android:textSize="12sp" + tools:text="메뉴3" /> + android:textSize="12sp" + tools:text="메뉴4" /> - + + android:textSize="12sp" + tools:text="메뉴5" /> + android:textSize="12sp" + tools:text="메뉴6" /> - + + android:textSize="12sp" + tools:text="메뉴7" /> + android:textSize="12sp" + tools:text="메뉴8" /> + android:paddingBottom="4dp"> + android:textSize="12sp" + tools:text="메뉴9" /> + android:textSize="12sp" + tools:text="까르보나라민트초코파맛첵스파게티" /> @@ -325,6 +365,7 @@ + diff --git a/koin/src/main/res/layout/main_card_dining.xml b/koin/src/main/res/layout/main_card_dining.xml index c348108be..dac42b917 100644 --- a/koin/src/main/res/layout/main_card_dining.xml +++ b/koin/src/main/res/layout/main_card_dining.xml @@ -20,7 +20,7 @@ android:paddingStart="16dp" android:paddingEnd="48dp" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintEnd_toStartOf="@id/text_view_card_dining_time" + app:layout_constraintEnd_toStartOf="@id/text_view_dining_time" app:layout_constraintTop_toTopOf="parent" > + + #FFAD0D + #FFF7E1 + + #4B4B4B + #EEEEEE \ No newline at end of file diff --git a/koin/src/main/res/values/strings.xml b/koin/src/main/res/values/strings.xml index 85839f6a3..79d7a9f08 100644 --- a/koin/src/main/res/values/strings.xml +++ b/koin/src/main/res/values/strings.xml @@ -232,6 +232,8 @@ 양식 능수관 학교에서 식단이 업로드 되지 않았습니다. + 품절 + 변경됨 버스 / 교통 운행정보 운행 정보 검색