pull/2731/head
			
			
		
		
							parent
							
								
									fe52530be4
								
							
						
					
					
						commit
						5765946d73
					
				| @ -0,0 +1,17 @@ | ||||
| package io.legado.app.help | ||||
| 
 | ||||
| import androidx.annotation.Keep | ||||
| import io.legado.app.utils.IntentType | ||||
| 
 | ||||
| @Keep | ||||
| @Suppress("unused") | ||||
| object AppIntentType : IntentType.TypeInterface { | ||||
| 
 | ||||
|     override fun from(path: String?): String? { | ||||
|         return when (path?.substringAfterLast(".")?.lowercase()) { | ||||
|             "apk" -> "application/vnd.android.package-archive" | ||||
|             else -> null | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -1,28 +0,0 @@ | ||||
| package io.legado.app.help | ||||
| 
 | ||||
| import android.net.Uri | ||||
| import androidx.annotation.Keep | ||||
| import java.io.File | ||||
| 
 | ||||
| @Keep | ||||
| object IntentType { | ||||
| 
 | ||||
|     fun from(uri: Uri): String? { | ||||
|         return from(uri.toString()) | ||||
|     } | ||||
| 
 | ||||
|     fun from(file: File): String? { | ||||
|         return from(file.absolutePath) | ||||
|     } | ||||
| 
 | ||||
|     fun from(path: String?): String? { | ||||
|         return when (path?.substringAfterLast(".")?.lowercase()) { | ||||
|             "m4a", "mp3", "mid", "xmf", "ogg", "wav" -> "video/*" | ||||
|             "3gp", "mp4" -> "audio/*" | ||||
|             "jpg", "gif", "png", "jpeg", "bmp" -> "image/*" | ||||
|             "txt", "json" -> "text/plain" | ||||
|             else -> null | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
					Loading…
					
					
				
		Reference in new issue