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

Is there any method to swipe slowly? #12

Open
Dajiang1202 opened this issue Sep 21, 2020 · 9 comments
Open

Is there any method to swipe slowly? #12

Dajiang1202 opened this issue Sep 21, 2020 · 9 comments

Comments

@Dajiang1202
Copy link

device.ext_smooth_swipe(
[(600, 2000), (600, 1500)], duration=1000, pressure=100, part=100
)
It swipes so fast so I can only see the start frame and end frame.
I tried to adjust 'part' and 'duration' higher up, but didn't work and still swipe so fast.

@williamfzc
Copy link
Owner

ext_smooth_swipe works fine on my phone before and I have no more free time to check it :(
Maybe you can view its implementation (ext_smooth_swipe) to figure it out. It's not difficult to write another one.
Please let me know if you still have some questions after that.

@Dajiang1202
Copy link
Author

ext_smooth_swipe works fine on my phone before and I have no more free time to check it :(
Maybe you can view its implementation (ext_smooth_swipe) to figure it out. It's not difficult to write another one.
Please let me know if you still have some questions after that.

Now it can swipe as slowly as I want. I think I solved this problem by modifying the swipe function. When there are more than 2 points, only the last delay works and other delays (_builder.wait(duration)) don't work.

@williamfzc
Copy link
Owner

williamfzc commented Sep 23, 2020

ext_smooth_swipe works fine on my phone before and I have no more free time to check it :(
Maybe you can view its implementation (ext_smooth_swipe) to figure it out. It's not difficult to write another one.
Please let me know if you still have some questions after that.

Now it can swipe as slowly as I want. I think I solved this problem by modifying the swipe function. When there are more than 2 points, only the last delay works and other delays (_builder.wait(duration)) don't work.

Great! Could you please share a snippet about what you have modified?
It should be helpful and of course PR is welcome.

@Dajiang1202
Copy link
Author

ext_smooth_swipe works fine on my phone before and I have no more free time to check it :(
Maybe you can view its implementation (ext_smooth_swipe) to figure it out. It's not difficult to write another one.
Please let me know if you still have some questions after that.

Now it can swipe as slowly as I want. I think I solved this problem by modifying the swipe function. When there are more than 2 points, only the last delay works and other delays (_builder.wait(duration)) don't work.

Great! Could you please share a snippet about what you have modified?
It should be helpful and of course PR is welcome.

I actually just added one line in the swipe function (line 192).

 if duration:
     _builder.wait(duration)
     _builder.publish(self.connection) #this line is what I added

It works for my task.
example:

self.device.ext_smooth_swipe(
            [(500,1900), (500, 1700)], duration=10, pressure=100, part=10
        )

@Dajiang1202
Copy link
Author

ext_smooth_swipe works fine on my phone before and I have no more free time to check it :(
Maybe you can view its implementation (ext_smooth_swipe) to figure it out. It's not difficult to write another one.
Please let me know if you still have some questions after that.

Now it can swipe as slowly as I want. I think I solved this problem by modifying the swipe function. When there are more than 2 points, only the last delay works and other delays (_builder.wait(duration)) don't work.

Great! Could you please share a snippet about what you have modified?
It should be helpful and of course PR is welcome.

Not sure if it is helpful for other tasks. if it helps, it's my pleasure to do the course PR :)

@williamfzc
Copy link
Owner

self.device.ext_smooth_swipe(
[(500,1900), (500, 1700)], duration=10, pressure=100, part=10
)

Thanks and I have run your snippet. Maybe you should modify these args.

# increase parts
device.ext_smooth_swipe(
    [(500, 1900), (500, 1700)], duration=10, pressure=100, part=100
)

# or increase duration
device.ext_smooth_swipe(
    [(500, 1900), (500, 1700)], duration=100, pressure=100, part=10
)

It works as I expected. If not:

device.ext_smooth_swipe(
    [(100, 100), (400, 400), (200, 400)], duration=500, pressure=50, part=20
)

Did this snippet work fine on your device?

@Dajiang1202
Copy link
Author

(100, 100), (400, 400), (200, 400)], duration=500, pressure=50, part=20

self.device.ext_smooth_swipe(
[(500,1900), (500, 1700)], duration=10, pressure=100, part=10
)

Thanks and I have run your snippet. Maybe you should modify these args.

# increase parts
device.ext_smooth_swipe(
    [(500, 1900), (500, 1700)], duration=10, pressure=100, part=100
)

# or increase duration
device.ext_smooth_swipe(
    [(500, 1900), (500, 1700)], duration=100, pressure=100, part=10
)

It works as I expected. If not:

device.ext_smooth_swipe(
    [(100, 100), (400, 400), (200, 400)], duration=500, pressure=50, part=20
)

Did this snippet work fine on your device?

None of these 3 snippets work, and that's the reason why I opened this issue.
Maybe the phone I use causes the problem. (HUAWEI P40 PRO & EMUI 10.1)

@williamfzc
Copy link
Owner

Ah I do not have a HUAWEI device with me. It looks like a specific device issue.
This change will not break other functions I think. (I have tried it on my phone
Feel free to submit a PR
Thanks for your help :)

@Dajiang1202
Copy link
Author

Ah I do not have a HUAWEI device with me. It looks like a specific device issue.
This change will not break other functions I think. (I have tried it on my phone
Feel free to submit a PR
Thanks for your help :)

ok, thanks. After my project, I will try it on other phone to figure it out.

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

No branches or pull requests

2 participants