shadowsocks / shadowsocks-android

A shadowsocks client for Android
Other
35.23k stars 11.57k forks source link

double click one profile and drag upwards, profiles would be displayed incorrectly #2752

Closed iamsad3508 closed 1 year ago

iamsad3508 commented 3 years ago

Please read contributing guidelines. Thanks.

Describe the bug select one profile, and double click the profile and drag upwards, profiles would be displayed incorrectly

To Reproduce Steps to reproduce the behavior: 1.select one profile 2.double click the profile fast 3.don't let go your finger and draw it upwards immediately

Expected behavior normal

Screenshots 20210628_162554

Smartphone (please complete the following information):

Configuration Put an x inside the [ ] that applies.

Additional context Add any other context about the problem here.

Mygod commented 3 years ago

Umm do not double click? 😭

iamsad3508 commented 3 years ago

🤣 it's ok to me, if you won't fix it

DescargarDixmax commented 2 years ago

And what is the fault for that double click operation?

MSVhora commented 1 year ago

Is anyone working on this issue?

Mygod commented 1 year ago

Not as far as I'm concerned. Feel free to submit a PR.

MSVhora commented 1 year ago

Can you assign it to me?

MSVhora commented 1 year ago

@Mygod There are a couple of optimizations we can do in the move function of ProfileAdapter.

1) I think instead of swapping each item in the [from, to] range, we can just swap [from, to] object's userOrder and [from, to] objects themselves in the array. 2) Instead of updated HashSet of Profile object, we can use HashMap of <profileId, Profile> to reduce the number of update operations on DB. For example, I dragged the item at index 20 to index 0 and back to index 20, which added 53 objects in the updated HashSet, where we only need to update at most 20.

MSVhora commented 1 year ago

@Mygod There are a couple of optimizations we can do in the move function of ProfileAdapter.

  1. I think instead of swapping each item in the [from, to] range, we can just swap [from, to] object's userOrder and [from, to] objects themselves in the array.
  2. Instead of updated HashSet of Profile object, we can use HashMap of <profileId, Profile> to reduce the number of update operations on DB. For example, I dragged the item at index 20 to index 0 and back to index 20, which added 53 objects in the updated HashSet, where we only need to update at most 20.

@Mygod Should I implement above optimization ?