shadowsocks-android icon indicating copy to clipboard operation
shadowsocks-android copied to clipboard

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

Open iamsad3508 opened this issue 4 years ago • 3 comments

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):

  • Android/Chrome OS version: android 8.10
  • Device: [e.g. Google nexus 6P
  • Version:5.2.4
  • Last version that did not exhibit the issue: [not applicable]

Configuration Put an x inside the [ ] that applies.

  • [ ] IPv4 server address
  • [ ] IPv6 server address
  • [ ] Client IPv4 availability
  • [ ] Client IPv6 availability
  • Encrypt method:
  • Route
    • [ ] All
    • [ ] Bypass LAN
    • [ ] Bypass China
    • [ ] Bypass LAN & China
    • [ ] GFW List
    • [ ] China List
    • [ ] Custom rules
  • [ ] IPv6 route
  • [ ] Apps VPN mode
    • [ ] Bypass mode
  • Remote DNS: 8.8.8.8
  • [ ] DNS over UDP
  • Plugin configuration (if applicable):
  • [ ] Auto Connect
  • [ ] TCP Fast Open
  • If you're not using VPN mode, please supply more details here:

Additional context Add any other context about the problem here.

iamsad3508 avatar Jun 28 '21 13:06 iamsad3508

Umm do not double click? 😭

Mygod avatar Jun 28 '21 18:06 Mygod

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

iamsad3508 avatar Jun 28 '21 23:06 iamsad3508

And what is the fault for that double click operation?

DescargarDixmax avatar Apr 30 '22 09:04 DescargarDixmax

Is anyone working on this issue?

MSVhora avatar Apr 10 '23 18:04 MSVhora

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

Mygod avatar Apr 10 '23 18:04 Mygod

Can you assign it to me?

MSVhora avatar Apr 10 '23 19:04 MSVhora

@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 avatar Apr 11 '23 07:04 MSVhora

@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 ?

MSVhora avatar Apr 11 '23 14:04 MSVhora