4 Commits
27 changed files with 642 additions and 420 deletions
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -20,8 +20,8 @@ android {
applicationId = "com.example.shiftalarm"
minSdk = 26
targetSdk = 35
versionCode = 104
versionName = "1.0.4"
versionCode = 108
versionName = "1.0.8"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
+4 -21
View File
@@ -2,21 +2,18 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<!-- Alarm & Full Screen -->
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<!-- Service & Notification -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<application
android:allowBackup="true"
@@ -42,12 +39,11 @@
android:name=".AlarmActivity"
android:exported="false"
android:excludeFromRecents="true"
android:taskAffinity=""
android:theme="@style/Theme.AppCompat.NoActionBar"
android:showWhenLocked="true"
android:turnScreenOn="true"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:launchMode="singleInstance"
android:documentLaunchMode="never"
android:configChanges="orientation|screenSize|keyboardHidden"
android:allowEmbedded="false"
@@ -94,22 +90,9 @@
<service
android:name=".AlarmForegroundService"
android:foregroundServiceType="specialUse"
android:exported="false">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Alarm playback and ringing notification" />
</service>
android:foregroundServiceType="mediaPlayback"
android:exported="false" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
</application>
</manifest>
@@ -185,50 +185,68 @@ class AlarmActivity : AppCompatActivity() {
}
private fun setupControls() {
val snoozeInterval = intent.getIntExtra("EXTRA_SNOOZE_INTERVAL", 5)
binding.tvSnoozeText.text = "다시 울림 (${snoozeInterval}분)"
binding.btnSnooze.setOnClickListener {
handleSnooze()
}
// Swipe-to-dismiss for Stop Button
// Omni-directional Swipe & Tap to Dismiss (Samsung One UI Clock Style)
var startX = 0f
var startY = 0f
var isMoved = false
val dismissBtn = binding.btnDismiss
val maxSwipe = dpToPx(100f).toFloat()
val maxSwipe = dpToPx(80f).toFloat()
dismissBtn.setOnTouchListener { v, event ->
when (event.action) {
MotionEvent.ACTION_DOWN -> {
startX = event.rawX
startY = event.rawY
isMoved = false
v.animate().cancel()
v.scaleX = 0.96f
v.scaleY = 0.96f
true
}
MotionEvent.ACTION_MOVE -> {
val dx = event.rawX - startX
val clampedDx = if (dx > 0) dx.coerceAtMost(maxSwipe) else dx.coerceAtLeast(-maxSwipe)
v.translationX = clampedDx
val dy = event.rawY - startY
val distance = Math.hypot(dx.toDouble(), dy.toDouble()).toFloat()
// Visual feedback: scale up when near trigger
val ratio = abs(clampedDx) / maxSwipe
v.scaleX = 1f + (ratio * 0.15f)
v.scaleY = 1f + (ratio * 0.15f)
v.alpha = 1f - (ratio * 0.3f)
if (distance > 10f) {
isMoved = true
}
val clampedDx = dx.coerceIn(-maxSwipe, maxSwipe)
val clampedDy = dy.coerceIn(-maxSwipe, maxSwipe)
v.translationX = clampedDx
v.translationY = clampedDy
val ratio = (distance / maxSwipe).coerceAtMost(1f)
v.scaleX = 0.96f + (ratio * 0.18f)
v.scaleY = 0.96f + (ratio * 0.18f)
binding.pulseCircle.alpha = 0.4f + (ratio * 0.6f)
true
}
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
val dx = event.rawX - startX
if (abs(dx) > maxSwipe * 0.8f) {
// Trigger Dismiss
@Suppress("DEPRECATION")
(getSystemService(Context.VIBRATOR_SERVICE) as? Vibrator)?.vibrate(50)
Toast.makeText(this, "알람 해제 완료", Toast.LENGTH_SHORT).show()
stopAlarm(); finish()
val dy = event.rawY - startY
val distance = Math.hypot(dx.toDouble(), dy.toDouble()).toFloat()
// Trigger dismiss if swiped past threshold or tapped
if (!isMoved || distance > maxSwipe * 0.5f) {
triggerDismiss()
} else {
// Reset
// Spring back reset
v.animate()
.translationX(0f)
.translationY(0f)
.scaleX(1f)
.scaleY(1f)
.alpha(1f)
.setDuration(300)
.setDuration(250)
.setInterpolator(android.view.animation.OvershootInterpolator(1.5f))
.start()
}
true
@@ -237,31 +255,71 @@ class AlarmActivity : AppCompatActivity() {
}
}
// Pulse logic with enhanced glow
// Dual Wave Breathing Animation (Samsung Ambient Glow)
fun startPulse() {
binding.pulseCircle.scaleX = 0.85f; binding.pulseCircle.scaleY = 0.85f; binding.pulseCircle.alpha = 0.5f
binding.pulseCircle.scaleX = 0.8f
binding.pulseCircle.scaleY = 0.8f
binding.pulseCircle.alpha = 0.3f
binding.ambientRing.scaleX = 0.9f
binding.ambientRing.scaleY = 0.9f
binding.ambientRing.alpha = 0.5f
binding.pulseCircle.animate()
.scaleX(1.3f).scaleY(1.3f).alpha(1.0f)
.setDuration(1500)
.scaleX(1.35f).scaleY(1.35f).alpha(0.8f)
.setDuration(1600)
.withEndAction {
binding.pulseCircle.animate()
.scaleX(0.85f).scaleY(0.85f).alpha(0.5f)
.setDuration(1500)
.scaleX(0.8f).scaleY(0.8f).alpha(0.3f)
.setDuration(1600)
.withEndAction { if (!isFinishing) startPulse() }
.start()
}
.start()
binding.ambientRing.animate()
.scaleX(1.15f).scaleY(1.15f).alpha(0.85f)
.setDuration(1600)
.withEndAction {
binding.ambientRing.animate()
.scaleX(0.9f).scaleY(0.9f).alpha(0.5f)
.setDuration(1600)
.start()
}
.start()
}
startPulse()
}
private fun handleSnooze() {
private fun triggerDismiss() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
(getSystemService(Context.VIBRATOR_SERVICE) as? Vibrator)?.vibrate(
VibrationEffect.createOneShot(50, VibrationEffect.DEFAULT_AMPLITUDE)
)
} else {
@Suppress("DEPRECATION")
(getSystemService(Context.VIBRATOR_SERVICE) as? Vibrator)?.vibrate(50)
}
Toast.makeText(this, "알람이 해제되었습니다.", Toast.LENGTH_SHORT).show()
stopAlarm()
finish()
}
private fun handleSnooze() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
(getSystemService(Context.VIBRATOR_SERVICE) as? Vibrator)?.vibrate(
VibrationEffect.createOneShot(50, VibrationEffect.DEFAULT_AMPLITUDE)
)
} else {
@Suppress("DEPRECATION")
(getSystemService(Context.VIBRATOR_SERVICE) as? Vibrator)?.vibrate(50)
}
val snoozeRepeat = intent.getIntExtra("EXTRA_SNOOZE_REPEAT", 3)
val text = if (snoozeRepeat == 99) "다시 울림 설정됨" else "다시 울림 (${snoozeRepeat}회 남음)"
Toast.makeText(this, text, Toast.LENGTH_SHORT).show()
snoozeAlarm(); stopAlarm(); finish()
snoozeAlarm()
stopAlarm()
finish()
}
private fun dpToPx(dp: Float): Int {
@@ -71,11 +71,18 @@ class AlarmForegroundService : Service() {
// 4. Foreground 시작
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { // Android 14+
startForeground(NOTIFICATION_ID, notification, android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
startForeground(NOTIFICATION_ID, notification, android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK)
} else {
startForeground(NOTIFICATION_ID, notification)
}
// 5. 사용 중일 때도 즉시 전체화면 AlarmActivity 화면 띄우기
try {
startActivity(fullScreenIntent)
} catch (e: Exception) {
e.printStackTrace()
}
return START_NOT_STICKY
}
@@ -17,9 +17,42 @@ import androidx.activity.ComponentActivity
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import kotlinx.coroutines.*
object AlarmPermissionUtil {
private var monitorJob: Job? = null
/**
* 시스템 설정 화면에서 사용자가 권한을 허용했을 때 뒤로가기를 누르지 않아도 앱으로 즉시 자동 복귀시킵니다.
*/
fun monitorAndAutoReturn(activity: Activity, isGrantedCheck: () -> Boolean) {
monitorJob?.cancel()
monitorJob = CoroutineScope(Dispatchers.Main).launch {
var count = 0
while (count < 150 && isActive) { // 최대 60초간 400ms 주기로 체크
delay(400)
count++
if (isGrantedCheck()) {
try {
val returnIntent = Intent(activity, SettingsActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_REORDER_TO_FRONT or Intent.FLAG_ACTIVITY_SINGLE_TOP
}
activity.startActivity(returnIntent)
} catch (e: Exception) {
e.printStackTrace()
}
break
}
}
}
}
fun cancelAutoReturn() {
monitorJob?.cancel()
monitorJob = null
}
/**
* 전체 권한 상태를 확인하고 필요한 경우 통합 안내 다이얼로그를 표시합니다.
*/
@@ -81,32 +81,20 @@ class AlarmReceiver : BroadcastReceiver() {
Log.d(TAG, "ForegroundService 시작 완료")
// 2. AlarmActivity 직접 실행 (알람 화면 표시)
// 2. AlarmActivity 직접 즉시 실행 (사용 중일 때도 전체화면 알람 창 띄우기)
val activityIntent = Intent(context, AlarmActivity::class.java).apply {
putExtra("EXTRA_SHIFT", intent?.getStringExtra("EXTRA_SHIFT") ?: "근무")
putExtra("EXTRA_SOUND", intent?.getStringExtra("EXTRA_SOUND"))
putExtra("EXTRA_SNOOZE", intent?.getIntExtra("EXTRA_SNOOZE", 5) ?: 5)
putExtra("EXTRA_SNOOZE_REPEAT", intent?.getIntExtra("EXTRA_SNOOZE_REPEAT", 3) ?: 3)
// 중요: 새 태스크로 실행 (FLAG_ACTIVITY_NEW_TASK)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
// 기존 인스턴스 재사용 및 최상위로 가져오기
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
// 잠금 화면 위에 표시
addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
// 화면 켜기
addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT or Intent.FLAG_ACTIVITY_NO_USER_ACTION)
}
// 지연 후 Activity 시작 (ForegroundService가 알림을 먼저 표시하도록)
android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({
try {
context.startActivity(activityIntent)
Log.d(TAG, "AlarmActivity 실행 완료")
Log.d(TAG, "AlarmActivity 즉시 실행 완료")
} catch (e: Exception) {
Log.e(TAG, "AlarmActivity 실행 실패", e)
}
}, 500)
} catch (e: Exception) {
Log.e(TAG, "알람 실행 실패", e)
@@ -108,7 +108,16 @@ object AppUpdateManager {
btnNow.setOnClickListener {
dialog.dismiss()
downloadAndInstallApk(activity, apkUrl, version)
try {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(apkUrl)).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
activity.startActivity(intent)
Toast.makeText(activity, "최신 버전 다운로드 페이지로 이동합니다.", Toast.LENGTH_SHORT).show()
} catch (e: Exception) {
e.printStackTrace()
Toast.makeText(activity, "다운로드 링크 열기 실패: ${e.message}", Toast.LENGTH_SHORT).show()
}
}
dialog.show()
@@ -116,100 +125,4 @@ object AppUpdateManager {
val width = (activity.resources.displayMetrics.widthPixels * 0.88).toInt()
dialog.window?.setLayout(width, android.view.ViewGroup.LayoutParams.WRAP_CONTENT)
}
private fun downloadAndInstallApk(activity: Activity, apkUrl: String, version: String) {
if (activity.isFinishing || activity.isDestroyed) return
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_update_progress_oneui, null)
val tvSub = view.findViewById<TextView>(R.id.tvProgressSub)
val progressBar = view.findViewById<ProgressBar>(R.id.downloadProgressBar)
val tvPercent = view.findViewById<TextView>(R.id.tvProgressPercent)
tvSub.text = "v$version 다운로드 중..."
val progressDialog = AlertDialog.Builder(activity)
.setView(view)
.setCancelable(false)
.create()
progressDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
progressDialog.show()
val width = (activity.resources.displayMetrics.widthPixels * 0.88).toInt()
progressDialog.window?.setLayout(width, android.view.ViewGroup.LayoutParams.WRAP_CONTENT)
Thread {
try {
val url = URL(apkUrl)
val connection = url.openConnection() as HttpURLConnection
connection.connectTimeout = 15000
connection.readTimeout = 15000
connection.requestMethod = "GET"
connection.connect()
val fileLength = connection.contentLength
val inputStream = BufferedInputStream(connection.inputStream)
val apkFile = File(activity.cacheDir, "update.apk")
val outputStream = FileOutputStream(apkFile)
val buffer = ByteArray(8192)
var total: Long = 0
var count: Int
while (inputStream.read(buffer).also { count = it } != -1) {
total += count
outputStream.write(buffer, 0, count)
if (fileLength > 0) {
val progress = (total * 100 / fileLength).toInt()
activity.runOnUiThread {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
progressBar.setProgress(progress, true)
} else {
progressBar.progress = progress
}
tvPercent.text = "$progress%"
}
}
}
outputStream.flush()
outputStream.close()
inputStream.close()
connection.disconnect()
activity.runOnUiThread {
progressDialog.dismiss()
installApk(activity, apkFile)
}
} catch (e: Exception) {
e.printStackTrace()
activity.runOnUiThread {
progressDialog.dismiss()
Toast.makeText(activity, "다운로드 실패: ${e.message}", Toast.LENGTH_LONG).show()
}
}
}.start()
}
private fun installApk(activity: Activity, apkFile: File) {
try {
val apkUri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
FileProvider.getUriForFile(activity, "${activity.packageName}.provider", apkFile)
} else {
Uri.fromFile(apkFile)
}
val intent = Intent(Intent.ACTION_VIEW).apply {
setDataAndType(apkUri, "application/vnd.android.package-archive")
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION
}
activity.startActivity(intent)
} catch (e: Exception) {
e.printStackTrace()
Toast.makeText(activity, "설치 실패: ${e.message}", Toast.LENGTH_LONG).show()
}
}
}
@@ -35,7 +35,6 @@ class CalendarAdapter(
val tvShiftSmall: TextView = view.findViewById(R.id.tvShiftSmall)
val shiftChar: TextView = view.findViewById(R.id.shiftChar)
val holidayNameSmall: TextView = view.findViewById(R.id.holidayNameSmall)
val memoIndicator: ImageView = view.findViewById(R.id.memoIndicator)
val tvTide: TextView = view.findViewById(R.id.tvTide)
val memoContent: TextView = view.findViewById(R.id.memoContent)
}
@@ -231,10 +230,8 @@ class CalendarAdapter(
if (hasMemo) {
holder.memoContent.visibility = View.VISIBLE
holder.memoContent.text = item.memoContent
holder.memoIndicator.visibility = View.VISIBLE
} else {
holder.memoContent.visibility = View.GONE
holder.memoIndicator.visibility = View.GONE
}
// Today Border or Highlight
@@ -193,6 +193,7 @@ class FragmentSettingsBasic : Fragment() {
override fun onResume() {
super.onResume()
AlarmPermissionUtil.cancelAutoReturn()
updatePermissionStatuses()
}
@@ -232,7 +233,10 @@ class FragmentSettingsBasic : Fragment() {
val prefs = requireContext().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
binding.btnBatteryOptimize.setOnClickListener {
AlarmPermissionUtil.requestBatteryOptimization(requireContext())
AlarmPermissionUtil.requestBatteryOptimization(requireActivity())
AlarmPermissionUtil.monitorAndAutoReturn(requireActivity()) {
AlarmPermissionUtil.getBatteryOptimizationStatus(requireContext())
}
}
binding.btnExactAlarm.setOnClickListener {
@@ -240,23 +244,35 @@ class FragmentSettingsBasic : Fragment() {
val intent = Intent(Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM).apply {
data = Uri.parse("package:${requireContext().packageName}")
}
startActivity(intent)
requireActivity().startActivity(intent)
AlarmPermissionUtil.monitorAndAutoReturn(requireActivity()) {
AlarmPermissionUtil.getExactAlarmStatus(requireContext())
}
}
}
binding.btnOverlayPermission.setOnClickListener {
AlarmPermissionUtil.requestOverlayPermission(requireContext())
AlarmPermissionUtil.requestOverlayPermission(requireActivity())
AlarmPermissionUtil.monitorAndAutoReturn(requireActivity()) {
AlarmPermissionUtil.getOverlayStatus(requireContext())
}
}
binding.btnFullScreenIntent.setOnClickListener {
AlarmPermissionUtil.requestFullScreenIntentPermission(requireContext())
AlarmPermissionUtil.requestFullScreenIntentPermission(requireActivity())
AlarmPermissionUtil.monitorAndAutoReturn(requireActivity()) {
AlarmPermissionUtil.getFullScreenIntentStatus(requireContext())
}
}
binding.btnPermissionSettings.setOnClickListener {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
data = Uri.parse("package:${requireContext().packageName}")
}
startActivity(intent)
requireActivity().startActivity(intent)
AlarmPermissionUtil.monitorAndAutoReturn(requireActivity()) {
AlarmPermissionUtil.isAllPermissionsGranted(requireContext())
}
}
binding.btnCheckUpdate.setOnClickListener {
@@ -31,6 +31,9 @@ import java.time.YearMonth
import java.time.format.DateTimeFormatter
import java.util.concurrent.TimeUnit
import androidx.recyclerview.widget.GridLayoutManager
import android.graphics.Bitmap
import android.graphics.Canvas
import android.util.Log
import kotlin.math.abs
class MainActivity : AppCompatActivity() {
@@ -41,6 +44,8 @@ class MainActivity : AppCompatActivity() {
private var currentViewMonth: YearMonth = YearMonth.now(ShiftCalculator.SEOUL_ZONE)
private var currentViewTeam: String = "A"
private lateinit var gestureDetector: GestureDetector
private var calendarAdapter: CalendarAdapter? = null
private var isAnimatingMonth = false
override fun onConfigurationChanged(newConfig: android.content.res.Configuration) {
super.onConfigurationChanged(newConfig)
@@ -261,18 +266,16 @@ class MainActivity : AppCompatActivity() {
private fun setupCalendar() {
binding.calendarGrid.layoutManager = GridLayoutManager(this, 7)
binding.calendarGrid.itemAnimator = null
updateCalendar()
}
private fun updateCalendar() {
private suspend fun loadCalendarDataForMonth(targetMonth: YearMonth) {
val prefs = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
val selectedTeam = prefs.getString(KEY_TEAM, "A") ?: "A"
val factory = prefs.getString("selected_factory", "Jeonju") ?: "Jeonju"
// Today's Shift
val today = LocalDate.now(ShiftCalculator.SEOUL_ZONE)
lifecycleScope.launch {
val db = AppDatabase.getDatabase(this@MainActivity)
val dao = db.shiftDao()
val repo = ShiftRepository(this@MainActivity)
@@ -290,7 +293,7 @@ class MainActivity : AppCompatActivity() {
}
// Load overrides and memos for the month
val monthStr = currentViewMonth.toString()
val monthStr = targetMonth.toString()
val overrides = withContext(Dispatchers.IO) {
dao.getOverridesForMonth(factory, currentViewTeam, monthStr).associateBy { overrideItem -> overrideItem.date }
}
@@ -298,36 +301,92 @@ class MainActivity : AppCompatActivity() {
dao.getMemosForMonth(monthStr).associateBy { memoItem -> memoItem.date }
}
val days = generateDaysForMonthWithData(currentViewMonth, currentViewTeam, factory, overrides, memos)
val days = generateDaysForMonthWithData(targetMonth, currentViewTeam, factory, overrides, memos)
val adapter = CalendarAdapter(days, object : CalendarAdapter.OnDayClickListener {
val availableHeight = binding.calendarGrid.height
val calcRowHeight = if (availableHeight > 0) availableHeight / 5 else 0
if (calendarAdapter == null || binding.calendarGrid.adapter == null) {
val newAdapter = CalendarAdapter(days, object : CalendarAdapter.OnDayClickListener {
override fun onDayClick(date: LocalDate, currentShift: String) {
showDaySettingsDialog(date, currentShift)
}
}, binding.cbShowHolidays.isChecked)
if (calcRowHeight > 0) {
newAdapter.rowHeight = calcRowHeight
}
calendarAdapter = newAdapter
binding.calendarGrid.adapter = newAdapter
} else {
calendarAdapter?.let { ad ->
ad.days = days
ad.showHolidays = binding.cbShowHolidays.isChecked
if (calcRowHeight > 0) {
ad.rowHeight = calcRowHeight
}
ad.notifyDataSetChanged()
}
}
binding.calendarGrid.adapter = adapter
binding.monthTitle.text = currentViewMonth.format(DateTimeFormatter.ofPattern("yyyy년 MM월"))
binding.monthTitle.text = targetMonth.format(DateTimeFormatter.ofPattern("yyyy년 MM월"))
// Dynamic row height: exactly 5 rows visible, 6-row months scroll
if (calcRowHeight == 0) {
binding.calendarGrid.post {
val availableHeight = binding.calendarGrid.height
if (availableHeight > 0) {
val calcRowHeight = availableHeight / 5
adapter.rowHeight = calcRowHeight
adapter.notifyDataSetChanged()
val h = binding.calendarGrid.height
if (h > 0) {
val rH = h / 5
calendarAdapter?.let {
if (it.rowHeight != rH) {
it.rowHeight = rH
it.notifyDataSetChanged()
}
}
}
}
}
// 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))
}
@@ -343,16 +402,22 @@ class MainActivity : AppCompatActivity() {
val juCount = days.count { it.date != null && (it.shift == "주간" || it.shift == "") }
val seokCount = days.count { it.date != null && (it.shift == "석간" || it.shift == "") }
val yaCount = days.count { it.date != null && (it.shift == "야간" || it.shift == "") }
val monthlyOvertime = withContext(Dispatchers.IO) { repo.getMonthlyOvertimeHours(currentViewMonth) }
val monthlyOvertime = withContext(Dispatchers.IO) { repo.getMonthlyOvertimeHours(targetMonth) }
binding.chipJu.text = "주간 ${juCount}"
binding.chipSeok.text = "석간 ${seokCount}"
binding.chipYa.text = "야간 ${yaCount}"
binding.chipOvertime.text = "연장 ${monthlyOvertime}h"
}
updateOtherTeamsLayout(today, factory, prefs)
}
private fun updateCalendar() {
lifecycleScope.launch {
loadCalendarDataForMonth(currentViewMonth)
}
}
private fun updateOtherTeamsLayout(today: LocalDate, factory: String, prefs: android.content.SharedPreferences) {
val teamColors = mapOf(
"A" to R.color.team_a_color,
@@ -717,46 +782,71 @@ class MainActivity : AppCompatActivity() {
}
private fun animateMonthTransition(direction: Int) {
if (isAnimatingMonth) return
val card = binding.calendarCard
val snapshot = binding.calendarOverlaySnapshot
val width = card.width.toFloat()
if (width == 0f) {
currentViewMonth = if (direction > 0) {
val nextMonth = if (direction > 0) {
currentViewMonth.plusMonths(1)
} else {
currentViewMonth.minusMonths(1)
}
if (width == 0f) {
currentViewMonth = nextMonth
updateCalendar()
return
}
val fluidInterpolator = androidx.core.view.animation.PathInterpolatorCompat.create(0.22f, 1.0f, 0.36f, 1.0f)
isAnimatingMonth = true
card.animate()
.translationX(if (direction > 0) -width else width)
.alpha(0.8f)
.setDuration(160)
.setInterpolator(fluidInterpolator)
.withEndAction {
currentViewMonth = if (direction > 0) {
currentViewMonth.plusMonths(1)
} else {
currentViewMonth.minusMonths(1)
// 1. Capture bitmap snapshot of current calendar card
try {
val bitmap = Bitmap.createBitmap(card.width, card.height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
card.draw(canvas)
snapshot.setImageBitmap(bitmap)
snapshot.visibility = android.view.View.VISIBLE
snapshot.alpha = 1.0f
snapshot.scaleX = 1.0f
snapshot.scaleY = 1.0f
snapshot.translationX = 0f
} catch (e: Exception) {
Log.w("MainActivity", "Failed to capture snapshot for month transition", e)
}
updateCalendar()
// Incoming slide animation from opposite side
// 2. Position top card offscreen before loading
card.translationX = if (direction > 0) width else -width
card.alpha = 0.8f
currentViewMonth = nextMonth
// 3. Load next month's data BEFORE starting slide animation to eliminate any flicker
lifecycleScope.launch {
loadCalendarDataForMonth(currentViewMonth)
val fluidInterpolator = androidx.core.view.animation.PathInterpolatorCompat.create(0.22f, 1.0f, 0.36f, 1.0f)
val duration = 280L
card.animate()
.translationX(0f)
.alpha(1f)
.setDuration(220)
.setDuration(duration)
.setInterpolator(fluidInterpolator)
.withEndAction {
snapshot.visibility = android.view.View.GONE
snapshot.setImageDrawable(null)
isAnimatingMonth = false
}
.start()
snapshot.animate()
.scaleX(0.94f)
.scaleY(0.94f)
.alpha(0.35f)
.translationX(if (direction > 0) -width * 0.22f else width * 0.22f)
.setDuration(duration)
.setInterpolator(fluidInterpolator)
.start()
}
.start()
}
private fun formatRemainingDays(days: Float): String {
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<gradient
android:type="radial"
android:gradientRadius="70dp"
android:startColor="#FF3B30"
android:endColor="#D70015" />
<stroke
android:width="2dp"
android:color="#80FFFFFF" />
</shape>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<gradient
android:type="radial"
android:gradientRadius="120dp"
android:startColor="#40FF3B30"
android:endColor="#00FF3B30" />
</shape>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="28dp" />
<solid android:color="#26FFFFFF" />
<stroke
android:width="1dp"
android:color="#4DFFFFFF" />
</shape>
+9
View File
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,7V3H2v18h20V7H12zM6,19H4v-2h2v2zm0,-4H4v-2h2v2zm0,-4H4V9h2v2zm0,-4H4V5h2v2zm4,12H8v-2h2v2zm0,-4H8v-2h2v2zm0,-4H8V9h2v2zm0,-4H8V5h2v2zm10,12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2,-8h-2v2h2V11zm0,4h-2v2h2v-2z"/>
</vector>
+9
View File
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M11.99,18.54l-7.37,-5.73L3,14.07l9,7 9,-7 -1.63,-1.27 -7.38,5.74zM12,16l7.36,-5.73L21,9.07l-9,-7 -9,7 1.63,1.2L12,16z"/>
</vector>
+9
View File
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,3c-4.97,0 -9,4.03 -9,9 0,2.12 0.74,4.07 1.97,5.61L4.35,18.4c-0.39,0.39 -0.39,1.02 0,1.41 0.39,0.39 1.02,0.39 1.41,0l0.79,-0.79C8.07,20.26 10.02,21 12,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zm-5.5,9c-0.83,0 -1.5,-0.67 -1.5,-1.5S5.67,9 6.5,9 8,9.67 8,10.5 7.33,12 6.5,12zm3,-4C8.67,8 8,7.33 8,6.5S8.67,5 9.5,5s1.5,0.67 1.5,1.5S10.33,8 9.5,8zm5,0c-0.83,0 -1.5,-0.67 -1.5,-1.5S13.67,5 14.5,5s1.5,0.67 1.5,1.5S15.33,8 14.5,8zm3,4c-0.83,0 -1.5,-0.67 -1.5,-1.5S16.67,9 17.5,9s1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/>
</vector>
+9
View File
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92s2.92,-1.31 2.92,-2.92c0,-1.61 -1.31,-2.92 -2.92,-2.92z"/>
</vector>
+9
View File
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,2c-5.33,4.55 -8,8.48 -8,11.8c0,4.98 3.8,8.2 8,8.2s8,-3.22 8,-8.2c0,-3.32 -2.67,-7.25 -8,-11.8zM12,20c-3.31,0 -6,-2.63 -6,-6.2c0,-2.36 1.83,-5.3 6,-9.05c4.17,3.75 6,6.69 6,9.05c0,3.57 -2.69,6.2 -6,6.2z"/>
</vector>
+9
View File
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M21,10.12h-6.78l2.74,-2.82c-2.73,-2.7 -7.15,-2.8 -9.88,-0.1 -2.73,2.71 -2.73,7.08 0,9.79s7.15,2.71 9.88,0C18.32,15.65 19,14.08 19,12.1h2c0,2.49 -0.95,4.83 -2.73,6.6 -3.76,3.73 -9.85,3.73 -13.6,0 -3.76,-3.73 -3.76,-9.78 0,-13.51 3.76,-3.73 9.84,-3.73 13.6,0L21,2.42v7.7z"/>
</vector>
+126 -72
View File
@@ -1,110 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/alarmRoot"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_mesh_gradient"
android:background="@drawable/bg_alarm_gradient"
android:clipChildren="false"
android:clipToPadding="false">
<!-- Header / Info Section -->
<!-- Top Shift / Alarm Label Pill Badge -->
<LinearLayout
android:id="@+id/headerContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="40dp"
android:paddingHorizontal="32dp"
android:paddingVertical="16dp">
<TextView
android:id="@+id/tvCurrentTime"
android:id="@+id/shiftBadgeContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="오후 2:59"
android:textSize="88sp"
android:fontFamily="sans-serif-thin"
android:textColor="@color/white"
android:letterSpacing="0.02"/>
android:orientation="horizontal"
android:gravity="center"
android:background="@drawable/bg_snooze_hub_samsung"
android:paddingHorizontal="16dp"
android:paddingVertical="6dp"
android:layout_marginTop="64dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<TextView
android:id="@+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2월 14일 토요일"
android:textSize="26sp"
android:textColor="@color/white"
android:alpha="0.5"
android:layout_marginTop="16dp"/>
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@drawable/ic_alarm"
app:tint="#FFFFFF"
android:layout_marginEnd="6dp"/>
<TextView
android:id="@+id/tvShiftType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="[주간] 근무 알람"
android:textSize="16sp"
android:textColor="@color/white"
android:alpha="0.4"
android:layout_marginTop="8dp"/>
android:text="[주간] 07:00 근무 알람"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#FFFFFF" />
</LinearLayout>
<!-- Center Control Area -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:layout_below="@id/headerContainer"
android:paddingBottom="80dp"
android:clipChildren="false"
android:clipToPadding="false">
<!-- Snooze Button (Glass style) -->
<!-- Large Time Display (Samsung One UI Clock Typography) -->
<TextView
android:id="@+id/tvCurrentTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="07:00"
android:textSize="80sp"
android:fontFamily="sans-serif-light"
android:textColor="#FFFFFF"
android:letterSpacing="0.01"
android:layout_marginTop="20dp"
app:layout_constraintTop_toBottomOf="@id/shiftBadgeContainer"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Date & Day Display -->
<TextView
android:id="@+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2월 14일 토요일"
android:textSize="20sp"
android:textColor="#CCFFFFFF"
android:layout_marginTop="6dp"
app:layout_constraintTop_toBottomOf="@id/tvCurrentTime"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Middle: Snooze Hub / Capsule Button (Samsung One UI 8.5/9.0 Style) -->
<LinearLayout
android:id="@+id/btnSnooze"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="48dp"
android:paddingVertical="18dp"
android:text="다시 울림"
android:textSize="22sp"
android:textColor="@color/white"
android:alpha="0.9"
android:background="@drawable/bg_glass_pill_v4"
android:orientation="horizontal"
android:gravity="center"
android:background="@drawable/bg_snooze_hub_samsung"
android:paddingHorizontal="36dp"
android:paddingVertical="16dp"
android:clickable="true"
android:focusable="true"/>
android:focusable="true"
android:layout_marginBottom="40dp"
app:layout_constraintBottom_toTopOf="@id/dismissContainer"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<!-- Stop Button Container with Pulse -->
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_bell"
app:tint="#FFFFFF"
android:layout_marginEnd="10dp"/>
<TextView
android:id="@+id/tvSnoozeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="다시 울림 (5분)"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="#FFFFFF" />
</LinearLayout>
<!-- Bottom: Dismiss (해제) Control with Expanding Breathing Wave -->
<FrameLayout
android:layout_width="320dp"
android:layout_height="320dp"
android:layout_marginTop="20dp"
android:id="@+id/dismissContainer"
android:layout_width="260dp"
android:layout_height="260dp"
android:layout_marginBottom="54dp"
android:clipChildren="false"
android:clipToPadding="false">
android:clipToPadding="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<!-- Glowing Pulse View -->
<!-- Outer Glowing Pulse Wave -->
<View
android:id="@+id/pulseCircle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/bg_pulse_gradient"/>
android:background="@drawable/bg_pulse_wave_samsung" />
<!-- Dismiss Button -->
<TextView
android:id="@+id/btnDismiss"
android:layout_width="200dp"
android:layout_height="200dp"
<!-- Inner Ambient Ring -->
<View
android:id="@+id/ambientRing"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_gravity="center"
android:background="@drawable/bg_pulse_wave_samsung" />
<!-- Samsung Style Dismiss Button (Tap or Swipe to dismiss) -->
<LinearLayout
android:id="@+id/btnDismiss"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:orientation="vertical"
android:gravity="center"
android:text="해제"
android:textSize="34sp"
android:textColor="@color/white"
android:background="@drawable/bg_dismiss_circle_v4"
android:background="@drawable/bg_dismiss_samsung"
android:elevation="8dp"
android:clickable="true"
android:focusable="true"/>
</FrameLayout>
android:focusable="true">
<ImageView
android:layout_width="28dp"
android:layout_height="28dp"
android:src="@drawable/ic_delete"
app:tint="#FFFFFF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="해제"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:layout_marginTop="2dp" />
</LinearLayout>
</FrameLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
+20 -6
View File
@@ -58,21 +58,34 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- Maximized Calendar Card -->
<androidx.cardview.widget.CardView
android:id="@+id/calendarCard"
<!-- Maximized Calendar Card with Layered Stack Wrapper -->
<FrameLayout
android:id="@+id/calendarWrapper"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginHorizontal="3dp"
android:layout_marginBottom="8dp"
app:cardCornerRadius="28dp"
app:cardElevation="0dp"
app:cardBackgroundColor="@android:color/transparent"
app:layout_constraintTop_toBottomOf="@id/headerRoot"
app:layout_constraintBottom_toTopOf="@id/otherTeamsCard"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<!-- Bottom Snapshot View (Underneath Card Stack) -->
<ImageView
android:id="@+id/calendarOverlaySnapshot"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:visibility="gone" />
<androidx.cardview.widget.CardView
android:id="@+id/calendarCard"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="28dp"
app:cardElevation="0dp"
app:cardBackgroundColor="@android:color/transparent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/calendarContainer"
android:layout_width="match_parent"
@@ -301,6 +314,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
<!-- Other Teams Compact Section -->
<androidx.cardview.widget.CardView
@@ -49,8 +49,8 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:src="@drawable/ic_plus_circle"
app:tint="@color/primary"/>
android:src="@drawable/ic_tide"
app:tint="#0EA5E9"/>
</FrameLayout>
<LinearLayout
@@ -120,8 +120,8 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:src="@drawable/ic_settings"
app:tint="@color/primary"/>
android:src="@drawable/ic_palette"
app:tint="#AF52DE"/>
</FrameLayout>
<TextView
@@ -260,7 +260,7 @@
android:layout_height="20dp"
android:layout_gravity="center"
android:src="@drawable/ic_memo"
app:tint="@color/primary"/>
app:tint="#0284C7"/>
</FrameLayout>
<TextView
@@ -309,7 +309,7 @@
android:layout_height="20dp"
android:layout_gravity="center"
android:src="@drawable/ic_bell"
app:tint="@color/primary"/>
app:tint="#FF9500"/>
</FrameLayout>
<TextView
@@ -357,8 +357,8 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:src="@drawable/ic_plus_circle"
app:tint="@color/primary"/>
android:src="@drawable/ic_share"
app:tint="#34C759"/>
</FrameLayout>
<TextView
@@ -55,8 +55,8 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:src="@drawable/ic_settings"
app:tint="@color/primary"/>
android:src="@drawable/ic_factory"
app:tint="#007AFF"/>
</FrameLayout>
<TextView
@@ -102,8 +102,8 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:src="@drawable/ic_check"
app:tint="@color/primary"/>
android:src="@drawable/ic_user"
app:tint="#34C759"/>
</FrameLayout>
<TextView
@@ -288,8 +288,8 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:src="@drawable/ic_plus_circle"
app:tint="@color/primary"/>
android:src="@drawable/ic_layers"
app:tint="#00C7BE"/>
</FrameLayout>
<LinearLayout
@@ -469,8 +469,8 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:src="@drawable/ic_bell"
app:tint="@color/primary"/>
android:src="@drawable/ic_update"
app:tint="#5856D6"/>
</FrameLayout>
<TextView
@@ -478,7 +478,7 @@
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="최신 버전 확인"
android:textColor="@color/primary"
android:textColor="@color/text_primary"
android:textSize="16sp"
android:textStyle="bold"/>
+2 -14
View File
@@ -81,7 +81,8 @@
android:gravity="center"
android:text="메모내용\n2줄\n3줄\n4줄"
android:textSize="9.5sp"
android:textColor="@color/secondary"
android:textStyle="bold"
android:textColor="@color/text_primary"
android:lineSpacingMultiplier="1.05"
android:maxLines="4"
android:ellipsize="end"
@@ -108,17 +109,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Memo Indicator (bottom-right) -->
<ImageView
android:id="@+id/memoIndicator"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginEnd="2dp"
android:layout_marginBottom="2dp"
android:src="@drawable/ic_memo"
app:tint="@color/secondary"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
+14 -17
View File
@@ -6,21 +6,18 @@ import shutil
token = "e3b515eaa0a6683c921ca3bf718e281ed30a6075"
owner_repo = "sanjeok77/ShiftRing"
tag = "v1.0.4"
title = "v1.0.4 - 날짜 옆 근무 뱃지 완벽한 원형/글자 크기 정밀 보정 & 설정 권한 아이콘/색상 시각화"
body = """## 🚀 ShiftRing v1.0.4 릴리즈
tag = "v1.0.8"
title = "v1.0.8 - 시스템 권한 설정 토글 시 앱 자동 즉시 복귀, 달력 상단 근무 텍스트 컬러화 및 최신 버전 확인 아이콘"
body = """## 🚀 ShiftRing v1.0.8 릴리즈
### 🌟 주요 변경 및 개선 사항
1. **날짜 옆 근무 뱃지 원형 왜곡 방지 및 글자 가독성 정밀 보정**:
- 메모가 있는 날짜의 상단 근무 뱃지(`tvShiftSmall`)를 정원(18dp × 18dp)으로 고정하여 찌그러짐 현상 완벽 방지
- 폰트 패딩 제거(`includeFontPadding=false`) 및 텍스트 크기 정밀 조정으로 '주/석/야/휴/월/연/교''주맞/야맞/반월' 텍스트가 잘림 없이 100% 선명하게 표시
2. **앱 안정성 설정 (필수) 항목별 아이콘 및 테마 색상 개편**:
- 배터리 최적화 제외: 배터리 전용 아이콘(`ic_battery`) + 에메랄드 그린(`#34C759`)
- 정확한 알람 허용: 정밀 시계 아이콘(`ic_alarm`) + One UI 블루(`#007AFF`)
- 전체화면 알림 허용: 전체화면 인텐트 전용 아이콘(`ic_fullscreen_intent`) + 비비드 퍼플(`#AF52DE`)
- 시스템 전체 권한 설정: 시스템 톱니바퀴 아이콘(`ic_settings`) + 앰버 오렌지(`#FF9500`)
- 각 권한의 성격과 상태를 한눈에 직관적으로 구분할 수 있도록 시각 계층 대폭 강화
3. **Android 14/15 호환 및 정식 서명키(release.jks) 적용**"""
1. **🔄 시스템 권한 설정 시 '뒤로가기 없이' 앱 즉시 자동 복귀 (`AlarmPermissionUtil.kt`, `FragmentSettingsBasic.kt`)**:
- 전체화면 알림, 정확한 알람, 배터리 최적화 등 시스템 설정 화면에서 권한 토글을 켜면 앱이 실시간으로 권한 부여를 감지하여 뒤로가기를 누르지 않아도 즉각 ShiftRing 앱 화면으로 자동 복귀하도록 구현
2. **🏷️ 달력 상단 '오늘의 근무' 레이블 및 색상 정밀 개편 (`MainActivity.kt`)**:
- 불필요하던 `(내 반)` 텍스트를 완전히 제거
- `오늘의 근무: 휴무`, `오늘의 근무: 주간` 등의 텍스트에서 근무 명칭(휴무, 주간, 석간, 야간 등)에 고유의 근무 색상(빨강, 노랑, 청록, 검정 등) 및 볼드 스타일을 정밀하게 적용
3. **🔄 기본 설정 탭 '최신 버전 확인' 아이콘 전면 개편 (`fragment_settings_basic.xml`, `ic_update.xml`)**:
- 기존 벨 아이콘 대신 전용 업데이트/동기화 벡터 아이콘(`ic_update`, 인디고 `#5856D6`)을 적용하여 설정 UI 일관성 완성"""
apk_path = "app/build/outputs/apk/release/app-release.apk"
if not os.path.exists(apk_path):
@@ -58,10 +55,10 @@ print("Updated app.apk at project root.")
# Update version.json
v_info = {
"versionCode": 104,
"versionName": "1.0.4",
"versionCode": 108,
"versionName": "1.0.8",
"apkUrl": direct_url,
"changelog": "v1.0.4: 날짜 옆 근무 뱃지 원형 정밀 보정 & 글자 가독성 개선, 앱 안정성 설정 아이콘 및 색상 시각화",
"changelog": "v1.0.8: 권한 설정 시 앱 자동 복귀, 달력 상단 근무 색상 적용, 최신 버전 확인 아이콘 개편",
"forceUpdate": False
}
with open("version.json", "w", encoding="utf-8") as f:
@@ -73,7 +70,7 @@ print(f"Updated version.json with apkUrl: {direct_url}")
git_path = r"C:\Users\work\AppData\Roaming\MobaXterm\slash\mx86_64b\bin"
os.environ["PATH"] = git_path + os.pathsep + os.environ.get("PATH", "")
commit_msg = "v1.0.4 - 날짜 옆 근무 뱃지 원형 정밀 보정, 앱 안정성 설정 아이콘 및 색상 개편"
commit_msg = "v1.0.8 - 시스템 권한 설정 토글 시 앱 자동 즉시 복귀, 달력 상단 근무 텍스트 컬러화 및 최신 버전 확인 아이콘 개편"
subprocess.run(["git", "add", "."], check=True)
subprocess.run(["git", "commit", "-m", commit_msg], check=True)
subprocess.run(["git", "push", "origin", "main"], check=True)
+4 -4
View File
@@ -1,7 +1,7 @@
{
"versionCode": 104,
"versionName": "1.0.4",
"apkUrl": "https://git.webpluss.net/attachments/017b75f6-07a5-468f-8694-83345c9692e3",
"changelog": "v1.0.4: 날짜 옆 근무 뱃지 원형 정밀 보정 & 글자 가독성 개선, 앱 안정성 설정 아이콘 및 색상 시각화",
"versionCode": 108,
"versionName": "1.0.8",
"apkUrl": "https://git.webpluss.net/attachments/184d5d36-cd76-4505-af83-abe97534f62f",
"changelog": "v1.0.8: 권한 설정 시 앱 자동 복귀, 달력 상단 근무 색상 적용, 최신 버전 확인 아이콘 개편",
"forceUpdate": false
}