Commit 59363e00 authored by Administrator's avatar Administrator

Merge branch 'master' of git.virjar.com:ratel/ratelextension

parents 3f7dba67 1d34c054
...@@ -32,6 +32,7 @@ import java.util.ArrayList; ...@@ -32,6 +32,7 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import static android.view.MotionEvent.TOOL_TYPE_FINGER; import static android.view.MotionEvent.TOOL_TYPE_FINGER;
...@@ -293,22 +294,22 @@ public class ViewImage { ...@@ -293,22 +294,22 @@ public class ViewImage {
} }
public boolean click() { public boolean click() {
if (originView.isClickable()) { // if (originView.isClickable()) {
if (originView.performClick()) { // if (originView.performClick()) {
return true; // return true;
} // }
} // }
ViewImage parentViewImage = parentNode(); // ViewImage parentViewImage = parentNode();
if (parentViewImage != null) { // if (parentViewImage != null) {
View parentOriginView = parentViewImage.getOriginView(); // View parentOriginView = parentViewImage.getOriginView();
if (parentOriginView instanceof AdapterView) { // if (parentOriginView instanceof AdapterView) {
if (!originView.performClick()) { // if (!originView.performClick()) {
if (clickAdapterView((AdapterView) parentOriginView, originView)) { // if (clickAdapterView((AdapterView) parentOriginView, originView)) {
return true; // return true;
} // }
} // }
} // }
} // }
return clickV2(); return clickV2();
} }
...@@ -361,17 +362,26 @@ public class ViewImage { ...@@ -361,17 +362,26 @@ public class ViewImage {
return rootView.dispatchTouchEvent(inputEvent); return rootView.dispatchTouchEvent(inputEvent);
} }
@SuppressLint("NewApi")
private boolean clickV2() { public boolean clickV2() {
float[] floats = measureClickPoint(); float[] floats = measureClickPoint();
return clickByPoint(floats[0], floats[1]); return clickByPoint(floats[0], floats[1]);
} }
private static Random random = new Random();
private float[] measureClickPoint() { private float[] measureClickPoint() {
int[] locs = new int[2]; int[] locs = new int[2];
originView.getLocationOnScreen(locs); originView.getLocationOnScreen(locs);
float x = locs[0] + originView.getWidth() / 4; float x = locs[0];//+ ((float) originView.getWidth() / 4) + random.nextInt(originView.getWidth() / 4);
float y = locs[1] + originView.getHeight() / 4; float y = locs[1];//+ ((float) originView.getHeight() / 4) + random.nextInt(originView.getHeight() / 4);
if (originView.getWidth() > 5) {
x += ((float) originView.getWidth() / 4) + random.nextInt(originView.getWidth() / 4);
}
if (originView.getHeight() > 5) {
y += ((float) originView.getHeight() / 4) + random.nextInt(originView.getHeight() / 4);
}
float[] ret = new float[2]; float[] ret = new float[2];
ret[0] = x; ret[0] = x;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment