Close button behavior change on search
This commit is contained in:
		
							parent
							
								
									896c917348
								
							
						
					
					
						commit
						4c4d477fe3
					
				
					 2 changed files with 8 additions and 4 deletions
				
			
		| 
						 | 
					@ -50,9 +50,13 @@ fun HomeScreen(
 | 
				
			||||||
                            viewModel.filterSearch(criteria = it)
 | 
					                            viewModel.filterSearch(criteria = it)
 | 
				
			||||||
                        },
 | 
					                        },
 | 
				
			||||||
                        onCloseTap = {
 | 
					                        onCloseTap = {
 | 
				
			||||||
                            focusManager.clearFocus(force = true)
 | 
					                            if (viewModel.search == null) {
 | 
				
			||||||
                            keyboard?.hide()
 | 
					                                focusManager.clearFocus(force = true)
 | 
				
			||||||
                            searchScaffoldState.collapse()
 | 
					                                keyboard?.hide()
 | 
				
			||||||
 | 
					                                searchScaffoldState.collapse()
 | 
				
			||||||
 | 
					                            } else {
 | 
				
			||||||
 | 
					                                viewModel.filterSearch(null)
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
                        },
 | 
					                        },
 | 
				
			||||||
                        onAvatarTap = {
 | 
					                        onAvatarTap = {
 | 
				
			||||||
                            homeViewModel.showProfileDialog()
 | 
					                            homeViewModel.showProfileDialog()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,7 +52,7 @@ class BookSearchViewModel @Inject constructor(
 | 
				
			||||||
            .cachedIn(viewModelScope + Dispatchers.IO)
 | 
					            .cachedIn(viewModelScope + Dispatchers.IO)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fun filterSearch(criteria: String) {
 | 
					    fun filterSearch(criteria: String?) {
 | 
				
			||||||
        this.search = criteria
 | 
					        this.search = criteria
 | 
				
			||||||
        searchSource?.invalidate()
 | 
					        searchSource?.invalidate()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue