Skip to content

Commit 5dbdc7d

Browse files
authored
Merge pull request #24 from ItzNotABug/updates
Updates
2 parents 79f0c7e + 1718fdd commit 5dbdc7d

8 files changed

Lines changed: 55 additions & 59 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55

66
.idea
77
build
8+
.kotlin
89
.gradle
910
local.properties

app/build.gradle

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
11
plugins {
2-
id 'com.android.application'
3-
id 'kotlin-android'
2+
id "com.android.application"
43
}
54

65
android {
7-
compileSdk 33
8-
namespace 'com.lazygeniouz.filecompat.example'
6+
compileSdk = 36
7+
namespace = "com.lazygeniouz.filecompat.example"
98

109
defaultConfig {
11-
applicationId "com.lazygeniouz.filecompat.example"
12-
minSdk 21
13-
targetSdk 33
14-
versionCode 1
15-
versionName "1.0"
10+
applicationId = "com.lazygeniouz.filecompat.example"
1611

17-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12+
minSdk = 23
13+
targetSdk = 36
14+
versionCode = 1
15+
versionName = "1.0"
16+
17+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1818
}
1919

2020
buildTypes {
2121
release {
22-
minifyEnabled false
23-
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22+
minifyEnabled = false
23+
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
2424
}
2525
}
2626

27-
compileOptions {
28-
sourceCompatibility JavaVersion.VERSION_1_8
29-
targetCompatibility JavaVersion.VERSION_1_8
27+
buildFeatures {
28+
buildConfig = true
3029
}
3130

32-
kotlinOptions {
33-
jvmTarget = '1.8'
34-
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
31+
compileOptions {
32+
sourceCompatibility = JavaVersion.VERSION_17
33+
targetCompatibility = JavaVersion.VERSION_17
3534
}
3635
}
3736

3837
dependencies {
39-
implementation project(':dfc')
38+
implementation project(":dfc")
39+
//implementation "com.lazygeniouz:dfc:1.1"
4040

41-
implementation 'androidx.appcompat:appcompat:1.6.0'
42-
implementation 'androidx.activity:activity-ktx:1.6.1'
43-
implementation 'com.google.android.material:material:1.7.0'
41+
implementation "androidx.appcompat:appcompat:1.7.1"
42+
implementation "androidx.activity:activity-ktx:1.12.3"
43+
implementation "androidx.documentfile:documentfile:1.1.0"
44+
implementation "com.google.android.material:material:1.13.0"
4445
}

app/src/main/java/com/lazygeniouz/filecompat/example/MainActivity.kt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package com.lazygeniouz.filecompat.example
22

33
import android.annotation.SuppressLint
4-
import android.app.Activity
5-
import android.content.Context
64
import android.content.Intent
75
import android.os.Build.VERSION.SDK_INT
86
import android.os.Bundle
97
import android.os.storage.StorageManager
108
import android.widget.Button
119
import android.widget.ProgressBar
1210
import android.widget.TextView
11+
import androidx.activity.addCallback
1312
import androidx.activity.result.contract.ActivityResultContracts
1413
import androidx.appcompat.app.AppCompatActivity
1514
import androidx.core.view.isVisible
@@ -29,7 +28,7 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) {
2928

3029
private val folderResultLauncher =
3130
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
32-
if (result.resultCode == Activity.RESULT_OK) {
31+
if (result.resultCode == RESULT_OK) {
3332
val documentUri = result.data?.data
3433
if (documentUri != null) {
3534
textView.text = ""
@@ -53,11 +52,10 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) {
5352
}
5453
}
5554

56-
5755
@SuppressLint("SetTextI18n")
5856
private val fileResultLauncher =
5957
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
60-
if (result.resultCode == Activity.RESULT_OK) {
58+
if (result.resultCode == RESULT_OK) {
6159
val documentUri = result.data?.data
6260
if (documentUri != null) {
6361
textView.text = ""
@@ -83,6 +81,8 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) {
8381
textView = findViewById(R.id.fileNames)
8482
progress = findViewById(R.id.progress)
8583

84+
onBackPressedDispatcher.addCallback(this) { finishAffinity() }
85+
8686
buttonDir.setOnClickListener {
8787
folderResultLauncher.launch(getStorageIntent())
8888
}
@@ -95,13 +95,9 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) {
9595
private fun getStorageIntent(single: Boolean = false): Intent {
9696
return if (single) Intent(Intent.ACTION_GET_CONTENT).setType("*/*") else {
9797
if (SDK_INT >= 30) {
98-
val storageManager = getSystemService(Context.STORAGE_SERVICE) as StorageManager
98+
val storageManager = getSystemService(STORAGE_SERVICE) as StorageManager
9999
storageManager.primaryStorageVolume.createOpenDocumentTreeIntent()
100100
} else Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
101101
}
102102
}
103-
104-
@Suppress("override_deprecation")
105-
// this is just a sample app, ignore this.
106-
override fun onBackPressed() = finishAffinity()
107103
}

app/src/main/res/layout/activity_main.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
44
android:layout_height="wrap_content"
5+
android:fitsSystemWindows="true"
56
android:gravity="center"
67
android:orientation="vertical">
78

build.gradle

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
2-
import com.vanniktech.maven.publish.SonatypeHost
2+
import com.vanniktech.maven.publish.JavadocJar
3+
import com.vanniktech.maven.publish.SourcesJar
34

45
buildscript {
56
repositories {
@@ -8,11 +9,10 @@ buildscript {
89
}
910

1011
dependencies {
11-
classpath 'com.android.tools.build:gradle:8.7.3'
12-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23"
12+
classpath "com.android.tools.build:gradle:9.0.0"
1313

14-
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.9.20'
15-
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.30.0'
14+
classpath "org.jetbrains.dokka:dokka-gradle-plugin:2.1.0"
15+
classpath "com.vanniktech:gradle-maven-publish-plugin:0.36.0"
1616
}
1717
}
1818

@@ -23,18 +23,22 @@ allprojects {
2323
}
2424

2525
plugins.withId("com.vanniktech.maven.publish.base") {
26-
version "1.2"
27-
group "com.lazygeniouz"
26+
version = "1.3"
27+
group = "com.lazygeniouz"
2828

2929
mavenPublishing {
3030
signAllPublications()
3131
pomFromGradleProperties()
32-
publishToMavenCentral(SonatypeHost.S01, true)
33-
configure(new AndroidSingleVariantLibrary("release", true, true))
32+
publishToMavenCentral(true)
33+
configure(new AndroidSingleVariantLibrary(
34+
new JavadocJar.Dokka("dokkaHtml"),
35+
new SourcesJar.Sources(),
36+
"release"
37+
))
3438
}
3539
}
3640
}
3741

38-
tasks.register('clean', Delete) {
42+
tasks.register("clean", Delete) {
3943
delete rootProject.layout.buildDirectory
4044
}

dfc/build.gradle

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,27 @@
11
plugins {
22
id 'com.android.library'
3-
id 'kotlin-android'
43
id 'org.jetbrains.dokka'
54
id 'com.vanniktech.maven.publish.base'
65
}
76

87
android {
9-
compileSdk 35
10-
namespace 'com.lazygeniouz.dfc'
8+
compileSdk = 36
9+
namespace = "com.lazygeniouz.dfc"
1110

1211
defaultConfig {
13-
minSdk 21
14-
targetSdk 35
12+
minSdk = 21
13+
targetSdk = 36
1514
}
1615

1716
buildTypes {
1817
release {
19-
minifyEnabled false
18+
minifyEnabled = false
2019
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2120
}
2221
}
2322

2423
compileOptions {
25-
sourceCompatibility JavaVersion.VERSION_17
26-
targetCompatibility JavaVersion.VERSION_17
27-
}
28-
29-
kotlinOptions {
30-
jvmTarget = JavaVersion.VERSION_17.toString()
24+
sourceCompatibility = JavaVersion.VERSION_17
25+
targetCompatibility = JavaVersion.VERSION_17
3126
}
3227
}

gradle.properties

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
android.useAndroidX=true
22
kotlin.code.style=official
3-
android.enableJetifier=true
43
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
54

6-
android.nonFinalResIds=false
7-
android.nonTransitiveRClass=false
8-
android.defaults.buildfeatures.buildconfig=true
95

106
POM_PACKAGING=aar
117
POM_NAME=dfc

gradle/wrapper/gradle-wrapper.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
#Fri Feb 06 19:51:09 IST 2026
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
4+
distributionSha256Sum=a17ddd85a26b6a7f5ddb71ff8b05fc5104c0202c6e64782429790c933686c806
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
46
networkTimeout=10000
57
validateDistributionUrl=true
68
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)