Library update (#78)
* Added print functionality to PDF viewer * feat(pdf): add interactive button support and visibility reveal heuristic * Moved search state management to MainViewModel and improved search UI interaction. * Updated `pdfiumandroid` to version 2.0.0 and handled resulting API changes, including nullable page/text page returns and revised native pointer access. increased compileSdk to 36. * Fixed Table of Contents (TOC) truncation bug and improved the TOC UI in `PdfViewerScreen`. - Implemented `getFixedTableOfContents` using reflection to bypass a library issue where sibling nodes were incorrectly truncated during traversal. - Enhanced the TOC drawer with a nested, expandable tree structure using the new `PdfTocTreeItem` component. - Added a custom `VerticalScrollbar` with draggable support for better navigation within long TOC lists. - Integrated `animateColorAsState` and `animateFloatAsState` for smoother UI transitions in the TOC and scrollbar. - Optimized TOC loading by flattening the tree structure and managing expansion states with `rememberSaveable`. * Improved zoom pivot calculation and interaction handling in PdfVerticalReader * Fixed high-res PDF tile bleeding by implementing clipRect in PdfBitmapLayer * fix(pdf): resolve zoom stuttering, in pagination mode, by removing eager scale snapping * Added book pinning and library filtering functionality * Updated folder sync logic, improved metadata extraction, and added persistent banner message while syncing * build: bump version to 1.0.37 (38)
This commit is contained in:
parent
1884ace646
commit
d6f7509e81
7 changed files with 338 additions and 37 deletions
|
|
@ -60,6 +60,7 @@ import androidx.compose.material.icons.filled.Info
|
|||
import androidx.compose.material.icons.filled.Menu
|
||||
import androidx.compose.material.icons.filled.MoreVert
|
||||
import androidx.compose.material.icons.filled.PhoneAndroid
|
||||
import androidx.compose.material.icons.filled.PushPin
|
||||
import androidx.compose.material.icons.filled.VerifiedUser
|
||||
import androidx.compose.material.icons.outlined.AccountCircle
|
||||
import androidx.compose.material3.AlertDialog
|
||||
|
|
@ -187,9 +188,11 @@ fun HomeScreen(
|
|||
}
|
||||
|
||||
LaunchedEffect(uiState.bannerMessage) {
|
||||
if (uiState.bannerMessage != null) {
|
||||
delay(3000L)
|
||||
viewModel.bannerMessageShown()
|
||||
uiState.bannerMessage?.let { msg ->
|
||||
if (!msg.isPersistent) {
|
||||
delay(3000L)
|
||||
viewModel.bannerMessageShown()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -304,6 +307,7 @@ fun HomeScreen(
|
|||
ContextualTopAppBar(
|
||||
selectedItemCount = selectedContextItems.size,
|
||||
onNavIconClick = { viewModel.clearContextualAction() },
|
||||
onPinClick = { viewModel.togglePinForContextualItems(isHome = true) },
|
||||
onDeleteClick = { showDeleteConfirmDialog = true },
|
||||
onSelectAllClick = { viewModel.selectAllRecentFiles() })
|
||||
}
|
||||
|
|
@ -336,6 +340,7 @@ fun HomeScreen(
|
|||
RecentFilesContent(
|
||||
recentFiles = recentFilesForHome,
|
||||
selectedContextItems = selectedContextItems,
|
||||
pinnedHomeBookIds = uiState.pinnedHomeBookIds,
|
||||
onItemClick = { item -> viewModel.onRecentFileClicked(item) },
|
||||
onItemLongClick = { item -> viewModel.onRecentItemLongPress(item) },
|
||||
onSelectFileClick = onSelectFileClick,
|
||||
|
|
@ -435,6 +440,7 @@ fun HomeScreen(
|
|||
private fun RecentFilesContent(
|
||||
recentFiles: List<RecentFileItem>,
|
||||
selectedContextItems: Collection<RecentFileItem>,
|
||||
pinnedHomeBookIds: Set<String>,
|
||||
onItemClick: (RecentFileItem) -> Unit,
|
||||
onItemLongClick: (RecentFileItem) -> Unit,
|
||||
onSelectFileClick: () -> Unit,
|
||||
|
|
@ -456,6 +462,7 @@ private fun RecentFilesContent(
|
|||
.padding(horizontal = 16.dp),
|
||||
recentFiles = recentFiles,
|
||||
selectedItemUris = selectedContextItems.mapNotNull { it.uriString }.toSet(),
|
||||
pinnedHomeBookIds = pinnedHomeBookIds,
|
||||
onItemClick = onItemClick,
|
||||
onItemLongClick = onItemLongClick,
|
||||
windowSizeClass = windowSizeClass,
|
||||
|
|
@ -498,6 +505,7 @@ private fun RecentFilesContent(
|
|||
private fun RecentFilesGrid(
|
||||
modifier: Modifier = Modifier,
|
||||
recentFiles: List<RecentFileItem>,
|
||||
pinnedHomeBookIds: Set<String>,
|
||||
selectedItemUris: Set<String>,
|
||||
onItemClick: (RecentFileItem) -> Unit,
|
||||
onItemLongClick: (RecentFileItem) -> Unit,
|
||||
|
|
@ -527,6 +535,7 @@ private fun RecentFilesGrid(
|
|||
RecentFileCard(
|
||||
item = item,
|
||||
isSelected = item.uriString in selectedItemUris,
|
||||
isPinned = item.bookId in pinnedHomeBookIds,
|
||||
onClick = { onItemClick(item) },
|
||||
onLongClick = { onItemLongClick(item) },
|
||||
isDownloading = item.bookId in downloadingBookIds
|
||||
|
|
@ -541,9 +550,10 @@ private fun RecentFilesGrid(
|
|||
fun RecentFileCard(
|
||||
item: RecentFileItem,
|
||||
isSelected: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
isPinned: Boolean = false,
|
||||
onClick: () -> Unit,
|
||||
onLongClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
isDownloading: Boolean,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
|
@ -598,6 +608,26 @@ fun RecentFileCard(
|
|||
}
|
||||
}
|
||||
|
||||
if (isPinned) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopStart)
|
||||
.padding(8.dp)
|
||||
.background(
|
||||
color = MaterialTheme.colorScheme.primaryContainer,
|
||||
shape = CircleShape
|
||||
)
|
||||
.padding(4.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.PushPin,
|
||||
contentDescription = "Pinned",
|
||||
modifier = Modifier.size(16.dp),
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (!item.isAvailable) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue