Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ccbd943c56 | |||
| 761e02fd94 | |||
| eda76a0ef6 |
@@ -20,8 +20,8 @@ android {
|
|||||||
applicationId = "com.example.shiftalarm"
|
applicationId = "com.example.shiftalarm"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 1142
|
versionCode = 1143
|
||||||
versionName = "1.4.2"
|
versionName = "1.4.3"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ data class DayShift(
|
|||||||
class CalendarAdapter(
|
class CalendarAdapter(
|
||||||
var days: List<DayShift>,
|
var days: List<DayShift>,
|
||||||
private val listener: OnDayClickListener,
|
private val listener: OnDayClickListener,
|
||||||
var showHolidays: Boolean = true,
|
var showHolidays: Boolean = true
|
||||||
private val rowCount: Int = 6 // Default to 6 rows
|
|
||||||
) : RecyclerView.Adapter<CalendarAdapter.ViewHolder>() {
|
) : RecyclerView.Adapter<CalendarAdapter.ViewHolder>() {
|
||||||
interface OnDayClickListener {
|
interface OnDayClickListener {
|
||||||
fun onDayClick(date: LocalDate, currentShift: String)
|
fun onDayClick(date: LocalDate, currentShift: String)
|
||||||
@@ -52,15 +51,6 @@ class CalendarAdapter(
|
|||||||
val item = days[position]
|
val item = days[position]
|
||||||
val context = holder.itemView.context
|
val context = holder.itemView.context
|
||||||
|
|
||||||
// Fixed item height - square cells based on screen width
|
|
||||||
val displayMetrics = context.resources.displayMetrics
|
|
||||||
val screenWidth = displayMetrics.widthPixels
|
|
||||||
val itemHeight = screenWidth / 7
|
|
||||||
|
|
||||||
val layoutParams = holder.itemView.layoutParams
|
|
||||||
layoutParams.height = itemHeight
|
|
||||||
holder.itemView.layoutParams = layoutParams
|
|
||||||
|
|
||||||
if (item.date == null) {
|
if (item.date == null) {
|
||||||
holder.itemView.visibility = View.INVISIBLE
|
holder.itemView.visibility = View.INVISIBLE
|
||||||
return
|
return
|
||||||
@@ -69,7 +59,7 @@ class CalendarAdapter(
|
|||||||
holder.itemView.visibility = View.VISIBLE
|
holder.itemView.visibility = View.VISIBLE
|
||||||
|
|
||||||
// Day Number
|
// Day Number
|
||||||
|
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
|
||||||
|
|||||||
@@ -268,7 +268,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun setupCalendar() {
|
private fun setupCalendar() {
|
||||||
binding.calendarGrid.layoutManager = GridLayoutManager(this, 7)
|
binding.calendarGrid.layoutManager = GridLayoutManager(this, 7)
|
||||||
binding.calendarGrid.setHasFixedSize(false) // Allow dynamic item sizing
|
|
||||||
updateCalendar()
|
updateCalendar()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,34 +307,13 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
val days = generateDaysForMonthWithData(currentViewMonth, currentViewTeam, factory, overrides, memos)
|
val days = generateDaysForMonthWithData(currentViewMonth, currentViewTeam, factory, overrides, memos)
|
||||||
|
|
||||||
// Calculate row count (5 or 6 rows)
|
|
||||||
val daysInMonth = currentViewMonth.lengthOfMonth()
|
|
||||||
val firstDayOfMonth = currentViewMonth.atDay(1).dayOfWeek.value % 7
|
|
||||||
val actualDayCount = firstDayOfMonth + daysInMonth
|
|
||||||
val rowCount = if (actualDayCount <= 35) 5 else 6
|
|
||||||
|
|
||||||
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)
|
||||||
}
|
}
|
||||||
}, binding.cbShowHolidays.isChecked, rowCount)
|
}, binding.cbShowHolidays.isChecked)
|
||||||
|
|
||||||
binding.calendarGrid.adapter = adapter
|
binding.calendarGrid.adapter = adapter
|
||||||
|
|
||||||
// Set RecyclerView height based on row count
|
|
||||||
// 5 rows: fixed height to fill space, no scroll
|
|
||||||
// 6 rows: max height (5 rows worth), enable scroll
|
|
||||||
val displayMetrics = resources.displayMetrics
|
|
||||||
val screenWidth = displayMetrics.widthPixels
|
|
||||||
val cellHeight = screenWidth / 7 // Square cells
|
|
||||||
val recyclerViewHeight = cellHeight * rowCount
|
|
||||||
val layoutParams = binding.calendarGrid.layoutParams
|
|
||||||
layoutParams.height = recyclerViewHeight
|
|
||||||
binding.calendarGrid.layoutParams = layoutParams
|
|
||||||
|
|
||||||
// Disable scroll for 5 rows, enable for 6 rows
|
|
||||||
binding.calendarGrid.isNestedScrollingEnabled = rowCount > 5
|
|
||||||
|
|
||||||
binding.monthTitle.text = currentViewMonth.format(DateTimeFormatter.ofPattern("yyyy년 MM월"))
|
binding.monthTitle.text = currentViewMonth.format(DateTimeFormatter.ofPattern("yyyy년 MM월"))
|
||||||
|
|
||||||
// Update Header Status Text with Permission Warning if needed
|
// Update Header Status Text with Permission Warning if needed
|
||||||
|
|||||||
@@ -58,12 +58,12 @@
|
|||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<!-- Maximized Calendar Card - Reduced margins for wider calendar -->
|
<!-- Maximized Calendar Card -->
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
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="4dp"
|
android:layout_marginHorizontal="12dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
app:cardCornerRadius="28dp"
|
app:cardCornerRadius="28dp"
|
||||||
app:cardElevation="0dp"
|
app:cardElevation="0dp"
|
||||||
@@ -240,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="4dp"
|
android:layout_marginHorizontal="12dp"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
app:cardCornerRadius="20dp"
|
app:cardCornerRadius="20dp"
|
||||||
app:cardElevation="0dp"
|
app:cardElevation="0dp"
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/dayRoot"
|
android:id="@+id/dayRoot"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="92dp"
|
||||||
android:minHeight="72dp"
|
|
||||||
android:background="@drawable/bg_grid_cell_v4">
|
android:background="@drawable/bg_grid_cell_v4">
|
||||||
|
|
||||||
<!-- Day Number (top-left) -->
|
<!-- Day Number (top-left) -->
|
||||||
@@ -17,7 +16,7 @@
|
|||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:text="12"
|
android:text="12"
|
||||||
android:textColor="@color/text_primary"
|
android:textColor="@color/text_primary"
|
||||||
android:textSize="15sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -36,21 +35,21 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<!-- Shift Abbreviation Circular Indicator (Center) - Larger size -->
|
<!-- Shift Abbreviation Circular Indicator (Center) -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/shiftChar"
|
android:id="@+id/shiftChar"
|
||||||
android:layout_width="48dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="40dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="주"
|
android:text="주"
|
||||||
android:textSize="17sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="@color/text_primary"
|
android:textColor="@color/text_primary"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintVertical_bias="0.42"/>
|
app:layout_constraintVertical_bias="0.45"/>
|
||||||
|
|
||||||
<!-- Memo Content Text (Below Shift) - Replacing icon logic for visibility -->
|
<!-- Memo Content Text (Below Shift) - Replacing icon logic for visibility -->
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"versionCode": 1142,
|
"versionCode": 1143,
|
||||||
"versionName": "1.4.2",
|
"versionName": "1.4.3",
|
||||||
"apkUrl": "https://git.webpluss.net/attachments/96025498-3f84-4410-9f13-7cdd559ef60e",
|
"apkUrl": "https://git.webpluss.net/attachments/40d6f89e-58c9-41a2-a4d1-c72784a95b70",
|
||||||
"changelog": "v1.4.2: 달력 5행/6행 스크롤 수정, 토스트 다크모드 완전 지원, 연차 설정 UI 개선",
|
"changelog": "v1.4.3: 달력 레이아웃 1.3.0 버전처럼 복원 (마진 12dp, 고정 높이)",
|
||||||
"forceUpdate": false
|
"forceUpdate": false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user