feat(bookshelf): add BookshelfViewModel, LibraryScreen and nav entry

- Create BookshelfViewModel (Hilt) for browsing remote libraries via BookshelfApiRepository.
- Create BookshelfLibraryScreen Compose UI: libraries list → items list.
- Add BOOKSHELF_LIBRARY_ROUTE to AppDestinations and wire composable in AppNavigation using hiltViewModel().
- Add Cloud icon button in LibraryScreen top bar to open server library.
- ':app:assembleOssDebug' passes.
This commit is contained in:
Atte149 2026-06-24 15:45:57 +03:00
parent a8ad2bf900
commit d999e9df77
4 changed files with 304 additions and 0 deletions

View file

@ -52,6 +52,8 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.platform.LocalContext
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.media3.common.util.UnstableApi
@ -59,6 +61,7 @@ import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import org.dueattendant149.bookreader.bookshelf.BookshelfLibraryScreen
import org.dueattendant149.bookreader.epubreader.EpubReaderScreen
import org.dueattendant149.bookreader.feedback.FeedbackScreen
import org.dueattendant149.bookreader.feedback.SupportProjectScreen
@ -79,6 +82,7 @@ object AppDestinations {
const val FONTS_SCREEN_ROUTE = "fonts_screen_route"
const val AI_SETTINGS_SCREEN_ROUTE = "ai_settings_screen_route"
const val SETTINGS_SCREEN_ROUTE = "settings_screen_route"
const val BOOKSHELF_LIBRARY_ROUTE = "bookshelf_library"
}
fun shouldInterceptAppNavBack(
@ -427,6 +431,16 @@ fun AppNavigation(
onBackClick = { navController.popBackStackIfReady() }
)
}
composable(route = AppDestinations.BOOKSHELF_LIBRARY_ROUTE) {
val bookshelfViewModel: org.dueattendant149.bookreader.bookshelf.BookshelfViewModel = hiltViewModel()
BookshelfLibraryScreen(
viewModel = bookshelfViewModel,
onItemClick = { item ->
Timber.d("Bookshelf item selected: ${item.id}")
}
)
}
}
AnimatedVisibility(