mirror of
https://code.gri.mw/GUI/grim.git
synced 2026-07-17 20:28:55 +00:00
Copy buttons: haptic tick + transient 'Copied' confirmation
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user