mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
exclude SD and OTG from SAF restricted directories
This commit is contained in:
@ -9,13 +9,13 @@ if (keystorePropertiesFile.exists()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 30
|
||||||
buildToolsVersion "29.0.3"
|
buildToolsVersion "29.0.3"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.simplemobiletools.filemanager.pro"
|
applicationId "com.simplemobiletools.filemanager.pro"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 108
|
versionCode 108
|
||||||
versionName "6.9.4"
|
versionName "6.9.4"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
@ -58,7 +58,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:649211e294'
|
implementation project(":commons")
|
||||||
implementation 'com.github.Stericson:RootTools:df729dcb13'
|
implementation 'com.github.Stericson:RootTools:df729dcb13'
|
||||||
implementation 'com.github.Stericson:RootShell:1.6'
|
implementation 'com.github.Stericson:RootShell:1.6'
|
||||||
implementation 'com.alexvasilkov:gesture-views:2.5.2'
|
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 kotlinx.android.synthetic.main.item_section.view.*
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
|
||||||
import java.net.URI
|
|
||||||
import java.net.URLEncoder
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.zip.ZipEntry
|
import java.util.zip.ZipEntry
|
||||||
import java.util.zip.ZipFile
|
|
||||||
import java.util.zip.ZipInputStream
|
import java.util.zip.ZipInputStream
|
||||||
import java.util.zip.ZipOutputStream
|
import java.util.zip.ZipOutputStream
|
||||||
|
|
||||||
@ -469,9 +465,9 @@ class ItemsAdapter(
|
|||||||
|
|
||||||
CompressAsDialog(activity, firstPath) {
|
CompressAsDialog(activity, firstPath) {
|
||||||
val destination = it
|
val destination = it
|
||||||
activity.handlePrimarySAFDialog(firstPath) { granted ->
|
activity.handlePrimaryAndroidSAFDialog(firstPath) { granted ->
|
||||||
if (!granted) {
|
if (!granted) {
|
||||||
return@handlePrimarySAFDialog
|
return@handlePrimaryAndroidSAFDialog
|
||||||
}
|
}
|
||||||
activity.handleSAFDialog(firstPath) {
|
activity.handleSAFDialog(firstPath) {
|
||||||
if (!it) {
|
if (!it) {
|
||||||
|
@ -68,10 +68,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca
|
|||||||
}
|
}
|
||||||
isRPlus() || path.startsWith(activity.internalStoragePath, true) -> {
|
isRPlus() || path.startsWith(activity.internalStoragePath, true) -> {
|
||||||
if (activity.isRestrictedAndroidDir(path)) {
|
if (activity.isRestrictedAndroidDir(path)) {
|
||||||
activity.handlePrimarySAFDialog(path) {
|
activity.handlePrimaryAndroidSAFDialog(path) {
|
||||||
if (!it) {
|
if (!it) {
|
||||||
callback(false)
|
callback(false)
|
||||||
return@handlePrimarySAFDialog
|
return@handlePrimaryAndroidSAFDialog
|
||||||
}
|
}
|
||||||
if (activity.createSAFOnlyDirectory(path)) {
|
if (activity.createSAFOnlyDirectory(path)) {
|
||||||
success(alertDialog)
|
success(alertDialog)
|
||||||
@ -103,10 +103,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca
|
|||||||
try {
|
try {
|
||||||
when {
|
when {
|
||||||
activity.isRestrictedAndroidDir(path) -> {
|
activity.isRestrictedAndroidDir(path) -> {
|
||||||
activity.handlePrimarySAFDialog(path) {
|
activity.handlePrimaryAndroidSAFDialog(path) {
|
||||||
if (!it) {
|
if (!it) {
|
||||||
callback(false)
|
callback(false)
|
||||||
return@handlePrimarySAFDialog
|
return@handlePrimaryAndroidSAFDialog
|
||||||
}
|
}
|
||||||
if (activity.createSAFOnlyFile(path)) {
|
if (activity.createSAFOnlyFile(path)) {
|
||||||
success(alertDialog)
|
success(alertDialog)
|
||||||
|
@ -188,7 +188,12 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
|||||||
val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST
|
val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST
|
||||||
|
|
||||||
if (context.isRestrictedAndroidDir(path)) {
|
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) {
|
context.getStorageItemsWithTreeUri(path, context.config.shouldShowHidden, getProperChildCount) {
|
||||||
callback(path, getListItemsFromFileDirItems(it))
|
callback(path, getListItemsFromFileDirItems(it))
|
||||||
}
|
}
|
||||||
|
@ -122,19 +122,18 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
|||||||
FileColumns.SIZE
|
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 {
|
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 {
|
cursor?.use {
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.5.30'
|
ext.kotlin_version = '1.5.31'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
@ -9,7 +9,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// 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
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
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 ':app'
|
||||||
include ':commons'
|
include ':commons'
|
||||||
project(":commons").projectDir = new File("/Users/cyberman/StudioProjects/Simple-Commons/commons")
|
project(":commons").projectDir = new File("/Users/darthpaul/StudioProjects/Simple-Commons/commons")
|
||||||
|
Reference in New Issue
Block a user