4 Commits
19 changed files with 499 additions and 99 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 = 107
versionName = "1.0.7"
versionCode = 111
versionName = "1.1.1"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
+11
View File
@@ -2,6 +2,7 @@
<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" />
@@ -93,6 +94,16 @@
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>
@@ -17,9 +17,43 @@ 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 {
delay(1000) // 설정 화면 전환 시간 대기
var count = 0
while (count < 150 && isActive) { // 최대 60초간 500ms 주기로 체크
delay(500)
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
}
/**
* 전체 권한 상태를 확인하고 필요한 경우 통합 안내 다이얼로그를 표시합니다.
*/
@@ -108,16 +108,7 @@ object AppUpdateManager {
btnNow.setOnClickListener {
dialog.dismiss()
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()
}
downloadAndInstallApk(activity, apkUrl, version)
}
dialog.show()
@@ -125,4 +116,100 @@ 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()
}
}
}
@@ -187,21 +187,19 @@ class FragmentSettingsAdditional : Fragment() {
}
}
// 1. 개별 근무/알람 설정 전체 삭제
binding.btnResetOverrides.setOnClickListener {
androidx.appcompat.app.AlertDialog.Builder(requireContext())
.setTitle("데이터 초기화")
.setMessage("달력에서 개별적으로 바꾼 모든 근무와 알람 정이 삭제됩니다. 계속하시겠습니까?")
.setPositiveButton("초기화") { _, _ ->
.setTitle("개별 근무/알람 설정 전체 삭제")
.setMessage("달력에서 개별 변경한 모든 근무와 알람 정이 삭제되고 기본값으로 복원됩니다. 계속하시겠습니까?")
.setPositiveButton("삭제") { _, _ ->
lifecycleScope.launch {
try {
val db = AppDatabase.getDatabase(requireContext())
val dao = db.shiftDao()
dao.clearOverrides()
// Immediately re-sync all alarms
syncAllAlarms(requireContext())
Toast.makeText(requireContext(), "모든 개별 설정이 삭제되고 알람이 재설정되었습니다.", Toast.LENGTH_SHORT).show()
Toast.makeText(requireContext(), "개별 근무 및 알람 설정이 초기화되었습니다.", Toast.LENGTH_SHORT).show()
} catch (e: Exception) {
Toast.makeText(requireContext(), "초기화 실패: ${e.message}", Toast.LENGTH_LONG).show()
}
@@ -210,6 +208,75 @@ class FragmentSettingsAdditional : Fragment() {
.setNegativeButton("취소", null)
.show()
}
// 2. 개별 근무 삭제
binding.btnResetShifts.setOnClickListener {
androidx.appcompat.app.AlertDialog.Builder(requireContext())
.setTitle("개별 근무 삭제")
.setMessage("달력에서 개별 변경한 교대근무 일정만 삭제되고 기본 근무표로 복원됩니다. 계속하시겠습니까?")
.setPositiveButton("삭제") { _, _ ->
lifecycleScope.launch {
try {
val db = AppDatabase.getDatabase(requireContext())
val dao = db.shiftDao()
dao.clearOverrides()
syncAllAlarms(requireContext())
Toast.makeText(requireContext(), "개별 근무 변경 내역이 초기화되었습니다.", Toast.LENGTH_SHORT).show()
} catch (e: Exception) {
Toast.makeText(requireContext(), "초기화 실패: ${e.message}", Toast.LENGTH_LONG).show()
}
}
}
.setNegativeButton("취소", null)
.show()
}
// 3. 알람 삭제
binding.btnResetAlarms.setOnClickListener {
androidx.appcompat.app.AlertDialog.Builder(requireContext())
.setTitle("알람 삭제")
.setMessage("등록된 모든 사용자 지정 알람이 삭제되고 기본 알람으로 초기화됩니다. 계속하시겠습니까?")
.setPositiveButton("삭제") { _, _ ->
lifecycleScope.launch {
try {
val db = AppDatabase.getDatabase(requireContext())
val dao = db.shiftDao()
dao.clearCustomAlarms()
syncAllAlarms(requireContext())
Toast.makeText(requireContext(), "등록된 알람이 모두 삭제되었습니다.", Toast.LENGTH_SHORT).show()
} catch (e: Exception) {
Toast.makeText(requireContext(), "삭제 실패: ${e.message}", Toast.LENGTH_LONG).show()
}
}
}
.setNegativeButton("취소", null)
.show()
}
// 4. 전체 삭제 (완전 초기화)
binding.btnResetAll.setOnClickListener {
androidx.appcompat.app.AlertDialog.Builder(requireContext())
.setTitle("전체 데이터 초기화")
.setMessage("⚠️ 주의: 메모, 연차, 개별 근무, 알람을 포함한 모든 앱 데이터가 완전히 초기화됩니다.\n\n정말 전체 데이터를 초기화하시겠습니까?")
.setPositiveButton("전체 초기화") { _, _ ->
lifecycleScope.launch {
try {
val db = AppDatabase.getDatabase(requireContext())
val dao = db.shiftDao()
dao.clearOverrides()
dao.clearMemos()
dao.clearCustomAlarms()
dao.clearAnnualLeave()
syncAllAlarms(requireContext())
Toast.makeText(requireContext(), "모든 데이터가 완전히 초기화되었습니다.", Toast.LENGTH_LONG).show()
} catch (e: Exception) {
Toast.makeText(requireContext(), "전체 초기화 실패: ${e.message}", Toast.LENGTH_LONG).show()
}
}
}
.setNegativeButton("취소", null)
.show()
}
}
@@ -134,32 +134,72 @@ class FragmentSettingsAlarm : Fragment(), SharedPreferences.OnSharedPreferenceCh
}
private val soundTitleCache = mutableMapOf<String?, String>()
private var isUpdatingMasterSwitch = false
private fun updateMasterToggleUI(isEnabled: Boolean) {
if (_binding == null) return
isUpdatingMasterSwitch = true
binding.masterSwitch.isChecked = isEnabled
isUpdatingMasterSwitch = false
if (isEnabled) {
binding.tvMasterStatus.text = "전체 알람 켜짐"
binding.tvMasterStatus.setTextColor(ContextCompat.getColor(requireContext(), R.color.primary))
binding.tvMasterStatus.backgroundTintList = android.content.res.ColorStateList.valueOf(Color.parseColor("#E3F2FD"))
binding.tvMasterStatus.setTextColor(ContextCompat.getColor(requireContext(), R.color.text_primary))
binding.ivMasterBell.imageTintList = android.content.res.ColorStateList.valueOf(ContextCompat.getColor(requireContext(), R.color.primary))
} else {
binding.tvMasterStatus.text = "전체 알람 꺼짐"
binding.tvMasterStatus.setTextColor(ContextCompat.getColor(requireContext(), R.color.shift_red))
binding.tvMasterStatus.backgroundTintList = android.content.res.ColorStateList.valueOf(Color.parseColor("#FFEBEE"))
binding.tvMasterStatus.setTextColor(ContextCompat.getColor(requireContext(), R.color.text_secondary))
binding.ivMasterBell.imageTintList = android.content.res.ColorStateList.valueOf(ContextCompat.getColor(requireContext(), R.color.text_secondary))
}
}
private fun showMasterAlarmOffConfirmationDialog() {
val prefs = requireContext().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
androidx.appcompat.app.AlertDialog.Builder(requireContext())
.setTitle("전체 알람 끄기")
.setMessage("전체 알람을 끄시겠습니까?\n모든 교대근무 알람 및 개별 알람이 정시에 울리지 않게 됩니다.")
.setPositiveButton("끄기") { _, _ ->
prefs.edit().putBoolean("master_alarm_enabled", false).apply()
updateMasterToggleUI(false)
Toast.makeText(requireContext(), "전체 알람이 꺼졌습니다.", Toast.LENGTH_SHORT).show()
lifecycleScope.launch { syncAllAlarms(requireContext()) }
}
.setNegativeButton("취소") { dialog, _ ->
// 스위치 원래대로 ON 복귀
isUpdatingMasterSwitch = true
binding.masterSwitch.isChecked = true
isUpdatingMasterSwitch = false
dialog.dismiss()
}
.setOnCancelListener {
// 바깥 터치 시에도 원래대로 ON 복귀
isUpdatingMasterSwitch = true
binding.masterSwitch.isChecked = true
isUpdatingMasterSwitch = false
}
.show()
}
private fun setupListeners() {
val prefs = requireContext().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
binding.tvMasterStatus.setOnClickListener {
val isEnabled = !ShiftAlarmDefaults.isMasterAlarmEnabled(prefs)
prefs.edit().putBoolean("master_alarm_enabled", isEnabled).apply()
updateMasterToggleUI(isEnabled)
val message = if (isEnabled) "전체 알람이 켜졌습니다." else "전체 알람이 꺼졌습니다."
Toast.makeText(requireContext(), message, Toast.LENGTH_SHORT).show()
// Resync immediately
lifecycleScope.launch { syncAllAlarms(requireContext()) }
binding.masterAlarmCard.setOnClickListener {
binding.masterSwitch.performClick()
}
binding.masterSwitch.setOnCheckedChangeListener { _, isChecked ->
if (isUpdatingMasterSwitch) return@setOnCheckedChangeListener
if (isChecked) {
// 바로 켜기
prefs.edit().putBoolean("master_alarm_enabled", true).apply()
updateMasterToggleUI(true)
Toast.makeText(requireContext(), "전체 알람이 켜졌습니다.", Toast.LENGTH_SHORT).show()
lifecycleScope.launch { syncAllAlarms(requireContext()) }
} else {
// 끌 때는 모달 확인 팝업
showMasterAlarmOffConfirmationDialog()
}
}
binding.btnAddCustomAlarm.setOnClickListener {
@@ -193,6 +193,7 @@ class FragmentSettingsBasic : Fragment() {
override fun onResume() {
super.onResume()
AlarmPermissionUtil.cancelAutoReturn()
updatePermissionStatuses()
}
@@ -232,27 +233,52 @@ class FragmentSettingsBasic : Fragment() {
val prefs = requireContext().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
binding.btnBatteryOptimize.setOnClickListener {
val isAlreadyGranted = AlarmPermissionUtil.getBatteryOptimizationStatus(requireContext())
AlarmPermissionUtil.requestBatteryOptimization(requireActivity())
if (!isAlreadyGranted) {
AlarmPermissionUtil.monitorAndAutoReturn(requireActivity()) {
AlarmPermissionUtil.getBatteryOptimizationStatus(requireContext())
}
}
}
binding.btnExactAlarm.setOnClickListener {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
val isAlreadyGranted = AlarmPermissionUtil.getExactAlarmStatus(requireContext())
val intent = Intent(Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM).apply {
data = Uri.parse("package:${requireContext().packageName}")
}
requireActivity().startActivity(intent)
if (!isAlreadyGranted) {
AlarmPermissionUtil.monitorAndAutoReturn(requireActivity()) {
AlarmPermissionUtil.getExactAlarmStatus(requireContext())
}
}
}
}
binding.btnOverlayPermission.setOnClickListener {
val isAlreadyGranted = AlarmPermissionUtil.getOverlayStatus(requireContext())
AlarmPermissionUtil.requestOverlayPermission(requireActivity())
if (!isAlreadyGranted) {
AlarmPermissionUtil.monitorAndAutoReturn(requireActivity()) {
AlarmPermissionUtil.getOverlayStatus(requireContext())
}
}
}
binding.btnFullScreenIntent.setOnClickListener {
val isAlreadyGranted = AlarmPermissionUtil.getFullScreenIntentStatus(requireContext())
AlarmPermissionUtil.requestFullScreenIntentPermission(requireActivity())
if (!isAlreadyGranted) {
AlarmPermissionUtil.monitorAndAutoReturn(requireActivity()) {
AlarmPermissionUtil.getFullScreenIntentStatus(requireContext())
}
}
}
binding.btnPermissionSettings.setOnClickListener {
// 앱 정보 상세 설정 화면은 일반 열람용이므로 자동 복귀를 걸지 않음
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
data = Uri.parse("package:${requireContext().packageName}")
}
@@ -63,9 +63,7 @@ class MainActivity : AppCompatActivity() {
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
val density = resources.displayMetrics.density
val p = (8 * density).toInt()
v.setPadding(systemBars.left + p, systemBars.top + p, systemBars.right + p, systemBars.bottom + p)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
insets
}
@@ -347,13 +345,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))
}
+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>
+4 -3
View File
@@ -12,8 +12,8 @@
android:id="@+id/headerRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="8dp"
android:paddingTop="2dp"
android:paddingBottom="4dp"
android:paddingHorizontal="20dp"
app:layout_constraintTop_toTopOf="parent">
@@ -35,7 +35,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="오늘의 근무"
android:textSize="13sp"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/text_secondary"
android:fontFamily="sans-serif-medium"
android:layout_marginStart="12dp"
@@ -13,8 +13,8 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingTop="32dp"
android:paddingBottom="16dp"
android:paddingTop="4dp"
android:paddingBottom="8dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
app:layout_constraintTop_toTopOf="parent"
@@ -139,8 +139,7 @@
android:layout_height="40dp"
android:background="@drawable/bg_spinner_oneui"
android:popupBackground="@drawable/bg_spinner_popup_oneui"
android:dropDownVerticalOffset="6dp"
android:paddingStart="12dp"/>
android:dropDownVerticalOffset="6dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
@@ -398,32 +397,116 @@
app:cardCornerRadius="24dp"
app:cardElevation="0dp"
app:cardBackgroundColor="@android:color/transparent"
android:layout_marginBottom="40dp">
android:layout_marginBottom="32dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/bg_oneui_settings_card"
android:padding="20dp">
android:padding="16dp">
<!-- 1. 개별 근무/알람 설정 전체 삭제 -->
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnResetOverrides"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="개별 근무/알람 설정 전체 삭제"
android:textColor="@color/shift_red"
android:textColor="@color/text_primary"
android:textStyle="bold"
android:textSize="15sp"
android:textSize="14sp"
android:background="@drawable/bg_glass_button_light"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="달력에서 개별적으로 바꾼 근무와 알람 시간 모두 기본값으로 복구니다."
android:text="달력에서 개별 변경한 근무와 알람 시간 모두 기본값으로 복구니다."
android:textSize="11sp"
android:textColor="@color/text_tertiary"
android:layout_marginTop="8dp"/>
android:layout_marginTop="4dp"
android:layout_marginBottom="12dp"
android:layout_marginStart="4dp"/>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/divider_subtle"
android:layout_marginBottom="12dp"/>
<!-- 2. 개별 근무 삭제 -->
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnResetShifts"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="개별 근무 삭제"
android:textColor="@color/text_primary"
android:textStyle="bold"
android:textSize="14sp"
android:background="@drawable/bg_glass_button_light"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="달력에서 개별 변경한 교대근무 일정만 기본값으로 복구합니다."
android:textSize="11sp"
android:textColor="@color/text_tertiary"
android:layout_marginTop="4dp"
android:layout_marginBottom="12dp"
android:layout_marginStart="4dp"/>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/divider_subtle"
android:layout_marginBottom="12dp"/>
<!-- 3. 알람 삭제 -->
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnResetAlarms"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="알람 삭제"
android:textColor="@color/text_primary"
android:textStyle="bold"
android:textSize="14sp"
android:background="@drawable/bg_glass_button_light"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="추가된 사용자 지정 알람을 모두 삭제하고 기본 설정으로 복원합니다."
android:textSize="11sp"
android:textColor="@color/text_tertiary"
android:layout_marginTop="4dp"
android:layout_marginBottom="12dp"
android:layout_marginStart="4dp"/>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/divider_subtle"
android:layout_marginBottom="12dp"/>
<!-- 4. 전체 삭제 (완전 초기화) -->
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnResetAll"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="전체 삭제"
android:textColor="@color/shift_red"
android:textStyle="bold"
android:textSize="14sp"
android:background="@drawable/bg_glass_button_light"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="메모, 연차, 개별 근무, 알람 등 앱의 모든 데이터를 완전히 초기화합니다."
android:textSize="11sp"
android:textColor="@color/shift_red"
android:layout_marginTop="4dp"
android:layout_marginStart="4dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
@@ -12,33 +12,44 @@
android:background="@color/surface"
android:padding="16dp">
<!-- Master Alarm Header with Switch -->
<LinearLayout
android:id="@+id/masterAlarmCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingHorizontal="8dp"
android:layout_marginBottom="8dp">
android:background="@drawable/bg_group_header"
android:paddingHorizontal="16dp"
android:paddingVertical="12dp"
android:layout_marginBottom="12dp"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="@+id/ivMasterBell"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_bell"
app:tint="@color/primary"
android:layout_marginEnd="10dp"/>
<TextView
android:id="@+id/tvMasterStatus"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="전체 알람 켜짐"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/text_primary"/>
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/masterSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="전체 알람 켜짐"
android:textSize="13sp"
android:textStyle="bold"
android:textColor="@color/primary"
android:background="@drawable/bg_glass_pill_v4"
android:backgroundTint="#F2F2F7"
android:paddingHorizontal="12dp"
android:paddingVertical="6dp"
android:clickable="true"
android:focusable="true"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
app:thumbTint="@color/white"
app:trackTint="@color/sl_switch_track"/>
</LinearLayout>
<!-- Unified Alarm List Container (Background removed as items are now individual cards) -->
@@ -75,8 +75,7 @@
android:entries="@array/factory_array"
android:background="@drawable/bg_spinner_oneui"
android:popupBackground="@drawable/bg_spinner_popup_oneui"
android:dropDownVerticalOffset="6dp"
android:paddingStart="12dp"/>
android:dropDownVerticalOffset="6dp"/>
</LinearLayout>
<View
@@ -121,8 +120,7 @@
android:layout_height="40dp"
android:background="@drawable/bg_spinner_oneui"
android:popupBackground="@drawable/bg_spinner_popup_oneui"
android:dropDownVerticalOffset="6dp"
android:paddingStart="12dp"/>
android:dropDownVerticalOffset="6dp"/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
@@ -469,8 +467,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 +476,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"/>
@@ -86,8 +86,7 @@
android:layout_height="40dp"
android:background="@drawable/bg_spinner_oneui"
android:popupBackground="@drawable/bg_spinner_popup_oneui"
android:dropDownVerticalOffset="6dp"
android:paddingStart="12dp"/>
android:dropDownVerticalOffset="6dp"/>
</LinearLayout>
<View
@@ -3,9 +3,9 @@
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center_vertical|end"
android:paddingStart="12dp"
android:paddingEnd="16dp"
android:gravity="center"
android:textAlignment="center"
android:paddingHorizontal="4dp"
android:textColor="@color/text_primary"
android:textSize="14sp"
android:textStyle="bold"
+17 -14
View File
@@ -6,18 +6,21 @@ import shutil
token = "e3b515eaa0a6683c921ca3bf718e281ed30a6075"
owner_repo = "sanjeok77/ShiftRing"
tag = "v1.0.7"
title = "v1.0.7 - 구글 플레이 프로텍트 유해앱 경고 원인 완벽 제거, 사용 중 전체화면 알람 즉시 표시 보장 및 설정 복귀 처리 개선"
body = """## 🚀 ShiftRing v1.0.7 릴리즈
tag = "v1.1.1"
title = "v1.1.1 - 전체 알람 온오프 스위치 및 해제 시 경고 팝업 적용, 앱 정보 화면 바운스 수정, 데이터 초기화 4단계 세분화"
body = """## 🚀 ShiftRing v1.1.1 릴리즈
### 🌟 주요 변경 및 개선 사항
1. **🛡️ Play Protect '유해한 앱 차단됨' 경고 원인 완벽 제거 (`AndroidManifest.xml`, `AppUpdateManager.kt`)**:
- 구글 플레이 프로텍트 자동 탐지 알고리즘에서 오진(Dropper PHA)을 유발하는 `REQUEST_INSTALL_PACKAGES`, `USE_EXACT_ALARM`, `REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` 선언을 완벽히 제거
- 앱 업데이트 시 내부 임의 패키지 인스톨러 대신 안전한 표준 브라우저 다이렉트 다운로드 연동으로 전면 개편
2. **⏰ 사용 중(화면 켜짐/잠금해제)에도 실제 전체화면 알람 창 즉시 표시 보장 (`AlarmForegroundService.kt`, `AlarmReceiver.kt`, `AndroidManifest.xml`)**:
- 폰 사용 중일 때 시스템 팝업 배너로만 뜨고 알람 화면이 가려지던 문제를 해결하여, 포그라운드 서비스 및 리시버에서 `AlarmActivity`를 `singleInstance` 및 최우선 포그라운드로 즉시 띄우도록 개선
3. **🔄 전체화면 알림 등 설정 권한 이동 후 원활한 앱 복귀 처리 (`FragmentSettingsBasic.kt`, `AlarmPermissionUtil.kt`)**:
- 액티비티 컨텍스트 기반의 네이티브 백스택 유지를 통해 시스템 권한 토글 후 앱으로 자연스럽게 복귀되도록 개선"""
1. **🔘 전체 알람 온/오프 스위치 UI 도입 및 안전 끄기 모달 팝업 (`fragment_settings_alarm.xml`, `FragmentSettingsAlarm.kt`)**:
- 기존 텍스트 터치 방식에서 그룹 알람과 동일한 원터치 머티리얼 스위치(`MaterialSwitch`) 카드로 개편
- 알람을 끌 때는 "전체 알람을 끄시겠습니까? 모든 교대근무 알람이 울리지 않게 됩니다." 경고 다이얼로그(확인/취소)를 띄워 오동작을 방지
2. **🛡️ 시스템 전체 권한 설정 진입 시 즉시 튕겨 돌아오던 현상 수정 (`FragmentSettingsBasic.kt`, `AlarmPermissionUtil.kt`)**:
- 앱 상세 정보 열람 화면에는 자동 복귀 타이머를 배제하고, 개별 권한 설정 시에도 미허용 상태일 때만 지능적으로 동작하도록 개선
3. **🧹 데이터 초기화 4단계 정밀 세분화 (`fragment_settings_additional.xml`, `FragmentSettingsAdditional.kt`)**:
- **개별 근무/알람 설정 전체 삭제**: 달력 개별 변경 내역 초기화
- **개별 근무 삭제**: 변경된 교대근무 일정만 복원
- **알람 삭제**: 추가된 커스텀 알람 삭제 및 기본 복원
- **전체 삭제**: 메모, 연차, 근무, 알람 등 전체 앱 데이터 완전 초기화"""
apk_path = "app/build/outputs/apk/release/app-release.apk"
if not os.path.exists(apk_path):
@@ -55,10 +58,10 @@ print("Updated app.apk at project root.")
# Update version.json
v_info = {
"versionCode": 107,
"versionName": "1.0.7",
"versionCode": 111,
"versionName": "1.1.1",
"apkUrl": direct_url,
"changelog": "v1.0.7: 구글 플레이 프로텍트 유해앱 경고 원인 완벽 제거, 사용 중 전체화면 알람 즉시 표시, 설정 복귀 처리 개선",
"changelog": "v1.1.1: 전체 알람 스위치 및 경고 팝업, 앱 상세설정 바운스 수정, 데이터 초기화 4단계 세분화",
"forceUpdate": False
}
with open("version.json", "w", encoding="utf-8") as f:
@@ -70,7 +73,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.7 - 구글 플레이 프로텍트 유해앱 경고 원인 완벽 제거, 사용 중 전체화면 알람 즉시 표시 보장 및 설정 복귀 처리 개선"
commit_msg = "v1.1.1 - 전체 알람 온오프 스위치 및 해제 시 경고 팝업 적용, 앱 정보 화면 바운스 수정, 데이터 초기화 4단계 세분화"
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": 107,
"versionName": "1.0.7",
"apkUrl": "https://git.webpluss.net/attachments/dcadee3f-c0be-4813-9477-2d3f538a7026",
"changelog": "v1.0.7: 구글 플레이 프로텍트 유해앱 경고 원인 완벽 제거, 사용 중 전체화면 알람 즉시 표시, 설정 복귀 처리 개선",
"versionCode": 111,
"versionName": "1.1.1",
"apkUrl": "https://git.webpluss.net/attachments/338d4f1c-3253-4de6-8632-0232bc1ce7a9",
"changelog": "v1.1.1: 전체 알람 스위치 및 경고 팝업, 앱 상세설정 바운스 수정, 데이터 초기화 4단계 세분화",
"forceUpdate": false
}