mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	Fix: Prevent RecyclerView from resetting scroll position after returning from preview (#5873)
Resolved an issue where RecyclerView would incorrectly scroll to the top after exiting fullscreen preview. Adjusted scroll behavior to maintain position unless actioned images are filtered. Implemented observer logic adjustments to handle dataset updates more efficiently.
This commit is contained in:
		
							parent
							
								
									56d0beb22a
								
							
						
					
					
						commit
						4067b79171
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		|  | @ -285,9 +285,11 @@ class ImageFragment : | |||
|                 imageAdapter.notifyDataSetChanged() | ||||
|                 selectorRV?.let { | ||||
|                     it.visibility = View.VISIBLE | ||||
|                     lastItemId?.let { pos -> | ||||
|                         (it.layoutManager as GridLayoutManager) | ||||
|                             .scrollToPosition(ImageHelper.getIndexFromId(filteredImages, pos)) | ||||
|                     if (switch?.isChecked == false) { | ||||
|                         lastItemId?.let { pos -> | ||||
|                             (it.layoutManager as GridLayoutManager) | ||||
|                                 .scrollToPosition(ImageHelper.getIndexFromId(filteredImages, pos)) | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } else { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Mingyi Chen
						Mingyi Chen