chore: add intent to broadcast font name

This commit is contained in:
Nnyny 2025-11-20 12:44:59 +07:00
parent 4b7829f978
commit 3264557bef

View file

@ -35,6 +35,7 @@ import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputConnection;
import android.widget.FrameLayout;
import android.content.Intent;
import io.sentry.android.core.SentryAndroid;
import io.sentry.Sentry;
@ -139,6 +140,17 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
KMManager.updateSelectionRange(KMManager.KeyboardType.KEYBOARD_TYPE_SYSTEM);
}
private void sendCurrentFontName() {
Keyboard keyboardInfo = KMManager.getCurrentKeyboardInfo(this);
if (keyboardInfo != null) {
String fontName = keyboardInfo.getFont();
Intent intent = new Intent("com.keyman.android.keyboard_changed");
intent.putExtra("fontName", fontName);
sendBroadcast(intent);
}
}
/**
* This is the main point where we do our initialization of the input method
* to begin operating on an application. At this point we have been
@ -197,6 +209,10 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
if (KMManager.isNumericField(inputType)) {
KMManager.setNumericLayer(KeyboardType.KEYBOARD_TYPE_SYSTEM);
}
if (KMManager.isKeyboardLoaded(KeyboardType.KEYBOARD_TYPE_SYSTEM)) {
sendCurrentFontName();
}
}
@Override
@ -264,6 +280,7 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
@Override
public void onKeyboardChanged(String newKeyboard) {
KMManager.showSystemKeyboard();
sendCurrentFontName();
}
@Override