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

BugFix Check emptiness of previousSortGroupState #12540

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2486,7 +2486,12 @@ private void setSortListGroup(boolean currentListGroupVisibility, boolean show)
* visibility earlier using {@link #setSortListGroup(boolean, boolean)}
*/
private void popSortListGroupVisibility() {
boolean popped = previousSortGroupState.pop();
showSortListGroup(popped);
showSortListGroup(false);
Copy link
Collaborator

@ZetaTom ZetaTom Feb 14, 2024

Choose a reason for hiding this comment

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

This would negate purpose of previousSortGroupState, which was introduced by #11965. If this choice was deliberate, check that all edge cases are handled appropriately and remove this variable entirely.

Copy link
Collaborator Author

@alperozturk96 alperozturk96 Feb 14, 2024

Choose a reason for hiding this comment

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

Current implementation on master is broken. We should't see SortListGroup in file detail or file sharing tab also we have crash right now. Crash has been fixed and appearance of SortListGroup working as expected (visible in file list not visible in file details, sharing).

This PR aims to fix crash and appearance of SortListGroup not refactor.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I also agree with Tom, but we should create a new Issue about it and for now merge to fix the crash.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JonasMayerDev I agree


if (previousSortGroupState.isEmpty()) {
return;
}

previousSortGroupState.pop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,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.FileDisplayActivity;
import com.owncloud.android.ui.fragment.SearchType;
import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface;
import com.owncloud.android.ui.preview.PreviewTextFragment;
Expand Down Expand Up @@ -160,6 +161,10 @@ public OCFileListAdapter(
this.gridView = gridView;
mStorageManager = transferServiceGetter.getStorageManager();

if (activity instanceof FileDisplayActivity) {
((FileDisplayActivity) activity).showSortListGroup(true);
}

if (mStorageManager == null) {
mStorageManager = new FileDataStorageManager(user, activity.getContentResolver());
}
Expand Down
Loading