Skip to content

Commit

Permalink
Revert changes, only bug-fix
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Sep 23, 2024
1 parent 097b6ad commit db41c94
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 10 deletions.
4 changes: 4 additions & 0 deletions app/src/main/java/com/owncloud/android/datamodel/OCFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,10 @@ public boolean isSharedViaLink() {
return this.sharedViaLink;
}

public boolean isShared() {
return isSharedViaLink() || isSharedWithSharee() || isSharedWithMe();
}

public String getPermissions() {
return this.permissions;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -998,25 +998,22 @@ private Boolean isRootDirectory() {
@Override
public void onBackPressed() {
final boolean isDrawerOpen = isDrawerOpen();
if (isDrawerOpen) {
super.onBackPressed();
return;
}

final boolean isSearchOpen = isSearchOpen();

final Fragment leftFragment = getLeftFragment();

if (isSearchOpen) {
resetSearchAction();
return;
}
} else if (isDrawerOpen) {
super.onBackPressed();
} else if (leftFragment instanceof OCFileListFragment listOfFiles) {

final Fragment leftFragment = getLeftFragment();
if (leftFragment instanceof OCFileListFragment listOfFiles) {
// all closed
OCFile currentDir = getCurrentDir();
if (isRoot(currentDir)) {
finish();
return;
}

browseUp(listOfFiles);
} else {
popBack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import com.owncloud.android.operations.RefreshFolderOperation;
import com.owncloud.android.operations.RemoteOperationFailedException;
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.fragment.SearchType;
import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface;
Expand Down Expand Up @@ -733,6 +734,30 @@ public boolean shouldShowHeader() {
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
*
Expand Down Expand Up @@ -765,6 +790,13 @@ public void swapDirectory(
if (OCFile.ROOT_PATH.equals(directory.getRemotePath()) && MainApp.isOnlyPersonFiles()) {
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);
mFiles = sortOrder.sortCloudFiles(mFiles);
prepareListOfHiddenFiles();
Expand Down

0 comments on commit db41c94

Please sign in to comment.