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 db41c94 commit 83389d8
Showing 1 changed file with 18 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -924,45 +924,39 @@ private void updateSortAndGridMenuItems() {
* return Count of folder levels browsed up.
*/
public int onBrowseUp() {
if (mFile == null) {
return 0;
}

OCFile parentDir = null;
OCFile parentDir;
int moveCount = 0;
FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
String parentPath = null;

if (mFile.getParentId() != FileDataStorageManager.ROOT_PARENT_ID) {
parentPath = new File(mFile.getRemotePath()).getParent();
if (parentPath != null) {
if (mFile != null) {
FileDataStorageManager storageManager = mContainerActivity.getStorageManager();

String parentPath = null;
if (mFile.getParentId() != FileDataStorageManager.ROOT_PARENT_ID) {
parentPath = new File(mFile.getRemotePath()).getParent();
parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath :
parentPath + OCFile.PATH_SEPARATOR;
parentDir = storageManager.getFileByPath(parentPath);
moveCount++;
} else {
parentDir = storageManager.getFileByPath(ROOT_PATH);
}
} else {
parentDir = storageManager.getFileByPath(ROOT_PATH);
}

while (parentDir == null) {
parentPath = new File(parentPath).getParent();
if (parentPath != null) {
while (parentDir == null) {
parentPath = new File(parentPath).getParent();
parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath :
parentPath + OCFile.PATH_SEPARATOR;
parentDir = storageManager.getFileByPath(parentPath);
moveCount++;
}
}
} // exit is granted because storageManager.getFileByPath("/") never returns null
mFile = parentDir;

mFile = parentDir;
listDirectory(mFile, MainApp.isOnlyOnDevice(), false);

listDirectory(mFile, MainApp.isOnlyOnDevice(), false);
onRefresh(false);

onRefresh(false);
// restore index and top position
restoreIndexAndTopPosition();

// restore index and top position
restoreIndexAndTopPosition();
} // else - should never happen now

return moveCount;
}
Expand Down

0 comments on commit 83389d8

Please sign in to comment.