v1.1.4 - 기기 사용 중 전체화면 알람 팝업 보장 및 설정 화면 상단 닫기 아이콘 배치로 화면 공간 극대화
This commit is contained in:
@@ -44,16 +44,6 @@ class AlarmActivity : AppCompatActivity() {
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// ForegroundService가 실행 중이면 먼저 중지
|
||||
stopService(Intent(this, AlarmForegroundService::class.java))
|
||||
|
||||
// Service 중지 후 약간의 지연을 두어 AudioFocus가 완전히 해제되도록 함
|
||||
try {
|
||||
Thread.sleep(100)
|
||||
} catch (e: InterruptedException) {
|
||||
// 무시
|
||||
}
|
||||
|
||||
enableEdgeToEdge()
|
||||
binding = ActivityAlarmBinding.inflate(layoutInflater)
|
||||
binding.root.background = ContextCompat.getDrawable(this, R.drawable.bg_alarm_gradient)
|
||||
@@ -467,6 +457,10 @@ class AlarmActivity : AppCompatActivity() {
|
||||
} catch (e: Exception) {}
|
||||
vibrator = null
|
||||
|
||||
try {
|
||||
stopService(Intent(this, AlarmForegroundService::class.java))
|
||||
} catch (e: Exception) {}
|
||||
|
||||
val nm = getSystemService(Context.NOTIFICATION_SERVICE) as android.app.NotificationManager
|
||||
nm.cancel(1)
|
||||
}
|
||||
|
||||
@@ -78,9 +78,20 @@ class AlarmForegroundService : Service() {
|
||||
|
||||
// 5. 사용 중일 때도 즉시 전체화면 AlarmActivity 화면 띄우기
|
||||
try {
|
||||
startActivity(fullScreenIntent)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
val options = android.app.ActivityOptions.makeBasic().apply {
|
||||
setPendingIntentBackgroundActivityStartMode(android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED)
|
||||
}
|
||||
fullScreenPendingIntent.send(this, 0, null, null, null, null, options.toBundle())
|
||||
} else {
|
||||
fullScreenPendingIntent.send()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
try {
|
||||
startActivity(fullScreenIntent)
|
||||
} catch (e2: Exception) {
|
||||
e2.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
return START_NOT_STICKY
|
||||
|
||||
@@ -89,11 +89,31 @@ class AlarmReceiver : BroadcastReceiver() {
|
||||
putExtra("EXTRA_SNOOZE_REPEAT", intent?.getIntExtra("EXTRA_SNOOZE_REPEAT", 3) ?: 3)
|
||||
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)
|
||||
}
|
||||
|
||||
val pendingLaunch = android.app.PendingIntent.getActivity(
|
||||
context,
|
||||
200,
|
||||
activityIntent,
|
||||
android.app.PendingIntent.FLAG_UPDATE_CURRENT or android.app.PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
try {
|
||||
context.startActivity(activityIntent)
|
||||
Log.d(TAG, "AlarmActivity 즉시 실행 완료")
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
val options = android.app.ActivityOptions.makeBasic().apply {
|
||||
setPendingIntentBackgroundActivityStartMode(android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED)
|
||||
}
|
||||
pendingLaunch.send(context, 0, null, null, null, null, options.toBundle())
|
||||
} else {
|
||||
pendingLaunch.send()
|
||||
}
|
||||
Log.d(TAG, "AlarmActivity PendingIntent 전송 완료")
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "AlarmActivity 실행 실패", e)
|
||||
try {
|
||||
context.startActivity(activityIntent)
|
||||
Log.d(TAG, "AlarmActivity 직접 startActivity 완료")
|
||||
} catch (e2: Exception) {
|
||||
Log.e(TAG, "AlarmActivity 실행 실패", e2)
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
|
||||
@@ -49,8 +49,7 @@ class SettingsActivity : AppCompatActivity() {
|
||||
val targetTab = intent.getIntExtra("TARGET_TAB", 0)
|
||||
binding.viewPager.setCurrentItem(targetTab, false)
|
||||
|
||||
binding.btnSave.text = "닫기"
|
||||
binding.btnSave.setOnClickListener {
|
||||
binding.btnCloseSettings.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user