| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -17,6 +17,7 @@ import io.legado.app.R | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import io.legado.app.base.BaseService | 
					 | 
					 | 
					 | 
					import io.legado.app.base.BaseService | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import io.legado.app.constant.* | 
					 | 
					 | 
					 | 
					import io.legado.app.constant.* | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import io.legado.app.help.MediaHelp | 
					 | 
					 | 
					 | 
					import io.legado.app.help.MediaHelp | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import io.legado.app.help.glide.ImageLoader | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import io.legado.app.model.ReadAloud | 
					 | 
					 | 
					 | 
					import io.legado.app.model.ReadAloud | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import io.legado.app.model.ReadBook | 
					 | 
					 | 
					 | 
					import io.legado.app.model.ReadBook | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import io.legado.app.receiver.MediaButtonReceiver | 
					 | 
					 | 
					 | 
					import io.legado.app.receiver.MediaButtonReceiver | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -29,6 +30,9 @@ import kotlinx.coroutines.isActive | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import kotlinx.coroutines.launch | 
					 | 
					 | 
					 | 
					import kotlinx.coroutines.launch | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import splitties.systemservices.audioManager | 
					 | 
					 | 
					 | 
					import splitties.systemservices.audioManager | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 * 朗读服务 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					abstract class BaseReadAloudService : BaseService(), | 
					 | 
					 | 
					 | 
					abstract class BaseReadAloudService : BaseService(), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    AudioManager.OnAudioFocusChangeListener { | 
					 | 
					 | 
					 | 
					    AudioManager.OnAudioFocusChangeListener { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -311,13 +315,19 @@ abstract class BaseReadAloudService : BaseService(), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            nSubtitle = getString(R.string.read_aloud_s) | 
					 | 
					 | 
					 | 
					            nSubtitle = getString(R.string.read_aloud_s) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        val builder = NotificationCompat.Builder(this, AppConst.channelIdReadAloud) | 
					 | 
					 | 
					 | 
					        val builder = NotificationCompat.Builder(this, AppConst.channelIdReadAloud) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            .setSmallIcon(R.drawable.ic_volume_up) | 
					 | 
					 | 
					 | 
					            .setSmallIcon(R.drawable.ic_volume_up) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            .setLargeIcon(BitmapFactory.decodeResource(resources, R.drawable.icon_read_book)) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            .setOngoing(true) | 
					 | 
					 | 
					 | 
					            .setOngoing(true) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            .setContentTitle(nTitle) | 
					 | 
					 | 
					 | 
					            .setContentTitle(nTitle) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            .setContentText(nSubtitle) | 
					 | 
					 | 
					 | 
					            .setContentText(nSubtitle) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            .setContentIntent( | 
					 | 
					 | 
					 | 
					            .setContentIntent( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                activityPendingIntent<ReadBookActivity>("activity") | 
					 | 
					 | 
					 | 
					                activityPendingIntent<ReadBookActivity>("activity") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            ) | 
					 | 
					 | 
					 | 
					            ) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        kotlin.runCatching { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            ImageLoader.loadBitmap(this, ReadBook.book?.getDisplayCover()).submit().get() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }.getOrElse { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            BitmapFactory.decodeResource(resources, R.drawable.icon_read_book) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }.let { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            builder.setLargeIcon(it) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (pause) { | 
					 | 
					 | 
					 | 
					        if (pause) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            builder.addAction( | 
					 | 
					 | 
					 | 
					            builder.addAction( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                R.drawable.ic_play_24dp, | 
					 | 
					 | 
					 | 
					                R.drawable.ic_play_24dp, | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |