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
c5b9fc63
Commit
c5b9fc63
authored
May 15, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
滑动丢失ACTION_UP Event问题
parent
c80bdbb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
12 deletions
+33
-12
SwipeUtils.java
...om/virjar/ratel/api/extension/superappium/SwipeUtils.java
+31
-12
ViewImage.java
...com/virjar/ratel/api/extension/superappium/ViewImage.java
+2
-0
No files found.
src/main/java/com/virjar/ratel/api/extension/superappium/SwipeUtils.java
View file @
c5b9fc63
...
@@ -105,15 +105,15 @@ public class SwipeUtils {
...
@@ -105,15 +105,15 @@ public class SwipeUtils {
isScrolling
=
true
;
isScrolling
=
true
;
Handler
handler
=
new
ViewHandler
(
object
);
Handler
handler
=
new
ViewHandler
(
object
);
//重置相对偏移
//
//重置相对偏移
int
[]
loca
=
new
int
[
2
];
//
int[] loca = new int[2];
object
.
rootViewImage
().
getOriginView
().
getLocationOnScreen
(
loca
);
//
object.rootViewImage().getOriginView().getLocationOnScreen(loca);
//
startX
-=
loca
[
0
];
//
startX -= loca[0];
endX
-=
loca
[
0
];
//
endX -= loca[0];
//
startY
-=
loca
[
1
];
//
startY -= loca[1];
endY
-=
loca
[
1
];
//
endY -= loca[1];
object
.
dispatchPointerEvent
(
genFingerEvent
(
MotionEvent
.
ACTION_DOWN
,
startX
,
startY
));
object
.
dispatchPointerEvent
(
genFingerEvent
(
MotionEvent
.
ACTION_DOWN
,
startX
,
startY
));
...
@@ -123,7 +123,7 @@ public class SwipeUtils {
...
@@ -123,7 +123,7 @@ public class SwipeUtils {
private
static
MotionEvent
genFingerEvent
(
int
action
,
float
x
,
float
y
)
{
private
static
MotionEvent
genFingerEvent
(
int
action
,
float
x
,
float
y
)
{
//
Log.i("HD_HOOK", "genFingerEvent action: " + action + " point:(" + x + " , " + y + ")");
Log
.
i
(
"HD_HOOK"
,
"genFingerEvent action: "
+
action
+
" point:("
+
x
+
" , "
+
y
+
")"
);
long
downTime
=
SystemClock
.
uptimeMillis
();
long
downTime
=
SystemClock
.
uptimeMillis
();
long
eventTime
=
SystemClock
.
uptimeMillis
();
long
eventTime
=
SystemClock
.
uptimeMillis
();
...
@@ -162,8 +162,17 @@ public class SwipeUtils {
...
@@ -162,8 +162,17 @@ public class SwipeUtils {
GestureBean
bean
=
(
GestureBean
)
msg
.
obj
;
GestureBean
bean
=
(
GestureBean
)
msg
.
obj
;
long
count
=
bean
.
count
;
long
count
=
bean
.
count
;
if
(
count
>=
bean
.
totalCount
)
{
if
(
count
>=
bean
.
totalCount
)
{
theView
.
dispatchInputEvent
(
genFingerEvent
(
MotionEvent
.
ACTION_UP
,
bean
.
endX
,
bean
.
endY
));
theView
.
dispatchPointerEvent
(
genFingerEvent
(
MotionEvent
.
ACTION_MOVE
,
bean
.
endX
,
bean
.
endY
));
new
Handler
(
Looper
.
myLooper
()).
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
theView
.
dispatchPointerEvent
(
genFingerEvent
(
MotionEvent
.
ACTION_UP
,
bean
.
endX
,
bean
.
endY
));
}
}
);
isScrolling
=
false
;
isScrolling
=
false
;
}
else
{
}
else
{
float
x
=
bean
.
startX
+
bean
.
ratioX
*
count
;
float
x
=
bean
.
startX
+
bean
.
ratioX
*
count
;
float
y
=
bean
.
startY
+
bean
.
ratioY
*
count
;
float
y
=
bean
.
startY
+
bean
.
ratioY
*
count
;
...
@@ -186,7 +195,17 @@ public class SwipeUtils {
...
@@ -186,7 +195,17 @@ public class SwipeUtils {
}
}
if
(
upEarly
)
{
if
(
upEarly
)
{
theView
.
dispatchInputEvent
(
genFingerEvent
(
MotionEvent
.
ACTION_UP
,
x
,
y
));
theView
.
dispatchPointerEvent
(
genFingerEvent
(
MotionEvent
.
ACTION_MOVE
,
x
,
y
));
float
finalX
=
x
;
float
finalY
=
y
;
new
Handler
(
Looper
.
myLooper
()).
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
theView
.
dispatchPointerEvent
(
genFingerEvent
(
MotionEvent
.
ACTION_UP
,
finalX
,
finalY
));
}
}
);
isScrolling
=
false
;
isScrolling
=
false
;
return
;
return
;
}
}
...
...
src/main/java/com/virjar/ratel/api/extension/superappium/ViewImage.java
View file @
c5b9fc63
...
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
...
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.Looper
;
import
android.os.SystemClock
;
import
android.os.SystemClock
;
import
android.util.Log
;
import
android.view.InputEvent
;
import
android.view.InputEvent
;
import
android.view.MotionEvent
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.View
;
...
@@ -348,6 +349,7 @@ public class ViewImage {
...
@@ -348,6 +349,7 @@ public class ViewImage {
View
rootView
=
rootViewImage
().
getOriginView
();
View
rootView
=
rootViewImage
().
getOriginView
();
final
Object
mViewRootImpl
=
RposedHelpers
.
callMethod
(
rootView
,
"getViewRootImpl"
);
final
Object
mViewRootImpl
=
RposedHelpers
.
callMethod
(
rootView
,
"getViewRootImpl"
);
if
(
mViewRootImpl
==
null
)
{
if
(
mViewRootImpl
==
null
)
{
Log
.
w
(
SuperAppium
.
TAG
,
"can not find RootViewImpl to dispatch event"
);
return
false
;
return
false
;
}
}
RposedHelpers
.
callMethod
(
mViewRootImpl
,
"dispatchInputEvent"
,
inputEvent
);
RposedHelpers
.
callMethod
(
mViewRootImpl
,
"dispatchInputEvent"
,
inputEvent
);
...
...
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