Forward scans with KDE Connect

Add a KDE Connect forwarding option that sends scan text to the
exported remote input activity via a text/x-keystrokes intent.
This commit is contained in:
Markus Fisch
2026-06-24 18:29:48 +02:00
parent fba7b0d70f
commit 7610fdd386
34 changed files with 137 additions and 0 deletions
@@ -57,6 +57,7 @@ import de.markusfisch.android.binaryeye.graphics.mapViewYToFrame
import de.markusfisch.android.binaryeye.graphics.setCovered
import de.markusfisch.android.binaryeye.graphics.setFrameRoi
import de.markusfisch.android.binaryeye.graphics.setFrameToView
import de.markusfisch.android.binaryeye.kdeconnect.sendToKdeConnect
import de.markusfisch.android.binaryeye.media.releaseToneGenerators
import de.markusfisch.android.binaryeye.net.isScanDeeplink
import de.markusfisch.android.binaryeye.net.sendAsync
@@ -1085,6 +1086,9 @@ fun Activity.showResult(
)
}
}
if (prefs.sendScanKdeConnect && !bulkMode) {
sendToKdeConnect(scan)
}
if (runAutomatedActions(scan)) {
return
}
@@ -37,6 +37,8 @@ fun Context.startIntent(intent: Intent): Boolean = try {
true
} catch (_: ActivityNotFoundException) {
false
} catch (_: SecurityException) {
false
}
fun Context.openUrl(url: String, silent: Boolean = false): Boolean {
@@ -373,6 +373,7 @@ class PreferencesFragment : PreferenceFragmentCompat() {
setIcon("send_scan_device_id", R.drawable.ic_label)
setIcon(SEND_SCAN_BLUETOOTH, R.drawable.ic_action_bluetooth)
setIcon(SEND_SCAN_BLUETOOTH_HOST, R.drawable.ic_action_bluetooth)
setIcon(SEND_SCAN_KDE_CONNECT, R.drawable.ic_action_forward)
setIcon("open_immediately", R.drawable.ic_action_open)
setIcon("strip_tracking_params", R.drawable.ic_action_remove)
setIcon("show_meta_data", R.drawable.ic_action_info)
@@ -503,6 +504,7 @@ class PreferencesFragment : PreferenceFragmentCompat() {
private const val IGNORE_CODES = "ignore_codes"
private const val SEND_SCAN_BLUETOOTH = "send_scan_bluetooth"
private const val SEND_SCAN_BLUETOOTH_HOST = "send_scan_bluetooth_host"
private const val SEND_SCAN_KDE_CONNECT = "send_scan_kde_connect"
}
}
@@ -0,0 +1,30 @@
package de.markusfisch.android.binaryeye.kdeconnect
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import de.markusfisch.android.binaryeye.content.startIntentOrToast
import de.markusfisch.android.binaryeye.database.Scan
private const val KDE_CONNECT_PACKAGE = "org.kde.kdeconnect_tp"
private const val KDE_CONNECT_KEYSTROKES_ACTIVITY =
"org.kde.kdeconnect.plugins.mousepad.SendKeystrokesToHostActivity"
private const val KEYSTROKES_MIME_TYPE = "text/x-keystrokes"
fun Context.sendToKdeConnect(scan: Scan): Boolean {
if (scan.text.isEmpty()) {
return false
}
return startIntentOrToast(createKdeConnectIntent(scan.text))
}
fun createKdeConnectIntent(text: String): Intent {
return Intent(Intent.ACTION_SEND).apply {
component = ComponentName(
KDE_CONNECT_PACKAGE,
KDE_CONNECT_KEYSTROKES_ACTIVITY
)
type = KEYSTROKES_MIME_TYPE
putExtra(Intent.EXTRA_TEXT, text)
}
}
@@ -231,6 +231,11 @@ class Preferences {
apply(SEND_SCAN_BLUETOOTH_HOST, value)
field = value
}
var sendScanKdeConnect = false
set(value) {
apply(SEND_SCAN_KDE_CONNECT, value)
field = value
}
var customLocale: String = ""
set(value) {
// Make sure this setting is written immediately because
@@ -404,6 +409,7 @@ class Preferences {
json.put(SEND_SCAN_DEVICE_ID, p, defaults.sendScanDeviceId)
json.put(SEND_SCAN_BLUETOOTH, p, defaults.sendScanBluetooth)
json.put(SEND_SCAN_BLUETOOTH_HOST, p, defaults.sendScanBluetoothHost)
json.put(SEND_SCAN_KDE_CONNECT, p, defaults.sendScanKdeConnect)
json.put(CUSTOM_LOCALE, p, defaults.customLocale)
json.put(INDEX_OF_LAST_SELECTED_FORMAT, p, defaults.indexOfLastSelectedFormat)
json.put(INDEX_OF_LAST_SELECTED_EC_LEVEL, p, defaults.indexOfLastSelectedEcLevel)
@@ -504,6 +510,7 @@ class Preferences {
putString(SEND_SCAN_DEVICE_ID, json)
putBoolean(SEND_SCAN_BLUETOOTH, json)
putString(SEND_SCAN_BLUETOOTH_HOST, json)
putBoolean(SEND_SCAN_KDE_CONNECT, json)
putString(CUSTOM_LOCALE, json)
putInt(INDEX_OF_LAST_SELECTED_FORMAT, json)
putInt(INDEX_OF_LAST_SELECTED_EC_LEVEL, json)
@@ -658,6 +665,10 @@ class Preferences {
)?.also {
sendScanBluetoothHost = it
}
sendScanKdeConnect = preferences.getBoolean(
SEND_SCAN_KDE_CONNECT,
sendScanKdeConnect
)
preferences.getString(CUSTOM_LOCALE, customLocale)?.also {
customLocale = it
}
@@ -833,6 +844,7 @@ class Preferences {
putString(SEND_SCAN_DEVICE_ID, defaults.sendScanDeviceId)
putBoolean(SEND_SCAN_BLUETOOTH, defaults.sendScanBluetooth)
putString(SEND_SCAN_BLUETOOTH_HOST, defaults.sendScanBluetoothHost)
putBoolean(SEND_SCAN_KDE_CONNECT, defaults.sendScanKdeConnect)
putString(CUSTOM_LOCALE, defaults.customLocale)
putInt(INDEX_OF_LAST_SELECTED_FORMAT, defaults.indexOfLastSelectedFormat)
putInt(INDEX_OF_LAST_SELECTED_EC_LEVEL, defaults.indexOfLastSelectedEcLevel)
@@ -941,6 +953,7 @@ class Preferences {
private const val SEND_SCAN_DEVICE_ID = "send_scan_device_id"
private const val SEND_SCAN_BLUETOOTH = "send_scan_bluetooth"
private const val SEND_SCAN_BLUETOOTH_HOST = "send_scan_bluetooth_host"
private const val SEND_SCAN_KDE_CONNECT = "send_scan_kde_connect"
private const val CUSTOM_LOCALE = "custom_locale"
private const val INDEX_OF_LAST_SELECTED_FORMAT = "index_of_last_selected_format"
private const val INDEX_OF_LAST_SELECTED_EC_LEVEL = "index_of_last_selected_ec_level"
+2
View File
@@ -219,6 +219,8 @@
<string name="send_scan_bluetooth">إرسال عمليات المسح عبر بلوتوث</string>
<string name="send_scan_bluetooth_summary">تمكين إرسال عمليات المسح إلى مضيف بلوتوث معين.</string>
<string name="send_scan_bluetooth_host">المضيف</string>
<string name="send_scan_kde_connect">إرسال عمليات المسح عبر KDE Connect</string>
<string name="send_scan_kde_connect_summary">فعّل لكتابة عمليات المسح على جهاز KDE Connect مقترن.</string>
<string name="no_bluetooth_hosts_paired">لا يوجد اقتران مع مضيفين</string>
<string name="bluetooth_connect_fail">تعذر الاتصال بجهاز بلوتوث.</string>
<string name="bluetooth_send_fail">تعذر الإرسال إلى جهاز بلوتوث.</string>
+2
View File
@@ -207,6 +207,8 @@
<string name="send_scan_bluetooth">Препращане на сканиранията с Bluetooth</string>
<string name="send_scan_bluetooth_summary">Активиране на препращане на сканирания към даден Bluetooth хост.</string>
<string name="send_scan_bluetooth_host">Хост</string>
<string name="send_scan_kde_connect">Препращане на сканиранията с KDE Connect</string>
<string name="send_scan_kde_connect_summary">Активиране на въвеждане на сканиранията на сдвоено устройство KDE Connect.</string>
<string name="no_bluetooth_hosts_paired">Няма сдвоени хостове</string>
<string name="bluetooth_connect_fail">Неуспешно свързване с Bluetooth устройство.</string>
<string name="bluetooth_send_fail">Неуспешно изпращане до Bluetooth устройство.</string>
+2
View File
@@ -207,6 +207,8 @@
<string name="send_scan_bluetooth">ব্লুটুথ দিয়ে স্ক্যান ফরোয়ার্ড করুন</string>
<string name="send_scan_bluetooth_summary">Enable to forwards scans to a given Bluetooth host.</string>
<string name="send_scan_bluetooth_host">হোস্ট</string>
<string name="send_scan_kde_connect">KDE Connect দিয়ে স্ক্যান ফরোয়ার্ড করুন</string>
<string name="send_scan_kde_connect_summary">জোড়া দেওয়া KDE Connect ডিভাইসে স্ক্যান টাইপ করতে সক্রিয় করুন।</string>
<string name="no_bluetooth_hosts_paired">কোন হোস্ট পেয়ার করা হয়নি</string>
<string name="bluetooth_connect_fail">Could not connect to bluetooth device.</string>
<string name="bluetooth_send_fail">Could not send to bluetooth device.</string>
+2
View File
@@ -213,6 +213,8 @@
<string name="send_scan_bluetooth">Přesměrovat skeny přes Bluetooth</string>
<string name="send_scan_bluetooth_summary">Skeny se přesměrují na daného hostitele Bluetooth.</string>
<string name="send_scan_bluetooth_host">Hostitel</string>
<string name="send_scan_kde_connect">Přesměrovat skeny přes KDE Connect</string>
<string name="send_scan_kde_connect_summary">Zapnout psaní skenů na spárovaném zařízení KDE Connect.</string>
<string name="no_bluetooth_hosts_paired">Není spárován žádný hostitel</string>
<string name="bluetooth_connect_fail">Nelze se připojit k zařízení Bluetooth.</string>
<string name="bluetooth_send_fail">Nelze odesílat na zařízení Bluetooth.</string>
+2
View File
@@ -207,6 +207,8 @@
<string name="send_scan_bluetooth">Send scanninger med Bluetooth</string>
<string name="send_scan_bluetooth_summary">Enable to forwards scans to a given Bluetooth host.</string>
<string name="send_scan_bluetooth_host">Vært</string>
<string name="send_scan_kde_connect">Send scanninger med KDE Connect</string>
<string name="send_scan_kde_connect_summary">Aktivér for at skrive scanninger på en parret KDE Connect-enhed.</string>
<string name="no_bluetooth_hosts_paired">Ingen værter parret</string>
<string name="bluetooth_connect_fail">Could not connect to bluetooth device.</string>
<string name="bluetooth_send_fail">Could not send to bluetooth device.</string>
+2
View File
@@ -207,6 +207,8 @@
<string name="send_scan_bluetooth">Scans per Bluetooth weiterleiten</string>
<string name="send_scan_bluetooth_summary">Aktivieren Sie diese Option, um Scans an das angegebene Bluetooth-Gerät weiterzuleiten.</string>
<string name="send_scan_bluetooth_host">Gerät</string>
<string name="send_scan_kde_connect">Scans mit KDE Connect weiterleiten</string>
<string name="send_scan_kde_connect_summary">Aktivieren Sie diese Option, um Scans auf einem gekoppelten KDE-Connect-Gerät einzugeben.</string>
<string name="no_bluetooth_hosts_paired">Keine Geräte verbunden</string>
<string name="bluetooth_connect_fail">Es kann leider keine Verbindung zum Bluetooth-Gerät hergestellt werden</string>
<string name="bluetooth_send_fail">Senden zum Bluetooth-Gerät fehlgeschlagen</string>
+2
View File
@@ -208,6 +208,8 @@
<string name="send_scan_bluetooth">Enviar escaneos con Bluetooth</string>
<string name="send_scan_bluetooth_summary">Habilita el envío de escaneos a un host Bluetooth.</string>
<string name="send_scan_bluetooth_host">Anfitrión</string>
<string name="send_scan_kde_connect">Enviar escaneos con KDE Connect</string>
<string name="send_scan_kde_connect_summary">Activa esta opción para escribir escaneos en un dispositivo KDE Connect emparejado.</string>
<string name="no_bluetooth_hosts_paired">Ningún host emparejado</string>
<string name="bluetooth_connect_fail">No se pudo conectar a un dispositivo bluetooth.</string>
<string name="bluetooth_send_fail">No se pudo enviar a un dispositivo bluetooth.</string>
+2
View File
@@ -207,6 +207,8 @@
<string name="send_scan_bluetooth">انتقال اسکن ها با بلوتوث</string>
<string name="send_scan_bluetooth_summary">برای ارسال اسکن‌ها به میزبان Bluetooth مشخص فعال کنید.</string>
<string name="send_scan_bluetooth_host">میزبان</string>
<string name="send_scan_kde_connect">انتقال اسکن‌ها با KDE Connect</string>
<string name="send_scan_kde_connect_summary">برای تایپ اسکن‌ها روی دستگاه KDE Connect جفت‌شده فعال کنید.</string>
<string name="no_bluetooth_hosts_paired">میزبان های جفت نشده</string>
<string name="bluetooth_connect_fail">اتصال به دستگاه Bluetooth ممکن نشد.</string>
<string name="bluetooth_send_fail">ارسال به دستگاه Bluetooth ممکن نشد.</string>
+2
View File
@@ -208,6 +208,8 @@
<string name="send_scan_bluetooth">Partager les scans par Bluetooth</string>
<string name="send_scan_bluetooth_summary">Partager les scans à un hôte Bluetooth donné.</string>
<string name="send_scan_bluetooth_host">Hôte</string>
<string name="send_scan_kde_connect">Partager les scans avec KDE Connect</string>
<string name="send_scan_kde_connect_summary">Activez cette option pour saisir les scans sur un appareil KDE Connect appairé.</string>
<string name="no_bluetooth_hosts_paired">Aucun hôte appairé</string>
<string name="bluetooth_connect_fail">Impossible de se connecter à l\'appareil Bluetooth.</string>
<string name="bluetooth_send_fail">Impossible d\'envoyer à l\'appareil Bluetooth.</string>
+2
View File
@@ -207,6 +207,8 @@
<string name="send_scan_bluetooth">Bluetooth segítségével továbbítás</string>
<string name="send_scan_bluetooth_summary">Enable to forwards scans to a given Bluetooth host.</string>
<string name="send_scan_bluetooth_host">Host</string>
<string name="send_scan_kde_connect">Továbbítás KDE Connecttel</string>
<string name="send_scan_kde_connect_summary">Engedélyezze a beolvasások beírását egy párosított KDE Connect-eszközön.</string>
<string name="no_bluetooth_hosts_paired">Nincsenek párosított hosztok</string>
<string name="bluetooth_connect_fail">Could not connect to bluetooth device.</string>
<string name="bluetooth_send_fail">Could not send to bluetooth device.</string>
+2
View File
@@ -205,6 +205,8 @@
<string name="send_scan_bluetooth">Reenviar exploraciones con Bluetooth</string>
<string name="send_scan_bluetooth_summary">Enable to forwards scans to a given Bluetooth host.</string>
<string name="send_scan_bluetooth_host">مضيف</string>
<string name="send_scan_kde_connect">Teruskan pemindaian dengan KDE Connect</string>
<string name="send_scan_kde_connect_summary">Aktifkan untuk mengetik hasil pemindaian pada perangkat KDE Connect yang dipasangkan.</string>
<string name="no_bluetooth_hosts_paired">No Hosts Paired</string>
<string name="bluetooth_connect_fail">Could not connect to bluetooth device.</string>
<string name="bluetooth_send_fail">Could not send to bluetooth device.</string>
+2
View File
@@ -222,6 +222,8 @@
<string name="send_scan_bluetooth">Inoltra scansioni con Bluetooth</string>
<string name="send_scan_bluetooth_summary">Abilita per inoltrare le scansioni ad un determinato host Bluetooth.</string>
<string name="send_scan_bluetooth_host">Host</string>
<string name="send_scan_kde_connect">Inoltra scansioni con KDE Connect</string>
<string name="send_scan_kde_connect_summary">Abilita per digitare le scansioni su un dispositivo KDE Connect associato.</string>
<string name="no_bluetooth_hosts_paired">Nessun host associato</string>
<string name="bluetooth_connect_fail">Impossibile connettersi al dispositivo Bluetooth.</string>
<string name="bluetooth_send_fail">Impossibile inviare al dispositivo Bluetooth.</string>
+2
View File
@@ -205,6 +205,8 @@
<string name="send_scan_bluetooth">Bluetooth でスキャンを転送</string>
<string name="send_scan_bluetooth_summary">Enable to forwards scans to a given Bluetooth host.</string>
<string name="send_scan_bluetooth_host">ホスト</string>
<string name="send_scan_kde_connect">KDE Connect でスキャンを転送</string>
<string name="send_scan_kde_connect_summary">ペアリング済みの KDE Connect デバイスでスキャン内容を入力します。</string>
<string name="no_bluetooth_hosts_paired">ホストがペアリングされていません</string>
<string name="bluetooth_connect_fail">Could not connect to bluetooth device.</string>
<string name="bluetooth_send_fail">Could not send to bluetooth device.</string>
+2
View File
@@ -207,6 +207,8 @@
<string name="send_scan_bluetooth">სკანების გადაგზავნა Bluetooth-ით</string>
<string name="send_scan_bluetooth_summary">Enable to forwards scans to a given Bluetooth host.</string>
<string name="send_scan_bluetooth_host">ჰოსტი</string>
<string name="send_scan_kde_connect">სკანების გადაგზავნა KDE Connect-ით</string>
<string name="send_scan_kde_connect_summary">ჩართეთ, რომ სკანები დაწეროს დაწყვილებულ KDE Connect მოწყობილობაზე.</string>
<string name="no_bluetooth_hosts_paired">პარიები არ არის შემერთებული</string>
<string name="bluetooth_connect_fail">Could not connect to bluetooth device.</string>
<string name="bluetooth_send_fail">Could not send to bluetooth device.</string>
+2
View File
@@ -205,6 +205,8 @@
<string name="send_scan_bluetooth">블루투스로 스캔 전송</string>
<string name="send_scan_bluetooth_summary">스캔을 지정한 Bluetooth 호스트로 전달합니다.</string>
<string name="send_scan_bluetooth_host">호스트</string>
<string name="send_scan_kde_connect">KDE Connect로 스캔 전송</string>
<string name="send_scan_kde_connect_summary">페어링된 KDE Connect 장치에 스캔을 입력합니다.</string>
<string name="no_bluetooth_hosts_paired">연결된 호스트가 없습니다</string>
<string name="bluetooth_connect_fail">Bluetooth 장치에 연결할 수 없습니다.</string>
<string name="bluetooth_send_fail">Bluetooth 장치로 보낼 수 없습니다.</string>
+2
View File
@@ -255,6 +255,8 @@
<string name="send_scan_bluetooth">Pārsūtīt skenējumus ar Bluetooth</string>
<string name="send_scan_bluetooth_summary">Iespējojiet, lai pārsūtītu skenējumus uz noteiktu Bluetooth resursdatoru.</string>
<string name="send_scan_bluetooth_host">Resursdators</string>
<string name="send_scan_kde_connect">Pārsūtīt skenējumus ar KDE Connect</string>
<string name="send_scan_kde_connect_summary">Iespējojiet, lai rakstītu skenējumus pārī savienotā KDE Connect ierīcē.</string>
<string name="no_bluetooth_hosts_paired">Nav sapārotu resursdatoru</string>
<string name="bluetooth_connect_fail">Neizdevās izveidot savienojumu ar Bluetooth ierīci.</string>
<string name="bluetooth_send_fail">Neizdevās nosūtīt uz Bluetooth ierīci.</string>
+2
View File
@@ -207,6 +207,8 @@
<string name="send_scan_bluetooth">Stuur scans door met Bluetooth</string>
<string name="send_scan_bluetooth_summary">Enable to forwards scans to a given Bluetooth host.</string>
<string name="send_scan_bluetooth_host">Host</string>
<string name="send_scan_kde_connect">Stuur scans door met KDE Connect</string>
<string name="send_scan_kde_connect_summary">Schakel in om scans te typen op een gekoppeld KDE Connect-apparaat.</string>
<string name="no_bluetooth_hosts_paired">Geen hosts gekoppeld</string>
<string name="bluetooth_connect_fail">Could not connect to bluetooth device.</string>
<string name="bluetooth_send_fail">Could not send to bluetooth device.</string>
+2
View File
@@ -226,6 +226,8 @@
<string name="send_scan_bluetooth">Przekazuj skany za pomocą Bluetooth</string>
<string name="send_scan_bluetooth_summary">Enable to forwards scans to a given Bluetooth host.</string>
<string name="send_scan_bluetooth_host">Gospodarz</string>
<string name="send_scan_kde_connect">Przekazuj skany za pomocą KDE Connect</string>
<string name="send_scan_kde_connect_summary">Włącz, aby wpisywać skany na sparowanym urządzeniu KDE Connect.</string>
<string name="no_bluetooth_hosts_paired">Brak sparowanych hostów</string>
<string name="bluetooth_connect_fail">Could not connect to bluetooth device.</string>
<string name="bluetooth_send_fail">Could not send to bluetooth device.</string>
@@ -207,6 +207,8 @@
<string name="send_scan_bluetooth">Encaminhar digitalizações com Bluetooth</string>
<string name="send_scan_bluetooth_summary">Ative para encaminhar digitalizações a um determinado host Bluetooth.</string>
<string name="send_scan_bluetooth_host">Anfitrião</string>
<string name="send_scan_kde_connect">Encaminhar digitalizações com KDE Connect</string>
<string name="send_scan_kde_connect_summary">Ative para digitar digitalizações em um dispositivo KDE Connect pareado.</string>
<string name="no_bluetooth_hosts_paired">Nenhum Host Pareado</string>
<string name="bluetooth_connect_fail">Não foi possível conectar com o dispositivo Bluetooth.</string>
<string name="bluetooth_send_fail">Não foi possível enviar para o dispositivo Bluetooth.</string>
@@ -213,6 +213,8 @@
<string name="send_scan_bluetooth">Отправлять сканирования по bluetooth</string>
<string name="send_scan_bluetooth_summary">Пересылать сканированные данные на указанный узел bluetooth.</string>
<string name="send_scan_bluetooth_host">Узел</string>
<string name="send_scan_kde_connect">Отправлять сканирования через KDE Connect</string>
<string name="send_scan_kde_connect_summary">Включите, чтобы вводить сканирования на сопряжённом устройстве KDE Connect.</string>
<string name="no_bluetooth_hosts_paired">Нет сопряжённых узлов</string>
<string name="bluetooth_connect_fail">Невозможно подключиться к bluetooth-устройству.</string>
<string name="bluetooth_send_fail">Невозможно отправить на bluetooth-устройство.</string>
+2
View File
@@ -207,6 +207,8 @@
<string name="send_scan_bluetooth">Taramaları Bluetooth ile ilet</string>
<string name="send_scan_bluetooth_summary">Taramaları belirtilen bir Bluetooth aygıtına iletmeyi etkinleştirin</string>
<string name="send_scan_bluetooth_host">Aygıt</string>
<string name="send_scan_kde_connect">Taramaları KDE Connect ile ilet</string>
<string name="send_scan_kde_connect_summary">Taramaları eşleştirilmiş bir KDE Connect aygıtında yazmayı etkinleştirin.</string>
<string name="no_bluetooth_hosts_paired">Eşleştirilen Aygıt Yok</string>
<string name="bluetooth_connect_fail">Bluetooth aygıtına bağlanılamadı.</string>
<string name="bluetooth_send_fail">Bluetooth aygıtına gönderilemedi.</string>
+2
View File
@@ -213,6 +213,8 @@
<string name="send_scan_bluetooth">Пересилати сканування через Bluetooth</string>
<string name="send_scan_bluetooth_summary">Увімкнути пересилання сканованих даних на вказаний хост Bluetooth.</string>
<string name="send_scan_bluetooth_host">Хост</string>
<string name="send_scan_kde_connect">Пересилати сканування через KDE Connect</string>
<string name="send_scan_kde_connect_summary">Увімкніть, щоб вводити сканування на сполученому пристрої KDE Connect.</string>
<string name="no_bluetooth_hosts_paired">Немає хостів у сполучених</string>
<string name="bluetooth_connect_fail">Неможливо підключитися до пристрою Bluetooth.</string>
<string name="bluetooth_send_fail">Неможливо надіслати на пристрій Bluetooth.</string>
+2
View File
@@ -205,6 +205,8 @@
<string name="send_scan_bluetooth">Chuyển tiếp quét với Bluetooth</string>
<string name="send_scan_bluetooth_summary">Enable to forwards scans to a given Bluetooth host.</string>
<string name="send_scan_bluetooth_host">Máy chủ</string>
<string name="send_scan_kde_connect">Chuyển tiếp quét bằng KDE Connect</string>
<string name="send_scan_kde_connect_summary">Bật để nhập nội dung quét trên thiết bị KDE Connect đã ghép đôi.</string>
<string name="no_bluetooth_hosts_paired">Không có Host nào được kết nối</string>
<string name="bluetooth_connect_fail">Could not connect to bluetooth device.</string>
<string name="bluetooth_send_fail">Could not send to bluetooth device.</string>
@@ -205,6 +205,8 @@
<string name="send_scan_bluetooth">使用蓝牙转发扫描结果</string>
<string name="send_scan_bluetooth_summary">启用以转发扫描结果至指定的蓝牙服务设备。</string>
<string name="send_scan_bluetooth_host">蓝牙服务器</string>
<string name="send_scan_kde_connect">使用 KDE Connect 转发扫描结果</string>
<string name="send_scan_kde_connect_summary">启用后在已配对的 KDE Connect 设备上输入扫描结果。</string>
<string name="no_bluetooth_hosts_paired">没有已配对的服务器</string>
<string name="bluetooth_connect_fail">无法连接蓝牙设备。</string>
<string name="bluetooth_send_fail">无法将结果发送至蓝牙设备。</string>
@@ -205,6 +205,8 @@
<string name="send_scan_bluetooth">透過藍牙轉發掃描</string>
<string name="send_scan_bluetooth_summary">啟用以將掃描轉發到指定藍牙裝置</string>
<string name="send_scan_bluetooth_host">主機</string>
<string name="send_scan_kde_connect">透過 KDE Connect 轉發掃描</string>
<string name="send_scan_kde_connect_summary">啟用以在已配對的 KDE Connect 裝置上輸入掃描內容。</string>
<string name="no_bluetooth_hosts_paired">沒有配對主機</string>
<string name="bluetooth_connect_fail">無法連線到藍牙裝置</string>
<string name="bluetooth_send_fail">無法傳送到藍牙裝置</string>
+2
View File
@@ -222,6 +222,8 @@
<string name="send_scan_bluetooth">Forward scans with Bluetooth</string>
<string name="send_scan_bluetooth_summary">Enable to forward scans to a given Bluetooth host.</string>
<string name="send_scan_bluetooth_host">Host</string>
<string name="send_scan_kde_connect">Forward scans with KDE Connect</string>
<string name="send_scan_kde_connect_summary">Enable to type scans on a paired KDE Connect device.</string>
<string name="no_bluetooth_hosts_paired">No hosts paired</string>
<string name="bluetooth_connect_fail">Could not connect to Bluetooth device.</string>
<string name="bluetooth_send_fail">Could not send to Bluetooth device.</string>
+5
View File
@@ -131,6 +131,11 @@
android:entries="@array/bluetooth_host_names"
android:entryValues="@array/bluetooth_host_values"
android:defaultValue="@string/no_bluetooth_hosts_paired_value"/>
<androidx.preference.SwitchPreferenceCompat
android:defaultValue="false"
android:key="send_scan_kde_connect"
android:title="@string/send_scan_kde_connect"
android:summary="@string/send_scan_kde_connect_summary"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/content_category">
<androidx.preference.SwitchPreferenceCompat
+5
View File
@@ -131,6 +131,11 @@
android:entries="@array/bluetooth_host_names"
android:entryValues="@array/bluetooth_host_values"
android:defaultValue="@string/no_bluetooth_hosts_paired_value"/>
<androidx.preference.SwitchPreferenceCompat
android:defaultValue="false"
android:key="send_scan_kde_connect"
android:title="@string/send_scan_kde_connect"
android:summary="@string/send_scan_kde_connect_summary"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/content_category">
<androidx.preference.SwitchPreferenceCompat
@@ -0,0 +1,24 @@
package de.markusfisch.android.binaryeye.kdeconnect
import android.content.Intent
import junit.framework.TestCase.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class KdeConnectSenderTest {
@Test
fun createKdeConnectIntent() {
val intent = createKdeConnectIntent("test scan")
assertEquals(Intent.ACTION_SEND, intent.action)
assertEquals("text/x-keystrokes", intent.type)
assertEquals("org.kde.kdeconnect_tp", intent.component?.packageName)
assertEquals(
"org.kde.kdeconnect.plugins.mousepad.SendKeystrokesToHostActivity",
intent.component?.className
)
assertEquals("test scan", intent.getStringExtra(Intent.EXTRA_TEXT))
}
}