|  |  |  | @ -19,7 +19,9 @@ import io.legado.app.utils.gone | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.utils.longToastOnUi | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.utils.visible | 
			
		
	
		
			
				
					|  |  |  |  | import kotlinx.coroutines.CoroutineScope | 
			
		
	
		
			
				
					|  |  |  |  | import kotlinx.coroutines.Dispatchers.Main | 
			
		
	
		
			
				
					|  |  |  |  | import kotlinx.coroutines.ensureActive | 
			
		
	
		
			
				
					|  |  |  |  | import kotlinx.coroutines.withContext | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.concurrent.ConcurrentHashMap | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | class ChapterListAdapter(context: Context, val callback: Callback) : | 
			
		
	
	
		
			
				
					|  |  |  | @ -84,9 +86,11 @@ class ChapterListAdapter(context: Context, val callback: Callback) : | 
			
		
	
		
			
				
					|  |  |  |  |                     val displayTitle = item.getDisplayTitle(replaceRules, useReplace) | 
			
		
	
		
			
				
					|  |  |  |  |                     ensureActive() | 
			
		
	
		
			
				
					|  |  |  |  |                     displayTitleMap[item.title] = displayTitle | 
			
		
	
		
			
				
					|  |  |  |  |                     withContext(Main) { | 
			
		
	
		
			
				
					|  |  |  |  |                         notifyItemChanged(i, true) | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |             for (i in 0 until startIndex) { | 
			
		
	
		
			
				
					|  |  |  |  |                 val item = items[i] | 
			
		
	
		
			
				
					|  |  |  |  |                 if (displayTitleMap[item.title] == null) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -94,11 +98,13 @@ class ChapterListAdapter(context: Context, val callback: Callback) : | 
			
		
	
		
			
				
					|  |  |  |  |                     val displayTitle = item.getDisplayTitle(replaceRules, useReplace) | 
			
		
	
		
			
				
					|  |  |  |  |                     ensureActive() | 
			
		
	
		
			
				
					|  |  |  |  |                     displayTitleMap[item.title] = displayTitle | 
			
		
	
		
			
				
					|  |  |  |  |                     withContext(Main) { | 
			
		
	
		
			
				
					|  |  |  |  |                         notifyItemChanged(i, true) | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     private fun getDisplayTitle(chapter: BookChapter): String { | 
			
		
	
		
			
				
					|  |  |  |  |         return displayTitleMap[chapter.title] ?: chapter.title | 
			
		
	
	
		
			
				
					|  |  |  | 
 |