v1.0.8 - 시스템 권한 설정 토글 시 앱 자동 즉시 복귀, 달력 상단 근무 텍스트 컬러화 및 최신 버전 확인 아이콘 개편
This commit is contained in:
@@ -347,13 +347,46 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
// Update Header Status Text with Permission Warning if needed
|
||||
val shiftForViewingTeam = withContext(Dispatchers.IO) { repo.getShift(today, currentViewTeam, factory) }
|
||||
val teamSuffix = if (currentViewTeam == selectedTeam) " (내 반)" else " (${currentViewTeam}반)"
|
||||
val teamSuffix = if (currentViewTeam == selectedTeam) "" else " (${currentViewTeam}반)"
|
||||
|
||||
if (currentViewTeam == selectedTeam && !AlarmPermissionUtil.getExactAlarmStatus(this@MainActivity)) {
|
||||
binding.todayStatusText.text = "⚠️ 정확한 알람 권한이 필요합니다 (설정 필요)"
|
||||
binding.todayStatusText.setTextColor(androidx.core.content.ContextCompat.getColor(this@MainActivity, R.color.warning_red))
|
||||
} else {
|
||||
binding.todayStatusText.text = "오늘의 근무: $shiftForViewingTeam$teamSuffix"
|
||||
val prefix = "오늘의 근무: "
|
||||
val fullText = "$prefix$shiftForViewingTeam$teamSuffix"
|
||||
val spannable = android.text.SpannableStringBuilder(fullText)
|
||||
|
||||
val shiftColorRes = when (shiftForViewingTeam) {
|
||||
"주간", "주" -> R.color.shift_ju
|
||||
"석간", "석" -> R.color.shift_seok
|
||||
"야간", "야" -> R.color.shift_ya
|
||||
"주간 맞교대" -> R.color.shift_jumat
|
||||
"야간 맞교대" -> R.color.shift_yamat
|
||||
"휴무", "휴가" -> R.color.shift_off
|
||||
"월차", "연차" -> R.color.secondary
|
||||
"반월", "반년" -> R.color.shift_red
|
||||
"교육" -> R.color.primary
|
||||
else -> R.color.text_primary
|
||||
}
|
||||
val shiftColor = androidx.core.content.ContextCompat.getColor(this@MainActivity, shiftColorRes)
|
||||
val startIndex = prefix.length
|
||||
val endIndex = startIndex + shiftForViewingTeam.length
|
||||
|
||||
spannable.setSpan(
|
||||
android.text.style.ForegroundColorSpan(shiftColor),
|
||||
startIndex,
|
||||
endIndex,
|
||||
android.text.Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
spannable.setSpan(
|
||||
android.text.style.StyleSpan(android.graphics.Typeface.BOLD),
|
||||
startIndex,
|
||||
endIndex,
|
||||
android.text.Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
|
||||
binding.todayStatusText.text = spannable
|
||||
binding.todayStatusText.setTextColor(androidx.core.content.ContextCompat.getColor(this@MainActivity, R.color.text_secondary))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user