Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions PhotoViewerKotlin/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" >

<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

<application
android:hardwareAccelerated="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class MainActivity : AppCompatActivity() {
private lateinit var recyclerView: RecyclerView
private lateinit var adapter: Adapter

private var requestedPermission = permission.READ_MEDIA_IMAGES;

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
Expand All @@ -38,7 +40,7 @@ class MainActivity : AppCompatActivity() {
}

private fun checkPermission(): Boolean {
val result = ContextCompat.checkSelfPermission(applicationContext, permission.READ_EXTERNAL_STORAGE)
val result = ContextCompat.checkSelfPermission(applicationContext, requestedPermission)
return result == PackageManager.PERMISSION_GRANTED
}

Expand All @@ -54,7 +56,7 @@ class MainActivity : AppCompatActivity() {
private fun requestPermission() {
ActivityCompat.requestPermissions(
this,
arrayOf(permission.READ_EXTERNAL_STORAGE),
arrayOf(requestedPermission),
PERMISSION_REQUEST_CODE
)
}
Expand Down Expand Up @@ -100,10 +102,10 @@ class MainActivity : AppCompatActivity() {
if (grantResults.isNotEmpty()) {
val storageAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED
if (storageAccepted) {
Toast.makeText(this, "Permissions Granted..", Toast.LENGTH_SHORT).show()
Toast.makeText(this, "Permissions Granted...", Toast.LENGTH_SHORT).show()
imagePath
} else {
Toast.makeText(this, "Permissions denied, Permissions are required to use the app..", Toast.LENGTH_SHORT).show()
Toast.makeText(this, "Permissions denied, Permissions are required to use the app...", Toast.LENGTH_SHORT).show()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion PhotoViewerKotlin/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
agp = "8.8.0"
agp = "8.13.1"
kotlin = "1.9.24"
coreKtx = "1.10.1"
junit = "4.13.2"
Expand Down
2 changes: 1 addition & 1 deletion PhotoViewerKotlin/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Feb 04 14:09:14 IST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists