코인 충전, 코인 내역

This commit is contained in:
2023-07-30 16:20:58 +09:00
parent 7fb43b3f91
commit 79127801c6
34 changed files with 1086 additions and 63 deletions

View File

@@ -0,0 +1,48 @@
package kr.co.vividnext.sodalive.extensions
import android.graphics.Typeface
import android.text.SpannableString
import kr.co.vividnext.sodalive.common.CustomTypefaceSpan
import java.text.SimpleDateFormat
import java.util.Locale
fun String.convertDateFormat(
from: String,
to: String,
inputLocale: Locale = Locale.KOREAN,
outputLocale: Locale = Locale.KOREAN
): String {
val fromDateFormat = SimpleDateFormat(from, inputLocale)
val toDateFormat = SimpleDateFormat(to, outputLocale)
var outputDateString = ""
val date = fromDateFormat.parse(this)
if (date != null) {
outputDateString = toDateFormat.format(date)
}
return outputDateString
}
fun String.fontSpan(typeface: Typeface?, text: String): SpannableString {
val typefaceSpan = CustomTypefaceSpan(typeface)
val spannableString = SpannableString(this)
var startIndex = this.indexOf(text)
while (startIndex != -1) {
val endIndex = startIndex + text.length
spannableString.setSpan(
typefaceSpan,
startIndex,
endIndex,
SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE
)
startIndex = this.indexOf(text, endIndex)
}
return spannableString
}