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;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import static android.view.MotionEvent.TOOL_TYPE_FINGER;
......@@ -293,22 +294,22 @@ public class ViewImage {
}
public boolean click() {
if (originView.isClickable()) {
if (originView.performClick()) {
return true;
}
}
ViewImage parentViewImage = parentNode();
if (parentViewImage != null) {
View parentOriginView = parentViewImage.getOriginView();
if (parentOriginView instanceof AdapterView) {
if (!originView.performClick()) {
if (clickAdapterView((AdapterView) parentOriginView, originView)) {
return true;
}
}
}
}
// if (originView.isClickable()) {
// if (originView.performClick()) {
// return true;
// }
// }
// ViewImage parentViewImage = parentNode();
// if (parentViewImage != null) {
// View parentOriginView = parentViewImage.getOriginView();
// if (parentOriginView instanceof AdapterView) {
// if (!originView.performClick()) {
// if (clickAdapterView((AdapterView) parentOriginView, originView)) {
// return true;
// }
// }
// }
// }
return clickV2();
}
......@@ -361,17 +362,26 @@ public class ViewImage {
return rootView.dispatchTouchEvent(inputEvent);
}
@SuppressLint("NewApi")
private boolean clickV2() {
public boolean clickV2() {
float[] floats = measureClickPoint();
return clickByPoint(floats[0], floats[1]);
}
private static Random random = new Random();
private float[] measureClickPoint() {
int[] locs = new int[2];
originView.getLocationOnScreen(locs);
float x = locs[0] + originView.getWidth() / 4;
float y = locs[1] + originView.getHeight() / 4;
float x = locs[0];//+ ((float) originView.getWidth() / 4) + random.nextInt(originView.getWidth() / 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];
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