Copy buttons: haptic tick + transient 'Copied' confirmation

This commit is contained in:
2ro
2026-06-15 21:15:26 -04:00
parent 22292ef79c
commit b7c3b95f51
5 changed files with 59 additions and 0 deletions
@@ -534,6 +534,22 @@ public class MainActivity extends GameActivity {
}
}
// Called from native code to play a tiny "tick" haptic on a successful copy.
public void vibrateCopy() {
Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
if (vibrator == null || !vibrator.hasVibrator()) {
return;
}
// One short, light tick — a confirmation, not an alert.
if (Build.VERSION.SDK_INT >= 29) {
vibrator.vibrate(VibrationEffect.createPredefined(VibrationEffect.EFFECT_TICK));
} else if (Build.VERSION.SDK_INT >= 26) {
vibrator.vibrate(VibrationEffect.createOneShot(20, VibrationEffect.DEFAULT_AMPLITUDE));
} else {
vibrator.vibrate(20);
}
}
// Called from native code to set status-bar icon color to contrast the
// in-app theme. white = light icons for a dark background. The app draws
// edge-to-edge, so the OS status-bar background is the app's own content;