Skip to content

Commit 3518943

Browse files
committed
refactor: update Proguard rules and enable edge-to-edge display
This commit updates the Proguard rules for both the library and sample app to use a simpler configuration. It also enables edge-to-edge display in all Activities within the `filepickerlibrary` by calling `enableEdgeToEdge()` in their `onCreate` methods. Additionally, the sample app's version code and name have been incremented, and some minor UI adjustments have been made to the `FilePickerWithResultList` composable. Test dependencies and Kotlin JVM target settings have been removed from the library's build script.
1 parent 6c2ae72 commit 3518943

File tree

10 files changed

+22
-89
lines changed

10 files changed

+22
-89
lines changed

filepickerlibrary/build.gradle.kts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ android {
4545
sourceCompatibility = JavaVersion.valueOf(libs.versions.jdkVersion.get())
4646
targetCompatibility = JavaVersion.valueOf(libs.versions.jdkVersion.get())
4747
}
48-
49-
kotlinOptions {
50-
jvmTarget = JavaVersion.valueOf(libs.versions.jdkVersion.get()).toString()
51-
}
5248
}
5349

5450
dependencies {
@@ -73,24 +69,6 @@ dependencies {
7369
androidTestImplementation(libs.androidx.ui.test.junit4)
7470
debugImplementation(libs.androidx.ui.tooling)
7571
debugImplementation(libs.androidx.ui.test.manifest)
76-
77-
// JUnit
78-
testImplementation("junit:junit:4.13.2")
79-
80-
// AndroidX Test
81-
testImplementation("androidx.test:core:1.5.0")
82-
testImplementation("androidx.test:runner:1.5.2")
83-
testImplementation("androidx.test.ext:junit:1.1.5")
84-
85-
// Robolectric for (Android framework simulation in unit tests)
86-
testImplementation("org.robolectric:robolectric:4.10.3")
87-
88-
// Mockito for mock(ing)
89-
testImplementation("org.mockito:mockito-core:5.7.0")
90-
testImplementation("org.mockito:mockito-inline:5.2.0")
91-
// For mocking final classes)
92-
// Optional: If you( need to mock Kotlin classes better)
93-
testImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1")
9472
}
9573

9674
mavenPublishing {
Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1 @@
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.kts.
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-
-keepclasseswithmembernames class com.nareshchocha.filepickerlibrary.models.**{
23-
*;
24-
}
25-
#-keepclassmembers class * extends com.nareshchocha.filepickerlibrary.models.BaseConfig {
26-
# *;
27-
#}
28-
#-keepclassmembers class * extends com.nareshchocha.filepickerlibrary.models.PickMediaType {
29-
# *;
30-
#}
31-
32-
-keepclassmembers class * extends androidx.appcompat.app.AppCompatActivity {
33-
*;
34-
}
1+
-keep,allowobfuscation class com.nareshchocha.filepickerlibrary.** {*;}

filepickerlibrary/src/main/java/com/nareshchocha/filepickerlibrary/ui/activitys/DocumentFilePickerActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.os.Build
66
import android.os.Bundle
77
import androidx.activity.ComponentActivity
88
import androidx.activity.compose.setContent
9+
import androidx.activity.enableEdgeToEdge
910
import androidx.activity.result.contract.ActivityResultContracts
1011
import androidx.compose.runtime.Composable
1112
import androidx.compose.runtime.getValue
@@ -64,6 +65,7 @@ internal class DocumentFilePickerActivity : ComponentActivity() {
6465

6566
override fun onCreate(savedInstanceState: Bundle?) {
6667
super.onCreate(savedInstanceState)
68+
enableEdgeToEdge()
6769
if (mDocumentFilePickerConfig == null) {
6870
setCanceledResult(getString(R.string.document_file_picker_config_null_error))
6971
return

filepickerlibrary/src/main/java/com/nareshchocha/filepickerlibrary/ui/activitys/ImageCaptureActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.os.Build
77
import android.os.Bundle
88
import androidx.activity.ComponentActivity
99
import androidx.activity.compose.setContent
10+
import androidx.activity.enableEdgeToEdge
1011
import androidx.activity.result.contract.ActivityResultContracts
1112
import androidx.compose.runtime.Composable
1213
import androidx.compose.runtime.getValue
@@ -79,6 +80,7 @@ internal class ImageCaptureActivity : ComponentActivity() {
7980

8081
override fun onCreate(savedInstanceState: Bundle?) {
8182
super.onCreate(savedInstanceState)
83+
enableEdgeToEdge()
8284
if (mImageCaptureConfig == null) {
8385
imageFile?.delete()
8486
setCanceledResult(getString(R.string.image_capture_config_null_error))

filepickerlibrary/src/main/java/com/nareshchocha/filepickerlibrary/ui/activitys/MediaFilePickerActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.os.Build
77
import android.os.Bundle
88
import androidx.activity.ComponentActivity
99
import androidx.activity.compose.setContent
10+
import androidx.activity.enableEdgeToEdge
1011
import androidx.activity.result.contract.ActivityResultContracts
1112
import androidx.compose.runtime.Composable
1213
import androidx.compose.runtime.getValue
@@ -65,6 +66,7 @@ internal class MediaFilePickerActivity : ComponentActivity() {
6566

6667
override fun onCreate(savedInstanceState: Bundle?) {
6768
super.onCreate(savedInstanceState)
69+
enableEdgeToEdge()
6870
if (mPickMediaConfig == null) {
6971
setCanceledResult(getString(R.string.media_file_picker_config_null_error))
7072
return

filepickerlibrary/src/main/java/com/nareshchocha/filepickerlibrary/ui/activitys/PopUpActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.os.Build
66
import android.os.Bundle
77
import androidx.activity.ComponentActivity
88
import androidx.activity.compose.setContent
9+
import androidx.activity.enableEdgeToEdge
910
import androidx.compose.foundation.background
1011
import androidx.compose.foundation.horizontalScroll
1112
import androidx.compose.foundation.layout.Column
@@ -68,6 +69,7 @@ internal class PopUpActivity : ComponentActivity() {
6869

6970
override fun onCreate(savedInstanceState: Bundle?) {
7071
super.onCreate(savedInstanceState)
72+
enableEdgeToEdge()
7173
setContent {
7274
val pickerData = mPickerData
7375
if (pickerData == null) {

filepickerlibrary/src/main/java/com/nareshchocha/filepickerlibrary/ui/activitys/VideoCaptureActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.os.Build
77
import android.os.Bundle
88
import androidx.activity.ComponentActivity
99
import androidx.activity.compose.setContent
10+
import androidx.activity.enableEdgeToEdge
1011
import androidx.activity.result.contract.ActivityResultContracts
1112
import androidx.compose.runtime.Composable
1213
import androidx.compose.runtime.getValue
@@ -77,6 +78,7 @@ internal class VideoCaptureActivity : ComponentActivity() {
7778

7879
override fun onCreate(savedInstanceState: Bundle?) {
7980
super.onCreate(savedInstanceState)
81+
enableEdgeToEdge()
8082
if (mVideoCaptureConfig == null) {
8183
videoFile?.delete()
8284
setCanceledResult(getString(R.string.image_capture_config_null_error))

sample/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ android {
2222
libs.versions.targetSdk
2323
.get()
2424
.toInt()
25-
versionCode = 1
26-
versionName = "0.4.0"
25+
versionCode = 2
26+
versionName = "0.5.0"
2727

2828
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2929
}

sample/proguard-rules.pro

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
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.kts.
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
1+
-keep,allowobfuscation class com.nareshchocha.filepicker.** {*;}

sample/src/main/java/com/nareshchocha/filepicker/components/FilePickerWithResultList.kt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import androidx.compose.material3.MaterialTheme
2020
import androidx.compose.material3.Text
2121
import androidx.compose.runtime.Composable
2222
import androidx.compose.ui.Modifier
23-
import androidx.compose.ui.graphics.Color
2423
import androidx.compose.ui.layout.ContentScale
2524
import androidx.compose.ui.text.font.FontWeight
2625
import androidx.compose.ui.tooling.preview.Preview
@@ -46,17 +45,17 @@ fun FilePickerWithResultList(pickedFiles: List<PickedFile>) {
4645

4746
"video" -> {
4847
Row(
49-
modifier = Modifier
50-
.background(
51-
color = MaterialTheme.colorScheme.secondaryContainer,
52-
shape = RoundedCornerShape(8.dp)
53-
)
54-
.padding(12.dp)
48+
modifier =
49+
Modifier
50+
.background(
51+
color = MaterialTheme.colorScheme.secondaryContainer,
52+
shape = RoundedCornerShape(8.dp)
53+
).padding(12.dp)
5554
) {
5655
Icon(
5756
imageVector = Icons.Default.Videocam,
5857
contentDescription = "Video",
59-
tint = Color(0xFF1976D2),
58+
tint = MaterialTheme.colorScheme.outline,
6059
modifier = Modifier.padding(end = 8.dp)
6160
)
6261
Text(
@@ -73,8 +72,7 @@ fun FilePickerWithResultList(pickedFiles: List<PickedFile>) {
7372
.background(
7473
color = MaterialTheme.colorScheme.outline,
7574
shape = RoundedCornerShape(8.dp)
76-
)
77-
.padding(12.dp)
75+
).padding(12.dp)
7876
) {
7977
Text(
8078
text = "URI: ${file.uri}",

0 commit comments

Comments
 (0)