docs(gift): 선물 신청 요구사항을 정리한다

This commit is contained in:
2026-10-01 15:51:51 +09:00
parent 0fb727d0ee
commit 79f47c25ab
4 changed files with 1166 additions and 0 deletions
@@ -0,0 +1,65 @@
package kr.co.vividnext.sodalive.v2.gift
import android.content.Context
import android.text.InputFilter
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import android.widget.TextView
import androidx.core.content.ContextCompat
import kr.co.vividnext.sodalive.R
class GiftCategoryAdapter(
context: Context,
items: List<String>
) : ArrayAdapter<String>(context, R.layout.item_gift_send_category, items) {
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View =
super.getView(position, convertView, parent).also { tintItem(it, position) }
override fun getDropDownView(position: Int, convertView: View?, parent: ViewGroup): View =
super.getDropDownView(position, convertView, parent).also { tintItem(it, position) }
private fun tintItem(view: View, position: Int) {
(view as? TextView)?.setTextColor(
ContextCompat.getColor(context, if (position == 0) R.color.gray_500 else R.color.white)
)
}
}
object GiftSendInputFilters {
fun senderName() = InputFilter { source, start, end, _, _, _ ->
filterChars(source, start, end) { it.isLetterOrDigit() && (it.code < 128 || it in '가'..'힣') }
}
fun phoneNumber() = InputFilter { source, start, end, _, _, _ ->
filterChars(source, start, end) { it.isDigit() }
}
private fun filterChars(
source: CharSequence,
start: Int,
end: Int,
accepts: (Char) -> Boolean
): CharSequence? {
val filtered = source.subSequence(start, end).filter(accepts)
return if (filtered.length == end - start) null else filtered
}
}
object GiftSendInputErrorBinder {
fun bind(
context: Context,
input: TextView,
helper: TextView,
hasError: Boolean,
errorText: String,
normalText: String
) {
input.setBackgroundResource(
if (hasError) R.drawable.bg_gift_send_input_error else R.drawable.bg_creator_channel_fantalk_reply
)
helper.text = if (hasError) errorText else normalText
helper.setTextColor(ContextCompat.getColor(context, if (hasError) R.color.red_400 else R.color.gray_400))
}
}
@@ -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/gray_900" />
<stroke
android:width="1dp"
android:color="@color/red_400" />
<corners android:radius="@dimen/radius_14" />
</shape>