mirror of
				https://github.com/MinimalBible/MinimalBible
				synced 2025-10-31 09:30:25 -04:00 
			
		
		
		
	Use first {} over filter {}
This commit is contained in:
		| @ -77,12 +77,16 @@ class BookAdapter(val b: Book, val lookup: VerseLookup) | |||||||
|                           lM: RecyclerView.LayoutManager) { |                           lM: RecyclerView.LayoutManager) { | ||||||
|         provider subscribe { |         provider subscribe { | ||||||
|             val event = it |             val event = it | ||||||
|             chapterList.withIndices() |             lM scrollToPosition | ||||||
|                     .filter { |                     // Get all objects in the form (index, object) | ||||||
|                         event.b == it.second.bibleBook && |                     chapterList.withIndices() | ||||||
|                                 event.chapter == it.second.chapter |                             // Get one that matches our book and chapter | ||||||
|                     } |                             .first { | ||||||
|                     .forEach { lM scrollToPosition it.first } |                                 event.b == it.second.bibleBook && | ||||||
|  |                                         event.chapter == it.second.chapter | ||||||
|  |                             } | ||||||
|  |                             // And get that index value to scroll to | ||||||
|  |                             .first | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Bradlee Speice
					Bradlee Speice