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

Add fab button for sorting group items #30

Closed
wants to merge 1 commit into from

Conversation

lgjint
Copy link

@lgjint lgjint commented Jun 2, 2024

For the updateExpand function, when I click on the fab button to update the sorting mode, the value of group.isExpand is not consistent with Libbox.newStandaloneCommandClient().setGroupExpand(group.tag, isExpand). This causes the expand state of the group to change back to its original state.

private fun updateExpand(isExpand: Boolean? = null) {
val newExpandStatus = isExpand ?: group.isExpand
if (isExpand != null) {
GlobalScope.launch {
runCatching {
Libbox.newStandaloneCommandClient().setGroupExpand(group.tag, isExpand)

The group.isExpand is synchronized by adding the following line, but I'm not sure if this is the behavior you want for the function

https://github.com/lgjint/sing-box-for-android/blob/74177358ed9f7ed0bde8187b81a84566a28da9d3/app/src/main/java/io/nekohasekai/sfa/ui/dashboard/GroupsFragment.kt#L201

Preview:

add-sort-button.mp4

@nekohasekai
Copy link
Member

Doesn't this conflict with material design?

@lgjint
Copy link
Author

lgjint commented Jun 3, 2024

Doesn't this conflict with material design?

I'd close this PR if you think it violates material design.

Perhaps a better solution would be to add a sort button next to the urltest button for each group.

But that might require adding logic to libbox to store the sortMode or adding an extra group table to the database?

@lgjint lgjint force-pushed the add-sort-button branch from 7417735 to a5b1c08 Compare June 4, 2024 12:23
@lgjint
Copy link
Author

lgjint commented Jun 4, 2024

Refer to Material Design Document, I put the sort button above the service start/stop button and adjusted it to the small fab style.

Preview:

add-sort-button-new.mp4

@nekohasekai nekohasekai force-pushed the main branch 3 times, most recently from 8622e6a to 00e3a80 Compare June 9, 2024 05:20
@lgjint lgjint closed this Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants