diff --git a/app.apk b/app.apk
index 2af59d1..b34eea1 100644
Binary files a/app.apk and b/app.apk differ
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 769dcae..2f5ac72 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -20,8 +20,8 @@ android {
applicationId = "com.example.shiftalarm"
minSdk = 26
targetSdk = 35
- versionCode = 108
- versionName = "1.0.8"
+ versionCode = 109
+ versionName = "1.0.9"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ff457e4..ca896d1 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,6 +2,7 @@
+
@@ -93,6 +94,16 @@
android:foregroundServiceType="mediaPlayback"
android:exported="false" />
+
+
+
+
diff --git a/app/src/main/java/com/example/shiftalarm/AppUpdateManager.kt b/app/src/main/java/com/example/shiftalarm/AppUpdateManager.kt
index f926b1a..33fc2b9 100644
--- a/app/src/main/java/com/example/shiftalarm/AppUpdateManager.kt
+++ b/app/src/main/java/com/example/shiftalarm/AppUpdateManager.kt
@@ -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(R.id.tvProgressSub)
+ val progressBar = view.findViewById(R.id.downloadProgressBar)
+ val tvPercent = view.findViewById(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()
+ }
+ }
}
diff --git a/app/src/main/java/com/example/shiftalarm/MainActivity.kt b/app/src/main/java/com/example/shiftalarm/MainActivity.kt
index 8bf2321..f584708 100644
--- a/app/src/main/java/com/example/shiftalarm/MainActivity.kt
+++ b/app/src/main/java/com/example/shiftalarm/MainActivity.kt
@@ -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
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 0c6f770..25ff734 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -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">
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index a165a08..b04661b 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -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"
diff --git a/scratch/release.py b/scratch/release.py
index db1084c..4a9e970 100755
--- a/scratch/release.py
+++ b/scratch/release.py
@@ -6,18 +6,17 @@ import shutil
token = "e3b515eaa0a6683c921ca3bf718e281ed30a6075"
owner_repo = "sanjeok77/ShiftRing"
-tag = "v1.0.8"
-title = "v1.0.8 - 시스템 권한 설정 토글 시 앱 자동 즉시 복귀, 달력 상단 근무 텍스트 컬러화 및 최신 버전 확인 아이콘 개편"
-body = """## 🚀 ShiftRing v1.0.8 릴리즈
+tag = "v1.0.9"
+title = "v1.0.9 - 메인 및 설정 화면 상단 빈 여백 완전 제거 및 인앱 APK 원클릭 업데이트 복원"
+body = """## 🚀 ShiftRing v1.0.9 릴리즈
### 🌟 주요 변경 및 개선 사항
-1. **🔄 시스템 권한 설정 시 '뒤로가기 없이' 앱 즉시 자동 복귀 (`AlarmPermissionUtil.kt`, `FragmentSettingsBasic.kt`)**:
- - 전체화면 알림, 정확한 알람, 배터리 최적화 등 시스템 설정 화면에서 권한 토글을 켜면 앱이 실시간으로 권한 부여를 감지하여 뒤로가기를 누르지 않아도 즉각 ShiftRing 앱 화면으로 자동 복귀하도록 구현
-2. **🏷️ 달력 상단 '오늘의 근무' 레이블 및 색상 정밀 개편 (`MainActivity.kt`)**:
- - 불필요하던 `(내 반)` 텍스트를 완전히 제거
- - `오늘의 근무: 휴무`, `오늘의 근무: 주간` 등의 텍스트에서 근무 명칭(휴무, 주간, 석간, 야간 등)에 고유의 근무 색상(빨강, 노랑, 청록, 검정 등) 및 볼드 스타일을 정밀하게 적용
-3. **🔄 기본 설정 탭 '최신 버전 확인' 아이콘 전면 개편 (`fragment_settings_basic.xml`, `ic_update.xml`)**:
- - 기존 벨 아이콘 대신 전용 업데이트/동기화 벡터 아이콘(`ic_update`, 인디고 `#5856D6`)을 적용하여 설정 UI 일관성 완성"""
+1. **📐 메인화면 상단 '교대링' 글자 위 빈 여백 공간 완전 제거 (`activity_main.xml`, `MainActivity.kt`)**:
+ - WindowInsets 및 헤더 레이아웃의 중복 패딩을 최적화하여 타이틀 상단 불필요한 공백을 완전히 없애고 시각적 안정감을 확보
+2. **📐 설정화면 상단 '설정' 타이틀 위 빈 여백 제거 (`activity_settings.xml`)**:
+ - `settingsHeader`의 과도한 상단 패딩(32dp)을 축소하여 상단 여백을 컴팩트하고 균형 있게 조정
+3. **🔄 인앱 APK 원클릭 다운로드 & 설치 업데이트 방식 복원 (`AppUpdateManager.kt`, `AndroidManifest.xml`)**:
+ - 앱 내에서 바로 업데이트 진행 상태를 확인하고 원클릭으로 즉시 설치할 수 있는 편리한 기존 인앱 업데이트 다이얼로그 방식으로 복원"""
apk_path = "app/build/outputs/apk/release/app-release.apk"
if not os.path.exists(apk_path):
@@ -55,10 +54,10 @@ print("Updated app.apk at project root.")
# Update version.json
v_info = {
- "versionCode": 108,
- "versionName": "1.0.8",
+ "versionCode": 109,
+ "versionName": "1.0.9",
"apkUrl": direct_url,
- "changelog": "v1.0.8: 권한 설정 시 앱 자동 복귀, 달력 상단 근무 색상 적용, 최신 버전 확인 아이콘 개편",
+ "changelog": "v1.0.9: 메인/설정 상단 빈 여백 제거, 인앱 APK 업데이트 복원",
"forceUpdate": False
}
with open("version.json", "w", encoding="utf-8") as f:
@@ -70,7 +69,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.8 - 시스템 권한 설정 토글 시 앱 자동 즉시 복귀, 달력 상단 근무 텍스트 컬러화 및 최신 버전 확인 아이콘 개편"
+commit_msg = "v1.0.9 - 메인 및 설정 화면 상단 빈 여백 완전 제거 및 인앱 APK 원클릭 업데이트 복원"
subprocess.run(["git", "add", "."], check=True)
subprocess.run(["git", "commit", "-m", commit_msg], check=True)
subprocess.run(["git", "push", "origin", "main"], check=True)
diff --git a/version.json b/version.json
index 80b66d1..9973b37 100644
--- a/version.json
+++ b/version.json
@@ -1,7 +1,7 @@
{
- "versionCode": 108,
- "versionName": "1.0.8",
- "apkUrl": "https://git.webpluss.net/attachments/184d5d36-cd76-4505-af83-abe97534f62f",
- "changelog": "v1.0.8: 권한 설정 시 앱 자동 복귀, 달력 상단 근무 색상 적용, 최신 버전 확인 아이콘 개편",
+ "versionCode": 109,
+ "versionName": "1.0.9",
+ "apkUrl": "https://git.webpluss.net/attachments/f72482fb-9a5f-4572-bacf-955b505b2c2b",
+ "changelog": "v1.0.9: 메인/설정 상단 빈 여백 제거, 인앱 APK 업데이트 복원",
"forceUpdate": false
}
\ No newline at end of file