diff --git a/app/build.gradle b/app/build.gradle index 88cc1fee..898fcb10 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,13 +9,13 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 29 + compileSdkVersion 30 buildToolsVersion "29.0.3" defaultConfig { applicationId "com.simplemobiletools.filemanager.pro" minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 30 versionCode 108 versionName "6.9.4" multiDexEnabled true @@ -58,7 +58,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:649211e294' + implementation project(":commons") implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.alexvasilkov:gesture-views:2.5.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt index 3b1a8493..ab97cdfb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt @@ -50,12 +50,8 @@ import kotlinx.android.synthetic.main.item_file_dir_list.view.item_name import kotlinx.android.synthetic.main.item_section.view.* import java.io.Closeable import java.io.File -import java.io.FileInputStream -import java.net.URI -import java.net.URLEncoder import java.util.* import java.util.zip.ZipEntry -import java.util.zip.ZipFile import java.util.zip.ZipInputStream import java.util.zip.ZipOutputStream @@ -469,9 +465,9 @@ class ItemsAdapter( CompressAsDialog(activity, firstPath) { val destination = it - activity.handlePrimarySAFDialog(firstPath) { granted -> + activity.handlePrimaryAndroidSAFDialog(firstPath) { granted -> if (!granted) { - return@handlePrimarySAFDialog + return@handlePrimaryAndroidSAFDialog } activity.handleSAFDialog(firstPath) { if (!it) { diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt index e24728c1..fa731fbc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt @@ -68,10 +68,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca } isRPlus() || path.startsWith(activity.internalStoragePath, true) -> { if (activity.isRestrictedAndroidDir(path)) { - activity.handlePrimarySAFDialog(path) { + activity.handlePrimaryAndroidSAFDialog(path) { if (!it) { callback(false) - return@handlePrimarySAFDialog + return@handlePrimaryAndroidSAFDialog } if (activity.createSAFOnlyDirectory(path)) { success(alertDialog) @@ -103,10 +103,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca try { when { activity.isRestrictedAndroidDir(path) -> { - activity.handlePrimarySAFDialog(path) { + activity.handlePrimaryAndroidSAFDialog(path) { if (!it) { callback(false) - return@handlePrimarySAFDialog + return@handlePrimaryAndroidSAFDialog } if (activity.createSAFOnlyFile(path)) { success(alertDialog) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt index 8174e4d0..13e6da3a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt @@ -188,7 +188,12 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST if (context.isRestrictedAndroidDir(path)) { - activity?.handlePrimarySAFDialog(path) { + activity?.handlePrimaryAndroidSAFDialog(path) { + if (!it) { + activity?.toast(R.string.no_storage_permissions) + return@handlePrimaryAndroidSAFDialog + } + context.getStorageItemsWithTreeUri(path, context.config.shouldShowHidden, getProperChildCount) { callback(path, getListItemsFromFileDirItems(it)) } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/RecentsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/RecentsFragment.kt index 8893e599..2deea1b6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/RecentsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/RecentsFragment.kt @@ -122,19 +122,18 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage FileColumns.SIZE ) - val cursor = if (isOreoPlus()) { - val queryArgs = bundleOf( - ContentResolver.QUERY_ARG_LIMIT to RECENTS_LIMIT, - ContentResolver.QUERY_ARG_SORT_COLUMNS to arrayOf(FileColumns.DATE_MODIFIED), - ContentResolver.QUERY_ARG_SORT_DIRECTION to ContentResolver.QUERY_SORT_DIRECTION_DESCENDING - ) - context?.contentResolver?.query(uri, projection, queryArgs, null) - } else { - val sortOrder = "${FileColumns.DATE_MODIFIED} DESC LIMIT $RECENTS_LIMIT" - context?.contentResolver?.query(uri, projection, null, null, sortOrder) - } - try { + val cursor = if (isOreoPlus()) { + val queryArgs = bundleOf( + ContentResolver.QUERY_ARG_LIMIT to RECENTS_LIMIT, + ContentResolver.QUERY_ARG_SORT_COLUMNS to arrayOf(FileColumns.DATE_MODIFIED), + ContentResolver.QUERY_ARG_SORT_DIRECTION to ContentResolver.QUERY_SORT_DIRECTION_DESCENDING + ) + context?.contentResolver?.query(uri, projection, queryArgs, null) + } else { + val sortOrder = "${FileColumns.DATE_MODIFIED} DESC LIMIT $RECENTS_LIMIT" + context?.contentResolver?.query(uri, projection, null, null, sortOrder) + } cursor?.use { if (cursor.moveToFirst()) { do { diff --git a/build.gradle b/build.gradle index e0fb0bd8..9b82dbc6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.5.30' + ext.kotlin_version = '1.5.31' repositories { google() @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' + classpath 'com.android.tools.build:gradle:7.0.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7490f4ab..0896a415 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip diff --git a/settings.gradle b/settings.gradle index 772c2522..707304a6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,3 @@ include ':app' include ':commons' -project(":commons").projectDir = new File("/Users/cyberman/StudioProjects/Simple-Commons/commons") +project(":commons").projectDir = new File("/Users/darthpaul/StudioProjects/Simple-Commons/commons")