mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-02-15 19:30:52 +01:00
exclude SD and OTG from SAF restricted directories
This commit is contained in:
parent
2de754e4cf
commit
b7ef3993f2
@ -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'
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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))
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user