36 Commits

Author SHA1 Message Date
7774c20a45 chore: 버전 업데이트 v1.4.9 (1149)
- versionCode: 1148 → 1149
- versionName: 1.4.8 → 1.4.9

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-13 00:54:05 +09:00
cce9c48345 fix: 애니메이션 개선 및 APK 업데이트
- ViewPropertyAnimator 사용으로 더 부드러운 전환
- alpha 애니메이션 추가로 시각적 효과 개선
- APK URL 업데이트

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-13 00:50:38 +09:00
7462656c15 feat: 달력 월 이동 시 부드러운 화면 전환 애니메이션 추가
- 월 이동 버튼 클릭 시 슬라이드 애니메이션 적용
- 설정 화면 탭 전환처럼 부드러운 전환 효과
- 버전 업데이트 v1.4.8 (1148)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-13 00:48:11 +09:00
30b150bb81 fix: 버전업 오류 수정 및 UI 개선
- 난부 버전 1147 (1.4.7)로 업데이트 (중복 버전 코드 제거)
- 휴가 관리 탭 → 근무 관리로 명칭 변경
- 남은 연차 하단에 '기능추가중' 표시 추가

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-13 00:34:35 +09:00
f586d74759 fix: 휴가관리 UI 정리 및 자동 저장 기능 추가
- 중복된 '연차: -1일 / 반년: -0.5일 차감' 텍스트 제거
- 중복된 Spinner/NumberPicker 뷰 정리
- 저장 버튼 제거하고 Spinner 선택 시 자동 저장되도록 개선
- 버전 업데이트 v1.4.6 (1146)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-13 00:27:42 +09:00
608109e437 chore: 버전 업데이트 v1.4.5 (1145)
- versionCode: 1144 → 1145
- versionName: 1.4.4 → 1.4.5

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-13 00:20:18 +09:00
48cfbf3473 fix: 달력 아이템 동그라미 크기 확대
- 양쪽 마진 축소로 인한 공백 제거
- shiftChar 크기: 40dp → 48dp

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-13 00:03:34 +09:00
911ff3003f feat: 휴가 관리 NumberPicker → Spinner 변경 + 저장 버튼 복원
- NumberPicker 대신 Spinner(드롭다운) 사용
- 값 변경 시 자동 저장 제거하고 저장 버튼 복원
- 더 직관적인 UI 제공

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-13 00:02:38 +09:00
975c2cc9f6 fix: 연차/반년 최초 적용 타이밍 문제 수정
- setOverride 후 updateRemainingAnnualLeave()를 먼저 호출하고 updateCalendar() 호출
- 연차 계산이 완료된 후 화면 갱신되도록 순서 변경

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-13 00:02:27 +09:00
b5a6abee97 chore: 버전 업데이트 v1.4.4 (1144)
- versionCode: 1143 → 1144
- versionName: 1.4.3 → 1.4.4

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:52:08 +09:00
fe050808b4 feat: 메인 화면 연차 표시 형식 개선
- 정수일 때 정수로 표시 (22)
- 0.5일 때 소숫점 표시 (21.5)
- formatRemainingDays() 함수 추가

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:45:07 +09:00
08c130f448 feat: 휴가 관리 컴팩트화 + 자동 저장 + 소숫점 표시 개선
- 레이아웃 컴팩트하게 변경 (패딩/마진 축소, 가로 배치)
- 저장 버튼 제거하고 NumberPicker 변경 시 자동 저장
- 소숫점 없을 때 정수로 표시 (22), 0.5일 때 소숫점 표시 (21.5)
- ScrollView 제거 (불필요한 스크롤 최소화)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:44:57 +09:00
7d50263e65 fix: 연차/반년 최초 적용 안되는 문제 수정
- updateRemainingAnnualLeave()에서 AnnualLeave 없을 때 기본값 15일로 생성
- 총 연차 설정 없이도 달력에서 연차/반년 사용 가능하도록 개선

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:44:45 +09:00
693704686f fix: 달력 양쪽 마진 3dp로 축소
- calendarCard marginHorizontal: 12dp → 3dp
- otherTeamsCard marginHorizontal: 12dp → 3dp

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:44:35 +09:00
ccbd943c56 chore: 버전 업데이트 v1.4.3 (1143)
- versionCode: 1142 → 1143
- versionName: 1.4.2 → 1.4.3

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:32:09 +09:00
761e02fd94 fix: 달력 동적 높이 계산 제거 (1.3.0 스타일로 복원)
- RecyclerView 높이 동적 계산 코드 제거
- CalendarAdapter rowCount 파라미터 제거
- 아이템 높이를 XML에서 고정하도록 변경
- 달력이 자연스럽게 화면에 채워지도록 개선

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:30:28 +09:00
eda76a0ef6 fix: 달력 레이아웃 1.3.0 버전처럼 복원
- 양쪽 마진 4dp → 12dp 복원
- 달력 아이템 높이 92dp 고정으로 복원
- shiftChar 크기 48dp → 40dp 복원
- 달력 화면이 ConstraintLayout에 자연스럽게 채워지도록 수정

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:30:19 +09:00
8a2dacb104 chore: 버전 업데이트 v1.4.2 (1142)
- versionCode: 1141 → 1142
- versionName: 1.4.1 → 1.4.2

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:21:19 +09:00
2f4b2ebe4c fix: 연차 설정 화면 ScrollView 추가
- 작은 화면에서 저장 버튼이 잘리지 않도록 ScrollView로 감싸기
- 저장 버튼 가시성 확보

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:18:31 +09:00
89068b4d05 fix: 토스트 다크모드 완전 지원
- 배경색을 반투명 회색(#CC333333)으로 변경하여 라이트/다크 모두 가독성 확보
- 텍스트 색상을 흰색(@android:color/white)으로 변경
- showCustomToast() 함수 개선

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:18:22 +09:00
7835d0ab65 fix: 달력 5행 고정높이, 6행 스크롤 지원
- 5행: RecyclerView 높이를 행 수에 맞게 고정, 스크롤 없음
- 6행: RecyclerView 높이를 6행으로 고정, 스크롤 활성화
- 아이템 높이를 화면 너비 기준 정사각형으로 통일

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:18:12 +09:00
819495323e chore: 버전 업데이트 v1.4.1 (1141)
- versionCode: 1140 → 1141
- versionName: 1.4.0 → 1.4.1
- dialog_day_settings.xml 레이아웃 개선

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 23:01:36 +09:00
5a0f6de646 fix: 연차 저장 및 계산 로직 수정
- calculateUsedAnnualLeave()에서 Seoul 타임존 명시
- FragmentSettingsLab 토스트를 커스텀 토스트로 변경
- 연차 저장 시 남은 연차 자동 계산 로직 개선

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 22:46:05 +09:00
f884e991a3 feat: 다크모드 지원 커스텀 토스트 구현
- showCustomToast() 함수 추가 (AlarmUtils)
- 커스텀 토스트 레이아웃 및 배경 drawable 추가
- values/colors.xml 및 values-night/colors.xml 리소스 사용

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 22:44:48 +09:00
b8454f76d1 feat: 달력 5행 동적 높이 조정 및 연차 메인 화면 연동
- 달력 5행일 때 아이템 높이를 동적으로 계산하여 화면 꽉 채우기
- 메인 화면 tvAnnualLeave에 남은 연차 표시 기능 추가
- onResume에서 연차 정보 자동 업데이트

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 22:43:44 +09:00
a4482f0b7b fix: DB 마이그레이션 추가 및 연차 저장/다크모드/달력 UI 개선
- DB 마이그레이션으로 기존 알람 데이터 보존
- 연차 저장 문제 수정 (원래대로/연차 설정 시 updateRemainingAnnualLeave 호출)
- 달력 5행 스크롤 없이 표시 (85dp 높이)
- 알람 편집/월년 선택 다크모드 지원
- 설정 앱정보 버전 동기화 표시

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 21:47:39 +09:00
29cc215346 chore: 버전 업데이트 v1.4.0 (1140)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 21:26:30 +09:00
666e38558d ui: 근무 표시 동그라미 크기 확대 (44dp → 52dp)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 21:26:22 +09:00
8e7f212352 feat: 남은 연차 표시 및 달력 UI 개선 (넓은 화면, 큰 근무 표시)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 21:26:14 +09:00
639b22948b feat: 휴가 관리 화면 구현 (휠 다이얼 연차 설정)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 21:26:05 +09:00
03c3fcd6f0 feat: 연차 관리 기능 추가 (AnnualLeave 엔티티, DAO, Repository)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-12 21:25:55 +09:00
b832f87a7b fix: version.json 중복 JSON 제거
- v1.2.5 JSON 블록 삭제
- v1.3.0만 유지

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-28 20:19:17 +09:00
0e60b62fd2 feat: v1.3.0 - versionCode 기반 업데이트 체크
- 버전 1.2.5 → 1.3.0 (versionCode 1130)
- AppUpdateManager: versionCode로 업데이트 비교
- versionName 비교 로직 제거
- 더 정확한 업데이트 감지

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-28 18:55:57 +09:00
597880e807 fix: build.gradle 버전 1.2.5로 업데이트
- versionCode: 1124 → 1125
- versionName: 1.2.4 → 1.2.5
- 무한 업데이트 버그 수정

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-28 18:43:29 +09:00
6fb83848f5 docs: Gitea 릴리즈 작업 가이드 추가
- 릴리즈 생성 절차 문서화
- API 엔드포인트 및 예시 명령어 정리
- 버전 업데이트 체크리스트 포함
- 인증 정보 및 주의사항 기록

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-28 18:37:32 +09:00
fef630d266 chore: 버전 업데이트 v1.2.5
- versionCode: 1124 → 1125
- versionName: 1.2.4 → 1.2.5
- changelog 업데이트

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-28 18:26:08 +09:00
33 changed files with 801 additions and 123 deletions

12
.env.local Normal file
View File

@@ -0,0 +1,12 @@
# 로컬 설정 파일
## Personal Access Token (Gitea)
- 토큰: `e3b515eaa0a6683c921ca3bf718e281ed30a6075`
- 용도: git.webpluss.net API 접근 (Release 업로드, version.json 업데이트)
- **Git에 Commit되지 않도록 주의**
## 사용 예시
```bash
curl -u "sanjeok77:e3b515eaa0a6683c921ca3bf718e281ed30a6075" \
"https://git.webpluss.net/api/v1/repos/sanjeok77/NeFLIX/releases"
```

BIN
.env.local:Zone.Identifier Normal file

Binary file not shown.

206
GITEA_RELEASE_GUIDE.md Normal file
View File

@@ -0,0 +1,206 @@
# Gitea 릴리즈 작업 가이드
> ShiftRing 프로젝트 Gitea 릴리즈 자동화 문서
> 저장소: https://git.webpluss.net/sanjeok77/ShiftRing
---
## 🔐 인증 정보
**Personal Access Token (PAT)**
- 위치: `.env.local` 파일
- 형식: `e3b515eaa0a6683c921ca3bf718e281ed30a6075`
- 사용자: `sanjeok77`
**인증 헤더**
```bash
-u "sanjeok77:TOKEN"
```
---
## 📋 릴리즈 생성 절차
### 1. 버전 업데이트 (3곳)
#### 1.1 `app/build.gradle.kts` - 앱 날부 버전
```kotlin
defaultConfig {
versionCode = 1125 // ← 이전: 1124
versionName = "1.2.5" // ← 이전: "1.2.4"
}
```
#### 1.2 `version.json` - 서버 버전 정보
```json
{
"versionCode": 1125,
"versionName": "1.2.5",
"apkUrl": "https://git.webpluss.net/attachments/{UUID}",
"changelog": "v1.2.5: 변경사항 요약",
"forceUpdate": false
}
```
#### 1.3 Git 태그 및 릴리즈
- 태그: `v1.2.5`
- 브랜치: `dev` (개발) → `main` (배포)
---
### 2. 릴리즈 생성 (API)
**엔드포인트**
```bash
POST https://git.webpluss.net/api/v1/repos/sanjeok77/ShiftRing/releases
```
**요청 예시**
```bash
curl -X POST \
-H "Content-Type: application/json" \
-u "sanjeok77:TOKEN" \
"https://git.webpluss.net/api/v1/repos/sanjeok77/ShiftRing/releases" \
-d '{
"tag_name": "v1.2.5",
"name": "v1.2.5 - 릴리즈 제목",
"body": "## 변경사항\n\n- 기능1\n- 기능2",
"prerelease": false,
"target_commitish": "dev"
}'
```
**응답 예시**
```json
{
"id": 30,
"tag_name": "v1.2.5",
"upload_url": "https://git.webpluss.net/api/v1/repos/sanjeok77/ShiftRing/releases/30/assets"
}
```
---
### 3. APK 빌드
**릴리즈 빌드**
```bash
./gradlew :app:assembleRelease
```
**출력 경로**
```
app/build/outputs/apk/release/app-release.apk
```
**서명 설정** (`keystore.properties`)
```properties
storePassword=비밀번호
keyAlias=별칭
keyPassword=비밀번호
storeFile=../release.jks
```
---
### 4. APK 업로드 (API)
**엔드포인트**
```bash
POST https://git.webpluss.net/api/v1/repos/sanjeok77/ShiftRing/releases/{release_id}/assets
```
**요청 예시**
```bash
curl -X POST \
-u "sanjeok77:TOKEN" \
-H "Content-Type: multipart/form-data" \
-F "attachment=@app/build/outputs/apk/release/app-release.apk" \
"https://git.webpluss.net/api/v1/repos/sanjeok77/ShiftRing/releases/30/assets?name=app.apk"
```
**응답 예시**
```json
{
"id": 37,
"name": "app.apk",
"size": 5236988,
"browser_download_url": "https://git.webpluss.net/attachments/b8f53c11-743f-416c-87ae-bd478c781abf"
}
```
---
### 5. version.json 업데이트
**APK URL 업데이트**
```json
{
"apkUrl": "https://git.webpluss.net/attachments/{UUID}"
}
```
**주의**: `releases/download/v1.2.5/app.apk` 형식이 아닌 `attachments/{UUID}` 형식 사용
---
## 🔧 유틸리티 명령어
### 릴리즈 조회
```bash
curl -s -u "sanjeok77:TOKEN" \
"https://git.webpluss.net/api/v1/repos/sanjeok77/ShiftRing/releases" | jq '.[].tag_name'
```
### 특정 릴리즈 조회
```bash
curl -s -u "sanjeok77:TOKEN" \
"https://git.webpluss.net/api/v1/repos/sanjeok77/ShiftRing/releases/30"
```
### 첨부파일 삭제
```bash
curl -s -u "sanjeok77:TOKEN" \
-X DELETE \
"https://git.webpluss.net/api/v1/repos/sanjeok77/ShiftRing/releases/30/assets/{asset_id}"
```
---
## ⚠️ 주의사항
1. **버전 일치**: `build.gradle.kts`, `version.json`, Git 태그 3곳 모두 동일 버전 사용
2. **APK 파일명**: 반드시 `app.apk`로 업로드 (클리어 이름 지정)
3. **UUID**: 업로드 후 반환된 UUID를 `version.json`에 반영
4. **브랜치**:
- 개발: `dev` 브랜치에 커밋
- 배포: `main` 브랜치에 cherry-pick
---
## 📁 관련 파일
| 파일 | 설명 |
|------|------|
| `app/build.gradle.kts` | 앱 날부 버전 설정 |
| `version.json` | 서버 버전 정보 |
| `keystore.properties` | 서명 키 설정 |
| `release.jks` | 서명 키스토어 |
| `.env.local` | API 토큰 저장 |
---
## 📝 변경 이력
| 날짜 | 버전 | 작업 |
|------|------|------|
| 2026-02-28 | v1.2.5 | 알람 시스템 단순화 릴리즈 |
| 2026-02-28 | v1.2.4 | 버그 수정 릴리즈 |
---
## 🔗 참고 링크
- 릴리즈 페이지: https://git.webpluss.net/sanjeok77/ShiftRing/releases
- API 문서: https://git.webpluss.net/api/swagger
- Swagger UI: https://git.webpluss.net/api/swagger#/repository/repoCreateRelease

BIN
app.apk

Binary file not shown.

View File

@@ -16,15 +16,15 @@ android {
namespace = "com.example.shiftalarm" namespace = "com.example.shiftalarm"
compileSdk = 35 compileSdk = 35
defaultConfig { defaultConfig {
applicationId = "com.example.shiftalarm" applicationId = "com.example.shiftalarm"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
versionCode = 1124 versionCode = 1149
versionName = "1.2.4" versionName = "1.4.9"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
signingConfigs { signingConfigs {
create("release") { create("release") {

View File

@@ -16,6 +16,26 @@ import java.util.concurrent.TimeUnit
val SEOUL_ZONE: ZoneId = ZoneId.of("Asia/Seoul") val SEOUL_ZONE: ZoneId = ZoneId.of("Asia/Seoul")
const val TAG = "ShiftAlarm" const val TAG = "ShiftAlarm"
/**
* 다크모드 지원 커스텀 토스트 표시
*/
fun showCustomToast(context: Context, message: String, duration: Int = android.widget.Toast.LENGTH_SHORT) {
try {
val inflater = android.view.LayoutInflater.from(context)
val layout = inflater.inflate(R.layout.custom_toast, null)
val textView = layout.findViewById<android.widget.TextView>(R.id.toastText)
textView.text = message
val toast = android.widget.Toast(context)
toast.duration = duration
toast.view = layout
toast.setGravity(android.view.Gravity.BOTTOM or android.view.Gravity.CENTER_HORIZONTAL, 0, 150)
toast.show()
} catch (e: Exception) {
// Fallback to default toast if custom toast fails
android.widget.Toast.makeText(context, message, duration).show()
}
}
// ============================================ // ============================================
// 알람 ID 생성 // 알람 ID 생성
// ============================================ // ============================================

View File

@@ -1,9 +1,13 @@
package com.example.shiftalarm package com.example.shiftalarm
import android.content.Context import android.content.Context
import androidx.room.* import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
@Database(entities = [ShiftOverride::class, DailyMemo::class, CustomAlarm::class], version = 3, exportSchema = false) @Database(entities = [ShiftOverride::class, DailyMemo::class, CustomAlarm::class, AnnualLeave::class], version = 4, exportSchema = false)
abstract class AppDatabase : RoomDatabase() { abstract class AppDatabase : RoomDatabase() {
abstract fun shiftDao(): ShiftDao abstract fun shiftDao(): ShiftDao
@@ -11,6 +15,23 @@ abstract class AppDatabase : RoomDatabase() {
@Volatile @Volatile
private var INSTANCE: AppDatabase? = null private var INSTANCE: AppDatabase? = null
// Migration from version 3 to 4: Add AnnualLeave table
private val MIGRATION_3_4 = object : Migration(3, 4) {
override fun migrate(database: SupportSQLiteDatabase) {
// Create AnnualLeave table
database.execSQL(
"""
CREATE TABLE IF NOT EXISTS annual_leave (
id INTEGER PRIMARY KEY NOT NULL,
totalDays REAL NOT NULL,
remainingDays REAL NOT NULL,
updatedAt INTEGER NOT NULL
)
""".trimIndent()
)
}
}
fun getDatabase(context: Context): AppDatabase { fun getDatabase(context: Context): AppDatabase {
return INSTANCE ?: synchronized(this) { return INSTANCE ?: synchronized(this) {
val instance = Room.databaseBuilder( val instance = Room.databaseBuilder(
@@ -18,7 +39,7 @@ abstract class AppDatabase : RoomDatabase() {
AppDatabase::class.java, AppDatabase::class.java,
"shift_database" "shift_database"
) )
.fallbackToDestructiveMigration() // Simple for now .addMigrations(MIGRATION_3_4)
.build() .build()
INSTANCE = instance INSTANCE = instance
instance instance

View File

@@ -39,14 +39,21 @@ object AppUpdateManager {
reader.close() reader.close()
val json = JSONObject(result) val json = JSONObject(result)
val serverVersionCode = json.getInt("versionCode")
val serverVersionName = json.getString("versionName") val serverVersionName = json.getString("versionName")
val apkUrl = json.getString("apkUrl") val apkUrl = json.getString("apkUrl")
val changelog = json.optString("changelog", "버그 수정 및 성능 향상") val changelog = json.optString("changelog", "버그 수정 및 성능 향상")
val pInfo = ctx.packageManager.getPackageInfo(ctx.packageName, 0) val pInfo = ctx.packageManager.getPackageInfo(ctx.packageName, 0)
val currentVersionCode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
pInfo.longVersionCode.toInt()
} else {
@Suppress("DEPRECATION")
pInfo.versionCode
}
val currentVersionName = pInfo.versionName ?: "0.0.0" val currentVersionName = pInfo.versionName ?: "0.0.0"
if (isNewerVersion(serverVersionName, currentVersionName)) { if (serverVersionCode > currentVersionCode) {
activity.runOnUiThread { activity.runOnUiThread {
showUpdateDialog(activity, serverVersionName, changelog, apkUrl) showUpdateDialog(activity, serverVersionName, changelog, apkUrl)
} }
@@ -71,29 +78,6 @@ object AppUpdateManager {
}.start() }.start()
} }
private fun isNewerVersion(server: String, current: String): Boolean {
try {
// Clean version strings (remove non-numeric suffixes if any)
val sClean = server.split("-")[0].split(" ")[0]
val cClean = current.split("-")[0].split(" ")[0]
val sParts = sClean.split(".").map { it.filter { char -> char.isDigit() }.let { p -> if (p.isEmpty()) 0 else p.toInt() } }
val cParts = cClean.split(".").map { it.filter { char -> char.isDigit() }.let { p -> if (p.isEmpty()) 0 else p.toInt() } }
val length = Math.max(sParts.size, cParts.size)
for (i in 0 until length) {
val s = if (i < sParts.size) sParts[i] else 0
val c = if (i < cParts.size) cParts[i] else 0
if (s > c) return true
if (s < c) return false
}
} catch (e: Exception) {
android.util.Log.e("AppUpdateManager", "Version comparison failed: ${e.message}")
return false
}
return false
}
private fun showUpdateDialog(activity: Activity, version: String, changelog: String, apkUrl: String) { private fun showUpdateDialog(activity: Activity, version: String, changelog: String, apkUrl: String) {
com.google.android.material.dialog.MaterialAlertDialogBuilder(activity) com.google.android.material.dialog.MaterialAlertDialogBuilder(activity)
.setTitle("새로운 업데이트 발견 (v$version)") .setTitle("새로운 업데이트 발견 (v$version)")

View File

@@ -13,10 +13,10 @@ import androidx.recyclerview.widget.RecyclerView
import java.time.LocalDate import java.time.LocalDate
data class DayShift( data class DayShift(
val date: LocalDate?, val date: LocalDate?,
val shift: String?, val shift: String?,
val hasMemo: Boolean = false, val hasMemo: Boolean = false,
val memoContent: String? = null val memoContent: String? = null
) )
class CalendarAdapter( class CalendarAdapter(
@@ -24,7 +24,6 @@ class CalendarAdapter(
private val listener: OnDayClickListener, private val listener: OnDayClickListener,
var showHolidays: Boolean = true var showHolidays: Boolean = true
) : RecyclerView.Adapter<CalendarAdapter.ViewHolder>() { ) : RecyclerView.Adapter<CalendarAdapter.ViewHolder>() {
interface OnDayClickListener { interface OnDayClickListener {
fun onDayClick(date: LocalDate, currentShift: String) fun onDayClick(date: LocalDate, currentShift: String)
} }
@@ -51,17 +50,16 @@ class CalendarAdapter(
override fun onBindViewHolder(holder: ViewHolder, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = days[position] val item = days[position]
val context = holder.itemView.context val context = holder.itemView.context
if (item.date == null) { if (item.date == null) {
holder.itemView.visibility = View.INVISIBLE holder.itemView.visibility = View.INVISIBLE
return return
} }
holder.itemView.visibility = View.VISIBLE holder.itemView.visibility = View.VISIBLE
// Day Number // Day Number
holder.dayNumber.text = item.date.dayOfMonth.toString() holder.dayNumber.text = item.date.dayOfMonth.toString()
// Holiday / Weekend logic // Holiday / Weekend logic
val isSunday = item.date.dayOfWeek == java.time.DayOfWeek.SUNDAY val isSunday = item.date.dayOfWeek == java.time.DayOfWeek.SUNDAY
val isSaturday = item.date.dayOfWeek == java.time.DayOfWeek.SATURDAY val isSaturday = item.date.dayOfWeek == java.time.DayOfWeek.SATURDAY
@@ -99,7 +97,7 @@ class CalendarAdapter(
holder.shiftChar.background = null holder.shiftChar.background = null
holder.shiftChar.text = "" holder.shiftChar.text = ""
holder.holidayNameSmall.visibility = View.GONE holder.holidayNameSmall.visibility = View.GONE
holder.shiftChar.textSize = 13f holder.shiftChar.textSize = 15f
// "반월", "반년" (Half-Monthly, Half-Yearly) Special Logic // "반월", "반년" (Half-Monthly, Half-Yearly) Special Logic
// These are overrides or specific shifts that user sets. // These are overrides or specific shifts that user sets.
@@ -111,7 +109,7 @@ class CalendarAdapter(
// Holiday Mode (Priority): Show full holiday name, no circle // Holiday Mode (Priority): Show full holiday name, no circle
holder.shiftChar.text = fullHolidayName holder.shiftChar.text = fullHolidayName
holder.shiftChar.setTextColor(Color.parseColor("#FF5252")) holder.shiftChar.setTextColor(Color.parseColor("#FF5252"))
holder.shiftChar.textSize = 10f holder.shiftChar.textSize = 11f
holder.shiftChar.background = null holder.shiftChar.background = null
} else if (item.shift != null && item.shift != "비번") { } else if (item.shift != null && item.shift != "비번") {
// Shift Mode // Shift Mode
@@ -120,7 +118,7 @@ class CalendarAdapter(
if (item.shift == "반월" || item.shift == "반년") { if (item.shift == "반월" || item.shift == "반년") {
holder.shiftChar.text = if (item.shift == "반월") "" else "" holder.shiftChar.text = if (item.shift == "반월") "" else ""
holder.shiftChar.setTextColor(ContextCompat.getColor(context, R.color.black)) // Black for contrast on Half Red/Transparent holder.shiftChar.setTextColor(ContextCompat.getColor(context, R.color.black)) // Black for contrast on Half Red/Transparent
holder.shiftChar.textSize = 13f holder.shiftChar.textSize = 15f
holder.shiftChar.background = ContextCompat.getDrawable(context, R.drawable.bg_shift_half_red) holder.shiftChar.background = ContextCompat.getDrawable(context, R.drawable.bg_shift_half_red)
} else { } else {
// Standard Logic // Standard Logic
@@ -137,7 +135,7 @@ class CalendarAdapter(
else -> item.shift.take(1) else -> item.shift.take(1)
} }
holder.shiftChar.text = shiftAbbreviation holder.shiftChar.text = shiftAbbreviation
holder.shiftChar.textSize = 15f holder.shiftChar.textSize = 17f
holder.shiftChar.setTypeface(null, android.graphics.Typeface.BOLD) holder.shiftChar.setTypeface(null, android.graphics.Typeface.BOLD)
val shiftColorRes = when (item.shift) { val shiftColorRes = when (item.shift) {
@@ -205,7 +203,7 @@ class CalendarAdapter(
// holder.holidayNameSmall.text = HolidayManager.getLunarDateString(item.date) // holder.holidayNameSmall.text = HolidayManager.getLunarDateString(item.date)
holder.shiftChar.text = HolidayManager.getLunarDateString(item.date) holder.shiftChar.text = HolidayManager.getLunarDateString(item.date)
holder.shiftChar.textSize = 10f holder.shiftChar.textSize = 11f
holder.shiftChar.setTextColor(ContextCompat.getColor(context, R.color.text_tertiary)) holder.shiftChar.setTextColor(ContextCompat.getColor(context, R.color.text_tertiary))
holder.shiftChar.background = null holder.shiftChar.background = null
} }

View File

@@ -1,6 +1,7 @@
package com.example.shiftalarm package com.example.shiftalarm
import androidx.room.* import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "shift_overrides", primaryKeys = ["factory", "team", "date"]) @Entity(tableName = "shift_overrides", primaryKeys = ["factory", "team", "date"])
data class ShiftOverride( data class ShiftOverride(
@@ -28,3 +29,12 @@ data class CustomAlarm(
val snoozeInterval: Int = 5, val snoozeInterval: Int = 5,
val snoozeRepeat: Int = 3 val snoozeRepeat: Int = 3
) )
@Entity(tableName = "annual_leave")
data class AnnualLeave(
@PrimaryKey
val id: Int = 1, // Single row for app-wide annual leave
val totalDays: Float, // 총 연차 (1~25)
val remainingDays: Float, // 남은 연차
val updatedAt: Long = System.currentTimeMillis()
)

View File

@@ -93,6 +93,7 @@ class FragmentSettingsAdditional : Fragment() {
// Tide Switch // Tide Switch
binding.switchTide.isChecked = prefs.getBoolean("show_tide", false) binding.switchTide.isChecked = prefs.getBoolean("show_tide", false)
loadAppVersion()
} }
private fun setupListeners() { private fun setupListeners() {
@@ -211,6 +212,18 @@ class FragmentSettingsAdditional : Fragment() {
} }
} }
private fun loadAppVersion() {
try {
val packageInfo = requireContext().packageManager.getPackageInfo(requireContext().packageName, 0)
val versionName = packageInfo.versionName
binding.tvAppVersion.text = "버전 $versionName"
} catch (e: Exception) {
binding.tvAppVersion.text = "버전 1.4.0"
}
}
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView() super.onDestroyView()
_binding = null _binding = null

View File

@@ -4,13 +4,19 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.AdapterView
import android.widget.ArrayAdapter
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import com.example.shiftalarm.databinding.FragmentSettingsLabBinding import com.example.shiftalarm.databinding.FragmentSettingsLabBinding
import kotlinx.coroutines.launch
import kotlinx.coroutines.delay
class FragmentSettingsLab : Fragment() { class FragmentSettingsLab : Fragment() {
private var _binding: FragmentSettingsLabBinding? = null private var _binding: FragmentSettingsLabBinding? = null
private val binding get() = _binding!! private val binding get() = _binding!!
private var isInitialLoad = true
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, inflater: LayoutInflater, container: ViewGroup?,
@@ -20,6 +26,86 @@ class FragmentSettingsLab : Fragment() {
return binding.root return binding.root
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupSpinner()
loadAnnualLeave()
}
private fun setupSpinner() {
// 1~25일 선택 가능한 어댑터 설정
val daysList = (1..25).map { "${it}" }.toList()
val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, daysList)
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
binding.spinnerTotalDays.adapter = adapter
// 선택 시 자동 저장
binding.spinnerTotalDays.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
if (!isInitialLoad) {
val totalDays = position + 1 // 0-indexed to actual days
saveAnnualLeave(totalDays)
}
}
override fun onNothingSelected(parent: AdapterView<*>?) {
// Do nothing
}
}
}
private fun loadAnnualLeave() {
lifecycleScope.launch {
isInitialLoad = true
val repo = ShiftRepository(requireContext())
val annualLeave = repo.getAnnualLeave()
annualLeave?.let {
// 저장된 값이 있으면 해당 위치 선택 (0-indexed)
binding.spinnerTotalDays.setSelection(it.totalDays.toInt() - 1)
binding.tvRemainingDays.text = formatRemainingDays(it.remainingDays)
} ?: run {
// Default: 15 days (index 14)
binding.spinnerTotalDays.setSelection(14)
binding.tvRemainingDays.text = "15"
}
// 초기 로드 완료 후 플래그 변경 (약간의 딜레이로 초기 선택 이벤트 방지)
delay(300)
isInitialLoad = false
}
}
private fun saveAnnualLeave(totalDays: Int) {
lifecycleScope.launch {
val repo = ShiftRepository(requireContext())
repo.recalculateAndSaveAnnualLeave(totalDays.toFloat())
val updated = repo.getAnnualLeave()
updated?.let {
binding.tvRemainingDays.text = formatRemainingDays(it.remainingDays)
showCustomToast(requireContext(), "총 연차 ${totalDays}일로 저장되었습니다 (남은 연차: ${formatRemainingDays(it.remainingDays)}일)")
}
}
}
/**
* 남은 연차 표시 형식 개선
* - 정수면 정수로 표시 (예: 22)
* - 소숫점 있으면 소숫점 표시 (예: 21.5)
*/
private fun formatRemainingDays(days: Float): String {
return if (days == days.toInt().toFloat()) {
// 정수인 경우
days.toInt().toString()
} else {
// 소숫점이 있는 경우 (0.5 등)
String.format("%.1f", days)
}
}
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView() super.onDestroyView()
_binding = null _binding = null

View File

@@ -80,8 +80,7 @@ class MainActivity : AppCompatActivity() {
} }
binding.prevMonth.setOnClickListener { binding.prevMonth.setOnClickListener {
currentViewMonth = currentViewMonth.minusMonths(1) animateMonthTransition(-1)
updateCalendar()
} }
binding.monthTitle.setOnClickListener { binding.monthTitle.setOnClickListener {
@@ -89,8 +88,7 @@ class MainActivity : AppCompatActivity() {
} }
binding.nextMonth.setOnClickListener { binding.nextMonth.setOnClickListener {
currentViewMonth = currentViewMonth.plusMonths(1) animateMonthTransition(1)
updateCalendar()
} }
binding.btnToday.setOnClickListener { binding.btnToday.setOnClickListener {
@@ -191,10 +189,10 @@ class MainActivity : AppCompatActivity() {
super.onResume() super.onResume()
val prefs = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE) val prefs = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
currentViewTeam = prefs.getString(KEY_TEAM, "A") ?: "A" currentViewTeam = prefs.getString(KEY_TEAM, "A") ?: "A"
updateTideButtonVisibility() updateTideButtonVisibility()
updateCalendar() updateCalendar()
// 일원화된 통합 권한 체크 실행 (신뢰도 100% 보장) // 일원화된 통합 권한 체크 실행 (신뢰도 100% 보장)
AlarmPermissionUtil.checkAndRequestAllPermissions(this) AlarmPermissionUtil.checkAndRequestAllPermissions(this)
@@ -202,6 +200,17 @@ class MainActivity : AppCompatActivity() {
lifecycleScope.launch { lifecycleScope.launch {
syncAllAlarms(this@MainActivity) syncAllAlarms(this@MainActivity)
} }
// 연차 정보 업데이트
lifecycleScope.launch {
val repo = ShiftRepository(this@MainActivity)
val annualLeave = repo.getAnnualLeave()
annualLeave?.let {
binding.tvAnnualLeave.text = "연차: ${formatRemainingDays(it.remainingDays)}"
} ?: run {
binding.tvAnnualLeave.text = "연차: --"
}
}
} }
private fun showMonthYearPicker() { private fun showMonthYearPicker() {
@@ -295,7 +304,7 @@ class MainActivity : AppCompatActivity() {
} }
val days = generateDaysForMonthWithData(currentViewMonth, currentViewTeam, factory, overrides, memos) val days = generateDaysForMonthWithData(currentViewMonth, currentViewTeam, factory, overrides, memos)
val adapter = CalendarAdapter(days, object : CalendarAdapter.OnDayClickListener { val adapter = CalendarAdapter(days, object : CalendarAdapter.OnDayClickListener {
override fun onDayClick(date: LocalDate, currentShift: String) { override fun onDayClick(date: LocalDate, currentShift: String) {
showDaySettingsDialog(date, currentShift) showDaySettingsDialog(date, currentShift)
@@ -316,8 +325,15 @@ class MainActivity : AppCompatActivity() {
binding.todayStatusText.text = "오늘의 근무: $shiftForViewingTeam$teamSuffix" binding.todayStatusText.text = "오늘의 근무: $shiftForViewingTeam$teamSuffix"
binding.todayStatusText.setTextColor(androidx.core.content.ContextCompat.getColor(this@MainActivity, R.color.text_secondary)) binding.todayStatusText.setTextColor(androidx.core.content.ContextCompat.getColor(this@MainActivity, R.color.text_secondary))
} }
}
// Update Annual Leave display
val annualLeave = withContext(Dispatchers.IO) { repo.getAnnualLeave() }
annualLeave?.let {
binding.tvAnnualLeave.text = "연차: ${formatRemainingDays(it.remainingDays)}"
} ?: run {
binding.tvAnnualLeave.text = "연차: --"
}
}
updateOtherTeamsLayout(today, factory, prefs) updateOtherTeamsLayout(today, factory, prefs)
} }
@@ -373,13 +389,13 @@ class MainActivity : AppCompatActivity() {
setMargins(4, 0, 4, 0) setMargins(4, 0, 4, 0)
} }
setOnClickListener { setOnClickListener {
if (currentViewTeam != t) { if (currentViewTeam != t) {
currentViewTeam = t currentViewTeam = t
updateCalendar() updateCalendar()
Toast.makeText(context, "${t}반 근무표를 표시합니다.", Toast.LENGTH_SHORT).show() showCustomToast(context, "${t}반 근무표를 표시합니다.")
} }
} }
} }
rowLayout.addView(textView) rowLayout.addView(textView)
} }
@@ -595,6 +611,7 @@ class MainActivity : AppCompatActivity() {
android.widget.Toast.makeText(this, "원래 근무로 복구되었습니다.", android.widget.Toast.LENGTH_SHORT).show() android.widget.Toast.makeText(this, "원래 근무로 복구되었습니다.", android.widget.Toast.LENGTH_SHORT).show()
syncAllAlarms(this) syncAllAlarms(this)
updateCalendar() updateCalendar()
repo.updateRemainingAnnualLeave()
} }
"직접 입력" -> { "직접 입력" -> {
showCustomInputDialog(date, repo, team, factory) showCustomInputDialog(date, repo, team, factory)
@@ -617,6 +634,8 @@ class MainActivity : AppCompatActivity() {
else -> { else -> {
// New Types: 월차, 연차, 반월, 반년, 교육 -> Saved as Override with no time // New Types: 월차, 연차, 반월, 반년, 교육 -> Saved as Override with no time
repo.setOverride(date, selected, team, factory) repo.setOverride(date, selected, team, factory)
// 연차 계산을 먼저 수행하고 달력 업데이트
repo.updateRemainingAnnualLeave()
updateCalendar() updateCalendar()
syncAllAlarms(this) syncAllAlarms(this)
android.widget.Toast.makeText(this, "${selected}(으)로 기록되었습니다. 알람이 해제됩니다.", android.widget.Toast.LENGTH_SHORT).show() android.widget.Toast.makeText(this, "${selected}(으)로 기록되었습니다. 알람이 해제됩니다.", android.widget.Toast.LENGTH_SHORT).show()
@@ -686,6 +705,49 @@ class MainActivity : AppCompatActivity() {
Toast.makeText(this, "⚠️ 루팅된 기기에서 시각적 오류나 알람 불안정이 발생할 수 있습니다.", Toast.LENGTH_LONG).show() Toast.makeText(this, "⚠️ 루팅된 기기에서 시각적 오류나 알람 불안정이 발생할 수 있습니다.", Toast.LENGTH_LONG).show()
} }
} }
private fun animateMonthTransition(direction: Int) {
val card = binding.calendarCard
val width = card.width.toFloat()
if (width == 0f) {
currentViewMonth = if (direction > 0) {
currentViewMonth.plusMonths(1)
} else {
currentViewMonth.minusMonths(1)
}
updateCalendar()
return
}
card.animate()
.translationX(if (direction > 0) -width else width)
.alpha(0.5f)
.setDuration(200)
.withEndAction {
currentViewMonth = if (direction > 0) {
currentViewMonth.plusMonths(1)
} else {
currentViewMonth.minusMonths(1)
}
updateCalendar()
card.translationX = if (direction > 0) width else -width
card.animate()
.translationX(0f)
.alpha(1f)
.setDuration(200)
.start()
}
.start()
}
private fun formatRemainingDays(days: Float): String {
return if (days == days.toInt().toFloat()) {
// 정수인 경우
days.toInt().toString()
} else {
// 소숫점이 있는 경우 (0.5 등)
String.format("%.1f", days)
}
}
} }

View File

@@ -1,6 +1,11 @@
package com.example.shiftalarm package com.example.shiftalarm
import androidx.room.* import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
@Dao @Dao
interface ShiftDao { interface ShiftDao {
@@ -57,4 +62,17 @@ interface ShiftDao {
@Query("DELETE FROM custom_alarms") @Query("DELETE FROM custom_alarms")
suspend fun clearCustomAlarms() suspend fun clearCustomAlarms()
// Annual Leave Queries
@Query("SELECT * FROM annual_leave WHERE id = 1")
suspend fun getAnnualLeave(): AnnualLeave?
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertAnnualLeave(annualLeave: AnnualLeave)
@Query("UPDATE annual_leave SET remainingDays = :remainingDays, updatedAt = :timestamp WHERE id = 1")
suspend fun updateRemainingDays(remainingDays: Float, timestamp: Long = System.currentTimeMillis())
@Query("DELETE FROM annual_leave")
suspend fun clearAnnualLeave()
} }

View File

@@ -57,4 +57,55 @@ class ShiftRepository(private val context: Context) {
suspend fun clearAllCustomAlarms() = withContext(Dispatchers.IO) { suspend fun clearAllCustomAlarms() = withContext(Dispatchers.IO) {
dao.clearCustomAlarms() dao.clearCustomAlarms()
} }
// Annual Leave
suspend fun calculateUsedAnnualLeave(): Float = withContext(Dispatchers.IO) {
val currentYear = java.time.Year.now(java.time.ZoneId.of("Asia/Seoul")).toString()
val overrides = dao.getAllOverrides()
var usedDays = 0f
for (override in overrides) {
if (override.date.startsWith(currentYear)) {
when (override.shift) {
"연차" -> usedDays += 1f
"반년" -> usedDays += 0.5f
}
}
}
usedDays
}
suspend fun getAnnualLeave(): AnnualLeave? = withContext(Dispatchers.IO) {
dao.getAnnualLeave()
}
suspend fun recalculateAndSaveAnnualLeave(totalDays: Float) {
val usedDays = calculateUsedAnnualLeave()
val remainingDays = totalDays - usedDays
dao.insertAnnualLeave(AnnualLeave(
id = 1,
totalDays = totalDays,
remainingDays = remainingDays
))
}
suspend fun updateRemainingAnnualLeave() {
val annualLeave = dao.getAnnualLeave()
val usedDays = calculateUsedAnnualLeave()
if (annualLeave != null) {
val remainingDays = annualLeave.totalDays - usedDays
dao.insertAnnualLeave(annualLeave.copy(remainingDays = remainingDays))
} else {
// AnnualLeave가 없으면 기본값 15일로 생성
dao.insertAnnualLeave(AnnualLeave(
id = 1,
totalDays = 15f,
remainingDays = 15f - usedDays
))
}
}
} }

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 배경색: 다크모드에서도 잘 보이도록 surface 색상 사용 -->
<solid android:color="#CC333333" />
<corners android:radius="16dp" />
<stroke
android:width="1dp"
android:color="@color/outline" />
</shape>

View File

@@ -8,7 +8,7 @@
<shape android:shape="oval"> <shape android:shape="oval">
<stroke android:width="1.5dp" android:color="@color/shift_red"/> <stroke android:width="1.5dp" android:color="@color/shift_red"/>
<solid android:color="@android:color/transparent"/> <solid android:color="@android:color/transparent"/>
<size android:width="44dp" android:height="44dp"/> <size android:width="52dp" android:height="52dp"/>
</shape> </shape>
</item> </item>
</layer-list> </layer-list>

View File

@@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"> android:shape="oval">
<solid android:color="@color/primary" /> <solid android:color="@color/primary" />
<size android:width="44dp" android:height="44dp" /> <size android:width="52dp" android:height="52dp" />
</shape> </shape>

View File

@@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"> android:shape="oval">
<stroke android:width="1.5dp" android:color="@color/primary" /> <stroke android:width="1.5dp" android:color="@color/primary" />
<size android:width="44dp" android:height="44dp" /> <size android:width="52dp" android:height="52dp" />
</shape> </shape>

View File

@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp" android:width="52dp"
android:height="44dp" android:height="52dp"
android:viewportWidth="44" android:viewportWidth="52"
android:viewportHeight="44"> android:viewportHeight="52">
<!-- Left Half Red --> <!-- Left Half Red -->
<path <path
android:name="left_half" android:name="left_half"
android:fillColor="@color/shift_red" android:fillColor="@color/shift_red"
android:pathData="M22,0 A22,22 0 0 0 22,44 L22,0 Z" /> android:pathData="M26,0 A26,26 0 0 0 26,52 L26,0 Z" />
</vector> </vector>

View File

@@ -63,7 +63,7 @@
android:id="@+id/calendarCard" android:id="@+id/calendarCard"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginHorizontal="12dp" android:layout_marginHorizontal="3dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:cardCornerRadius="28dp" app:cardCornerRadius="28dp"
app:cardElevation="0dp" app:cardElevation="0dp"
@@ -160,7 +160,20 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/btnTideLocation"/> app:layout_constraintEnd_toStartOf="@id/tvAnnualLeave"/>
<TextView
android:id="@+id/tvAnnualLeave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="연차: 0.0"
android:textSize="12sp"
android:textStyle="bold"
android:textColor="@color/primary"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toStartOf="@id/btnTideLocation"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<androidx.appcompat.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnTideLocation" android:id="@+id/btnTideLocation"
@@ -227,7 +240,7 @@
android:id="@+id/otherTeamsCard" android:id="@+id/otherTeamsCard"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp" android:layout_marginHorizontal="3dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
app:cardCornerRadius="20dp" app:cardCornerRadius="20dp"
app:cardElevation="0dp" app:cardElevation="0dp"
@@ -261,5 +274,4 @@
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bg_custom_toast"
android:paddingHorizontal="20dp"
android:paddingVertical="12dp"
android:gravity="center">
<TextView
android:id="@+id/toastText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@android:color/white"
android:maxLines="2"
android:ellipsize="end" />
</LinearLayout>

View File

@@ -29,7 +29,7 @@
android:text="알람 추가" android:text="알람 추가"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/black" android:textColor="@color/text_primary"
android:layout_centerInParent="true"/> android:layout_centerInParent="true"/>
<TextView <TextView
@@ -80,7 +80,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:cardCornerRadius="24dp" app:cardCornerRadius="24dp"
app:cardElevation="0dp" app:cardElevation="0dp"
app:cardBackgroundColor="@color/white" app:cardBackgroundColor="@color/surface"
android:layout_marginBottom="16dp"> android:layout_marginBottom="16dp">
<LinearLayout <LinearLayout
@@ -116,7 +116,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:cardCornerRadius="24dp" app:cardCornerRadius="24dp"
app:cardElevation="0dp" app:cardElevation="0dp"
app:cardBackgroundColor="@color/white" app:cardBackgroundColor="@color/surface"
android:layout_marginBottom="16dp"> android:layout_marginBottom="16dp">
<LinearLayout <LinearLayout
android:id="@+id/btnSelectSound" android:id="@+id/btnSelectSound"
@@ -162,7 +162,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:cardCornerRadius="24dp" app:cardCornerRadius="24dp"
app:cardElevation="0dp" app:cardElevation="0dp"
app:cardBackgroundColor="@color/white" app:cardBackgroundColor="@color/surface"
android:layout_marginBottom="16dp"> android:layout_marginBottom="16dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -56,16 +56,32 @@
<TextView android:id="@+id/btnYaMat" style="@style/ShiftCircleButton" android:text="야맞" android:textSize="13sp" android:textColor="@color/shift_yamat"/> <TextView android:id="@+id/btnYaMat" style="@style/ShiftCircleButton" android:text="야맞" android:textSize="13sp" android:textColor="@color/shift_yamat"/>
<!-- Row 2 --> <!-- Row 2 -->
<TextView android:id="@+id/btnOff" style="@style/ShiftCircleButton" android:text="휴" android:textColor="@color/shift_off"/> <TextView android:id="@+id/btnOff" style="@style/ShiftCircleButton" android:text="휴" android:textColor="@color/shift_off"
<TextView android:id="@+id/btnWolcha" style="@style/ShiftCircleButton" android:text="월차" android:textSize="13sp" android:textColor="@color/secondary"/> app:layout_constraintTop_toTopOf="parent"
<TextView android:id="@+id/btnYeoncha" style="@style/ShiftCircleButton" android:text="연차" android:textSize="13sp" android:textColor="@color/secondary"/> app:layout_constraintStart_toStartOf="parent"/>
<TextView android:id="@+id/btnBanwol" style="@style/ShiftCircleButton" android:text="월" android:textSize="13sp" android:textColor="@color/shift_red"/> <TextView android:id="@+id/btnWolcha" style="@style/ShiftCircleButton" android:text="월" android:textSize="13sp" android:textColor="@color/secondary"
<TextView android:id="@+id/btnBannyeon" style="@style/ShiftCircleButton" android:text="반년" android:textSize="13sp" android:textColor="@color/shift_red"/> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<TextView android:id="@+id/btnYeoncha" style="@style/ShiftCircleButton" android:text="연차" android:textSize="13sp" android:textColor="@color/secondary"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<TextView android:id="@+id/btnBanwol" style="@style/ShiftCircleButton" android:text="반월" android:textSize="13sp" android:textColor="@color/shift_red"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<TextView android:id="@+id/btnBannyeon" style="@style/ShiftCircleButton" android:text="반년" android:textSize="13sp" android:textColor="@color/shift_red"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<!-- Row 3 --> <!-- Row 3 -->
<TextView android:id="@+id/btnEdu" style="@style/ShiftCircleButton" android:text="교육" android:textSize="13sp" android:textColor="@color/primary"/> <TextView android:id="@+id/btnEdu" style="@style/ShiftCircleButton" android:text="교육" android:textSize="13sp" android:textColor="@color/primary"
<TextView android:id="@+id/btnReset" style="@style/ShiftCircleButton" android:text="초기" android:textSize="13sp" android:textColor="@color/text_secondary"/> app:layout_constraintTop_toTopOf="parent"
<TextView android:id="@+id/btnManual" style="@style/ShiftCircleButton" android:text="직접" android:textSize="14sp" android:textColor="@color/shift_gray"/> app:layout_constraintStart_toStartOf="parent"/>
<TextView android:id="@+id/btnReset" style="@style/ShiftCircleButton" android:text="초기" android:textSize="13sp" android:textColor="@color/text_secondary"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<TextView android:id="@+id/btnManual" style="@style/ShiftCircleButton" android:text="직접" android:textSize="14sp" android:textColor="@color/shift_gray"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<androidx.constraintlayout.helper.widget.Flow <androidx.constraintlayout.helper.widget.Flow
android:id="@+id/gridFlow" android:id="@+id/gridFlow"

View File

@@ -20,7 +20,7 @@
android:text="날짜 이동" android:text="날짜 이동"
android:textSize="24sp" android:textSize="24sp"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/black" android:textColor="@color/text_primary"
android:layout_marginBottom="32dp" android:layout_marginBottom="32dp"
android:layout_gravity="center_horizontal"/> android:layout_gravity="center_horizontal"/>

View File

@@ -361,5 +361,17 @@
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<!-- App Version -->
<TextView
android:id="@+id/tvAppVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="버전 1.4.0"
android:textColor="@color/text_tertiary"
android:textSize="12sp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"/>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

View File

@@ -4,33 +4,133 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:padding="24dp" android:padding="16dp"
android:gravity="center"> android:gravity="center_horizontal">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/ic_settings"
app:tint="@color/text_tertiary"
android:layout_marginBottom="16dp"
android:alpha="0.5"/>
<!-- Header Title -->
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="실험실 기능 준비 중" android:text="나의 연차 설정"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/text_secondary" android:textColor="@color/text_primary"
android:layout_marginBottom="8dp"/> android:layout_marginBottom="24dp"/>
<!-- Total Annual Leave Setting -->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:cardBackgroundColor="@color/surface">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="16dp"
android:gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="총 연차"
android:textSize="14sp"
android:textColor="@color/text_secondary"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<Spinner
android:id="@+id/spinnerTotalDays"
android:layout_width="80dp"
android:layout_height="48dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="일"
android:textSize="14sp"
android:textColor="@color/text_tertiary"
android:layout_marginStart="4dp"/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- Remaining Annual Leave Display -->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:cardBackgroundColor="@color/surface">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="16dp"
android:gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="남은 연차"
android:textSize="14sp"
android:textColor="@color/text_secondary"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom">
<TextView
android:id="@+id/tvRemainingDays"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="15"
android:textSize="28sp"
android:textStyle="bold"
android:textColor="@color/primary"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="일"
android:textSize="14sp"
android:textColor="@color/text_tertiary"
android:layout_marginStart="4dp"/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- Calculation Info -->
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="더욱 편리한 기능을 개발하고 있습니다.\n다음 업데이트를 기대해 주세요!" android:text="※ 연차: -1일 / 반년: -0.5일 차감"
android:textSize="14sp" android:textSize="12sp"
android:textColor="@color/text_tertiary" android:textColor="@color/text_tertiary"
android:gravity="center" android:layout_marginBottom="8dp"
android:lineSpacingExtra="4dp"/> android:gravity="center"/>
<!-- 기능추가중 Notice -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="기능추가중"
android:textSize="11sp"
android:textColor="@color/primary"
android:layout_marginBottom="24dp"
android:gravity="center"/>
</LinearLayout> </LinearLayout>

View File

@@ -38,8 +38,9 @@
<!-- Shift Abbreviation Circular Indicator (Center) --> <!-- Shift Abbreviation Circular Indicator (Center) -->
<TextView <TextView
android:id="@+id/shiftChar" android:id="@+id/shiftChar"
android:layout_width="40dp" android:layout_width="48dp"
android:layout_height="40dp" android:layout_height="48dp"
android:gravity="center" android:gravity="center"
android:text="주" android:text="주"
android:textSize="15sp" android:textSize="15sp"

View File

@@ -1,3 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">shiftring</string> <string name="app_name">Shift Alarm</string>
<string name="team_selection">Team selection</string>
<string name="current_shift">Current shift: %1$s</string>
<string name="next_shift">Next shift: %1$s</string>
<string name="alarm_status">Alarm Status</string>
<string name="company_selection">Company selection</string>
<string name="tab_basic">Basic Settings</string>
<string name="tab_alarm">Alarm Settings</string>
<string name="tab_additional">Extras</string>
<string name="tab_lab">Leave Management</string>
<string-array name="factory_array">
<item>Jeonju</item>
<item>Nonsan</item>
</string-array>
<string-array name="team_array">
<item>A Team</item>
<item>B Team</item>
<item>C Team</item>
<item>D Team</item>
</string-array>
<string-array name="theme_array">
<item>System Settings</item>
<item>Light</item>
<item>Dark</item>
</string-array>
</resources> </resources>

View File

@@ -9,7 +9,7 @@
<string name="tab_basic">기본 설정</string> <string name="tab_basic">기본 설정</string>
<string name="tab_alarm">알람 설정</string> <string name="tab_alarm">알람 설정</string>
<string name="tab_additional">부가기능</string> <string name="tab_additional">부가기능</string>
<string name="tab_lab">실험실</string> <string name="tab_lab">근무 관리</string>
<string-array name="factory_array"> <string-array name="factory_array">
<item>전주</item> <item>전주</item>

0
gradlew vendored Normal file → Executable file
View File

View File

@@ -1,6 +1,6 @@
# Release signing configuration # Release signing configuration
# You should keep this file out of version control # You should keep this file out of version control
storePassword=my-password storePassword=my-password
keyAlias=my-alias keyAlias=my-alias
keyPassword=my-password keyPassword=my-password
storeFile=../release.jks storeFile=../release.jks

View File

@@ -1,7 +1,7 @@
{ {
"versionCode": 1124, "versionCode": 1149,
"versionName": "1.2.4", "versionName": "1.4.9",
"apkUrl": "https://git.webpluss.net/sanjeok77/ShiftRing/releases/download/v1.2.4/app.apk", "apkUrl": "https://git.webpluss.net/attachments/b8f51fa6-d26c-404a-b798-ee1c847a2be0",
"changelog": "v1.2.4: Deprecation 경고 수정 및 삭제 알람 버그 수정", "changelog": "v1.4.9: 버전 업데이트",
"forceUpdate": false "forceUpdate": false
} }