Revert changes, only bug-fix

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-09-23 12:09:48 +02:00
parent 25f203c5d1
commit d6f57ed97a
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF
2 changed files with 36 additions and 0 deletions

View file

@ -760,6 +760,10 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
return this.sharedViaLink; return this.sharedViaLink;
} }
public boolean isShared() {
return isSharedViaLink() || isSharedWithSharee() || isSharedWithMe();
}
public String getPermissions() { public String getPermissions() {
return this.permissions; return this.permissions;
} }

View file

@ -60,6 +60,7 @@ import com.owncloud.android.lib.resources.shares.ShareeUser;
import com.owncloud.android.operations.RefreshFolderOperation; import com.owncloud.android.operations.RefreshFolderOperation;
import com.owncloud.android.operations.RemoteOperationFailedException; import com.owncloud.android.operations.RemoteOperationFailedException;
import com.owncloud.android.ui.activity.ComponentsGetter; import com.owncloud.android.ui.activity.ComponentsGetter;
import com.owncloud.android.ui.activity.DrawerActivity;
import com.owncloud.android.ui.activity.FileDisplayActivity; import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.fragment.SearchType; import com.owncloud.android.ui.fragment.SearchType;
import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface; import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface;
@ -733,6 +734,30 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
return !TextUtils.isEmpty(currentDirectory.getRichWorkspace().trim()); return !TextUtils.isEmpty(currentDirectory.getRichWorkspace().trim());
} }
private List<OCFile> filterSharedFiles(Iterable<OCFile> files) {
List<OCFile> ret = new ArrayList<>();
for (OCFile file : files) {
if (file.isShared()) {
ret.add(file);
}
}
return ret;
}
private List<OCFile> filterFavoriteFiles(Iterable<OCFile> files) {
List<OCFile> ret = new ArrayList<>();
for (OCFile file : files) {
if (file.isFavorite()) {
ret.add(file);
}
}
return ret;
}
/** /**
* Change the adapted directory for a new one * Change the adapted directory for a new one
* *
@ -765,6 +790,13 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
if (OCFile.ROOT_PATH.equals(directory.getRemotePath()) && MainApp.isOnlyPersonFiles()) { if (OCFile.ROOT_PATH.equals(directory.getRemotePath()) && MainApp.isOnlyPersonFiles()) {
mFiles = limitToPersonalFiles(mFiles); mFiles = limitToPersonalFiles(mFiles);
} }
if (DrawerActivity.menuItemId == R.id.nav_shared && currentDirectory.isRootDirectory()) {
mFiles = filterSharedFiles(mFiles);
}
if (DrawerActivity.menuItemId == R.id.nav_favorites && currentDirectory.isRootDirectory()) {
mFiles = filterFavoriteFiles(mFiles);
}
sortOrder = preferences.getSortOrderByFolder(directory); sortOrder = preferences.getSortOrderByFolder(directory);
mFiles = sortOrder.sortCloudFiles(mFiles); mFiles = sortOrder.sortCloudFiles(mFiles);
prepareListOfHiddenFiles(); prepareListOfHiddenFiles();