├── mimemagic ├── .gitignore ├── consumer-rules.pro ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── de │ │ │ └── datlag │ │ │ └── mimemagic │ │ │ ├── commons │ │ │ ├── ExtendInputStream.kt │ │ │ ├── ExtendByteArray.kt │ │ │ ├── ExtendContext.kt │ │ │ ├── ExtendContentResolver.kt │ │ │ ├── ExtendFile.kt │ │ │ └── ExtendUri.kt │ │ │ ├── MimePrefix.kt │ │ │ ├── Magic.kt │ │ │ ├── MimeSuffix.kt │ │ │ └── MimeData.kt │ ├── test │ │ └── java │ │ │ └── de │ │ │ └── datlag │ │ │ └── mimemagic │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── de │ │ └── datlag │ │ └── mimemagic │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── app ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── themes.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ ├── layout │ │ │ │ ├── activity_main.xml │ │ │ │ └── recycler_mime_item.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ │ └── de │ │ │ │ └── datlag │ │ │ │ └── mimemagicexample │ │ │ │ ├── RecyclerData.kt │ │ │ │ ├── RecyclerAdapter.kt │ │ │ │ └── MainActivity.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── de │ │ │ └── datlag │ │ │ └── mimemagicexample │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── de │ │ └── datlag │ │ └── mimemagicexample │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro ├── build.gradle └── .gitignore ├── .github └── FUNDING.yml ├── gradle.properties ├── gradlew.bat ├── README.md ├── gradlew ├── LICENSE └── .gitignore /mimemagic/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /mimemagic/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':mimemagic' 2 | include ':app' 3 | rootProject.name = "MimeMagicExample" -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DatL4g/MimeMagic-Android/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DatL4g/MimeMagic-Android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DatL4g/MimeMagic-Android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | 2 | # These are supported funding model platforms 3 | 4 | github: DatL4g 5 | patreon: datlag 6 | custom: ['paypal.me/datlag'] 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DatL4g/MimeMagic-Android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DatL4g/MimeMagic-Android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DatL4g/MimeMagic-Android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DatL4g/MimeMagic-Android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DatL4g/MimeMagic-Android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DatL4g/MimeMagic-Android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DatL4g/MimeMagic-Android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DatL4g/MimeMagic-Android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mimemagic/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/de/datlag/mimemagicexample/RecyclerData.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagicexample 2 | 3 | import de.datlag.mimemagic.MimeData 4 | 5 | data class RecyclerData( 6 | val header: String, 7 | val mimeData: MimeData 8 | ) -------------------------------------------------------------------------------- /mimemagic/src/main/java/de/datlag/mimemagic/commons/ExtendInputStream.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagic.commons 2 | 3 | import de.datlag.mimemagic.MimeData 4 | import java.io.InputStream 5 | 6 | fun InputStream.getMimeData() = MimeData.fromInputStream(this) -------------------------------------------------------------------------------- /mimemagic/src/main/java/de/datlag/mimemagic/commons/ExtendByteArray.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagic.commons 2 | 3 | import de.datlag.mimemagic.MimeData 4 | 5 | @JvmOverloads 6 | fun ByteArray.getMimeData(offset: Int = 0, length: Int = this.size) = MimeData.fromByteArray(this, offset, length) -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Nov 07 14:47:23 CET 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF000000 7 | #FFFFFFFF 8 | -------------------------------------------------------------------------------- /mimemagic/src/main/java/de/datlag/mimemagic/MimePrefix.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagic 2 | 3 | object MimePrefix { 4 | 5 | const val AUDIO = "audio" 6 | const val APPLICATION = "application" 7 | const val FONT = "font" 8 | const val IMAGE = "image" 9 | const val TEXT = "text" 10 | const val VIDEO = "video" 11 | 12 | } -------------------------------------------------------------------------------- /mimemagic/src/test/java/de/datlag/mimemagic/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagic 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/test/java/de/datlag/mimemagicexample/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagicexample 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MimeMagicExample 3 | Choose File 4 | is Archive 5 | is Audio 6 | is Document 7 | is Font 8 | is Image 9 | is Text 10 | is Video 11 | -------------------------------------------------------------------------------- /mimemagic/src/main/java/de/datlag/mimemagic/commons/ExtendContext.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagic.commons 2 | 3 | import android.content.Context 4 | import android.net.Uri 5 | import android.webkit.MimeTypeMap 6 | import de.datlag.mimemagic.MimeData 7 | import java.io.File 8 | 9 | fun Context.getMimeData(file: File) = MimeData.fromFile(file, this) 10 | 11 | @JvmOverloads 12 | fun Context.getMimeData(uri: Uri, extension: String = MimeTypeMap.getFileExtensionFromUrl(uri.toString())) = MimeData.fromUri(uri, this, extension) -------------------------------------------------------------------------------- /mimemagic/src/main/java/de/datlag/mimemagic/commons/ExtendContentResolver.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagic.commons 2 | 3 | import android.content.ContentResolver 4 | import android.net.Uri 5 | import android.webkit.MimeTypeMap 6 | import de.datlag.mimemagic.MimeData 7 | import java.io.File 8 | 9 | fun ContentResolver.getMimeData(file: File) = MimeData.fromFile(file, this) 10 | 11 | fun ContentResolver.getMimeData(uri: Uri, extension: String = MimeTypeMap.getFileExtensionFromUrl(uri.toString())) = MimeData.fromUri(uri, this, extension) -------------------------------------------------------------------------------- /mimemagic/src/main/java/de/datlag/mimemagic/commons/ExtendFile.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagic.commons 2 | 3 | import android.content.ContentResolver 4 | import android.content.Context 5 | import de.datlag.mimemagic.MimeData 6 | import java.io.File 7 | 8 | @JvmOverloads 9 | fun File.getMimeData(context: Context? = null): MimeData { 10 | return if (context == null) { 11 | MimeData.fromFile(this) 12 | } else { 13 | MimeData.fromFile(this, context) 14 | } 15 | } 16 | 17 | fun File.getMimeData(contentResolver: ContentResolver): MimeData { 18 | return MimeData.fromFile(this, contentResolver) 19 | } -------------------------------------------------------------------------------- /mimemagic/src/main/java/de/datlag/mimemagic/commons/ExtendUri.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagic.commons 2 | 3 | import android.content.ContentResolver 4 | import android.content.Context 5 | import android.net.Uri 6 | import android.webkit.MimeTypeMap 7 | import de.datlag.mimemagic.MimeData 8 | 9 | @JvmOverloads 10 | fun Uri.getMimeData(context: Context, extension: String = MimeTypeMap.getFileExtensionFromUrl(this.toString())) = MimeData.fromUri(this, context, extension) 11 | 12 | @JvmOverloads 13 | fun Uri.getMimeData(contentResolver: ContentResolver, extension: String = MimeTypeMap.getFileExtensionFromUrl(this.toString())) = MimeData.fromUri(this, contentResolver, extension) -------------------------------------------------------------------------------- /mimemagic/src/androidTest/java/de/datlag/mimemagic/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagic 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("de.datlag.mimemagic.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/de/datlag/mimemagicexample/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package de.datlag.mimemagicexample 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("de.datlag.mimemagicexample", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /mimemagic/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 |