lab 5
This commit is contained in:
parent
9a5617611d
commit
03b53dbdfc
8784
Server/data.json
8784
Server/data.json
File diff suppressed because it is too large
Load Diff
@ -26,7 +26,7 @@ interface ServerService{
|
||||
@Path("id") id: Int,
|
||||
): BookRemote
|
||||
|
||||
@GET("search")
|
||||
@GET("books")
|
||||
suspend fun getBySearch(
|
||||
@Query("title") searchStr: String,
|
||||
): List<BookRemote>
|
||||
@ -117,7 +117,7 @@ interface ServerService{
|
||||
@Path("id") id: Int,
|
||||
): UserRemote
|
||||
companion object {
|
||||
private const val BASE_URL = "http://92.252.221.42:8079/"
|
||||
private const val BASE_URL = "http://89.239.172.45:8079/"
|
||||
|
||||
@Volatile
|
||||
private var INSTANCE: ServerService? = null
|
||||
|
@ -46,10 +46,16 @@ import kotlinx.coroutines.withContext
|
||||
fun BookSearch(navController: NavController, searchStr: String, viewModel: SearchPageViewModel = viewModel(factory = AppViewModelProvider.Factory)) {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val searchPageUiState = viewModel.searchPageUiState
|
||||
val searchBook: List<Book> = searchPageUiState.bookList
|
||||
val pagingBook: LazyPagingItems<Book> = viewModel.bookPagedData.collectAsLazyPagingItems()
|
||||
LaunchedEffect(Unit) {
|
||||
viewModel.refreshState()
|
||||
}
|
||||
fun refresh(){
|
||||
coroutineScope.launch { viewModel.refreshState() }
|
||||
}
|
||||
LazyVerticalGrid(columns = GridCells.Adaptive(minSize = 180.dp)){
|
||||
items(searchBook.size) { index ->
|
||||
BookCell(navController = navController, book = searchBook[index]!!.copy())
|
||||
items (pagingBook.itemCount){
|
||||
index -> BookCell(navController = navController, book = pagingBook[index]!!.copy())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
<domain-config cleartextTrafficPermitted="true">
|
||||
<domain includeSubdomains="true">100.87.48.148</domain>
|
||||
<domain includeSubdomains="true">192.168.43.198</domain>
|
||||
<domain includeSubdomains="true">92.252.221.42</domain>
|
||||
<domain includeSubdomains="true">89.239.172.45</domain>
|
||||
</domain-config>
|
||||
</network-security-config>
|
BIN
Отчеты и макеты/Тюрнер_ЛР5.docx
Normal file
BIN
Отчеты и макеты/Тюрнер_ЛР5.docx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user