From 7ae3a1412252d82c9c285284aca31423e5692213 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:21:38 +0530 Subject: [PATCH 01/28] Emulator: add hide-controls handle (imports) --- src/plugins/browser/android/com/foxdebug/browser/Emulator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Emulator.java b/src/plugins/browser/android/com/foxdebug/browser/Emulator.java index 25f0d70ea..d3114d32c 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Emulator.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Emulator.java @@ -3,6 +3,7 @@ import android.content.Context; import android.graphics.Typeface; import android.util.Log; +import android.view.Gravity; import android.view.View; import android.view.ViewTreeObserver; import android.widget.ImageView; From 4cdc386b7a81035849f47615ce0489f30bf8c12a Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:21:44 +0530 Subject: [PATCH 02/28] Emulator: hide listener field --- src/plugins/browser/android/com/foxdebug/browser/Emulator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Emulator.java b/src/plugins/browser/android/com/foxdebug/browser/Emulator.java index d3114d32c..c8463a1e6 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Emulator.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Emulator.java @@ -23,6 +23,7 @@ public class Emulator extends LinearLayout { private View reference; private Context context; private Callback listener; + private Runnable hideListener; private Device customDevice; private Device selectedDevice; private boolean initialized = false; From 742caac7d589318620397fbdf83e3111251314c4 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:21:52 +0530 Subject: [PATCH 03/28] Emulator: add tappable handle that hides the bottom controls --- .../com/foxdebug/browser/Emulator.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Emulator.java b/src/plugins/browser/android/com/foxdebug/browser/Emulator.java index c8463a1e6..c31b55a56 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Emulator.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Emulator.java @@ -117,11 +117,41 @@ public void onSelect(Device device) { addControl("width", 50, "Width"); addControl("height", 50, "Height"); addControl("scale", 50, "Scale"); + // Thin tappable handle on top of the panel that hides the whole panel. + TextView handle = new TextView(context); + handle.setText("\u25BC Hide controls"); + handle.setGravity(Gravity.CENTER); + handle.setTextSize(12); + handle.setTextColor(theme.get("primaryTextColor")); + handle.setBackgroundColor(theme.get("primaryColor")); + handle.setClickable(true); + handle.setLayoutParams( + new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + Ui.dpToPixels(context, 28) + ) + ); + handle.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + if (hideListener != null) { + hideListener.run(); + } + } + } + ); + + addView(handle); addView(border); addView(main); setOrientation(LinearLayout.VERTICAL); } + public void setHideListener(Runnable listener) { + this.hideListener = listener; + } + public void setChangeListener(Callback listener) { this.listener = listener; } From 8bda366d72ac6130e4f490fcdc8648be15e849f0 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:21:59 +0530 Subject: [PATCH 04/28] Browser: imports for cursor settings + trackpad --- .../browser/android/com/foxdebug/browser/Browser.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index 9f82f235d..84694a372 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -49,6 +49,14 @@ import android.widget.Toast; import android.os.Handler; import android.os.Looper; +import android.app.Dialog; +import android.graphics.drawable.ColorDrawable; +import android.view.MotionEvent; +import android.view.ViewConfiguration; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.SeekBar; From c7f6900932f06259d269739c68535821a46c1bd9 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:22:07 +0530 Subject: [PATCH 05/28] Browser: continuous cursor speed/size fields + trackpad state --- .../android/com/foxdebug/browser/Browser.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index 84694a372..9a1e1ac4a 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -83,9 +83,26 @@ public class Browser extends LinearLayout { // time the browser is launched. public boolean cursor = false; // How far the cursor moves per unit of finger movement (trackpad speed). - // Tap "Cursor Speed" in the menu to cycle through CURSOR_SPEEDS. + // Adjusted with the "Cursor Settings" slider (continuous), saved in prefs. public float cursorSpeed = 1.5f; - private static final float[] CURSOR_SPEEDS = { 0.5f, 1f, 1.5f, 2f, 3f, 4f }; + // Cursor size multiplier (1 = default size). Also set in "Cursor Settings". + public float cursorSize = 1f; + // Cursor size at 1x, in dp, independent of preview zoom / device preset. + private static final float CURSOR_BASE_DP = 12f; + private static final float SPEED_MIN = 0.2f; + private static final float SPEED_MAX = 6f; + private static final float SIZE_MIN = 0.4f; + private static final float SIZE_MAX = 2.5f; + private static final int SEEK_STEPS = 200; + + private Dialog cursorDialog; + // Native trackpad state, used for the area around/under the preview. + private float padX; + private float padY; + private float padDownX; + private float padDownY; + private long padDownTime; + private boolean padMoved; private String url = ""; private String title = "Browser"; From 5512f8a5ec8cc885cef3e4bf893afb7917ca6f91 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:22:13 +0530 Subject: [PATCH 06/28] Browser: load saved cursor prefs --- src/plugins/browser/android/com/foxdebug/browser/Browser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index 9a1e1ac4a..fce6edc59 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -127,6 +127,7 @@ public Browser(Context context, Ui.Theme theme, Boolean onlyConsole) { this.imageSize = Ui.dpToPixels(context, 35); this.titleHeight = Ui.dpToPixels(context, 45); this.titleTextHeight = Ui.dpToPixels(context, 35); + loadCursorPrefs(); this.init(); } From c8384cbcd536847b05cdae342d0bf84426ef3281 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:22:19 +0530 Subject: [PATCH 07/28] Browser: install trackpad touch handling on the area around the preview --- src/plugins/browser/android/com/foxdebug/browser/Browser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index fce6edc59..fd124ae73 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -253,6 +253,7 @@ public void onDownloadStart(String url, String userAgent, ); webViewContainer.setBackgroundColor(theme.get("primaryColor")); webViewContainer.addView(webView); + installTrackpad(webViewContainer); setOrientation(LinearLayout.VERTICAL); setFocusableInTouchMode(true); From 27d84fe625a047a36e0eb740cbc845f2aeb0d880 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:22:26 +0530 Subject: [PATCH 08/28] Browser menu: Cursor Settings + Preview Controls toggle --- .../browser/android/com/foxdebug/browser/Browser.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index fd124ae73..e5ef874a4 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -272,9 +272,10 @@ private void createMenu() { menu.addItem(Ui.Icons.NO_CACHE, "Disable Cache", false); menu.addItem(Ui.Icons.TERMINAL, "Console", false); menu.addItem(Ui.Icons.CURSOR, "Cursor", false); - menu.addItem(Ui.Icons.TUNE, "Cursor Speed"); - menu.setVisible("Cursor Speed", false); - menu.setLabel("Cursor Speed", cursorSpeedLabel()); + menu.addItem(Ui.Icons.TUNE, "Cursor Settings"); + menu.setVisible("Cursor Settings", false); + menu.addItem(Ui.Icons.DEVICES, "Preview Controls", true); + menu.setVisible("Preview Controls", false); menu.addItem(Ui.Icons.TUNE, "Set as Default"); menu.addItem(Ui.Icons.REFRESH, "Clear Default"); menu.setVisible("Set as Default", false); From 4b6fdd556dd7e1aac1fca45dc5593338aca0c2f3 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:22:33 +0530 Subject: [PATCH 09/28] Browser menu callbacks: cursor settings dialog + controls toggle --- .../android/com/foxdebug/browser/Browser.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index e5ef874a4..9a80a0ee1 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -331,11 +331,17 @@ public void onGlobalLayout() { break; case "Cursor": cursor = checked; - menu.setVisible("Cursor Speed", checked); + menu.setVisible("Cursor Settings", checked); + if (!checked && cursorDialog != null) { + cursorDialog.dismiss(); + } applyCursor(); break; - case "Cursor Speed": - cycleCursorSpeed(); + case "Cursor Settings": + showCursorSettings(); + break; + case "Preview Controls": + setControlsVisible(checked); break; case "Set as Default": if (deviceEmulator != null) { From 98ed3fc33d128616fc5a7624468f0dede867e5fc Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:22:39 +0530 Subject: [PATCH 10/28] Browser: show controls whenever Devices is enabled --- src/plugins/browser/android/com/foxdebug/browser/Browser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index 9a80a0ee1..aef9fdc79 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -301,6 +301,7 @@ public void onSelect(String action, Boolean checked) { menu.setChecked("Console", false); menu.setVisible("Console", false); addView(deviceEmulator); + onEmulatorShown(); fitWebViewTo( deviceEmulator.getWidthProgress(), deviceEmulator.getHeightProgress(), From 874f96822417cb9bd093624bedf4038d60e27ee8 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:22:45 +0530 Subject: [PATCH 11/28] Browser: hide Preview Controls menu item when Devices is off --- src/plugins/browser/android/com/foxdebug/browser/Browser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index aef9fdc79..065c0d47b 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -310,6 +310,7 @@ public void onSelect(String action, Boolean checked) { } else { menu.setVisible("Console", true); removeView(deviceEmulator); + menu.setVisible("Preview Controls", false); fitWebViewTo(0, 0, 1); webView .getViewTreeObserver() From 81e32592b580f86043a9af1857b93684d97ecbe6 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:22:51 +0530 Subject: [PATCH 12/28] Browser: restored default emulator also registers controls toggle --- src/plugins/browser/android/com/foxdebug/browser/Browser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index 065c0d47b..3940a33a0 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -484,6 +484,7 @@ public void run() { menu.setChecked("Console", false); menu.setVisible("Console", false); addView(deviceEmulator); + onEmulatorShown(); // The emulator sets up its sliders on a later layout pass and then // applies the saved size itself, so the webview is not resized here. } From bc4eb51faf88f5aafe23df9162a187feef7e54de Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:22:58 +0530 Subject: [PATCH 13/28] Browser: wire the emulator's hide handle --- .../browser/android/com/foxdebug/browser/Browser.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index 3940a33a0..caf3f49ee 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -496,6 +496,15 @@ private void createDeviceEmulatorLayout() { Browser browser = this; deviceEmulator = new Emulator(context, theme); deviceEmulator.setReference(webView); + deviceEmulator.setHideListener( + new Runnable() { + @Override + public void run() { + setControlsVisible(false); + menu.setChecked("Preview Controls", false); + } + } + ); deviceEmulator.setChangeListener( new Emulator.Callback() { @Override From c97348f32d3affa15edda313a095dc3561287ba6 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:23:24 +0530 Subject: [PATCH 14/28] Browser: cursor settings dialog (speed/size sliders), prefs, native trackpad, hide controls --- .../android/com/foxdebug/browser/Browser.java | 304 +++++++++++++++++- 1 file changed, 289 insertions(+), 15 deletions(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index caf3f49ee..c9449641a 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -389,26 +389,300 @@ public void onGlobalLayout() { ); } - private String cursorSpeedLabel() { - return "Cursor Speed: " + cursorSpeed + "x"; + private float density() { + return context.getResources().getDisplayMetrics().density; } - /** Moves to the next speed in CURSOR_SPEEDS (wrapping) and applies it. */ - private void cycleCursorSpeed() { - int index = 0; - for (int i = 0; i < CURSOR_SPEEDS.length; i++) { - if (CURSOR_SPEEDS[i] == cursorSpeed) { - index = i; - break; + private static float clampf(float v, float lo, float hi) { + return Math.max(lo, Math.min(hi, v)); + } + + private static int toProgress(float v, float lo, float hi) { + return Math.round(((v - lo) / (hi - lo)) * SEEK_STEPS); + } + + private static float fromProgress(int p, float lo, float hi) { + return lo + ((hi - lo) * p) / (float) SEEK_STEPS; + } + + private void loadCursorPrefs() { + android.content.SharedPreferences prefs = context.getSharedPreferences( + "acode_browser", + Context.MODE_PRIVATE + ); + cursorSpeed = clampf(prefs.getFloat("cursor_speed", 1.5f), SPEED_MIN, SPEED_MAX); + cursorSize = clampf(prefs.getFloat("cursor_size", 1f), SIZE_MIN, SIZE_MAX); + } + + private void saveCursorPrefs() { + context + .getSharedPreferences("acode_browser", Context.MODE_PRIVATE) + .edit() + .putFloat("cursor_speed", cursorSpeed) + .putFloat("cursor_size", cursorSize) + .apply(); + } + + private String speedText() { + return String.format("Cursor speed: %.2fx", cursorSpeed); + } + + private String sizeText() { + return String.format("Cursor size: %.2fx", cursorSize); + } + + /** + * On-screen width (in real pixels, including the preview scale) of the page + * area. The cursor script uses it to know how many screen pixels one CSS + * pixel is, so the cursor keeps the same physical size and the same + * sensitivity on every device preset / zoom level. + */ + private float previewScreenWidth() { + int w = webView.getWidth(); + if (w <= 0 && webView.getParent() != null) { + w = ((View) webView.getParent()).getWidth(); + } + return w * webView.getScaleX(); + } + + /** Pushes the current speed/size into an already injected cursor. */ + private void pushCursorSettings(float screenWidth) { + if (!cursor) return; + webView.evaluateJavascript( + "window.__acodeCursorSet&&window.__acodeCursorSet(" + + cursorSpeed + "," + cursorSize + "," + screenWidth + "," + + (CURSOR_BASE_DP * density()) + ");", + null + ); + } + + private void moveCursorBy(float dx, float dy) { + webView.evaluateJavascript( + "window.__acodeCursorMove&&window.__acodeCursorMove(" + dx + "," + dy + ");", + null + ); + } + + private void clickCursor() { + webView.evaluateJavascript( + "window.__acodeCursorClick&&window.__acodeCursorClick();", + null + ); + } + + /** + * Makes the whole area around the preview (the empty space above/below it, + * e.g. under a desktop-sized preview) act as a trackpad: drag to move the + * cursor, quick tap to click. Touches on the page itself are handled by the + * injected script, so both behave the same. + */ + @SuppressWarnings("ClickableViewAccessibility") + private void installTrackpad(View area) { + final int slop = ViewConfiguration.get(context).getScaledTouchSlop(); + area.setOnTouchListener( + new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent e) { + if (!cursor) return false; + + switch (e.getActionMasked()) { + case MotionEvent.ACTION_DOWN: + padX = padDownX = e.getX(); + padY = padDownY = e.getY(); + padDownTime = e.getEventTime(); + padMoved = false; + return true; + case MotionEvent.ACTION_MOVE: + float x = e.getX(); + float y = e.getY(); + if ( + !padMoved && + Math.abs(x - padDownX) + Math.abs(y - padDownY) > slop + ) { + padMoved = true; + padX = padDownX; + padY = padDownY; + } + if (padMoved) { + moveCursorBy(x - padX, y - padY); + } + padX = x; + padY = y; + return true; + case MotionEvent.ACTION_UP: + if (!padMoved && e.getEventTime() - padDownTime < 300) { + clickCursor(); + } + return true; + default: + return true; + } + } } + ); + } + + /** Shows or hides the bottom Width/Height/Scale/device panel. */ + private void setControlsVisible(boolean visible) { + if (deviceEmulator != null) { + deviceEmulator.setVisibility(visible ? View.VISIBLE : View.GONE); + } + } + + /** Called whenever the device panel is added, so it starts out visible. */ + private void onEmulatorShown() { + setControlsVisible(true); + menu.setVisible("Preview Controls", true); + menu.setChecked("Preview Controls", true); + } + + /** + * Floating panel with live sliders for cursor speed and size. It does not + * dim or block the screen, so the cursor can be dragged around while tuning. + */ + private void showCursorSettings() { + if (cursorDialog != null && cursorDialog.isShowing()) return; + + final int pad = Ui.dpToPixels(context, 14); + final int textColor = theme.get("primaryTextColor"); + final float radius = Ui.dpToPixels(context, 14); + + LinearLayout panel = new LinearLayout(context); + panel.setOrientation(LinearLayout.VERTICAL); + panel.setPadding(pad, pad, pad, pad); + GradientDrawable background = new GradientDrawable(); + background.setColor(theme.get("primaryColor")); + background.setCornerRadii( + new float[] { radius, radius, radius, radius, 0, 0, 0, 0 } + ); + panel.setBackgroundDrawable(background); + + final TextView speedLabel = new TextView(context); + speedLabel.setTextColor(textColor); + speedLabel.setText(speedText()); + + final SeekBar speedBar = new SeekBar(context); + speedBar.setMax(SEEK_STEPS); + speedBar.setProgress(toProgress(cursorSpeed, SPEED_MIN, SPEED_MAX)); + speedBar.setOnSeekBarChangeListener( + new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) { + if (!fromUser) return; + cursorSpeed = fromProgress(progress, SPEED_MIN, SPEED_MAX); + speedLabel.setText(speedText()); + pushCursorSettings(previewScreenWidth()); + } + + @Override + public void onStartTrackingTouch(SeekBar bar) {} + + @Override + public void onStopTrackingTouch(SeekBar bar) { + saveCursorPrefs(); + } + } + ); + + final TextView sizeLabel = new TextView(context); + sizeLabel.setTextColor(textColor); + sizeLabel.setText(sizeText()); + + final SeekBar sizeBar = new SeekBar(context); + sizeBar.setMax(SEEK_STEPS); + sizeBar.setProgress(toProgress(cursorSize, SIZE_MIN, SIZE_MAX)); + sizeBar.setOnSeekBarChangeListener( + new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) { + if (!fromUser) return; + cursorSize = fromProgress(progress, SIZE_MIN, SIZE_MAX); + sizeLabel.setText(sizeText()); + pushCursorSettings(previewScreenWidth()); + } + + @Override + public void onStartTrackingTouch(SeekBar bar) {} + + @Override + public void onStopTrackingTouch(SeekBar bar) { + saveCursorPrefs(); + } + } + ); + + LinearLayout buttons = new LinearLayout(context); + buttons.setOrientation(LinearLayout.HORIZONTAL); + buttons.setGravity(Gravity.END); + + Button reset = new Button(context); + reset.setText("Reset"); + Button done = new Button(context); + done.setText("Done"); + buttons.addView(reset); + buttons.addView(done); + + panel.addView(speedLabel); + panel.addView(speedBar); + panel.addView(sizeLabel); + panel.addView(sizeBar); + panel.addView(buttons); + + final Dialog dialog = new Dialog(context); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + dialog.setContentView(panel); + + reset.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + cursorSpeed = 1.5f; + cursorSize = 1f; + speedBar.setProgress(toProgress(cursorSpeed, SPEED_MIN, SPEED_MAX)); + sizeBar.setProgress(toProgress(cursorSize, SIZE_MIN, SIZE_MAX)); + speedLabel.setText(speedText()); + sizeLabel.setText(sizeText()); + pushCursorSettings(previewScreenWidth()); + saveCursorPrefs(); + } + } + ); + + done.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + dialog.dismiss(); + } + } + ); + + dialog.setOnDismissListener( + new android.content.DialogInterface.OnDismissListener() { + @Override + public void onDismiss(android.content.DialogInterface d) { + saveCursorPrefs(); + cursorDialog = null; + } + } + ); + + Window window = dialog.getWindow(); + if (window != null) { + window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); + // Let touches outside the panel through so the cursor can be moved + // while the sliders are open. + window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL); + window.setLayout( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT + ); + window.setGravity(Gravity.BOTTOM); } - cursorSpeed = CURSOR_SPEEDS[(index + 1) % CURSOR_SPEEDS.length]; - menu.setLabel("Cursor Speed", cursorSpeedLabel()); - Toast - .makeText(context, "Cursor speed: " + cursorSpeed + "x", Toast.LENGTH_SHORT) - .show(); - applyCursor(); + cursorDialog = dialog; + dialog.show(); } /** From 6c00e98e8aa0479e7b23c26a439774fa7210d328 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:23:31 +0530 Subject: [PATCH 15/28] Browser: pass size/screen metrics to the cursor script --- .../browser/android/com/foxdebug/browser/Browser.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index c9449641a..bc822ee7a 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -693,7 +693,16 @@ public void onDismiss(android.content.DialogInterface d) { */ public void applyCursor() { // The injected script lives in CursorScript (bottom of this file). - webView.evaluateJavascript(CursorScript.build(cursor, cursorSpeed), null); + webView.evaluateJavascript( + CursorScript.build( + cursor, + cursorSpeed, + cursorSize, + previewScreenWidth(), + CURSOR_BASE_DP * density() + ), + null + ); } private void updateDefaultItems(boolean emulatorOn) { From f0f838ea8ea64f5099f78f67071c73f14b310331 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:23:38 +0530 Subject: [PATCH 16/28] Browser: keep cursor size/speed consistent when preview size changes --- .../browser/android/com/foxdebug/browser/Browser.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index bc822ee7a..27856e62c 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -911,6 +911,13 @@ private void fitWebViewTo(int width, int height, float scale) { if (width > 0 && height > 0) { updateViewportDimension(width, height); } + + if (cursor && webView.getParent() != null) { + int shownWidth = width == 0 + ? ((View) webView.getParent()).getWidth() + : width; + pushCursorSettings(shownWidth * scale); + } } private void styleIcon(ImageView view) { From 9b8b2d8a94a4e5c702a9841b888188e1a31dc939 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:23:45 +0530 Subject: [PATCH 17/28] CursorScript: accept size + screen metrics --- .../browser/android/com/foxdebug/browser/Browser.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index 27856e62c..4a3866560 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -1102,9 +1102,15 @@ public void exit() { */ class CursorScript { - static String build(boolean on, float speed) { + static String build( + boolean on, + float speed, + float size, + float screenW, + float basePx + ) { String[] js = { - "(function(on,SPEED){", + "(function(on,SPEED,SIZE,SW,BASE){", "if(window.__acodeCursorCleanup){window.__acodeCursorCleanup();window.__acodeCursorCleanup=null;}", "if(!on)return;", "var root=document.documentElement;if(!root)return;", From 67cd488c59f8a6284682950ef76e1b78301ee171 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:23:52 +0530 Subject: [PATCH 18/28] CursorScript: live-adjustable config object --- src/plugins/browser/android/com/foxdebug/browser/Browser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index 4a3866560..91e44520b 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -1117,6 +1117,8 @@ static String build( "var NS='http://www.w3.org/2000/svg';", "var HV='__acode_hv';", "var cur='',hot=[0,0],hv=null,gesture=false;", + // live config: speed, size multiplier, on-screen px width of the page, base cursor px + "var cfg={speed:SPEED,size:SIZE,sw:SW,base:BASE};", "var t0=0,sx=0,sy=0,lx=0,ly=0,moved=false,active=false;", // visible area, so the cursor also behaves while pinch-zoomed "function bounds(){var v=window.visualViewport;", From 70d6cb9648b6b7fc5de0f8a76ee69d8f89c1283d Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:23:59 +0530 Subject: [PATCH 19/28] CursorScript: constant on-screen cursor size regardless of preview zoom --- .../browser/android/com/foxdebug/browser/Browser.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index 91e44520b..5a52e3819 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -1185,8 +1185,11 @@ static String build( // position "var pos=window.__acodeCursorPos;var b0=bounds();", "var cx=pos?pos[0]:(b0.x0+b0.x1)/2,cy=pos?pos[1]:(b0.y0+b0.y1)/2;", - "function draw(){var b=bounds();window.__acodeCursorPos=[cx,cy];", - "c.style.transform='translate('+(cx-hot[0]/b.s)+'px,'+(cy-hot[1]/b.s)+'px) scale('+(1/b.s)+')';}", + // K = real screen pixels per CSS pixel; M = scale that gives the cursor a fixed physical size + "function K(){var b=bounds();var w=b.x1-b.x0;return (cfg.sw>0&&w>0)?cfg.sw/w:1;}", + "function M(){return (cfg.base*cfg.size)/(24*K());}", + "function draw(){window.__acodeCursorPos=[cx,cy];var m=M();", + "c.style.transform='translate('+(cx-hot[0]*m)+'px,'+(cy-hot[1]*m)+'px) scale('+m+')';}", "function nudge(dx,dy){var b=bounds();", "cx=Math.max(b.x0,Math.min(b.x1-1,cx+dx));", "cy=Math.max(b.y0,Math.min(b.y1-1,cy+dy));draw();}", From a2d2e8d924124ff9430e51e7ce643bb21c1c7979 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:24:06 +0530 Subject: [PATCH 20/28] CursorScript: read speed live from config --- src/plugins/browser/android/com/foxdebug/browser/Browser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index 5a52e3819..dab930909 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -1234,7 +1234,7 @@ static String build( "function onTM(e){if(gesture||e.touches.length>1){gesture=true;return;}", "var t=e.touches[0];if(!t)return;", "if(!moved&&Math.abs(t.clientX-sx)+Math.abs(t.clientY-sy)>10){moved=true;lx=sx;ly=sy;}", - "if(moved){nudge((t.clientX-lx)*SPEED,(t.clientY-ly)*SPEED);hover(true);}", + "if(moved){nudge((t.clientX-lx)*cfg.speed,(t.clientY-ly)*cfg.speed);hover(true);}", "lx=t.clientX;ly=t.clientY;}", "function onTE(e){if(e.touches.length>0)return;", "if(active&&!moved&&!gesture&&Date.now()-t0<300)clickAtCursor();", From 6166e6d2a30cf10b3a267b25c35d935baf5130af Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:24:13 +0530 Subject: [PATCH 21/28] CursorScript: expose move/click/set hooks for the native trackpad and sliders --- .../browser/android/com/foxdebug/browser/Browser.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index dab930909..f4ef14cfb 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -1257,7 +1257,12 @@ static String build( "if(vv){vv.addEventListener('resize',vp);vv.addEventListener('scroll',vp);}", // layout can change under a resting cursor (after a click, animations) "var iv=setInterval(function(){hover(false);},250);", + // hooks called from Java: native trackpad (area outside the page) and settings sliders + "window.__acodeCursorMove=function(dx,dy){var f=cfg.speed/K();nudge(dx*f,dy*f);hover(true);};", + "window.__acodeCursorClick=function(){clickAtCursor();};", + "window.__acodeCursorSet=function(sp,sz,sw,bs){cfg.speed=sp;cfg.size=sz;cfg.sw=sw;cfg.base=bs;draw();};", "window.__acodeCursorCleanup=function(){", + "window.__acodeCursorMove=null;window.__acodeCursorClick=null;window.__acodeCursorSet=null;", "clearInterval(iv);", "types.forEach(function(t){window.removeEventListener(t,block,o);});", "if(vv){vv.removeEventListener('resize',vp);vv.removeEventListener('scroll',vp);}", From e2454aed27bbca62a7c45fef31b32254a9d73c5b Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:24:19 +0530 Subject: [PATCH 22/28] CursorScript: redraw periodically so size follows viewport changes --- src/plugins/browser/android/com/foxdebug/browser/Browser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index f4ef14cfb..bf3ebe7ca 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -1256,7 +1256,7 @@ static String build( "function vp(){nudge(0,0);}", "if(vv){vv.addEventListener('resize',vp);vv.addEventListener('scroll',vp);}", // layout can change under a resting cursor (after a click, animations) - "var iv=setInterval(function(){hover(false);},250);", + "var iv=setInterval(function(){hover(false);draw();},250);", // hooks called from Java: native trackpad (area outside the page) and settings sliders "window.__acodeCursorMove=function(dx,dy){var f=cfg.speed/K();nudge(dx*f,dy*f);hover(true);};", "window.__acodeCursorClick=function(){clickAtCursor();};", From de70cbe5ade675adc635e8911a968b964427482a Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:24:26 +0530 Subject: [PATCH 23/28] CursorScript: pass new args on invocation --- .../android/com/foxdebug/browser/Browser.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index bf3ebe7ca..b533dc318 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -1277,7 +1277,18 @@ static String build( for (String line : js) { sb.append(line).append('\n'); } - sb.append('(').append(on).append(',').append(speed).append(");"); + sb + .append('(') + .append(on) + .append(',') + .append(speed) + .append(',') + .append(size) + .append(',') + .append(screenW) + .append(',') + .append(basePx) + .append(");"); return sb.toString(); } } From 7bc0940b9802058dc7982de37809e0252e5f42eb Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:44:41 +0530 Subject: [PATCH 24/28] CursorScript: hide the yellow focus ring / tap highlight on clicked elements --- src/plugins/browser/android/com/foxdebug/browser/Browser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Browser.java b/src/plugins/browser/android/com/foxdebug/browser/Browser.java index b533dc318..5b0280bf0 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Browser.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Browser.java @@ -1141,7 +1141,8 @@ static String build( "return css;}", // block panning / text selection but keep pinch zoom "var st=document.createElement('style');", - "st.textContent='html,body,*{touch-action:pinch-zoom!important;-webkit-user-select:none!important;user-select:none!important;}'+hoverCss();", + // outline/tap-highlight off: clicking with the cursor focuses elements, which otherwise draws a yellow ring + "st.textContent='html,body,*{touch-action:pinch-zoom!important;-webkit-user-select:none!important;user-select:none!important;-webkit-tap-highlight-color:transparent!important;}*:focus,*:focus-visible,*:active{outline:none!important;}'+hoverCss();", "(document.head||root).appendChild(st);", "var c=document.createElement('div');", "c.style.cssText='position:fixed;left:0;top:0;width:24px;height:24px;pointer-events:none;z-index:2147483647;transform-origin:0 0;will-change:transform;';", From d3f37e6716e887eb39c8cd56409594f9c8453008 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:44:47 +0530 Subject: [PATCH 25/28] Ui.Icons: add VISIBILITY_OFF constant --- src/plugins/system/android/com/foxdebug/system/Ui.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/system/android/com/foxdebug/system/Ui.java b/src/plugins/system/android/com/foxdebug/system/Ui.java index b681f845a..083544df0 100644 --- a/src/plugins/system/android/com/foxdebug/system/Ui.java +++ b/src/plugins/system/android/com/foxdebug/system/Ui.java @@ -37,6 +37,10 @@ public static class Icons { // cursor arrow is drawn directly with a Canvas instead. public static final String CURSOR = "\uF8FF"; + // Also not a glyph in icon.ttf: drawn with a Canvas in get() (eye with a + // slash, like a "hide password" icon). + public static final String VISIBILITY_OFF = "\uF8FE"; + private static Paint paint; private static int size = 24; private static int color = Color.parseColor("#FFFFFF"); From 0b5e7de6f6ff9dd9be354d77e61109bc1fdfd5d1 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:44:54 +0530 Subject: [PATCH 26/28] Ui.Icons: route VISIBILITY_OFF to the canvas-drawn icon --- src/plugins/system/android/com/foxdebug/system/Ui.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/system/android/com/foxdebug/system/Ui.java b/src/plugins/system/android/com/foxdebug/system/Ui.java index 083544df0..e91a922af 100644 --- a/src/plugins/system/android/com/foxdebug/system/Ui.java +++ b/src/plugins/system/android/com/foxdebug/system/Ui.java @@ -56,6 +56,10 @@ public static Bitmap get( return drawCursor(color); } + if (VISIBILITY_OFF.equals(code)) { + return drawEyeOff(color); + } + if (paint == null) { paint = new Paint(); paint.setAntiAlias(true); From f7e19ede0a5f2a8e2fea0e123ee51a596fdaed10 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:45:02 +0530 Subject: [PATCH 27/28] Ui.Icons: draw an eye-with-slash (hide password) icon --- .../android/com/foxdebug/system/Ui.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/plugins/system/android/com/foxdebug/system/Ui.java b/src/plugins/system/android/com/foxdebug/system/Ui.java index e91a922af..ec3a73d1f 100644 --- a/src/plugins/system/android/com/foxdebug/system/Ui.java +++ b/src/plugins/system/android/com/foxdebug/system/Ui.java @@ -86,6 +86,28 @@ public static Bitmap get( return bitmap; } + /** Draws an eye with a slash through it (like a "hide password" icon). */ + private static Bitmap drawEyeOff(int color) { + int px = 96; + Bitmap bitmap = Bitmap.createBitmap(px, px, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); + p.setColor(color); + p.setStyle(Paint.Style.STROKE); + p.setStrokeWidth(7f); + p.setStrokeCap(Paint.Cap.ROUND); + p.setStrokeJoin(Paint.Join.ROUND); + + Path eye = new Path(); + eye.moveTo(8f, 48f); + eye.quadTo(48f, 4f, 88f, 48f); + eye.quadTo(48f, 92f, 8f, 48f); + canvas.drawPath(eye, p); + canvas.drawCircle(48f, 48f, 14f, p); + canvas.drawLine(18f, 14f, 78f, 82f, p); + return bitmap; + } + /** Draws the cursor arrow (same shape as the in-page cursor). */ private static Bitmap drawCursor(int color) { int px = 96; From 31e078aa088e36d6fb041d04e91cf42a95a57f02 Mon Sep 17 00:00:00 2001 From: Aadin Date: Sun, 22 Nov 2026 10:45:11 +0530 Subject: [PATCH 28/28] Emulator: hide button on the left with a hide (eye-slash) icon --- .../com/foxdebug/browser/Emulator.java | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/plugins/browser/android/com/foxdebug/browser/Emulator.java b/src/plugins/browser/android/com/foxdebug/browser/Emulator.java index c31b55a56..38d3d6cee 100644 --- a/src/plugins/browser/android/com/foxdebug/browser/Emulator.java +++ b/src/plugins/browser/android/com/foxdebug/browser/Emulator.java @@ -118,13 +118,38 @@ public void onSelect(Device device) { addControl("height", 50, "Height"); addControl("scale", 50, "Scale"); // Thin tappable handle on top of the panel that hides the whole panel. - TextView handle = new TextView(context); - handle.setText("\u25BC Hide controls"); - handle.setGravity(Gravity.CENTER); - handle.setTextSize(12); - handle.setTextColor(theme.get("primaryTextColor")); + LinearLayout handle = new LinearLayout(context); + handle.setOrientation(LinearLayout.HORIZONTAL); + handle.setGravity(Gravity.CENTER_VERTICAL | Gravity.START); + handle.setPadding( + Ui.dpToPixels(context, 12), + 0, + Ui.dpToPixels(context, 12), + 0 + ); handle.setBackgroundColor(theme.get("primaryColor")); handle.setClickable(true); + + ImageView hideIcon = new ImageView(context); + hideIcon.setImageBitmap( + Ui.Icons.get(context, Ui.Icons.VISIBILITY_OFF, theme.get("primaryTextColor")) + ); + hideIcon.setScaleType(ImageView.ScaleType.FIT_CENTER); + hideIcon.setLayoutParams( + new LinearLayout.LayoutParams( + Ui.dpToPixels(context, 18), + Ui.dpToPixels(context, 18) + ) + ); + + TextView hideLabel = new TextView(context); + hideLabel.setText("Hide controls"); + hideLabel.setTextSize(12); + hideLabel.setTextColor(theme.get("primaryTextColor")); + hideLabel.setPadding(Ui.dpToPixels(context, 8), 0, 0, 0); + + handle.addView(hideIcon); + handle.addView(hideLabel); handle.setLayoutParams( new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT,