룰렛 설정 개수에 따라 룰렛 프리셋 버튼 활성화/비활성화

This commit is contained in:
klaus 2024-02-28 03:56:51 +09:00
parent af4e802259
commit 2d0c4ea738
4 changed files with 45 additions and 18 deletions

View File

@ -236,9 +236,6 @@ class RouletteSettingsFragment : BaseFragment<FragmentRouletteSettingsBinding>(
binding.ivSelectRoulette3.visibility = View.GONE binding.ivSelectRoulette3.visibility = View.GONE
binding.llSelectRoulette1.setBackgroundResource(R.drawable.bg_round_corner_6_7_13181b) binding.llSelectRoulette1.setBackgroundResource(R.drawable.bg_round_corner_6_7_13181b)
binding.llSelectRoulette2.setBackgroundResource(R.drawable.bg_round_corner_6_7_13181b)
binding.llSelectRoulette3.setBackgroundResource(R.drawable.bg_round_corner_6_7_13181b)
binding.tvSelectRoulette1.setTextColor( binding.tvSelectRoulette1.setTextColor(
ContextCompat.getColor( ContextCompat.getColor(
requireContext(), requireContext(),
@ -246,19 +243,41 @@ class RouletteSettingsFragment : BaseFragment<FragmentRouletteSettingsBinding>(
) )
) )
if (viewModel.rouletteList.size > 0) {
binding.llSelectRoulette2.setBackgroundResource(R.drawable.bg_round_corner_6_7_13181b)
binding.tvSelectRoulette2.setTextColor( binding.tvSelectRoulette2.setTextColor(
ContextCompat.getColor( ContextCompat.getColor(
requireContext(), requireContext(),
R.color.color_3bb9f1 R.color.color_3bb9f1
) )
) )
} else {
binding.llSelectRoulette2.setBackgroundResource(R.drawable.bg_round_corner_6_7_777777)
binding.tvSelectRoulette2.setTextColor(
ContextCompat.getColor(
requireContext(),
R.color.color_555555
)
)
}
if (viewModel.rouletteList.size > 1) {
binding.llSelectRoulette3.setBackgroundResource(R.drawable.bg_round_corner_6_7_13181b)
binding.tvSelectRoulette3.setTextColor( binding.tvSelectRoulette3.setTextColor(
ContextCompat.getColor( ContextCompat.getColor(
requireContext(), requireContext(),
R.color.color_3bb9f1 R.color.color_3bb9f1
) )
) )
} else {
binding.llSelectRoulette3.setBackgroundResource(R.drawable.bg_round_corner_6_7_777777)
binding.tvSelectRoulette3.setTextColor(
ContextCompat.getColor(
requireContext(),
R.color.color_555555
)
)
}
} }
private fun selectRouletteButton( private fun selectRouletteButton(

View File

@ -53,7 +53,7 @@ class RouletteSettingsViewModel(private val repository: RouletteRepository) : Ba
private var rouletteId = 0L private var rouletteId = 0L
private val options = mutableListOf<RouletteOption>() private val options = mutableListOf<RouletteOption>()
private val rouletteList = mutableListOf<GetNewRouletteResponse>() val rouletteList = mutableListOf<GetNewRouletteResponse>()
fun plusWeight(optionIndex: Int) { fun plusWeight(optionIndex: Int) {
val currentOption = options[optionIndex] val currentOption = options[optionIndex]

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_777777" />
<corners android:radius="6.7dp" />
<stroke
android:width="1dp"
android:color="@color/color_777777" />
</shape>

View File

@ -60,7 +60,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="13.3dp" android:layout_marginStart="13.3dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/bg_round_corner_6_7_13181b" android:background="@drawable/bg_round_corner_6_7_777777"
android:gravity="center" android:gravity="center"
android:paddingVertical="14.3dp"> android:paddingVertical="14.3dp">
@ -79,7 +79,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="@font/gmarket_sans_bold" android:fontFamily="@font/gmarket_sans_bold"
android:text="룰렛 2" android:text="룰렛 2"
android:textColor="@color/color_3bb9f1" android:textColor="@color/color_555555"
android:textSize="14.7sp" /> android:textSize="14.7sp" />
</LinearLayout> </LinearLayout>
@ -89,7 +89,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="13.3dp" android:layout_marginStart="13.3dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/bg_round_corner_6_7_13181b" android:background="@drawable/bg_round_corner_6_7_777777"
android:gravity="center" android:gravity="center"
android:paddingVertical="14.3dp"> android:paddingVertical="14.3dp">
@ -108,7 +108,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="@font/gmarket_sans_bold" android:fontFamily="@font/gmarket_sans_bold"
android:text="룰렛 3" android:text="룰렛 3"
android:textColor="@color/color_3bb9f1" android:textColor="@color/color_555555"
android:textSize="14.7sp" /> android:textSize="14.7sp" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>