| 12345678910111213141516171819202122232425262728293031323334 |
- /**
- * probe-images.js — 只 dump 可见 ImageView 的位置与尺寸
- *
- * 用途:`userListRows`/`profile` 那套锚点只收"有文案或可点"的节点,
- * 而**头像节点两样都不占**(无 text、无 desc、不可点),所以看不见它。
- * 「无头像」这个过滤项要落地,就得先知道头像在哪 —— 这是给它用的探针。
- */
- var OUT = "/sdcard/tiktok_app/probe-images.txt";
- var lines = [];
- var hits = className('android.widget.ImageView').find();
- for (var i = 0; i < hits.size(); i += 1) {
- var node = hits.get(i);
- var visible = false;
- try { visible = node.isVisibleToUser() === true; } catch (e) { visible = true; }
- if (!visible) { continue; }
- var box = node.bounds();
- var w = box.right - box.left;
- var h = box.bottom - box.top;
- if (w < 8 || h < 8) { continue; }
- var id = "";
- try { id = String(node.id() || ""); } catch (e) { }
- lines.push([
- "id=" + (id.indexOf("/") >= 0 ? id.split("/").pop() : id),
- "desc=" + JSON.stringify(String(node.desc() || "")),
- "b=[" + box.left + "," + box.top + "][" + box.right + "," + box.bottom + "]",
- "size=" + w + "x" + h,
- "clk=" + (node.clickable() === true)
- ].join(" "));
- }
- files.ensureDir("/sdcard/tiktok_app/");
- files.write(OUT, "count=" + lines.length + "\n" + lines.join("\n") + "\n");
- console.log("images written: " + lines.length);
|