Update Android port
* doc/emacs/android.texi (Android Windowing): Document `android-keyboard-bell-duration'. * java/org/gnu/emacs/EmacsService.java (ringBell): New argument DURATION. * src/android.c (android_init_emacs_service): Adjust correspondingly. (android_bell): Provide the duration of the vibration. * src/androidfns.c (syms_of_androidfns) <android_keyboard_bell_duration>: New variable.
This commit is contained in:
parent
dc2199de3e
commit
7b43d70c73
4 changed files with 31 additions and 6 deletions
|
@ -690,6 +690,15 @@ these key sequences before they can be filtered by the input method.
|
|||
disabled by setting the variable
|
||||
@code{android-intercept-control-space} to @code{nil}.
|
||||
|
||||
@vindex android-keyboard-bell-duration
|
||||
@cindex keyboard bell, android
|
||||
The keyboard bell installed within Android systems takes the form of
|
||||
a vibrating element that is activated for a number of milliseconds
|
||||
whenever the bell is rung. The duration of this vibration can be
|
||||
customized through altering the variable
|
||||
@code{android-keyboard-bell-duration} to any value between @code{10}
|
||||
and @code{1000}.
|
||||
|
||||
@node Android Fonts
|
||||
@section Font Backends and Selection under Android
|
||||
@cindex fonts, android
|
||||
|
|
|
@ -448,12 +448,13 @@ public final class EmacsService extends Service
|
|||
|
||||
@SuppressWarnings ("deprecation")
|
||||
public void
|
||||
ringBell ()
|
||||
ringBell (int duration)
|
||||
{
|
||||
Vibrator vibrator;
|
||||
VibrationEffect effect;
|
||||
VibratorManager vibratorManager;
|
||||
Object tem;
|
||||
int amplitude;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
||||
{
|
||||
|
@ -467,13 +468,13 @@ public final class EmacsService extends Service
|
|||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
{
|
||||
amplitude = VibrationEffect.DEFAULT_AMPLITUDE;
|
||||
effect
|
||||
= VibrationEffect.createOneShot (50,
|
||||
VibrationEffect.DEFAULT_AMPLITUDE);
|
||||
= VibrationEffect.createOneShot (duration, amplitude);
|
||||
vibrator.vibrate (effect);
|
||||
}
|
||||
else
|
||||
vibrator.vibrate (50);
|
||||
vibrator.vibrate (duration);
|
||||
}
|
||||
|
||||
public short[]
|
||||
|
|
|
@ -1552,7 +1552,7 @@ android_init_emacs_service (void)
|
|||
"(Lorg/gnu/emacs/EmacsWindow;)V");
|
||||
FIND_METHOD (clear_area, "clearArea",
|
||||
"(Lorg/gnu/emacs/EmacsWindow;IIII)V");
|
||||
FIND_METHOD (ring_bell, "ringBell", "()V");
|
||||
FIND_METHOD (ring_bell, "ringBell", "(I)V");
|
||||
FIND_METHOD (query_tree, "queryTree",
|
||||
"(Lorg/gnu/emacs/EmacsWindow;)[S");
|
||||
FIND_METHOD (get_screen_width, "getScreenWidth", "(Z)I");
|
||||
|
@ -4900,10 +4900,17 @@ android_put_image (android_pixmap handle, struct android_image *image)
|
|||
void
|
||||
android_bell (void)
|
||||
{
|
||||
jint duration;
|
||||
|
||||
/* Restrict android_keyboard_bell_duration to values between 10 and
|
||||
1000. */
|
||||
duration = MIN (1000, MAX (0, android_keyboard_bell_duration));
|
||||
|
||||
(*android_java_env)->CallNonvirtualVoidMethod (android_java_env,
|
||||
emacs_service,
|
||||
service_class.class,
|
||||
service_class.ring_bell);
|
||||
service_class.ring_bell,
|
||||
duration);
|
||||
android_exception_check ();
|
||||
}
|
||||
|
||||
|
|
|
@ -3232,6 +3232,14 @@ restrictions.
|
|||
This option has no effect on Android 9 and earlier. */);
|
||||
android_use_exec_loader = true;
|
||||
|
||||
DEFVAR_INT ("android-keyboard-bell-duration",
|
||||
android_keyboard_bell_duration,
|
||||
doc: /* Number of milliseconds to vibrate after ringing the keyboard bell.
|
||||
The keyboard bell under Android systems takes the form of a vibrating
|
||||
element that is activated for a given number of milliseconds upon the
|
||||
bell being rung. */);
|
||||
android_keyboard_bell_duration = 50;
|
||||
|
||||
/* Functions defined. */
|
||||
defsubr (&Sx_create_frame);
|
||||
defsubr (&Sxw_color_defined_p);
|
||||
|
|
Loading…
Reference in a new issue