|
@@ -2,8 +2,20 @@ package io.legado.app.ui.widget.components
|
|
|
|
|
|
|
|
import androidx.compose.animation.animateContentSize
|
|
import androidx.compose.animation.animateContentSize
|
|
|
import androidx.compose.foundation.BorderStroke
|
|
import androidx.compose.foundation.BorderStroke
|
|
|
-import androidx.compose.foundation.layout.*
|
|
|
|
|
-import androidx.compose.foundation.lazy.grid.*
|
|
|
|
|
|
|
+import androidx.compose.foundation.layout.Arrangement
|
|
|
|
|
+import androidx.compose.foundation.layout.Column
|
|
|
|
|
+import androidx.compose.foundation.layout.PaddingValues
|
|
|
|
|
+import androidx.compose.foundation.layout.Row
|
|
|
|
|
+import androidx.compose.foundation.layout.Spacer
|
|
|
|
|
+import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
|
|
+import androidx.compose.foundation.layout.height
|
|
|
|
|
+import androidx.compose.foundation.layout.heightIn
|
|
|
|
|
+import androidx.compose.foundation.layout.padding
|
|
|
|
|
+import androidx.compose.foundation.layout.size
|
|
|
|
|
+import androidx.compose.foundation.layout.width
|
|
|
|
|
+import androidx.compose.foundation.lazy.grid.GridCells
|
|
|
|
|
+import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
|
|
|
|
+import androidx.compose.foundation.lazy.grid.items
|
|
|
import androidx.compose.foundation.pager.HorizontalPager
|
|
import androidx.compose.foundation.pager.HorizontalPager
|
|
|
import androidx.compose.foundation.pager.rememberPagerState
|
|
import androidx.compose.foundation.pager.rememberPagerState
|
|
|
import androidx.compose.foundation.shape.CircleShape
|
|
import androidx.compose.foundation.shape.CircleShape
|
|
@@ -11,17 +23,28 @@ import androidx.compose.material.icons.Icons
|
|
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
|
|
import androidx.compose.material.icons.automirrored.filled.ArrowForward
|
|
import androidx.compose.material.icons.automirrored.filled.ArrowForward
|
|
|
import androidx.compose.material.icons.filled.Delete
|
|
import androidx.compose.material.icons.filled.Delete
|
|
|
-import androidx.compose.material3.*
|
|
|
|
|
-import androidx.compose.runtime.*
|
|
|
|
|
|
|
+import androidx.compose.material3.Button
|
|
|
|
|
+import androidx.compose.material3.ButtonDefaults
|
|
|
|
|
+import androidx.compose.material3.FilledTonalIconButton
|
|
|
|
|
+import androidx.compose.material3.Icon
|
|
|
|
|
+import androidx.compose.material3.IconButton
|
|
|
|
|
+import androidx.compose.material3.MaterialTheme
|
|
|
|
|
+import androidx.compose.material3.Text
|
|
|
|
|
+import androidx.compose.runtime.Composable
|
|
|
|
|
+import androidx.compose.runtime.derivedStateOf
|
|
|
|
|
+import androidx.compose.runtime.getValue
|
|
|
|
|
+import androidx.compose.runtime.remember
|
|
|
|
|
+import androidx.compose.runtime.rememberCoroutineScope
|
|
|
import androidx.compose.ui.Alignment
|
|
import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.text.font.FontWeight
|
|
import androidx.compose.ui.text.font.FontWeight
|
|
|
import androidx.compose.ui.unit.dp
|
|
import androidx.compose.ui.unit.dp
|
|
|
import kotlinx.coroutines.launch
|
|
import kotlinx.coroutines.launch
|
|
|
-import java.time.*
|
|
|
|
|
|
|
+import java.time.DayOfWeek
|
|
|
|
|
+import java.time.LocalDate
|
|
|
import java.time.format.DateTimeFormatter
|
|
import java.time.format.DateTimeFormatter
|
|
|
import java.time.format.TextStyle
|
|
import java.time.format.TextStyle
|
|
|
-import java.util.*
|
|
|
|
|
|
|
+import java.util.Locale
|
|
|
|
|
|
|
|
const val START_PAGE_OFFSET = 100
|
|
const val START_PAGE_OFFSET = 100
|
|
|
|
|
|
|
@@ -55,12 +78,14 @@ fun Calendar(
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Card(
|
|
|
|
|
|
|
+ GlassCard(
|
|
|
modifier = modifier.fillMaxWidth(),
|
|
modifier = modifier.fillMaxWidth(),
|
|
|
shape = MaterialTheme.shapes.medium,
|
|
shape = MaterialTheme.shapes.medium,
|
|
|
- colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer)
|
|
|
|
|
|
|
+ color = MaterialTheme.colorScheme.surfaceContainer
|
|
|
) {
|
|
) {
|
|
|
- Column(modifier = Modifier.padding(vertical = 12.dp).animateContentSize()) {
|
|
|
|
|
|
|
+ Column(modifier = Modifier
|
|
|
|
|
+ .padding(vertical = 12.dp)
|
|
|
|
|
+ .animateContentSize()) {
|
|
|
MonthNavigation(
|
|
MonthNavigation(
|
|
|
currentMonth = currentMonth,
|
|
currentMonth = currentMonth,
|
|
|
selectedDate = selectedDate,
|
|
selectedDate = selectedDate,
|
|
@@ -145,7 +170,9 @@ fun MonthNavigation(
|
|
|
onClearClick: (() -> Unit)?
|
|
onClearClick: (() -> Unit)?
|
|
|
) {
|
|
) {
|
|
|
Row(
|
|
Row(
|
|
|
- modifier = Modifier.fillMaxWidth().padding(horizontal = 12.dp),
|
|
|
|
|
|
|
+ modifier = Modifier
|
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
|
+ .padding(horizontal = 12.dp),
|
|
|
horizontalArrangement = Arrangement.SpaceBetween,
|
|
horizontalArrangement = Arrangement.SpaceBetween,
|
|
|
verticalAlignment = Alignment.CenterVertically
|
|
verticalAlignment = Alignment.CenterVertically
|
|
|
) {
|
|
) {
|
|
@@ -246,7 +273,9 @@ fun DateItem(
|
|
|
|
|
|
|
|
Button(
|
|
Button(
|
|
|
onClick = onClick,
|
|
onClick = onClick,
|
|
|
- modifier = Modifier.size(36.dp).padding(4.dp),
|
|
|
|
|
|
|
+ modifier = Modifier
|
|
|
|
|
+ .size(36.dp)
|
|
|
|
|
+ .padding(4.dp),
|
|
|
shape = CircleShape,
|
|
shape = CircleShape,
|
|
|
colors = buttonColors,
|
|
colors = buttonColors,
|
|
|
border = borderStroke,
|
|
border = borderStroke,
|