Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RatelExtension
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ratel
RatelExtension
Commits
7c47c22e
Commit
7c47c22e
authored
Feb 12, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 滑动边界问题
parent
bf41ac2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
7 deletions
+33
-7
SwipeUtils.java
...om/virjar/ratel/api/extension/superappium/SwipeUtils.java
+26
-6
ViewImage.java
...com/virjar/ratel/api/extension/superappium/ViewImage.java
+7
-1
No files found.
src/main/java/com/virjar/ratel/api/extension/superappium/SwipeUtils.java
View file @
7c47c22e
...
...
@@ -159,15 +159,35 @@ public class SwipeUtils {
GestureBean
bean
=
(
GestureBean
)
msg
.
obj
;
long
count
=
bean
.
count
;
if
(
count
>=
bean
.
totalCount
)
{
Log
.
i
(
SuperAppium
.
TAG
,
"dispatch MotionEvent.ACTION_UP..."
);
theView
.
dispatchInputEvent
(
genFingerEvent
(
MotionEvent
.
ACTION_UP
,
bean
.
endX
,
bean
.
endY
));
isScrolling
=
false
;
}
else
{
Log
.
i
(
SuperAppium
.
TAG
,
"dispatch MotionEvent.ACTION_MOVE. now count: "
+
count
+
" totalCount: "
+
bean
.
totalCount
+
" x: "
+
(
bean
.
startX
+
bean
.
ratioX
*
count
)
+
" y: "
+
(
bean
.
startY
+
bean
.
ratioY
*
count
)
);
float
x
=
bean
.
startX
+
bean
.
ratioX
*
count
;
float
y
=
bean
.
startY
+
bean
.
ratioY
*
count
;
boolean
upEarly
=
false
;
if
(
x
<
5
)
{
x
=
5
;
upEarly
=
true
;
}
if
(
y
<
5
)
{
y
=
5
;
upEarly
=
true
;
}
if
(
x
>
theView
.
rootViewImage
().
getOriginView
().
getWidth
()
-
5
)
{
x
=
theView
.
rootViewImage
().
getOriginView
().
getWidth
()
-
5
;
upEarly
=
true
;
}
if
(
y
>
theView
.
rootViewImage
().
getOriginView
().
getHeight
()
-
5
)
{
y
=
theView
.
rootViewImage
().
getOriginView
().
getHeight
()
-
5
;
upEarly
=
true
;
}
if
(
upEarly
)
{
theView
.
dispatchInputEvent
(
genFingerEvent
(
MotionEvent
.
ACTION_UP
,
x
,
y
));
isScrolling
=
false
;
return
;
}
theView
.
dispatchPointerEvent
(
genFingerEvent
(
MotionEvent
.
ACTION_MOVE
,
bean
.
startX
+
bean
.
ratioX
*
count
,
bean
.
startY
+
bean
.
ratioY
*
count
));
bean
.
count
++;
Message
message
=
new
Message
();
...
...
src/main/java/com/virjar/ratel/api/extension/superappium/ViewImage.java
View file @
7c47c22e
...
...
@@ -370,12 +370,18 @@ public class ViewImage {
int
viewHeight
=
originView
.
getHeight
();
int
fromX
=
(
int
)
(
locs
[
0
]
+
viewWidth
*
(
ThreadLocalRandom
.
current
().
nextDouble
(
0.4
)
-
0.2
));
if
(
fromX
<
2
)
{
fromX
=
2
;
}
int
toX
=
(
int
)
(
fromX
+
viewWidth
*
(
ThreadLocalRandom
.
current
().
nextDouble
(
0.1
)));
int
fromY
=
(
int
)
(
locs
[
1
]
+
viewHeight
*
ThreadLocalRandom
.
current
().
nextDouble
(
0.1
));
if
(
fromY
<
2
)
{
fromY
=
2
;
}
int
toY
=
fromY
+
height
;
SwipeUtils
.
simulateScroll
(
this
,
fromX
,
fromY
,
toX
,
toY
);
SwipeUtils
.
simulateScroll
(
this
,
fromX
,
fromY
,
toX
,
toY
,
400
,
50
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment