-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/4.0' of ssh://github.com/TeamAmaze/AmazeFileMan…
…ager into release/3.10
- Loading branch information
Showing
45 changed files
with
2,654 additions
and
1,723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,9 +85,10 @@ We strongly recommend using apk signed by us (either Play Store version or from | |
### License: | ||
|
||
Copyright (C) 2014-2018 Arpit Khurana <[email protected]> | ||
Copyright (C) 2014-2021 Vishal Nehra <[email protected]> | ||
Copyright (C) 2017-2021 Emmanuel Messulam <[email protected]> | ||
Copyright (C) 2018-2021 Raymond Lai <airwave209gt at gmail.com> | ||
Copyright (C) 2014-2023 Vishal Nehra <[email protected]> | ||
Copyright (C) 2017-2023 Emmanuel Messulam <[email protected]> | ||
Copyright (C) 2018-2023 Raymond Lai <airwave209gt at gmail.com> | ||
Copyright (C) 2019-2023 Vishnu Sanal T <t.v.s10123 at gmail.com> | ||
This file is part of Amaze File Manager. | ||
Amaze File Manager is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...c/main/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/BasicSearch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (C) 2014-2024 Arpit Khurana <[email protected]>, Vishal Nehra <[email protected]>, | ||
* Emmanuel Messulam<[email protected]>, Raymond Lai <airwave209gt at gmail.com> and Contributors. | ||
* | ||
* This file is part of Amaze File Manager. | ||
* | ||
* Amaze File Manager is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.amaze.filemanager.asynchronous.asynctasks.searchfilesystem | ||
|
||
import android.content.Context | ||
import com.amaze.filemanager.filesystem.HybridFileParcelable | ||
import com.amaze.filemanager.filesystem.root.ListFilesCommand.listFiles | ||
|
||
class BasicSearch( | ||
query: String, | ||
path: String, | ||
searchParameters: SearchParameters, | ||
context: Context | ||
) : FileSearch(query, path, searchParameters) { | ||
private val applicationContext = context.applicationContext | ||
|
||
override suspend fun search(filter: SearchFilter) { | ||
listFiles( | ||
path, | ||
SearchParameter.ROOT in searchParameters, | ||
SearchParameter.SHOW_HIDDEN_FILES in searchParameters, | ||
{ } | ||
) { hybridFileParcelable: HybridFileParcelable -> | ||
if (SearchParameter.SHOW_HIDDEN_FILES in searchParameters || | ||
!hybridFileParcelable.isHidden | ||
) { | ||
val resultRange = | ||
filter.searchFilter(hybridFileParcelable.getName(applicationContext)) | ||
if (resultRange != null) { | ||
publishProgress(hybridFileParcelable, resultRange) | ||
} | ||
} | ||
} | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
...rc/main/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/DeepSearch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright (C) 2014-2024 Arpit Khurana <[email protected]>, Vishal Nehra <[email protected]>, | ||
* Emmanuel Messulam<[email protected]>, Raymond Lai <airwave209gt at gmail.com> and Contributors. | ||
* | ||
* This file is part of Amaze File Manager. | ||
* | ||
* Amaze File Manager is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.amaze.filemanager.asynchronous.asynctasks.searchfilesystem | ||
|
||
import android.content.Context | ||
import com.amaze.filemanager.fileoperations.filesystem.OpenMode | ||
import com.amaze.filemanager.filesystem.HybridFile | ||
import kotlinx.coroutines.isActive | ||
import org.slf4j.LoggerFactory | ||
import kotlin.coroutines.coroutineContext | ||
|
||
class DeepSearch( | ||
query: String, | ||
path: String, | ||
searchParameters: SearchParameters, | ||
context: Context, | ||
private val openMode: OpenMode | ||
) : FileSearch(query, path, searchParameters) { | ||
private val LOG = LoggerFactory.getLogger(DeepSearch::class.java) | ||
|
||
private val applicationContext: Context | ||
|
||
init { | ||
applicationContext = context.applicationContext | ||
} | ||
|
||
/** | ||
* Search for occurrences of a given text in file names and publish the result | ||
* | ||
* @param directory the current path | ||
*/ | ||
override suspend fun search(filter: SearchFilter) { | ||
val directory = HybridFile(openMode, path) | ||
if (directory.isSmb) return | ||
|
||
if (directory.isDirectory(applicationContext)) { | ||
// you have permission to read this directory | ||
val worklist = ArrayDeque<HybridFile>() | ||
worklist.add(directory) | ||
while (coroutineContext.isActive && worklist.isNotEmpty()) { | ||
val nextFile = worklist.removeFirst() | ||
nextFile.forEachChildrenFile( | ||
applicationContext, | ||
SearchParameter.ROOT in searchParameters | ||
) { file -> | ||
if (!file.isHidden || SearchParameter.SHOW_HIDDEN_FILES in searchParameters) { | ||
val resultRange = filter.searchFilter(file.getName(applicationContext)) | ||
if (resultRange != null) { | ||
publishProgress(file, resultRange) | ||
} | ||
if (file.isDirectory(applicationContext)) { | ||
worklist.add(file) | ||
} | ||
} | ||
} | ||
} | ||
} else { | ||
LOG.warn("Cannot search " + directory.path + ": Permission Denied") | ||
} | ||
} | ||
} |
Oops, something went wrong.