Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue #3245 #3251

Open
wants to merge 6 commits into
base: release/3.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 17 additions & 11 deletions app/src/main/java/com/amaze/filemanager/adapters/HiddenAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,24 @@ class HiddenAdapter(
// if the user taps on the delete button, un-hide the file.
// TODO: the "hide files" feature just hide files from view in Amaze and not create
// .nomedia
if (!file.isSmb && file.isDirectory(context)) {
val nomediaFile = HybridFileParcelable(
hiddenFiles[position].path + "/" + FileUtils.NOMEDIA_FILE)
nomediaFile.mode = OpenMode.FILE
val filesToDelete = ArrayList<HybridFileParcelable>()
filesToDelete.add(nomediaFile)
val task = DeleteTask(context)
task.execute(filesToDelete)
thread {
val fragmentActivity = mainFragment.requireActivity()
if (!file.isSmb && file.isDirectory(context)) {
val nomediaFile = HybridFileParcelable(
file.path + "/" + FileUtils.NOMEDIA_FILE)
nomediaFile.mode = OpenMode.FILE
val filesToDelete = ArrayList<HybridFileParcelable>()
filesToDelete.add(nomediaFile)
val task = DeleteTask(context)
task.execute(filesToDelete)
}
DataUtils.getInstance().removeHiddenFile(file.path)
hiddenFiles.remove(file)
val position = hiddenFiles.indexOf(file)
fragmentActivity.runOnUiThread {
notifyItemRemoved(position)
}
}
DataUtils.getInstance().removeHiddenFile(hiddenFiles[position].path)
hiddenFiles.remove(hiddenFiles[position])
notifyItemRemoved(position)
}
holder.row.setOnClickListener {
// if the user taps on the hidden file, take the user there.
Expand Down
24 changes: 3 additions & 21 deletions app/src/main/java/com/amaze/filemanager/filesystem/HybridFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public String getParentName() {

/**
* Whether this object refers to a directory or file, handles all types of files
*
* Warning: Can't be used directly in UI/main thread
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a @WorkerThread annotation.

* @deprecated use {@link #isDirectory(Context)} to handle content resolvers
*/
public boolean isDirectory() {
Expand Down Expand Up @@ -558,31 +558,13 @@ public Boolean execute(SFTPClient client) {
isDirectory = OTGUtil.getDocumentFile(path, context, false).isDirectory();
break;
case DROPBOX:
isDirectory =
dataUtils
.getAccount(OpenMode.DROPBOX)
.getMetadata(CloudUtil.stripPath(OpenMode.DROPBOX, path))
.getFolder();
break;
case BOX:
isDirectory =
dataUtils
.getAccount(OpenMode.BOX)
.getMetadata(CloudUtil.stripPath(OpenMode.BOX, path))
.getFolder();
break;
case GDRIVE:
isDirectory =
dataUtils
.getAccount(OpenMode.GDRIVE)
.getMetadata(CloudUtil.stripPath(OpenMode.GDRIVE, path))
.getFolder();
break;
case ONEDRIVE:
isDirectory =
dataUtils
.getAccount(OpenMode.ONEDRIVE)
.getMetadata(CloudUtil.stripPath(OpenMode.ONEDRIVE, path))
.getAccount(mode)
.getMetadata(CloudUtil.stripPath(mode, path))
.getFolder();
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class MainActivityActionMode(private val mainActivityReference: WeakReference<Ma
hideOption(R.id.share, menu)
hideOption(R.id.openwith, menu)
if (mainActivity.mReturnIntent) showOption(R.id.openmulti, menu)
// hideOption(R.id.setringtone,menu);
// hideOption(R.id.setringtone,menu);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't leave commented code.

mode.title = mainActivity.resources.getString(R.string.select)
mainActivity
.updateViews(
Expand Down Expand Up @@ -214,7 +214,7 @@ class MainActivityActionMode(private val mainActivityReference: WeakReference<Ma
if (mainFragmentViewModel.openMode != OpenMode.FILE) {
hideOption(R.id.openwith, menu)
hideOption(R.id.compress, menu)
hideOption(R.id.hide, menu)
// hideOption(R.id.hide, menu)
hideOption(R.id.addshortcut, menu)
}
}
Expand Down