Browse Source

hurrah! update c:

Ethosa 2 years ago
parent
commit
1add77c77b

+ 1 - 1
app/build.gradle

@@ -15,7 +15,7 @@ android {
         minSdk 21
         targetSdk 33
         versionCode 29
-        versionName "0.10.2"
+        versionName "1.0.0"
         ndk {
             abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
         }

+ 1 - 0
app/src/main/AndroidManifest.xml

@@ -7,6 +7,7 @@
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
         tools:ignore="ScopedStorage" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER" />
 
     <application
         android:allowBackup="true"

+ 11 - 9
app/src/main/java/com/ethosa/ktc/college/ProCollege.kt

@@ -140,15 +140,17 @@ class ProCollege(
 
         fragment.binding.content.setDownloadListener { url, _, contentDisposition, mimetype, _ ->
             val req = DownloadManager.Request(Uri.parse(url))
-            req.setTitle(URLUtil.guessFileName(url, contentDisposition, mimetype))
-            req.setDescription("Downloading file...")
-            req.setNotificationVisibility(
-                DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED
-            )
-            req.setDestinationInExternalPublicDir(
-                Environment.DIRECTORY_DOWNLOADS,
-                URLUtil.guessFileName(url, contentDisposition, mimetype)
-            )
+                .setTitle(URLUtil.guessFileName(url, contentDisposition, mimetype))
+                .setDescription("Downloading file...")
+                .setNotificationVisibility(
+                    DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED
+                )
+                .setAllowedOverMetered(true)
+                .setAllowedOverRoaming(false)
+                .setDestinationInExternalPublicDir(
+                    Environment.DIRECTORY_DOWNLOADS,
+                    URLUtil.guessFileName(url, contentDisposition, mimetype)
+                )
             val dm = fragment.requireActivity().getSystemService(
                 DOWNLOAD_SERVICE
             ) as DownloadManager?