Skip to content

Commit

Permalink
feat: 티켓 상태에 따라 버튼 색깔 변경 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongHoonC committed Jul 18, 2023
1 parent 84e80c5 commit 2b2bb76
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.festago.festago.presentation.ui.ticketentry

import android.view.ViewGroup
import android.widget.Button
import android.widget.ImageView
import android.widget.ProgressBar
import androidx.core.content.res.ResourcesCompat
Expand Down Expand Up @@ -59,3 +60,12 @@ fun ProgressBar.setRemainTimeProgressDrawableByState(state: TicketStateUiModel)
)
}
}

@BindingAdapter("ticketStateBackground")
fun Button.setTicketStateBackgroundByState(state: TicketStateUiModel) {
val colorRes = when (state) {
BEFORE_ENTRY, AWAY, EMPTY -> R.color.md_theme_light_primary
AFTER_ENTRY -> R.color.md_theme_light_secondary
}
backgroundTintList = ResourcesCompat.getColorStateList(resources, colorRes, null)
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@

<Button
android:id="@+id/btnTicketState"
ticketStateBackground="@{vm.ticket.ticketState}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/space_lsm"
Expand Down

0 comments on commit 2b2bb76

Please sign in to comment.