This commit is contained in:
ityurner02@mail.ru 2023-12-22 21:00:20 +04:00
parent 9a5617611d
commit 03b53dbdfc
5 changed files with 7306 additions and 1498 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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()
LaunchedEffect(Unit) {
viewModel.refreshState()
}
fun refresh(){
coroutineScope.launch { viewModel.refreshState() }
}
LazyVerticalGrid(columns = GridCells.Adaptive(minSize = 180.dp)){ LazyVerticalGrid(columns = GridCells.Adaptive(minSize = 180.dp)){
items(searchBook.size) { index -> items (pagingBook.itemCount){
BookCell(navController = navController, book = searchBook[index]!!.copy()) index -> BookCell(navController = navController, book = pagingBook[index]!!.copy())
} }
} }
} }

View File

@ -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>

Binary file not shown.