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,
|
@Path("id") id: Int,
|
||||||
): BookRemote
|
): BookRemote
|
||||||
|
|
||||||
@GET("search")
|
@GET("books")
|
||||||
suspend fun getBySearch(
|
suspend fun getBySearch(
|
||||||
@Query("title") searchStr: String,
|
@Query("title") searchStr: String,
|
||||||
): List<BookRemote>
|
): List<BookRemote>
|
||||||
@ -117,7 +117,7 @@ interface ServerService{
|
|||||||
@Path("id") id: Int,
|
@Path("id") id: Int,
|
||||||
): UserRemote
|
): UserRemote
|
||||||
companion object {
|
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
|
@Volatile
|
||||||
private var INSTANCE: ServerService? = null
|
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)) {
|
fun BookSearch(navController: NavController, searchStr: String, viewModel: SearchPageViewModel = viewModel(factory = AppViewModelProvider.Factory)) {
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
val searchPageUiState = viewModel.searchPageUiState
|
val searchPageUiState = viewModel.searchPageUiState
|
||||||
val searchBook: List<Book> = searchPageUiState.bookList
|
val pagingBook: LazyPagingItems<Book> = viewModel.bookPagedData.collectAsLazyPagingItems()
|
||||||
LazyVerticalGrid(columns = GridCells.Adaptive(minSize = 180.dp)) {
|
LaunchedEffect(Unit) {
|
||||||
items(searchBook.size) { index ->
|
viewModel.refreshState()
|
||||||
BookCell(navController = navController, book = searchBook[index]!!.copy())
|
}
|
||||||
|
fun refresh(){
|
||||||
|
coroutineScope.launch { viewModel.refreshState() }
|
||||||
|
}
|
||||||
|
LazyVerticalGrid(columns = GridCells.Adaptive(minSize = 180.dp)){
|
||||||
|
items (pagingBook.itemCount){
|
||||||
|
index -> BookCell(navController = navController, book = pagingBook[index]!!.copy())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
<domain-config cleartextTrafficPermitted="true">
|
<domain-config cleartextTrafficPermitted="true">
|
||||||
<domain includeSubdomains="true">100.87.48.148</domain>
|
<domain includeSubdomains="true">100.87.48.148</domain>
|
||||||
<domain includeSubdomains="true">192.168.43.198</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>
|
</domain-config>
|
||||||
</network-security-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