Skip to content

Commit 6d79fd8

Browse files
authored
Merge pull request #11 from ItzNotABug/fix-crash
Fix crash on `exists` check
2 parents 69e83ca + f66b7c0 commit 6d79fd8

8 files changed

Lines changed: 233 additions & 155 deletions

File tree

.gitignore

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
*.iml
2-
.gradle
3-
/local.properties
4-
/.idea/caches
5-
/.idea/libraries
6-
/.idea/modules.xml
7-
/.idea/workspace.xml
8-
/.idea/navEditor.xml
9-
/.idea/assetWizardSettings.xml
2+
*.txt
103
.DS_Store
11-
/build
12-
/captures
13-
.externalNativeBuild
14-
.cxx
4+
5+
.idea
6+
build
7+
gradle
8+
.gradle
159
local.properties

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@ dependencies {
4646
#### Maven
4747

4848
```xml
49+
4950
<dependency>
50-
<groupId>com.lazygeniouz</groupId>
51-
<artifactId>dfc</artifactId>
52-
<version>$latest_version</version>
53-
<type>aar</type>
51+
<groupId>com.lazygeniouz</groupId>
52+
<artifactId>dfc</artifactId>
53+
<version>$latest_version</version>
54+
<type>aar</type>
5455
</dependency>
5556
```
5657

build.gradle

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import com.vanniktech.maven.publish.*
1+
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
2+
import com.vanniktech.maven.publish.SonatypeHost
23

34
buildscript {
45
repositories {
@@ -7,11 +8,11 @@ buildscript {
78
}
89

910
dependencies {
10-
classpath 'com.android.tools.build:gradle:7.4.2'
11-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
11+
classpath 'com.android.tools.build:gradle:8.7.2'
12+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23"
1213

13-
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.6.0'
14-
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.25.2'
14+
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.9.20'
15+
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.30.0'
1516
}
1617
}
1718

@@ -22,18 +23,18 @@ allprojects {
2223
}
2324

2425
plugins.withId("com.vanniktech.maven.publish.base") {
26+
version "1.0.9"
2527
group "com.lazygeniouz"
26-
version "1.0.8"
2728

2829
mavenPublishing {
2930
signAllPublications()
3031
pomFromGradleProperties()
3132
publishToMavenCentral(SonatypeHost.S01, true)
32-
configure(new AndroidSingleVariantLibrary("release"))
33+
configure(new AndroidSingleVariantLibrary("release", true, true))
3334
}
3435
}
3536
}
3637

3738
tasks.register('clean', Delete) {
38-
delete rootProject.buildDir
39+
delete rootProject.layout.buildDirectory
3940
}

dfc/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ plugins {
66
}
77

88
android {
9-
compileSdk 33
9+
compileSdk 35
1010
namespace 'com.lazygeniouz.dfc'
1111

1212
defaultConfig {
1313
minSdk 21
14-
targetSdk 33
14+
targetSdk 35
1515
}
1616

1717
buildTypes {

dfc/src/main/java/com/lazygeniouz/dfc/resolver/ResolverCompat.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,14 @@ internal object ResolverCompat {
8989
* Returns True if the Document Folder / File exists, False otherwise.
9090
*/
9191
internal fun exists(context: Context, uri: Uri): Boolean {
92-
getCursor(context, uri, idProjection)?.use { cursor -> return (cursor.count > 0) }
93-
return false
92+
return try {
93+
getCursor(context, uri, idProjection)?.use { cursor ->
94+
cursor.count > 0
95+
} ?: false
96+
} catch (exception: Exception) {
97+
ErrorLogger.logError("Exception while checking if the uri exists", exception)
98+
false
99+
}
94100
}
95101

96102
/**

gradle.properties

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
21
android.useAndroidX=true
3-
android.enableJetifier=true
42
kotlin.code.style=official
3+
android.enableJetifier=true
4+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
5+
6+
android.nonFinalResIds=false
7+
android.nonTransitiveRClass=false
8+
android.defaults.buildfeatures.buildconfig=true
59

610
POM_PACKAGING=aar
711
POM_NAME=dfc

0 commit comments

Comments
 (0)