├── docs ├── SECURITY.md ├── FUNDING.yml ├── others │ ├── release.templ.md │ └── lib.templ.properties ├── SUPPORT.md ├── CONTRIBUTING.md └── CODE_OF_CONDUCT.md ├── handle-path-oz ├── consumer-rules.pro ├── .gitignore ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── br │ │ │ └── com │ │ │ └── onimur │ │ │ └── handlepathoz │ │ │ ├── model │ │ │ └── PathOz.kt │ │ │ ├── errors │ │ │ ├── HandlePathOzListenerException.kt │ │ │ └── HandlePathOzException.kt │ │ │ ├── utils │ │ │ ├── extension │ │ │ │ ├── strings.kt │ │ │ │ ├── log.kt │ │ │ │ ├── coroutines.kt │ │ │ │ └── paths.kt │ │ │ ├── ContentUriUtils.kt │ │ │ ├── Constants.kt │ │ │ ├── SDCardUtils.kt │ │ │ ├── FileUtils.kt │ │ │ ├── HandlePathOzUtils.kt │ │ │ └── PathUtils.kt │ │ │ ├── HandlePathOzListener.kt │ │ │ └── HandlePathOz.kt │ ├── test │ │ └── java │ │ │ └── br │ │ │ └── com │ │ │ └── onimur │ │ │ └── handlepathoz │ │ │ ├── ExampleUnitTest.kt │ │ │ └── utils │ │ │ └── PathUtilsKtTest.kt │ └── androidTest │ │ └── java │ │ └── br │ │ └── com │ │ └── onimur │ │ └── handlepathoz │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro ├── build.gradle └── publish.gradle ├── app ├── .gitignore ├── libs │ └── choicelanguage.aar ├── src │ ├── main │ │ ├── ic_launcher-playstore.png │ │ ├── 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 │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── drawable │ │ │ │ ├── round_progressbar.xml │ │ │ │ ├── app_background.xml │ │ │ │ ├── arrow_expand_24.xml │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ └── logo_app.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── text_view_recycler.xml │ │ │ │ ├── dialog_progressbar.xml │ │ │ │ ├── activity_multiple_uri.xml │ │ │ │ ├── row_real_path.xml │ │ │ │ └── activity_single_uri.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── br │ │ │ │ └── com │ │ │ │ └── onimur │ │ │ │ └── sample │ │ │ │ └── handlepathoz │ │ │ │ ├── kotlin │ │ │ │ ├── model │ │ │ │ │ └── PathModel.kt │ │ │ │ ├── ProgressDialog.kt │ │ │ │ ├── adapter │ │ │ │ │ └── RealPathAdapter.kt │ │ │ │ ├── SingleUriActivity.kt │ │ │ │ └── MultipleUriActivity.kt │ │ │ │ ├── ChoiceActivity.kt │ │ │ │ └── java │ │ │ │ ├── SingleUriActivity.java │ │ │ │ └── MultipleUriActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── br │ │ │ └── com │ │ │ └── onimur │ │ │ └── sample │ │ │ └── handlepathoz │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── br │ │ └── com │ │ └── onimur │ │ └── sample │ │ └── handlepathoz │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── .github ├── resources │ ├── sample.gif │ ├── logo_git.png │ ├── logo_git_small.png │ ├── support-patreon.png │ ├── support-paypal.png │ └── support-buy-coffee.png ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── PULL_REQUEST_TEMPLATE │ └── pull_request_template.md ├── artifacts └── HandlePathOZ.apk ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── settings.gradle ├── lib.properties ├── .gitignore ├── gradle.properties ├── CHANGELOG.md ├── gradlew.bat ├── gradlew ├── README.md ├── .circleci └── config.yml └── LICENSE /docs/SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /handle-path-oz/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /handle-path-oz/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | 3 | #Release apk not ignore 4 | #!/build/outputs/apk/release/*.apk -------------------------------------------------------------------------------- /.github/resources/sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/.github/resources/sample.gif -------------------------------------------------------------------------------- /app/libs/choicelanguage.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/libs/choicelanguage.aar -------------------------------------------------------------------------------- /artifacts/HandlePathOZ.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/artifacts/HandlePathOZ.apk -------------------------------------------------------------------------------- /.github/resources/logo_git.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/.github/resources/logo_git.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.github/resources/logo_git_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/.github/resources/logo_git_small.png -------------------------------------------------------------------------------- /.github/resources/support-patreon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/.github/resources/support-patreon.png -------------------------------------------------------------------------------- /.github/resources/support-paypal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/.github/resources/support-paypal.png -------------------------------------------------------------------------------- /app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /.github/resources/support-buy-coffee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/.github/resources/support-buy-coffee.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /docs/FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: onimur 2 | custom: ["https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=YUTBBKXR2XCPJ", "https://www.buymeacoffee.com/onimur"] 3 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/handle-path-oz/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /docs/others/release.templ.md: -------------------------------------------------------------------------------- 1 | ## 📌 %s release notes 2 | 3 | | 📅 Date | ⚠️ Version | 🧰 CI Build | 📝 Changelog | 4 | |:-------:|:------------:|:-------------:|:------------:| 5 | | %s | %s | [#%s](%s) | [%s](%s) | -------------------------------------------------------------------------------- /docs/SUPPORT.md: -------------------------------------------------------------------------------- 1 | # 😷 How To Get Support For Project 2 | 3 | For **help**, **support**, **questions** and **ideas** please email at murillo_comino@hotmail.com 4 | 5 | 6 | 7 | Issues which are not bug reports will be closed. 8 | -------------------------------------------------------------------------------- /handle-path-oz/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 22/06/20 17:50 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 22/06/20 16:24 9 | */ 10 | 11 | rootProject.name='Handle Path Oz' 12 | include ':app' 13 | include ':handle-path-oz' 14 | -------------------------------------------------------------------------------- /handle-path-oz/src/main/java/br/com/onimur/handlepathoz/model/PathOz.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 27/07/20 13:46 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 27/07/20 13:20 9 | */ 10 | 11 | package br.com.onimur.handlepathoz.model 12 | 13 | data class PathOz(val type:String, val path:String) -------------------------------------------------------------------------------- /handle-path-oz/src/main/java/br/com/onimur/handlepathoz/errors/HandlePathOzListenerException.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 27/07/20 13:46 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 27/07/20 13:44 9 | */ 10 | 11 | package br.com.onimur.handlepathoz.errors 12 | 13 | 14 | class HandlePathOzListenerException(message: String) : RuntimeException(message) 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | Handle Path Oz 13 | Validating… 14 | Cancelling… 15 | 16 | -------------------------------------------------------------------------------- /handle-path-oz/src/main/java/br/com/onimur/handlepathoz/utils/extension/strings.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 29/07/20 13:22 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 29/07/20 10:42 9 | */ 10 | 11 | package br.com.onimur.handlepathoz.utils.extension 12 | 13 | import android.text.TextUtils 14 | 15 | internal fun String.isDigitsOnly() = TextUtils.isDigitsOnly(this) -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Created by Murillo Comino on 25/07/20 23:23 3 | # Github: github.com/onimur 4 | # StackOverFlow: pt.stackoverflow.com/users/128573 5 | # Email: murillo_comino@hotmail.com 6 | # 7 | # Copyright (c) 2020. 8 | # Last modified 25/07/20 22:30 9 | # 10 | 11 | #Sat Jul 25 22:30:21 BRT 2020 12 | distributionBase=GRADLE_USER_HOME 13 | distributionPath=wrapper/dists 14 | zipStoreBase=GRADLE_USER_HOME 15 | zipStorePath=wrapper/dists 16 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/round_progressbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/app_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 17 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | #1976D2 14 | #0D47A1 15 | #81C784 16 | #C8E6C9 17 | #FFE0B2 18 | #4CAF50 19 | #FFFFFF 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/arrow_expand_24.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 17 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/text_view_recycler.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 21 | -------------------------------------------------------------------------------- /lib.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Created by Murillo Comino on 24/07/20 21:18 3 | # Github: github.com/onimur 4 | # StackOverFlow: pt.stackoverflow.com/users/128573 5 | # Email: murillo_comino@hotmail.com 6 | # 7 | # Copyright (c) 2020. 8 | # Last modified 24/07/20 20:37 9 | # 10 | libVersionName=1.0.7 11 | libVersionCode=107 12 | 13 | libUrl=https://github.com/onimur/handle-path-oz 14 | libName=HandlePathOz 15 | libGroupId=com.github.onimur 16 | libRepoName=maven 17 | libArtifact=handle-path-oz 18 | libDesc=Android Library to handle multiple Uri(paths) received through Intents. 19 | libDevId=onimur 20 | libDevName=Murillo Comino 21 | libDevEmail=murillo_comino@hotmail.com 22 | libGithubPackage=https://maven.pkg.github.com/onimur/handle-path-oz 23 | -------------------------------------------------------------------------------- /docs/others/lib.templ.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Created by Murillo Comino on 24/07/20 21:18 3 | # Github: github.com/onimur 4 | # StackOverFlow: pt.stackoverflow.com/users/128573 5 | # Email: murillo_comino@hotmail.com 6 | # 7 | # Copyright (c) 2020. 8 | # Last modified 24/07/20 20:37 9 | # 10 | libVersionName=%s 11 | libVersionCode=%s 12 | 13 | libUrl=https://github.com/onimur/handle-path-oz 14 | libName=HandlePathOz 15 | libGroupId=com.github.onimur 16 | libRepoName=maven 17 | libArtifact=handle-path-oz 18 | libDesc=Android Library to handle multiple Uri(paths) received through Intents. 19 | libDevId=onimur 20 | libDevName=Murillo Comino 21 | libDevEmail=murillo_comino@hotmail.com 22 | libGithubPackage=https://maven.pkg.github.com/onimur/handle-path-oz -------------------------------------------------------------------------------- /app/src/main/java/br/com/onimur/sample/handlepathoz/kotlin/model/PathModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 27/07/20 15:18 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 27/07/20 13:20 9 | */ 10 | 11 | package br.com.onimur.sample.handlepathoz.kotlin.model 12 | 13 | import br.com.onimur.handlepathoz.model.PathOz 14 | import java.io.File 15 | 16 | data class PathModel(private val pathOz: PathOz) { 17 | private val file = File(pathOz.path) 18 | var expanded = false 19 | var type = pathOz.type 20 | var nameFile: String = file.name 21 | var absolutePath: String = file.absolutePath 22 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### Android template 2 | # Built application files 3 | *.apk 4 | *.aab 5 | 6 | # Generated files 7 | bin/ 8 | gen/ 9 | 10 | # Gradle files 11 | .gradle/ 12 | build/ 13 | 14 | # Local configuration file (sdk path, etc) 15 | local.properties 16 | 17 | # Proguard folder generated by Eclipse 18 | proguard/ 19 | 20 | # Log Files 21 | *.log 22 | 23 | # Android Studio Navigation editor temp files 24 | .navigation/ 25 | 26 | # Android Studio captures folder 27 | captures/ 28 | 29 | # IntelliJ 30 | *.iml 31 | .idea/ 32 | 33 | # External native build folder generated in Android Studio 2.2 and later 34 | .externalNativeBuild 35 | 36 | # Person files 37 | .coverage/ 38 | .exclude/ 39 | secret.properties 40 | 41 | #Exclude Release Apk 42 | !artifacts/*.apk -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[ENHANCEMENT]" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe. 🚀** 11 | 12 | 13 | **Describe the solution you'd like:** 14 | 15 | 16 | **Describe alternatives you've considered:** 17 | 18 | 19 | **Additional context:** 20 | 21 | -------------------------------------------------------------------------------- /app/src/test/java/br/com/onimur/sample/handlepathoz/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 18/06/20 20:56 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 18/06/20 20:41 9 | */ 10 | 11 | package br.com.onimur.sample.handlepathoz 12 | 13 | import org.junit.Assert.assertEquals 14 | import org.junit.Test 15 | 16 | /** 17 | * Example local unit test, which will execute on the development machine (host). 18 | * 19 | * See [testing documentation](http://d.android.com/tools/testing). 20 | */ 21 | class ExampleUnitTest { 22 | @Test 23 | fun addition_isCorrect() { 24 | assertEquals(4, 2 + 2) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /handle-path-oz/src/test/java/br/com/onimur/handlepathoz/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 22/06/20 17:50 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 18/06/20 20:56 9 | */ 10 | 11 | package br.com.onimur.handlepathoz 12 | 13 | import org.junit.Assert.assertEquals 14 | import org.junit.Test 15 | 16 | /** 17 | * Example local unit test, which will execute on the development machine (host). 18 | * 19 | * See [testing documentation](http://d.android.com/tools/testing). 20 | */ 21 | class ExampleUnitTest { 22 | @Test 23 | fun addition_isCorrect() { 24 | assertEquals(4, 2 + 2) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 20 | 21 | -------------------------------------------------------------------------------- /handle-path-oz/src/main/java/br/com/onimur/handlepathoz/utils/extension/log.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 22/06/20 17:50 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 18/06/20 20:56 9 | */ 10 | 11 | package br.com.onimur.handlepathoz.utils.extension 12 | 13 | import android.util.Log 14 | 15 | private const val TAG = "HandlePathOz" 16 | 17 | internal fun Any.logD(message: String?) { 18 | Log.d(TAG, "${this::class.java.simpleName} - $message") 19 | } 20 | 21 | internal fun Any.logE(message: String?) { 22 | Log.e(TAG, "${this::class.java.simpleName} - $message") 23 | } 24 | 25 | internal fun T.alsoLogD(message: String = ""): T = 26 | also { logD("$this $message") } 27 | -------------------------------------------------------------------------------- /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 22 | -------------------------------------------------------------------------------- /handle-path-oz/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 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug 🐛:** 11 | 12 | 13 | **To Reproduce:** 14 | 21 | **Expected behavior:** 22 | 23 | 24 | **Screenshots:** 25 | 26 | 27 | **Smartphone (please complete the following information):** 28 | 32 | 33 | **Additional context:** 34 | 35 | -------------------------------------------------------------------------------- /handle-path-oz/src/main/java/br/com/onimur/handlepathoz/utils/extension/coroutines.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 29/07/20 14:40 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 29/07/20 14:39 9 | */ 10 | 11 | package br.com.onimur.handlepathoz.utils.extension 12 | 13 | import kotlinx.coroutines.Job 14 | 15 | /** 16 | * Status Job 17 | */ 18 | internal val Job.wasCancelled: Boolean 19 | get() = !isActive and isCompleted and isCancelled 20 | 21 | internal val Job.wasCompleted: Boolean 22 | get() = !isActive and isCompleted and !isCancelled 23 | 24 | internal val Job.isCancelling: Boolean 25 | get() = !isActive and !isCompleted and isCancelled 26 | 27 | internal val Job.isCompleting: Boolean 28 | get() = isActive and !isCompleted and !isCancelled 29 | 30 | internal val Job.isNew: Boolean 31 | get() = !isActive and !isCompleted and !isCancelled -------------------------------------------------------------------------------- /docs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # ♻️ Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via issue, 4 | email, or any other method with the owners of this repository before making a change. 5 | 6 | Please note we have a code of conduct, please follow it in all your interactions with the project. 7 | 8 | ## 💬 Pull Request Process 9 | 10 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a 11 | build. 12 | 2. Update the README.md with details of changes to the interface, this includes new environment 13 | variables, exposed ports, useful file locations and container parameters. 14 | 3. Increase the version numbers in any examples files and the README.md to the new version that this 15 | Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/). 16 | 4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you 17 | do not have permission to do that, you may request the second reviewer to merge it for you. 18 | -------------------------------------------------------------------------------- /handle-path-oz/src/androidTest/java/br/com/onimur/handlepathoz/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 23/06/20 11:08 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 23/06/20 11:05 9 | */ 10 | 11 | package br.com.onimur.handlepathoz 12 | 13 | import androidx.test.ext.junit.runners.AndroidJUnit4 14 | import androidx.test.platform.app.InstrumentationRegistry 15 | import org.junit.Assert.assertEquals 16 | import org.junit.Test 17 | import org.junit.runner.RunWith 18 | 19 | /** 20 | * Instrumented test, which will execute on an Android device. 21 | * 22 | * See [testing documentation](http://d.android.com/tools/testing). 23 | */ 24 | @RunWith(AndroidJUnit4::class) 25 | class ExampleInstrumentedTest { 26 | @Test 27 | fun useAppContext() { 28 | // Context of the app under test. 29 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 30 | assertEquals("br.com.onimur.handlepathoz.test", appContext.packageName) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/androidTest/java/br/com/onimur/sample/handlepathoz/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 23/06/20 11:08 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 23/06/20 11:07 9 | */ 10 | 11 | package br.com.onimur.sample.handlepathoz 12 | 13 | import androidx.test.ext.junit.runners.AndroidJUnit4 14 | import androidx.test.platform.app.InstrumentationRegistry 15 | import org.junit.Assert.assertEquals 16 | import org.junit.Test 17 | import org.junit.runner.RunWith 18 | 19 | /** 20 | * Instrumented test, which will execute on an Android device. 21 | * 22 | * See [testing documentation](http://d.android.com/tools/testing). 23 | */ 24 | @RunWith(AndroidJUnit4::class) 25 | class ExampleInstrumentedTest { 26 | @Test 27 | fun useAppContext() { 28 | // Context of the app under test. 29 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 30 | assertEquals("br.com.onimur.sample.handlepathoz", appContext.packageName) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 17 | 21 | 25 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/java/br/com/onimur/sample/handlepathoz/kotlin/ProgressDialog.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 18/06/20 20:56 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 18/06/20 20:41 9 | */ 10 | 11 | package br.com.onimur.sample.handlepathoz.kotlin 12 | 13 | import android.app.Dialog 14 | import android.content.Context 15 | import android.graphics.Color 16 | import android.graphics.drawable.ColorDrawable 17 | import android.view.View 18 | import android.widget.TextView 19 | import br.com.comino.sample.handlepathoz.R 20 | 21 | class ProgressDialog(context: Context, private val text: String) : Dialog(context) { 22 | private lateinit var textView: TextView 23 | private lateinit var textViewLoad: TextView 24 | 25 | var currentLoad: String = "" 26 | set(value) { 27 | textViewLoad.text = value 28 | field = value 29 | } 30 | 31 | 32 | override fun create() { 33 | val view = View.inflate(context, R.layout.dialog_progressbar, null) 34 | setContentView(view) 35 | textView = view.findViewById(R.id.tv_progress_dialog) 36 | textViewLoad = view.findViewById(R.id.tv_list_load) 37 | 38 | window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) 39 | textView.text = text 40 | 41 | } 42 | } -------------------------------------------------------------------------------- /handle-path-oz/src/main/java/br/com/onimur/handlepathoz/errors/HandlePathOzException.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 22/06/20 17:50 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 18/06/20 20:56 9 | */ 10 | 11 | package br.com.onimur.handlepathoz.errors 12 | 13 | 14 | open class HandlePathOzException(message: String, mErrorCode: Int) : RuntimeException(message) { 15 | protected companion object { 16 | const val EMPTY_GOOGLE_PHOTOS = 3551 17 | const val UNKNOWN_FILE_PATH = 3552 18 | const val UNKNOWN_EXCEPTION = 3553 19 | } 20 | 21 | val errorCode = mErrorCode 22 | } 23 | class EmptyGooglePhotosException(path: String) : 24 | HandlePathOzException("$MESSAGE $path", EMPTY_GOOGLE_PHOTOS) { 25 | companion object { 26 | private const val MESSAGE = "has empty google photos with path: " 27 | } 28 | } 29 | 30 | class UnknownFilePathException(path: String) : 31 | HandlePathOzException("$MESSAGE $path", UNKNOWN_FILE_PATH) { 32 | companion object { 33 | private const val MESSAGE = "has unknown file path with path: " 34 | } 35 | } 36 | 37 | class HandlePathOzUnknownException(path: String) : 38 | HandlePathOzException("$MESSAGE $path", UNKNOWN_EXCEPTION) { 39 | companion object { 40 | private const val MESSAGE = "has unknown exception with path: " 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Created by Murillo Comino on 27/06/20 16:35 3 | # Github: github.com/onimur 4 | # StackOverFlow: pt.stackoverflow.com/users/128573 5 | # Email: murillo_comino@hotmail.com 6 | # 7 | # Copyright (c) 2020. 8 | # Last modified 27/06/20 11:54 9 | # 10 | 11 | # Project-wide Gradle settings. 12 | # IDE (e.g. Android Studio) users: 13 | # Gradle settings configured through the IDE *will override* 14 | # any settings specified in this file. 15 | # For more details on how to configure your build environment visit 16 | # http://www.gradle.org/docs/current/userguide/build_environment.html 17 | # Specifies the JVM arguments used for the daemon process. 18 | # The setting is particularly useful for tweaking memory settings. 19 | org.gradle.jvmargs=-Xmx1536m 20 | # When configured, Gradle will run in incubating parallel mode. 21 | # This option should only be used with decoupled projects. More details, visit 22 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 23 | # org.gradle.parallel=true 24 | # AndroidX package structure to make it clearer which packages are bundled with the 25 | # Android operating system, and which are packaged with your app's APK 26 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 27 | android.useAndroidX=true 28 | # Automatically convert third-party libraries to use AndroidX 29 | android.enableJetifier=true 30 | # Kotlin code style for this project: "official" or "obsolete": 31 | kotlin.code.style=official -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Description 🚀: 4 | 5 | 6 | ## Motivation and Context: 7 | 8 | 9 | 10 | ## How Has This Been Tested? 11 | 12 | 13 | 14 | 15 | ## Types of changes 16 | 17 | - [ ] Bug fix (non-breaking change which fixes an issue) 18 | - [ ] New feature (non-breaking change which adds functionality) 19 | - [ ] Breaking change (fix or feature that would cause existing functionality to change) 20 | 21 | ## Checklist: 22 | 23 | 24 | - [ ] My code follows the code style of this project. 25 | - [ ] My change requires a change to the documentation. 26 | - [ ] I have updated the documentation accordingly. 27 | - [ ] I have read the **CONTRIBUTING** document. 28 | - [ ] I have added tests to cover my changes. 29 | - [ ] All new and existing tests passed. 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 13 | 14 | 15 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.0.7](https://github.com/onimur/handle-path-oz/tree/1.0.7) (29-07-20) 4 | 5 | [Full Changelog](https://github.com/onimur/handle-path-oz/compare/1.0.6...1.0.7) 6 | 7 | **Implemented enhancements:** 8 | 9 | - Single file Uri without list [\#1](https://github.com/onimur/handle-path-oz/issues/1) 10 | - Close \#1 Single uri [\#2](https://github.com/onimur/handle-path-oz/pull/2) ([onimur](https://github.com/onimur)) 11 | 12 | **Merged pull requests:** 13 | 14 | - Developer - changes from sdcard [\#3](https://github.com/onimur/handle-path-oz/pull/3) ([onimur](https://github.com/onimur)) 15 | 16 | ## [1.0.6](https://github.com/onimur/handle-path-oz/tree/1.0.6) (30-06-20) 17 | 18 | [Full Changelog](https://github.com/onimur/handle-path-oz/compare/1.0.4...1.0.6) 19 | 20 | ## [1.0.4](https://github.com/onimur/handle-path-oz/tree/1.0.4) (30-06-20) 21 | 22 | [Full Changelog](https://github.com/onimur/handle-path-oz/compare/1.0.3...1.0.4) 23 | 24 | ## [1.0.3](https://github.com/onimur/handle-path-oz/tree/1.0.3) (23-06-20) 25 | 26 | [Full Changelog](https://github.com/onimur/handle-path-oz/compare/1.0.2...1.0.3) 27 | 28 | ## [1.0.2](https://github.com/onimur/handle-path-oz/tree/1.0.2) (23-06-20) 29 | 30 | [Full Changelog](https://github.com/onimur/handle-path-oz/compare/1.0.1...1.0.2) 31 | 32 | ## [1.0.1](https://github.com/onimur/handle-path-oz/tree/1.0.1) (22-06-20) 33 | 34 | [Full Changelog](https://github.com/onimur/handle-path-oz/compare/75101f51a2d66e31a7f76f82e5c7891c4ac6c0b3...1.0.1) 35 | 36 | 37 | 38 | \* *This Changelog was automatically generated by [circleci Github Changelog Generator](https://github.com/onimur/circleci-github-changelog-generator) Orb* 39 | -------------------------------------------------------------------------------- /handle-path-oz/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 29/06/20 15:51 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 29/06/20 15:45 9 | */ 10 | 11 | apply plugin: 'com.android.library' 12 | apply plugin: 'kotlin-android' 13 | apply plugin: 'kotlin-android-extensions' 14 | apply from: 'publish.gradle' 15 | 16 | android { 17 | compileSdkVersion 29 18 | buildToolsVersion "29.0.3" 19 | 20 | defaultConfig { 21 | minSdkVersion 16 22 | targetSdkVersion 29 23 | versionCode = libVersionCode 24 | versionName = libVersionName 25 | 26 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 27 | consumerProguardFiles 'consumer-rules.pro' 28 | } 29 | 30 | buildTypes { 31 | release { 32 | minifyEnabled false 33 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 34 | } 35 | } 36 | buildToolsVersion = '29.0.3' 37 | compileOptions { 38 | sourceCompatibility JavaVersion.VERSION_1_8 39 | targetCompatibility JavaVersion.VERSION_1_8 40 | } 41 | } 42 | 43 | dependencies { 44 | implementation fileTree(dir: 'libs', include: ['*.jar']) 45 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 46 | implementation 'androidx.loader:loader:1.1.0' 47 | //Coroutines 48 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7' 49 | testImplementation 'junit:junit:4.13' 50 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 51 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/br/com/onimur/sample/handlepathoz/ChoiceActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 27/07/20 15:18 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 27/07/20 15:16 9 | */ 10 | 11 | package br.com.onimur.sample.handlepathoz 12 | 13 | import android.content.Intent 14 | import br.com.comino.choicekotlinjava.BaseChoiceActivity 15 | import br.com.comino.choicekotlinjava.Choice 16 | import br.com.onimur.sample.handlepathoz.java.MultipleUriActivity 17 | import br.com.onimur.sample.handlepathoz.java.SingleUriActivity 18 | 19 | class ChoiceActivity : BaseChoiceActivity() { 20 | 21 | override val choices: List 22 | get() = listOf( 23 | Choice( 24 | "Java - MultipleUri", 25 | "Run the Example App with MultipleUri using HandlePathOz library written in Java.", 26 | Intent(this, MultipleUriActivity::class.java) 27 | ), 28 | Choice( 29 | "Java - SingleUri", 30 | "Run the Example App with SingleUri using HandlePathOz library written in Java.", 31 | Intent(this, SingleUriActivity::class.java) 32 | ), 33 | Choice( 34 | "Kotlin - MultipleUri", 35 | "Run the Example App with MultipleUri using HandlePathOz library written in Kotlin.", 36 | Intent( 37 | this, 38 | br.com.onimur.sample.handlepathoz.kotlin.MultipleUriActivity::class.java 39 | ) 40 | ), 41 | Choice( 42 | "Kotlin - SingleUri", 43 | "Run the Example App with SingleUri using HandlePathOz library written in Kotlin.", 44 | Intent(this, br.com.onimur.sample.handlepathoz.kotlin.SingleUriActivity::class.java) 45 | ) 46 | ) 47 | } -------------------------------------------------------------------------------- /handle-path-oz/src/main/java/br/com/onimur/handlepathoz/HandlePathOzListener.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 27/07/20 13:46 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 27/07/20 13:20 9 | */ 10 | 11 | package br.com.onimur.handlepathoz 12 | 13 | import br.com.onimur.handlepathoz.model.PathOz 14 | 15 | interface HandlePathOzListener { 16 | 17 | interface SingleUri : HandlePathOzListener { 18 | 19 | /** 20 | * Listener communicates with the responsible for your call. 21 | * 22 | * @param pathOz returns the path already handled. 23 | * 24 | * @param tr Returns the exception for the user to handle (Optional). 25 | * The exception return will be null, when the task is completely complete without errors 26 | * and without being canceled. 27 | */ 28 | fun onRequestHandlePathOz(pathOz: PathOz, tr: Throwable? = null) 29 | } 30 | 31 | interface MultipleUri : HandlePathOzListener { 32 | 33 | /** 34 | * Listener communicates with the responsible for your call. 35 | * 36 | * @param listPathOz returns the list of path already handled. 37 | * If the user cancels the task then the list returns to the last path that could be handled 38 | * 39 | * @param tr Returns the exception for the user to handle (Optional). 40 | * The exception return will be null, when the task is completely complete without errors 41 | * and without being canceled. 42 | */ 43 | fun onRequestHandlePathOz(listPathOz: List, tr: Throwable? = null) 44 | 45 | /** 46 | * Optional method to show how many uris have already been verified. 47 | * 48 | * @param currentUri 49 | */ 50 | fun onLoading(currentUri: Int) {} 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_progressbar.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 20 | 21 | 29 | 30 | 42 | 43 | 44 | 54 | -------------------------------------------------------------------------------- /handle-path-oz/src/main/java/br/com/onimur/handlepathoz/HandlePathOz.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 27/07/20 13:46 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 27/07/20 12:14 9 | */ 10 | 11 | package br.com.onimur.handlepathoz 12 | 13 | import android.content.Context 14 | import android.net.Uri 15 | import br.com.onimur.handlepathoz.utils.HandlePathOzUtils 16 | import kotlinx.coroutines.FlowPreview 17 | 18 | class HandlePathOz(context: Context, listener: HandlePathOzListener) { 19 | private val handlePathOzUtils = 20 | HandlePathOzUtils(context, listener) 21 | 22 | /** 23 | * 24 | * Working with multiple uri's 25 | * Method responsible for handle file path, for previous API of KitKat and later. 26 | * 27 | * @param listUri list to handle 28 | * 29 | * @param concurrency It explains the number of tasks that can be performed in parallel, 30 | * by default it is 10. If you choose 1 then the task will be sequential. 31 | */ 32 | @FlowPreview 33 | fun getListRealPath(listUri: List, concurrency: Int) { 34 | handlePathOzUtils.getListRealPath(listUri, concurrency) 35 | } 36 | 37 | @FlowPreview 38 | fun getListRealPath(listUri: List) { 39 | getListRealPath(listUri, 10) 40 | } 41 | 42 | /** 43 | * Working with single uri 44 | * Method responsible for handle file path, for previous API of KitKat and later. 45 | * 46 | * @param uri 47 | */ 48 | @FlowPreview 49 | fun getRealPath(uri: Uri) { 50 | handlePathOzUtils.getRealPath(uri) 51 | } 52 | 53 | /** 54 | * Cancel the task, if it is active 55 | * 56 | */ 57 | fun cancelTask() { 58 | handlePathOzUtils.cancelTask() 59 | } 60 | 61 | /** 62 | * Destroy all task if it is active 63 | * 64 | */ 65 | fun onDestroy() { 66 | handlePathOzUtils.onDestroy() 67 | } 68 | 69 | /** 70 | * Delete temporary files on the folder if exists: 71 | * yourPackageName/files/Temp/... 72 | * 73 | */ 74 | fun deleteTemporaryFiles() { 75 | handlePathOzUtils.deleteTemporaryFiles() 76 | } 77 | 78 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /handle-path-oz/src/main/java/br/com/onimur/handlepathoz/utils/ContentUriUtils.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 22/06/20 17:50 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 18/06/20 20:56 9 | */ 10 | 11 | package br.com.onimur.handlepathoz.utils 12 | 13 | import android.content.ContentResolver 14 | import android.net.Uri 15 | import br.com.onimur.handlepathoz.utils.extension.logE 16 | 17 | internal object ContentUriUtils { 18 | /** 19 | * Get the value of the column for this Uri. This is useful for 20 | * MediaStore Uris, and other file-based ContentProviders. 21 | * 22 | * @param uri to Query 23 | * @param column 24 | * @param selection Optional Filter used in the query 25 | * @param selectionArgs Optional arguments used in the query 26 | * @return Value of the column, which is typically a file path or null. 27 | */ 28 | fun getPathFromColumn( 29 | contentResolver: ContentResolver, 30 | uri: Uri, 31 | column: String, 32 | selection: String? = null, 33 | selectionArgs: Array? = null 34 | ): String { 35 | var path = "" 36 | val projection = arrayOf(column) 37 | try { 38 | getCursor(contentResolver, uri, projection, selection, selectionArgs) 39 | ?.use { 40 | if (it.moveToFirst()) { 41 | val index = it.getColumnIndexOrThrow(column) 42 | path = it.getString(index) 43 | } 44 | } 45 | } catch (e: Exception) { 46 | e.message?.let { 47 | //Checks whether the exception message does not contain the following string. 48 | if (!it.contains("column '$column' does not exist")) { 49 | throw e 50 | } 51 | } 52 | logE("Error on gePathFromColumn: $column - ${e.message}") 53 | 54 | } finally { 55 | return path 56 | } 57 | } 58 | 59 | /** 60 | * Helper for get cursor 61 | * 62 | */ 63 | fun getCursor( 64 | contentResolver: ContentResolver, 65 | uri: Uri, 66 | projection: Array? = null, 67 | selection: String? = null, 68 | selectionArgs: Array? = null 69 | ) = 70 | contentResolver.query(uri, projection, selection, selectionArgs, null) 71 | } -------------------------------------------------------------------------------- /handle-path-oz/src/main/java/br/com/onimur/handlepathoz/utils/Constants.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Murillo Comino on 29/07/20 14:47 3 | * Github: github.com/onimur 4 | * StackOverFlow: pt.stackoverflow.com/users/128573 5 | * Email: murillo_comino@hotmail.com 6 | * 7 | * Copyright (c) 2020. 8 | * Last modified 29/07/20 14:46 9 | */ 10 | 11 | package br.com.onimur.handlepathoz.utils 12 | 13 | import android.annotation.SuppressLint 14 | import android.provider.MediaStore 15 | 16 | object Constants { 17 | internal object PathUri { 18 | //Local 19 | private const val PATH_ANDROID = "com.android" 20 | const val PATH_EXTERNAL_STORAGE = "$PATH_ANDROID.externalstorage.documents" 21 | const val PATH_DOWNLOAD = "$PATH_ANDROID.providers.downloads.documents" 22 | const val PATH_MEDIA = "$PATH_ANDROID.providers.media.documents" 23 | const val PATH_RAW_DOWNLOAD = "$PATH_DOWNLOAD/document/raw" 24 | 25 | //Cloud GoogleDrive 26 | private const val PATH_GOOGLE = "com.google.android" 27 | const val PATH_GOOGLE_APPS = "$PATH_GOOGLE.apps" 28 | const val PATH_GOOGLE_PHOTOS = "$PATH_GOOGLE_APPS.photos.content" 29 | 30 | //Cloud OneDrive 31 | const val PATH_ONEDRIVE = "com.microsoft.skydrive.content" 32 | 33 | //Cloud DropBox 34 | const val PATH_DROPBOX = "com.dropbox." 35 | 36 | //Folder 37 | const val FOLDER_DOWNLOAD = "Download" 38 | 39 | //Columns 40 | const val COLUMN_DISPLAY_NAME = MediaStore.Files.FileColumns.DISPLAY_NAME 41 | 42 | //Deprecated 43 | //val COLUMN_DATA = MediaStore.MediaColumns.DATA 44 | const val COLUMN_DATA = "_data" 45 | } 46 | internal object SDCard { 47 | @SuppressLint("SdCardPath") 48 | val SDCARD_PATHS = arrayOf( 49 | "/storage/sdcard0", 50 | "/storage/sdcard1", 51 | "/storage/extsdcard", 52 | "/storage/sdcard0/external_sdcard", 53 | "/mnt/extsdcard", 54 | "/mnt/sdcard/external_sd", 55 | "/mnt/sdcard/ext_sd", 56 | "/mnt/external_sd", 57 | "/mnt/media_rw/sdcard1", 58 | "/removable/microsd", 59 | "/mnt/emmc", 60 | "/storage/external_SD", 61 | "/storage/ext_sd", 62 | "/storage/removable/sdcard1", 63 | "/data/sdext", 64 | "/data/sdext2", 65 | "/data/sdext3", 66 | "/data/sdext4", 67 | "/sdcard1", 68 | "/sdcard2", 69 | "/storage/microsd" 70 | ) 71 | } 72 | 73 | object HandlePathOz { 74 | const val BELOW_KITKAT_FILE = "belowKitkatFile" 75 | const val CLOUD_FILE = "cloudFile" 76 | const val UNKNOWN_PROVIDER = "unknownProvider" 77 | const val UNKNOWN_FILE_CHOOSER = "unknownFileChooser" 78 | const val LOCAL_PROVIDER = "localProvider" 79 | } 80 | } 81 | 82 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_multiple_uri.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 17 | 18 | 24 | 25 | 37 | 38 | 52 | 53 |