mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-01 06:35:09 +00:00
Compare commits
44 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
45bbed6d72 | ||
|
42f2f425a1 | ||
|
801c7cbd45 | ||
|
366aaea282 | ||
|
02f5ce2581 | ||
|
a360ca0a01 | ||
|
d356a9e964 | ||
|
e588428812 | ||
|
db0f6288ff | ||
|
86236169d1 | ||
|
32d9f199ff | ||
|
1d51c8792d | ||
|
6124b9a206 | ||
|
c3ad265490 | ||
|
9cf9f43118 | ||
|
11012e21e5 | ||
|
b7faa97292 | ||
|
cc17402609 | ||
|
a0b82d17b4 | ||
|
8550de5e7f | ||
|
46c70639ac | ||
|
fb2b1232fb | ||
|
c2011831a9 | ||
|
ac3ab375ab | ||
|
ab4a1079cc | ||
|
57871802d8 | ||
|
838be381c3 | ||
|
53ad94ef32 | ||
|
53031a0ff1 | ||
|
459fe403a8 | ||
|
c15263b416 | ||
|
6e2b3289e6 | ||
|
7d7f10f022 | ||
|
ea514c0a19 | ||
|
1e34a42b8f | ||
|
db3f4a2fec | ||
|
63a3b6afe4 | ||
|
66c137d11d | ||
|
7f26472665 | ||
|
3c3cfa9c94 | ||
|
7f808a2e0f | ||
|
970f8c63b0 | ||
|
d2dbfd6384 | ||
|
d1b2cba609 |
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.kde.kdeconnect_tp"
|
||||
android:versionCode="800"
|
||||
android:versionName="0.8">
|
||||
android:versionCode="807"
|
||||
android:versionName="0.8g">
|
||||
|
||||
<uses-sdk android:minSdkVersion="9"
|
||||
android:targetSdkVersion="21" />
|
||||
|
@@ -3,7 +3,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.0.+'
|
||||
classpath 'com.android.tools.build:gradle:1.1.0'
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,20 +1,126 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="pref_plugin_telephony">Telefonski obavještavač</string>
|
||||
<string name="pref_plugin_telephony_desc">Pošalji notifikacije za SMS i pozive</string>
|
||||
<string name="pref_plugin_battery">Baterijski izvještaj</string>
|
||||
<string name="pref_plugin_battery_desc">Periodično javi baterijski status</string>
|
||||
<string name="pref_plugin_sftp">Otkrivanje datotečnog sistema</string>
|
||||
<string name="pref_plugin_sftp_desc">Dopušta daljinsko pretraživanje datotečnog sistema telefona</string>
|
||||
<string name="pref_plugin_clipboard">Sinhronizovanje sandučića</string>
|
||||
<string name="pref_plugin_clipboard_desc">Podijeli sadržaj sandučića</string>
|
||||
<string name="pref_plugin_mousepad">Daljinska kontrola ulaza</string>
|
||||
<string name="pref_plugin_mousepad_desc">Koristi telofon kao miš i tastaturu</string>
|
||||
<string name="pref_plugin_mpris">Daljinske kontrole multimedije</string>
|
||||
<string name="pref_plugin_mpris_desc">Upravljajte zvukom/slikom sa vašeg telefona</string>
|
||||
<string name="pref_plugin_ping">Ping</string>
|
||||
<string name="pref_plugin_ping_desc">Šalji i primaj ping-ove</string>
|
||||
<string name="pref_plugin_notifications">Sinhronizovano obavještenje</string>
|
||||
<string name="pref_plugin_notifications_desc">Pristupite vašim notifikacijama sa drugog uređaja</string>
|
||||
<string name="pref_plugin_sharereceiver">Podijeli prijemnik</string>
|
||||
<string name="pref_plugin_sharereceiver_desc">Spasi dolazeće datoteke na telefonsku memoriju</string>
|
||||
<string name="plugin_not_available">Ovo svojstvo nije dostupno i vašoj Android verziji</string>
|
||||
<string name="device_list_empty">Nema uređaja</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Prekini</string>
|
||||
<string name="open_settings">Otvori postavke</string>
|
||||
<string name="no_permissions">Morate odobriti dopuštenje da pristupite notifikacijama</string>
|
||||
<string name="send_ping">Pošalji ping</string>
|
||||
<string name="open_mpris_controls">Otvori daljinsku kontrolu</string>
|
||||
<string name="open_mousepad">Otvori touchpad kontrolu</string>
|
||||
<string name="mousepad_info">Pomjerite prst na ekranu da opmjerite kursor miša. Tapnite za klik i koristite dva ili tri prsta za srednje i desno dugme. Koristite dugi pritisak za prevlačenje.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Postavite akciju tapa sa dva prsta</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Postavite akciju tapa sa tri prsta</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Right click</item>
|
||||
<item>Middle click</item>
|
||||
<item>Nothing</item>
|
||||
<item>Desni klik</item>
|
||||
<item>Srednji klik</item>
|
||||
<item>Ništa</item>
|
||||
</string-array>
|
||||
<string name="mousepad_double_default">desno</string>
|
||||
<string name="mousepad_triple_default">Srednje</string>
|
||||
<string name="category_connected_devices">Spojeni uređaji</string>
|
||||
<string name="category_not_paired_devices">Dostupni uređaji</string>
|
||||
<string name="category_remembered_devices">Zapamćeni uređaji</string>
|
||||
<string name="plugins_failed_to_load">Dodaci se nisu uspjeli učitati (kucnite za više informacija):</string>
|
||||
<string name="device_menu_plugins">Postavke dodatka</string>
|
||||
<string name="device_menu_unpair">Razdvoji</string>
|
||||
<string name="device_not_reachable">Upareni uređaj nije dostupan</string>
|
||||
<string name="unknown_device">Nepoznat uređaj</string>
|
||||
<string name="error_not_reachable">Uređaj nije dostupan</string>
|
||||
<string name="error_already_requested">Uparivanje već zatraženo</string>
|
||||
<string name="error_already_paired">Uređaj već uparen</string>
|
||||
<string name="error_could_not_send_package">Nije moguće poslati paket</string>
|
||||
<string name="error_timed_out">Isteklo</string>
|
||||
<string name="error_canceled_by_user">Prekinuo korisnik</string>
|
||||
<string name="error_canceled_by_other_peer">Prekinuo drugi korisnik</string>
|
||||
<string name="error_invalid_key">Primljen pogrešan ključ</string>
|
||||
<string name="pair_requested">Uparivanje zatraženo</string>
|
||||
<string name="pairing_request_from">Uparivanje zatraženo od %1s</string>
|
||||
<string name="received_url_title">Primljena veza od %1s</string>
|
||||
<string name="received_url_text">Kucni za otvaranje \'%1s\'</string>
|
||||
<string name="incoming_file_title">Dolazna datoteka od %1s</string>
|
||||
<string name="incoming_file_text">%1s</string>
|
||||
<string name="outgoing_file_title">Slanje datoteke na %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Primljena datoteka od %1s</string>
|
||||
<string name="received_file_text">Kucni za otvaranje \'%1s\'</string>
|
||||
<string name="sent_file_title">Poslana datoteka na %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
<string name="sent_file_failed_title">Neuspjelo slanje datoteke %1s</string>
|
||||
<string name="sent_file_failed_text">%1s</string>
|
||||
<string name="tap_to_answer">Kucni za odgovor</string>
|
||||
<string name="reconnect">Ponovo uspostavi vezu</string>
|
||||
<string name="right_click">Pošalji Desni Klik</string>
|
||||
<string name="middle_click">Pošalji Srednji Klik</string>
|
||||
<string name="show_keyboard">Pokaži Tastaturu</string>
|
||||
<string name="device_not_paired">Uređaj nije uparen</string>
|
||||
<string name="request_pairing">Zatraži uparivanje</string>
|
||||
<string name="pairing_accept">Prihvati</string>
|
||||
<string name="pairing_reject">Odbij</string>
|
||||
<string name="device">Uređaj</string>
|
||||
<string name="pair_device">Upari uređaj</string>
|
||||
<string name="remote_control">Daljinska kontrola</string>
|
||||
<string name="settings">KDE Postavke Veze</string>
|
||||
<string name="mpris_play">Reprodukuj</string>
|
||||
<string name="mpris_previous">Prethodni</string>
|
||||
<string name="mpris_rew">Premotaj</string>
|
||||
<string name="mpris_ff">Ubrzano</string>
|
||||
<string name="mpris_next">Sljedeći</string>
|
||||
<string name="mpris_volume">Glasnoća</string>
|
||||
<string name="mpris_settings">Postavke multimedije</string>
|
||||
<string name="mpris_time_settings_title">Dugmad za naprijed/premotavanje</string>
|
||||
<string name="mpris_time_settings_summary">Postavi vrijeme na ubrzano ili premotaj multimedijalnu datoteku.</string>
|
||||
<string-array name="mpris_time_entries">
|
||||
<item>10 seconds</item>
|
||||
<item>20 seconds</item>
|
||||
<item>30 seconds</item>
|
||||
<item>1 minute</item>
|
||||
<item>2 minutes</item>
|
||||
<item>10 sekundi</item>
|
||||
<item>20 sekundi</item>
|
||||
<item>30 sekundi</item>
|
||||
<item>1 minuta</item>
|
||||
<item>2 minute</item>
|
||||
</string-array>
|
||||
<string name="share_to">Podijeli na...</string>
|
||||
<string name="protocol_version_older">Ovaj uređaj koristi staru verziju protokola</string>
|
||||
<string name="protocol_version_newer">Ovaj uređaj koristi noviju verziju protokola</string>
|
||||
<string name="general_settings">Opšte postavke</string>
|
||||
<string name="plugin_settings">Postavke</string>
|
||||
<string name="plugin_settings_with_name">%s Postavke</string>
|
||||
<string name="device_name">Naziv uređaja</string>
|
||||
<string name="device_name_preference_summary">%s</string>
|
||||
<string name="invalid_device_name">Pogrešnan naziv uređaja</string>
|
||||
<string name="shareplugin_text_saved">Primljeni tekst, spašen u ormarić</string>
|
||||
<string name="custom_devices_settings">Lista vlastitih uređaja</string>
|
||||
<string name="custom_device_list">Dodaj uređaje po IP</string>
|
||||
<string name="share_notification_preference">Glasne notifikacije</string>
|
||||
<string name="share_notification_preference_summary">Vibriraj i reprodukuj zvuk kad se prima datoteka</string>
|
||||
<string name="title_activity_notification_filter">Filter napomena</string>
|
||||
<string name="filter_apps_info">Notifikacije će biti sinhronizovane s izabranim aplikacijama.</string>
|
||||
<string name="sftp_internal_storage">Unutrašnji smještaj</string>
|
||||
<string name="sftp_all_files">Sve fajlove</string>
|
||||
<string name="sftp_sdcard_num">SD kartica %d</string>
|
||||
<string name="sftp_sdcard">SD kartica</string>
|
||||
<string name="sftp_readonly">(samo za čitanje)</string>
|
||||
<string name="sftp_camera">Slike sa kamere</string>
|
||||
<string name="add_host">Dodaj host/IP</string>
|
||||
<string name="add_host_hint">IP ili ime računara</string>
|
||||
<string name="no_players_connected">Nema nađenih igrača</string>
|
||||
<string name="custom_dev_list_help">Koristite ovu opciju samo ako vaš uređaj nije automatski otkriven. Unesite IP adresu ili ime hosta i dodirnite dugme da dodate na listu. Dodirnite postojeće dume da uklonite s liste.</string>
|
||||
<string name="mpris_player_on_device">%1$s na %2$s</string>
|
||||
</resources>
|
||||
|
@@ -62,6 +62,7 @@
|
||||
<string name="outgoing_file_title">S\'està enviant el fitxer a %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Fitxer rebut des de %1s</string>
|
||||
<string name="received_file_fail_title">Ha fallat en rebre el fitxer des de %1s</string>
|
||||
<string name="received_file_text">Puntegeu per obrir «%1s»</string>
|
||||
<string name="sent_file_title">Envia el fitxer a %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
|
@@ -62,6 +62,7 @@
|
||||
<string name="outgoing_file_title">Odesílám soubor do %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Přijat soubor od %1s</string>
|
||||
<string name="received_file_fail_title">Selhalo přijímání souboru od %1s</string>
|
||||
<string name="received_file_text">Ťukněte pro otevření \'%1s\'</string>
|
||||
<string name="sent_file_title">Soubor byl odeslán do %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
|
@@ -119,6 +119,7 @@
|
||||
<string name="sftp_readonly">(skrivebeskyttet)</string>
|
||||
<string name="sftp_camera">Kamerabilleder</string>
|
||||
<string name="add_host">Tilføj vært/IP</string>
|
||||
<string name="add_host_hint">Værtsnavn eller IP</string>
|
||||
<string name="no_players_connected">Ingen afspillere fundet</string>
|
||||
<string name="custom_dev_list_help">Brug kun denne indstilling hvis din enhed ikke opdages automatisk. Angiv IP-adresse eller værtsnavn nedenfor og tryk på knappen for at føje den til listen. Tryk på et eksisterende element for at fjerne det fra listen.</string>
|
||||
<string name="mpris_player_on_device">%1$s på %2$s</string>
|
||||
|
@@ -8,6 +8,7 @@
|
||||
<string name="pref_plugin_sftp_desc">Erlaubt das Browsen des Dateisystems auf dem entfernten Handy</string>
|
||||
<string name="pref_plugin_clipboard">Abgleich der Zwischenablage</string>
|
||||
<string name="pref_plugin_clipboard_desc">Inhalt der Zwischenablage freigeben</string>
|
||||
<string name="pref_plugin_mousepad_desc">Verwendet Ihr Handy als Maus und Tastatur</string>
|
||||
<string name="pref_plugin_mpris">Multimedia-Fernbedienungen</string>
|
||||
<string name="pref_plugin_mpris_desc">Audio und Video mit Ihrem Telefon steuern</string>
|
||||
<string name="pref_plugin_ping">Ping</string>
|
||||
@@ -52,7 +53,13 @@
|
||||
<string name="received_url_title">Verknüpfung von %1s erhalten</string>
|
||||
<string name="incoming_file_title">Eingehende Datei von %1s</string>
|
||||
<string name="incoming_file_text">%1s</string>
|
||||
<string name="outgoing_file_title">Datei wird an %1s gesendet</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Datei von %1s erhalten</string>
|
||||
<string name="sent_file_title">Datei an %1s gesendet</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
<string name="sent_file_failed_title">Das Senden der Datei an %1s ist fehlgeschlagen</string>
|
||||
<string name="sent_file_failed_text">%1s</string>
|
||||
<string name="tap_to_answer">Tippen zum Antworten</string>
|
||||
<string name="reconnect">Erneut verbinden</string>
|
||||
<string name="right_click">Rechtsklick senden</string>
|
||||
@@ -91,7 +98,9 @@
|
||||
<string name="invalid_device_name">Ungültiger Gerätename</string>
|
||||
<string name="shareplugin_text_saved">Text empfangen und in der Zwischenablage gespeichert</string>
|
||||
<string name="custom_devices_settings">Benutzerdefinierte Geräteliste</string>
|
||||
<string name="custom_device_list">Geräte nach IP hinzufügen</string>
|
||||
<string name="share_notification_preference_summary">Beim Empfang einer Datei vibrieren und einen Sound abspielen</string>
|
||||
<string name="title_activity_notification_filter">Benachrichtigungs-Filter</string>
|
||||
<string name="sftp_internal_storage">Interner Speicher</string>
|
||||
<string name="sftp_all_files">Alle Dateien</string>
|
||||
<string name="sftp_sdcard_num">SD-Karte %d</string>
|
||||
@@ -99,5 +108,6 @@
|
||||
<string name="sftp_readonly">(Nur lesen)</string>
|
||||
<string name="sftp_camera">Kamerabilder</string>
|
||||
<string name="add_host">Rechner/IP hinzufügen</string>
|
||||
<string name="add_host_hint">Rechnername oder IP</string>
|
||||
<string name="mpris_player_on_device">%1$s auf %2$s</string>
|
||||
</resources>
|
||||
|
@@ -59,8 +59,14 @@
|
||||
<string name="received_url_text">Pulse para abrir «%1s»</string>
|
||||
<string name="incoming_file_title">Archivo entrante desde %1s</string>
|
||||
<string name="incoming_file_text">%1s</string>
|
||||
<string name="outgoing_file_title">Enviando archivo a %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Archivo recibido desde %1s</string>
|
||||
<string name="received_file_text">Pulse para abrir «%1s»</string>
|
||||
<string name="sent_file_title">Archivo enviado a %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
<string name="sent_file_failed_title">Fallo al enviar el archivo %1s</string>
|
||||
<string name="sent_file_failed_text">%1s</string>
|
||||
<string name="tap_to_answer">Pulse para responder</string>
|
||||
<string name="reconnect">Reconectar</string>
|
||||
<string name="right_click">Enviar clic derecho</string>
|
||||
@@ -112,7 +118,8 @@
|
||||
<string name="sftp_sdcard">Tarjeta SD</string>
|
||||
<string name="sftp_readonly">(solo lectura)</string>
|
||||
<string name="sftp_camera">Imágenes de la cámara</string>
|
||||
<string name="add_host">Añadir IP/nombre</string>
|
||||
<string name="add_host">Añadir servidor/IP</string>
|
||||
<string name="add_host_hint">Nombre o dirección IP</string>
|
||||
<string name="no_players_connected">Ningún reproductor encontrado</string>
|
||||
<string name="custom_dev_list_help">Use esta opción solo si su dispositivo no es detectado automáticamente. Introduzca la dirección IP o nombre debajo y pulse el botón para añadirlo a la lista. Pulse un ítem existente para eliminarlo de la lista.</string>
|
||||
<string name="mpris_player_on_device">%1$s en %2$s</string>
|
||||
|
@@ -62,6 +62,7 @@
|
||||
<string name="outgoing_file_title">Lähetetään tiedostoa laitteeseen %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Vastaanotettiin tiedosto lähettäjältä %1s</string>
|
||||
<string name="received_file_fail_title">Ei voitu vastaanottaa tiedostoa lähettäjältä %1s</string>
|
||||
<string name="received_file_text">Avaa ”%1s” napauttamalla</string>
|
||||
<string name="sent_file_title">Tiedosto lähetetty laitteeseen %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
|
@@ -16,6 +16,7 @@
|
||||
<string name="pref_plugin_ping_desc">Envoie et reçoit des commandes « Ping »</string>
|
||||
<string name="pref_plugin_notifications">Synchronisation des notifications</string>
|
||||
<string name="pref_plugin_notifications_desc">Accédez à vos notifications depuis d\'autres périphériques</string>
|
||||
<string name="pref_plugin_sharereceiver">Réception de fichier</string>
|
||||
<string name="pref_plugin_sharereceiver_desc">Enregistrer les fichiers reçus dans le stockage du téléphone</string>
|
||||
<string name="plugin_not_available">Cette fonctionnalité n\'est pas disponible dans votre version de Android</string>
|
||||
<string name="device_list_empty">Pas de périphériques</string>
|
||||
@@ -26,6 +27,9 @@
|
||||
<string name="send_ping">Envoyer un « Ping »</string>
|
||||
<string name="open_mpris_controls">Ouvrir un contrôle distant</string>
|
||||
<string name="open_mousepad">Ouvrir le pavé tactile</string>
|
||||
<string name="mousepad_info">Déplacer le doigt sur l\'écran pour bouger le pointeur de la souris. Appuyez pour cliquer et utiliser deux/trois doigts pour les clic droit et centre. Appuyez longtemps pour faire un glisser déplacer.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Action pour l\'appui à deux doigts</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Action pour l\'appui à trois doigts</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Clic droit</item>
|
||||
<item>Clic central</item>
|
||||
@@ -51,8 +55,15 @@
|
||||
<string name="error_invalid_key">Clé reçue non valable</string>
|
||||
<string name="pair_requested">Paire demandée</string>
|
||||
<string name="pairing_request_from">Demande d\'appariement provenant de %1s</string>
|
||||
<string name="received_url_title">Lien reçu de %1s</string>
|
||||
<string name="received_url_text">Appuyez pour ouvrir %1s</string>
|
||||
<string name="incoming_file_title">Réception d\'un fichier en cours depuis %1s</string>
|
||||
<string name="incoming_file_text">%1s</string>
|
||||
<string name="outgoing_file_title">Envoi d\'un fichier à %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Fichier reçu de %1s</string>
|
||||
<string name="received_file_text">Appuyez pour ouvrir %1s</string>
|
||||
<string name="sent_file_title">Fichier envoyé à %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
<string name="sent_file_failed_title">Impossible d\'envoyer le fichier %1s</string>
|
||||
<string name="sent_file_failed_text">%1s</string>
|
||||
@@ -76,6 +87,8 @@
|
||||
<string name="mpris_next">Suivant</string>
|
||||
<string name="mpris_volume">Volume</string>
|
||||
<string name="mpris_settings">Configuration multimédia</string>
|
||||
<string name="mpris_time_settings_title">Boutons avance / retour rapide.</string>
|
||||
<string name="mpris_time_settings_summary">Ajustez le temps pour l\'avance ou retour rapide</string>
|
||||
<string-array name="mpris_time_entries">
|
||||
<item>10 secondes</item>
|
||||
<item>20 secondes</item>
|
||||
@@ -92,9 +105,13 @@
|
||||
<string name="device_name">Nom du périphérique</string>
|
||||
<string name="device_name_preference_summary">%s</string>
|
||||
<string name="invalid_device_name">Nom de périphérique non valable</string>
|
||||
<string name="shareplugin_text_saved">Texte reçu et enregistré dans le presse-papiers</string>
|
||||
<string name="custom_devices_settings">Liste personnalisée de périphériques</string>
|
||||
<string name="custom_device_list">Ajouter des périphériques par IP</string>
|
||||
<string name="share_notification_preference">Notifications sonores</string>
|
||||
<string name="share_notification_preference_summary">Vibrer et jouer un son quand un fichier est reçu</string>
|
||||
<string name="title_activity_notification_filter">Filtre des notifications</string>
|
||||
<string name="filter_apps_info">Les notifications seront synchronisées pour les applications sélectionnées.</string>
|
||||
<string name="sftp_internal_storage">Stockage interne</string>
|
||||
<string name="sftp_all_files">Tous les fichiers</string>
|
||||
<string name="sftp_sdcard_num">Carte SD %d</string>
|
||||
@@ -102,6 +119,8 @@
|
||||
<string name="sftp_readonly">(lecture seule)</string>
|
||||
<string name="sftp_camera">Images de l\'appareil photo</string>
|
||||
<string name="add_host">Ajouter hôte/IP</string>
|
||||
<string name="add_host_hint">Nom d\'hôte ou adresse IP </string>
|
||||
<string name="no_players_connected">Aucun lecteur trouvé</string>
|
||||
<string name="custom_dev_list_help">N\'utilisez cette option que si votre périphérique n\'est pas détecté automatiquement. Saisissez l\'adresse IP ou le nom d\'hôte ci-dessous et appuyez sur le bouton pour l\'ajouter à la liste. Appuyez sur un élément existant pour le retirer de la liste.</string>
|
||||
<string name="mpris_player_on_device">%1$s sur %2$s</string>
|
||||
</resources>
|
||||
|
@@ -23,9 +23,9 @@
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Annulla</string>
|
||||
<string name="open_settings">Apri impostazioni</string>
|
||||
<string name="no_permissions">Devi garantire a KDE Connect l\'accesso alle notifiche</string>
|
||||
<string name="no_permissions">Devi concedere i permessi per l\'accesso alle notifiche</string>
|
||||
<string name="send_ping">Invia ping</string>
|
||||
<string name="open_mpris_controls">Apri il telecomando multimediale</string>
|
||||
<string name="open_mpris_controls">Apri telecomando</string>
|
||||
<string name="open_mousepad">Apri controllo del touchpad</string>
|
||||
<string name="mousepad_info">Muovi un dito sullo schermo per spostare il puntatore del mouse. Tocca per un clic e usa due/tre dita per i pulsanti destro e centrale. Utilizza una pressione lunga per trascinare e rilasciare.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Imposta azione per il tocco a due dita</string>
|
||||
@@ -40,18 +40,18 @@
|
||||
<string name="category_connected_devices">Dispositivi connessi</string>
|
||||
<string name="category_not_paired_devices">Dispositivi disponibili</string>
|
||||
<string name="category_remembered_devices">Dispositivi memorizzati</string>
|
||||
<string name="plugins_failed_to_load">Alcune estensioni non si sono avviate correttamente (tocca per maggiori informazioni):</string>
|
||||
<string name="plugins_failed_to_load">Impossibile caricare alcune estensioni (tocca per maggiori informazioni):</string>
|
||||
<string name="device_menu_plugins">Impostazioni estensioni</string>
|
||||
<string name="device_menu_unpair">Disassocia</string>
|
||||
<string name="device_not_reachable">Dispositivo accoppiato non raggiungibile</string>
|
||||
<string name="device_not_reachable">Dispositivo associato non raggiungibile</string>
|
||||
<string name="unknown_device">Dispositivo sconosciuto</string>
|
||||
<string name="error_not_reachable">Dispositivo fuori portata</string>
|
||||
<string name="error_already_requested">Richiesta già inviata</string>
|
||||
<string name="error_already_paired">Dispositivo già associato</string>
|
||||
<string name="error_could_not_send_package">Impossibile inviare i dati</string>
|
||||
<string name="error_timed_out">Richiesta scaduta</string>
|
||||
<string name="error_canceled_by_user">Richiesta annullata dall\'utente</string>
|
||||
<string name="error_canceled_by_other_peer">Richiesta annullata dal dispositivo remoto</string>
|
||||
<string name="error_canceled_by_user">Annullata dall\'utente</string>
|
||||
<string name="error_canceled_by_other_peer">Annullata dal dispositivo remoto</string>
|
||||
<string name="error_invalid_key">Ricevuta chiave non valida</string>
|
||||
<string name="pair_requested">Richiesta di associazione</string>
|
||||
<string name="pairing_request_from">Richiesta associazione da %1s</string>
|
||||
@@ -62,6 +62,7 @@
|
||||
<string name="outgoing_file_title">Invio file a %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">File ricevuto da %1s</string>
|
||||
<string name="received_file_fail_title">Ricezione file da %1s non riuscita</string>
|
||||
<string name="received_file_text">Tocca per aprire «%1s»</string>
|
||||
<string name="sent_file_title">File inviato a %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
@@ -87,7 +88,7 @@
|
||||
<string name="mpris_next">Successivo</string>
|
||||
<string name="mpris_volume">Volume</string>
|
||||
<string name="mpris_settings">Impostazioni multimediali</string>
|
||||
<string name="mpris_time_settings_title">I pulsanti di avanzamento/riavvolgimento</string>
|
||||
<string name="mpris_time_settings_title">Pulsanti di avanzamento/riavvolgimento</string>
|
||||
<string name="mpris_time_settings_summary">Regola l\'ora per avanzare rapidamente o riavvolgere in caso di pressione.</string>
|
||||
<string-array name="mpris_time_entries">
|
||||
<item>10 secondi</item>
|
||||
@@ -104,7 +105,7 @@
|
||||
<string name="plugin_settings_with_name">Impostazioni di %s</string>
|
||||
<string name="device_name">Nome dispositivo</string>
|
||||
<string name="device_name_preference_summary">%s</string>
|
||||
<string name="invalid_device_name">Nome non valido</string>
|
||||
<string name="invalid_device_name">Nome dispositivo non valido</string>
|
||||
<string name="shareplugin_text_saved">Testo ricevuto, salvato negli appunti</string>
|
||||
<string name="custom_devices_settings">Elenco dispositivi personalizzato</string>
|
||||
<string name="custom_device_list">Aggiungi dispositivi per IP</string>
|
||||
@@ -119,7 +120,8 @@
|
||||
<string name="sftp_readonly">(sola lettura)</string>
|
||||
<string name="sftp_camera">Immagini fotocamera</string>
|
||||
<string name="add_host">Aggiungi host/IP</string>
|
||||
<string name="add_host_hint">Nome host o IP</string>
|
||||
<string name="no_players_connected">Nessun lettore trovato</string>
|
||||
<string name="custom_dev_list_help">Usa questa opzioone solo se il tuo dispositivo non è rilevato automaticamente. Digita l\'indirizzo IP o il nome host in basso e tocca il pulsante per aggiungerlo all\'elenco. Tocca un elemento esistente per rimuoverlo dall\'elenco.</string>
|
||||
<string name="custom_dev_list_help">Usa questa opzione solo se il tuo dispositivo non è rilevato automaticamente. Digita l\'indirizzo IP o il nome host in basso e tocca il pulsante per aggiungerlo all\'elenco. Tocca un elemento esistente per rimuoverlo dall\'elenco.</string>
|
||||
<string name="mpris_player_on_device">%1$s su %2$s</string>
|
||||
</resources>
|
||||
|
@@ -62,6 +62,7 @@
|
||||
<string name="outgoing_file_title">Bezig bestand te verzenden naar %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Bestand ontvangen van %1s</string>
|
||||
<string name="received_file_fail_title">Bestand ontvangen van %1s is mislukt</string>
|
||||
<string name="received_file_text">Tap om \'%1s\' te openen</string>
|
||||
<string name="sent_file_title">Bestand verzonden naar %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
|
@@ -62,6 +62,7 @@
|
||||
<string name="outgoing_file_title">Enviando arquivo para %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Arquivo recebido de %1s</string>
|
||||
<string name="received_file_fail_title">Falha ao receber o arquivo de %1s</string>
|
||||
<string name="received_file_text">Toque para abrir o \'%1s\'</string>
|
||||
<string name="sent_file_title">Enviar arquivo para %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
|
@@ -62,6 +62,7 @@
|
||||
<string name="outgoing_file_title">A enviar o ficheiro para o %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Ficheiro recebido de %1s</string>
|
||||
<string name="received_file_fail_title">Falhou a recepção do ficheiro de %1s</string>
|
||||
<string name="received_file_text">Toque para abrir o \'%1s\'</string>
|
||||
<string name="sent_file_title">O ficheiro foi enviado para %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
|
@@ -27,6 +27,7 @@
|
||||
<string name="send_ping">Poslať ping</string>
|
||||
<string name="open_mpris_controls">Otvoriť diaľkové ovládanie</string>
|
||||
<string name="open_mousepad">Otvoriť ovládanie touchpadu</string>
|
||||
<string name="mousepad_info">Posúvajte prst na obrazovke na posun kurzora. Ťuknutie vyvolá klik a použite dva/tri prsty pre pravé a stredné tlačidlo. Použite dlhé stlačenie pre drag and drop.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Nastaviť akciu dvoch prstov</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Nastaviť akciu troch prstov</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
@@ -58,10 +59,14 @@
|
||||
<string name="received_url_text">Ťuknite na otvorenie \'%1s\'</string>
|
||||
<string name="incoming_file_title">Prichádzajúci súbor od %s</string>
|
||||
<string name="incoming_file_text">%1s</string>
|
||||
<string name="outgoing_file_title">Posielam súbor pre %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Prijatý súbor od %1s</string>
|
||||
<string name="received_file_fail_title">Zlyhalo prijatie súboru od %1s</string>
|
||||
<string name="received_file_text">Ťuknite na otvorenie \'%1s\'</string>
|
||||
<string name="sent_file_title">Poslať súbor pre %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
<string name="sent_file_failed_title">Zlyhalo poslanie súboru %1s</string>
|
||||
<string name="sent_file_failed_text">%1s</string>
|
||||
<string name="tap_to_answer">Tapnite na odpoveď</string>
|
||||
<string name="reconnect">Znovu pripojiť</string>
|
||||
@@ -83,6 +88,8 @@
|
||||
<string name="mpris_next">Nasledovné</string>
|
||||
<string name="mpris_volume">Hlasitosť</string>
|
||||
<string name="mpris_settings">Multimediálne nastavenia</string>
|
||||
<string name="mpris_time_settings_title">Tlačidlá dopredu/pretočiť</string>
|
||||
<string name="mpris_time_settings_summary">Prispôsobiť čas na pretáčanie dopredu alebo dozadu pri stlačení.</string>
|
||||
<string-array name="mpris_time_entries">
|
||||
<item>10 sekúnd</item>
|
||||
<item>20 sekúnd</item>
|
||||
@@ -104,6 +111,8 @@
|
||||
<string name="custom_device_list">Pridať zariadenia podľa IP</string>
|
||||
<string name="share_notification_preference">Hlučné pripomienky</string>
|
||||
<string name="share_notification_preference_summary">Vibrovať a prehrať zvuk pri prijatí súboru</string>
|
||||
<string name="title_activity_notification_filter">Filter upozornení</string>
|
||||
<string name="filter_apps_info">Upozornenia budú synchronizované pre vybrané aplikácie.</string>
|
||||
<string name="sftp_internal_storage">Interné úložisko</string>
|
||||
<string name="sftp_all_files">Všetky súbory</string>
|
||||
<string name="sftp_sdcard_num">SD karta %d</string>
|
||||
@@ -111,6 +120,7 @@
|
||||
<string name="sftp_readonly">(iba na čítanie)</string>
|
||||
<string name="sftp_camera">Obrázky fotoaparátu</string>
|
||||
<string name="add_host">Pridať hostiteľa/IP</string>
|
||||
<string name="add_host_hint">Názov hostiteľa alebo IP</string>
|
||||
<string name="no_players_connected">Nenašli sa žiadne prehrávače</string>
|
||||
<string name="custom_dev_list_help">Túto voľbu použite iba vtedy, ak vaše zariadenie nie je automaticky detekované. Zadajte IP adresu alebo názov hostiteľa nižšie a kliknite na tlačidlo na pridanie do zoznamu. Kliknite na existujúcu položku na odstránenie jej zo zoznamu.</string>
|
||||
<string name="mpris_player_on_device">%1$s na %2$s</string>
|
||||
|
@@ -62,6 +62,7 @@
|
||||
<string name="outgoing_file_title">Skickar fil till %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Tog emot fil från %1s</string>
|
||||
<string name="received_file_fail_title">Misslyckades ta emot fil från %1s</string>
|
||||
<string name="received_file_text">Rör för att öppna \'%1s\'</string>
|
||||
<string name="sent_file_title">Skickade fil till %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
|
@@ -62,6 +62,7 @@
|
||||
<string name="outgoing_file_title">Надсилаємо файл до %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Отримано файл з %1s</string>
|
||||
<string name="received_file_fail_title">Не вдалося отримати файл з %1s</string>
|
||||
<string name="received_file_text">Натисніть, щоб відкрити «%1s»</string>
|
||||
<string name="sent_file_title">Файл надіслано до %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
|
@@ -1,11 +0,0 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme for API 11+. This theme completely replaces
|
||||
AppBaseTheme from res/values/styles.xml on API 11+ devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="android:Theme.Holo">
|
||||
<!-- API 11 theme customizations can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
@@ -70,6 +70,7 @@
|
||||
<string name="outgoing_file_title">Sending file to %1s</string>
|
||||
<string name="outgoing_file_text">%1s</string>
|
||||
<string name="received_file_title">Received file from %1s</string>
|
||||
<string name="received_file_fail_title">Failed receiving file from %1s</string>
|
||||
<string name="received_file_text">Tap to open \'%1s\'</string>
|
||||
<string name="sent_file_title">Sent file to %1s</string>
|
||||
<string name="sent_file_text">%1s</string>
|
||||
|
@@ -46,13 +46,13 @@ public abstract class BaseLinkProvider {
|
||||
|
||||
//These two should be called when the provider links to a new computer
|
||||
protected void connectionAccepted(NetworkPackage identityPackage, BaseLink link) {
|
||||
Log.i("LinkProvider", "connectionAccepted");
|
||||
//Log.i("KDE/LinkProvider", "connectionAccepted");
|
||||
for(ConnectionReceiver cr : connectionReceivers) {
|
||||
cr.onConnectionReceived(identityPackage, link);
|
||||
}
|
||||
}
|
||||
protected void connectionLost(BaseLink link) {
|
||||
Log.i("LinkProvider", "connectionLost");
|
||||
//Log.i("KDE/LinkProvider", "connectionLost");
|
||||
for(ConnectionReceiver cr : connectionReceivers) {
|
||||
cr.onConnectionLost(link);
|
||||
}
|
||||
|
@@ -47,8 +47,10 @@ public class LanLink extends BaseLink {
|
||||
private IoSession session = null;
|
||||
|
||||
public void disconnect() {
|
||||
if (session == null) return;
|
||||
//Log.i("LanLink", "Disconnect: "+session.getRemoteAddress().toString());
|
||||
if (session == null) {
|
||||
Log.e("KDE/LanLink", "Not yet connected");
|
||||
return;
|
||||
}
|
||||
session.close(true);
|
||||
}
|
||||
|
||||
@@ -60,7 +62,7 @@ public class LanLink extends BaseLink {
|
||||
//Blocking, do not call from main thread
|
||||
private void sendPackageInternal(NetworkPackage np, final Device.SendPackageStatusCallback callback, PublicKey key) {
|
||||
if (session == null) {
|
||||
Log.e("sendPackage", "Not yet connected");
|
||||
Log.e("KDE/sendPackage", "Not yet connected");
|
||||
callback.sendFailure(new NotYetConnectedException());
|
||||
return;
|
||||
}
|
||||
@@ -87,7 +89,7 @@ public class LanLink extends BaseLink {
|
||||
WriteFuture future = session.write(np.serialize());
|
||||
future.awaitUninterruptibly();
|
||||
if (!future.isWritten()) {
|
||||
Log.e("sendPackage", "!future.isWritten()");
|
||||
Log.e("KDE/sendPackage", "!future.isWritten()");
|
||||
callback.sendFailure(future.getException());
|
||||
return;
|
||||
}
|
||||
@@ -97,19 +99,10 @@ public class LanLink extends BaseLink {
|
||||
OutputStream socket = null;
|
||||
try {
|
||||
//Wait a maximum of 10 seconds for the other end to establish a connection with our socket, close it afterwards
|
||||
Timer timeout = new Timer();
|
||||
timeout.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.e("sendPackage","Timeout");
|
||||
try { server.close(); } catch (Exception e) { }
|
||||
callback.sendFailure(new TimeoutException("Timed out waiting for other end to establish a connection to receive the payload."));
|
||||
}
|
||||
},10*1000);
|
||||
server.setSoTimeout(10*1000);
|
||||
socket = server.accept().getOutputStream();
|
||||
timeout.cancel();
|
||||
|
||||
Log.i("LanLink", "Beginning to send payload");
|
||||
Log.i("KDE/LanLink", "Beginning to send payload");
|
||||
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
@@ -123,9 +116,11 @@ public class LanLink extends BaseLink {
|
||||
callback.sendProgress((int)(progress / np.getPayloadSize()));
|
||||
}
|
||||
}
|
||||
Log.i("LanLink", "Finished sending payload");
|
||||
socket.flush();
|
||||
stream.close();
|
||||
Log.i("KDE/LanLink", "Finished sending payload ("+progress+" bytes written)");
|
||||
} catch (Exception e) {
|
||||
Log.e("sendPackage", "Exception: "+e);
|
||||
Log.e("KDE/sendPackage", "Exception: "+e);
|
||||
callback.sendFailure(e);
|
||||
return;
|
||||
} finally {
|
||||
@@ -167,22 +162,24 @@ public class LanLink extends BaseLink {
|
||||
np = np.decrypt(privateKey);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("onPackageReceived","Exception reading the key needed to decrypt the package");
|
||||
Log.e("KDE/onPackageReceived","Exception reading the key needed to decrypt the package");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (np.hasPayloadTransferInfo()) {
|
||||
|
||||
Socket socket = null;
|
||||
try {
|
||||
Socket socket = new Socket();
|
||||
socket = new Socket();
|
||||
int tcpPort = np.getPayloadTransferInfo().getInt("port");
|
||||
InetSocketAddress address = (InetSocketAddress)session.getRemoteAddress();
|
||||
socket.connect(new InetSocketAddress(address.getAddress(), tcpPort));
|
||||
np.setPayload(socket.getInputStream(), np.getPayloadSize());
|
||||
} catch (Exception e) {
|
||||
try { socket.close(); } catch(Exception ignored) { }
|
||||
e.printStackTrace();
|
||||
Log.e("LanLink", "Exception connecting to payload remote socket");
|
||||
Log.e("KDE/LanLink", "Exception connecting to payload remote socket");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -200,12 +197,12 @@ public class LanLink extends BaseLink {
|
||||
candidateServer = new ServerSocket();
|
||||
candidateServer.bind(new InetSocketAddress(tcpPort));
|
||||
success = true;
|
||||
Log.i("LanLink", "Using port "+tcpPort);
|
||||
Log.i("KDE/LanLink", "Using port "+tcpPort);
|
||||
} catch(IOException e) {
|
||||
//Log.e("LanLink", "Exception openning serversocket: "+e);
|
||||
tcpPort++;
|
||||
if (tcpPort >= 1764) {
|
||||
Log.e("LanLink", "No more ports available");
|
||||
Log.e("KDE/LanLink", "No more ports available");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@
|
||||
package org.kde.kdeconnect.Backends.LanBackend;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
import android.util.Log;
|
||||
@@ -47,9 +46,11 @@ import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
public class LanLinkProvider extends BaseLinkProvider {
|
||||
|
||||
@@ -59,6 +60,7 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
private final Context context;
|
||||
private final HashMap<String, LanLink> visibleComputers = new HashMap<String, LanLink>();
|
||||
private final LongSparseArray<LanLink> nioSessions = new LongSparseArray<LanLink>();
|
||||
private final LongSparseArray<NioSocketConnector> nioConnectors = new LongSparseArray<NioSocketConnector>();
|
||||
|
||||
private NioSocketAcceptor tcpAcceptor = null;
|
||||
private NioDatagramAcceptor udpAcceptor = null;
|
||||
@@ -66,29 +68,46 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
private final IoHandler tcpHandler = new IoHandlerAdapter() {
|
||||
@Override
|
||||
public void sessionClosed(IoSession session) throws Exception {
|
||||
|
||||
final LanLink brokenLink = nioSessions.get(session.getId());
|
||||
if (brokenLink != null) {
|
||||
nioSessions.remove(session.getId());
|
||||
brokenLink.disconnect();
|
||||
String deviceId = brokenLink.getDeviceId();
|
||||
if (visibleComputers.get(deviceId) == brokenLink) {
|
||||
visibleComputers.remove(deviceId);
|
||||
try {
|
||||
long id = session.getId();
|
||||
final LanLink brokenLink = nioSessions.get(id);
|
||||
NioSocketConnector connector = nioConnectors.get(id);
|
||||
if (connector != null) {
|
||||
connector.dispose();
|
||||
nioConnectors.remove(id);
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//Wait a bit before emiting connectionLost, in case the same device re-appears
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
} catch (InterruptedException e) { }
|
||||
connectionLost(brokenLink);
|
||||
|
||||
if (brokenLink != null) {
|
||||
nioSessions.remove(id);
|
||||
//Log.i("KDE/LanLinkProvider", "nioSessions.size(): " + nioSessions.size() + " (-)");
|
||||
try {
|
||||
brokenLink.disconnect();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("KDE/LanLinkProvider", "Exception. Already disconnected?");
|
||||
}
|
||||
}).start();
|
||||
//Log.i("KDE/LanLinkProvider", "Disconnected!");
|
||||
String deviceId = brokenLink.getDeviceId();
|
||||
if (visibleComputers.get(deviceId) == brokenLink) {
|
||||
visibleComputers.remove(deviceId);
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//Wait a bit before emiting connectionLost, in case the same device re-appears
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
connectionLost(brokenLink);
|
||||
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
} catch (Exception e) { //If we don't catch it here, Mina will swallow it :/
|
||||
e.printStackTrace();
|
||||
Log.e("KDE/LanLinkProvider", "sessionClosed exception");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,7 +119,7 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
|
||||
String theMessage = (String) message;
|
||||
if (theMessage.isEmpty()) {
|
||||
Log.e("LanLinkProvider","Empty package received");
|
||||
Log.e("KDE/LanLinkProvider","Empty package received");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,15 +132,16 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.e("LanLinkProvider", "Identity package received from "+np.getString("deviceName"));
|
||||
//Log.i("KDE/LanLinkProvider", "Identity package received from " + np.getString("deviceName"));
|
||||
|
||||
LanLink link = new LanLink(session, np.getString("deviceId"), LanLinkProvider.this);
|
||||
nioSessions.put(session.getId(),link);
|
||||
//Log.e("KDE/LanLinkProvider","nioSessions.size(): " + nioSessions.size());
|
||||
addLink(np, link);
|
||||
} else {
|
||||
LanLink prevLink = nioSessions.get(session.getId());
|
||||
if (prevLink == null) {
|
||||
Log.e("LanLinkProvider","2 Expecting an identity package");
|
||||
Log.e("KDE/LanLinkProvider","Expecting an identity package (A)");
|
||||
} else {
|
||||
prevLink.injectNetworkPackage(np);
|
||||
}
|
||||
@@ -143,7 +163,7 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
final NetworkPackage identityPackage = NetworkPackage.unserialize(theMessage);
|
||||
|
||||
if (!identityPackage.getType().equals(NetworkPackage.PACKAGE_TYPE_IDENTITY)) {
|
||||
Log.e("LanLinkProvider", "1 Expecting an identity package");
|
||||
Log.e("KDE/LanLinkProvider", "Expecting an identity package (B)");
|
||||
return;
|
||||
} else {
|
||||
String myId = NetworkPackage.createIdentityPackage(context).getString("deviceId");
|
||||
@@ -152,56 +172,60 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
}
|
||||
}
|
||||
|
||||
Log.i("LanLinkProvider", "Identity package received, creating link");
|
||||
//Log.i("KDE/LanLinkProvider", "Identity package received, creating link");
|
||||
|
||||
final InetSocketAddress address = (InetSocketAddress) udpSession.getRemoteAddress();
|
||||
|
||||
final NioSocketConnector connector = new NioSocketConnector();
|
||||
connector.setHandler(tcpHandler);
|
||||
//TextLineCodecFactory will split incoming data delimited by the given string
|
||||
connector.getFilterChain().addLast("codec",
|
||||
new ProtocolCodecFilter(
|
||||
new TextLineCodecFactory(Charset.defaultCharset(), LineDelimiter.UNIX, LineDelimiter.UNIX)
|
||||
)
|
||||
);
|
||||
connector.getSessionConfig().setKeepAlive(true);
|
||||
//TextLineCodecFactory will buffer incoming data and emit a message very time it finds a \n
|
||||
TextLineCodecFactory textLineFactory = new TextLineCodecFactory(Charset.defaultCharset(), LineDelimiter.UNIX, LineDelimiter.UNIX);
|
||||
textLineFactory.setDecoderMaxLineLength(512*1024); //Allow to receive up to 512kb of data
|
||||
connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(textLineFactory));
|
||||
|
||||
int tcpPort = identityPackage.getInt("tcpPort",port);
|
||||
ConnectFuture future = connector.connect(new InetSocketAddress(address.getAddress(), tcpPort));
|
||||
int tcpPort = identityPackage.getInt("tcpPort", port);
|
||||
final ConnectFuture future = connector.connect(new InetSocketAddress(address.getAddress(), tcpPort));
|
||||
future.addListener(new IoFutureListener<IoFuture>() {
|
||||
|
||||
@Override
|
||||
public void operationComplete(IoFuture ioFuture) {
|
||||
final IoSession session = ioFuture.getSession();
|
||||
try {
|
||||
future.removeListener(this);
|
||||
final IoSession session = ioFuture.getSession();
|
||||
Log.i("KDE/LanLinkProvider", "Connection successful: " + session.isConnected());
|
||||
|
||||
final LanLink link = new LanLink(session, identityPackage.getString("deviceId"), LanLinkProvider.this);
|
||||
final LanLink link = new LanLink(session, identityPackage.getString("deviceId"), LanLinkProvider.this);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
NetworkPackage np2 = NetworkPackage.createIdentityPackage(context);
|
||||
link.sendPackage(np2,new Device.SendPackageStatusCallback() {
|
||||
@Override
|
||||
protected void onSuccess() {
|
||||
nioSessions.put(session.getId(), link);
|
||||
nioConnectors.put(session.getId(), connector);
|
||||
//Log.e("KDE/LanLinkProvider","nioSessions.size(): " + nioSessions.size());
|
||||
addLink(identityPackage, link);
|
||||
}
|
||||
|
||||
Log.i("LanLinkProvider", "Connection successful: " + session.isConnected());
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
NetworkPackage np2 = NetworkPackage.createIdentityPackage(context);
|
||||
link.sendPackage(np2,new Device.SendPackageStatusCallback() {
|
||||
@Override
|
||||
protected void onSuccess() {
|
||||
nioSessions.put(session.getId(), link);
|
||||
addLink(identityPackage, link);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFailure(Throwable e) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).start();
|
||||
@Override
|
||||
protected void onFailure(Throwable e) {
|
||||
Log.e("KDE/LanLinkProvider", "Connection failed: could not send identity package back");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).start();
|
||||
} catch (Exception e) { //If we don't catch it here, Mina will swallow it :/
|
||||
e.printStackTrace();
|
||||
Log.e("KDE/LanLinkProvider", "sessionClosed exception");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e("LanLinkProvider","Exception receiving udp package!!");
|
||||
Log.e("KDE/LanLinkProvider","Exception receiving udp package!!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -210,16 +234,16 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
|
||||
private void addLink(NetworkPackage identityPackage, LanLink link) {
|
||||
String deviceId = identityPackage.getString("deviceId");
|
||||
Log.i("LanLinkProvider","addLink to "+deviceId);
|
||||
Log.i("KDE/LanLinkProvider","addLink to "+deviceId);
|
||||
LanLink oldLink = visibleComputers.get(deviceId);
|
||||
if (oldLink == link) {
|
||||
Log.e("KDEConnect", "LanLinkProvider: oldLink == link. This should not happen!");
|
||||
Log.e("KDE/LanLinkProvider", "oldLink == link. This should not happen!");
|
||||
return;
|
||||
}
|
||||
visibleComputers.put(deviceId, link);
|
||||
connectionAccepted(identityPackage, link);
|
||||
if (oldLink != null) {
|
||||
Log.i("LanLinkProvider","Removing old connection to same device");
|
||||
Log.i("KDE/LanLinkProvider","Removing old connection to same device");
|
||||
oldLink.disconnect();
|
||||
connectionLost(oldLink);
|
||||
}
|
||||
@@ -234,18 +258,15 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
tcpAcceptor.setHandler(tcpHandler);
|
||||
tcpAcceptor.getSessionConfig().setKeepAlive(true);
|
||||
tcpAcceptor.getSessionConfig().setReuseAddress(true);
|
||||
tcpAcceptor.setCloseOnDeactivation(false);
|
||||
//TextLineCodecFactory will split incoming data delimited by the given string
|
||||
tcpAcceptor.getFilterChain().addLast("codec",
|
||||
new ProtocolCodecFilter(
|
||||
new TextLineCodecFactory(Charset.defaultCharset(), LineDelimiter.UNIX, LineDelimiter.UNIX)
|
||||
)
|
||||
);
|
||||
|
||||
//TextLineCodecFactory will buffer incoming data and emit a message very time it finds a \n
|
||||
TextLineCodecFactory textLineFactory = new TextLineCodecFactory(Charset.defaultCharset(), LineDelimiter.UNIX, LineDelimiter.UNIX);
|
||||
textLineFactory.setDecoderMaxLineLength(512*1024); //Allow to receive up to 512kb of data
|
||||
tcpAcceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(textLineFactory));
|
||||
|
||||
udpAcceptor = new NioDatagramAcceptor();
|
||||
udpAcceptor.getSessionConfig().setReuseAddress(true); //Share port if existing
|
||||
//TextLineCodecFactory will split incoming data delimited by the given string
|
||||
udpAcceptor.getSessionConfig().setReuseAddress(true); //Share port if existing
|
||||
//TextLineCodecFactory will buffer incoming data and emit a message very time it finds a \n
|
||||
//This one will have the default MaxLineLength of 1KB
|
||||
udpAcceptor.getFilterChain().addLast("codec",
|
||||
new ProtocolCodecFilter(
|
||||
new TextLineCodecFactory(Charset.defaultCharset(), LineDelimiter.UNIX, LineDelimiter.UNIX)
|
||||
@@ -259,12 +280,19 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
|
||||
//This handles the case when I'm the existing device in the network and receive a "hello" UDP package
|
||||
|
||||
Set<SocketAddress> addresses = udpAcceptor.getLocalAddresses();
|
||||
for (SocketAddress address : addresses) {
|
||||
Log.i("KDE/LanLinkProvider", "UDP unbind old address");
|
||||
udpAcceptor.unbind(address);
|
||||
}
|
||||
|
||||
//Log.i("KDE/LanLinkProvider", "UDP Bind.");
|
||||
udpAcceptor.setHandler(udpHandler);
|
||||
|
||||
try {
|
||||
udpAcceptor.bind(new InetSocketAddress(port));
|
||||
} catch(Exception e) {
|
||||
Log.e("LanLinkProvider", "Error: Could not bind udp socket");
|
||||
Log.e("KDE/LanLinkProvider", "Error: Could not bind udp socket");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -279,50 +307,73 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
}
|
||||
}
|
||||
|
||||
Log.i("LanLinkProvider","Using tcpPort "+tcpPort);
|
||||
Log.i("KDE/LanLinkProvider","Using tcpPort "+tcpPort);
|
||||
|
||||
//I'm on a new network, let's be polite and introduce myself
|
||||
final int finalTcpPort = tcpPort;
|
||||
new AsyncTask<Void,Void,Void>() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
public void run() {
|
||||
|
||||
String deviceListPrefs = PreferenceManager.getDefaultSharedPreferences(context).getString(
|
||||
KEY_CUSTOM_DEVLIST_PREFERENCE, "");
|
||||
ArrayList<String> iplist = new ArrayList<String>();
|
||||
if (!deviceListPrefs.isEmpty()) {
|
||||
iplist = CustomDevicesActivity.deserializeIpList(deviceListPrefs);
|
||||
}
|
||||
iplist.add("255.255.255.255");
|
||||
for (String ipstr : iplist) {
|
||||
try {
|
||||
InetAddress client = InetAddress.getByName(ipstr);
|
||||
NetworkPackage identity = NetworkPackage.createIdentityPackage(context);
|
||||
identity.set("tcpPort", finalTcpPort);
|
||||
byte[] b = identity.serialize().getBytes("UTF-8");
|
||||
DatagramPacket packet = new DatagramPacket(b, b.length, client, port);
|
||||
DatagramSocket socket = new DatagramSocket();
|
||||
socket.setReuseAddress(true);
|
||||
socket.setBroadcast(true);
|
||||
socket.send(packet);
|
||||
//Log.i("LanLinkProvider","Udp identity package sent to address "+packet.getAddress());
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("LanLinkProvider","Sending udp identity package failed. Invalid address? ("+ipstr+")");
|
||||
iplist.add("255.255.255.255"); //Default: broadcast.
|
||||
|
||||
NetworkPackage identity = NetworkPackage.createIdentityPackage(context);
|
||||
identity.set("tcpPort", finalTcpPort);
|
||||
DatagramSocket socket = null;
|
||||
byte[] bytes = null;
|
||||
try {
|
||||
socket = new DatagramSocket();
|
||||
socket.setReuseAddress(true);
|
||||
socket.setBroadcast(true);
|
||||
bytes = identity.serialize().getBytes("UTF-8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("KDE/LanLinkProvider","Failed to create DatagramSocket");
|
||||
}
|
||||
|
||||
if (bytes != null) {
|
||||
//Log.e("KDE/LanLinkProvider","Sending packet to "+iplist.size()+" ips");
|
||||
for (String ipstr : iplist) {
|
||||
try {
|
||||
InetAddress client = InetAddress.getByName(ipstr);
|
||||
DatagramPacket packet = new DatagramPacket(bytes, bytes.length, client, port);
|
||||
socket.send(packet);
|
||||
//Log.i("KDE/LanLinkProvider","Udp identity package sent to address "+packet.getAddress());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("KDE/LanLinkProvider", "Sending udp identity package failed. Invalid address? (" + ipstr + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
socket.close();
|
||||
|
||||
}
|
||||
|
||||
}.execute();
|
||||
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetworkChange() {
|
||||
//Log.e("KDE/LanLinkProvider","onNetworkChange");
|
||||
|
||||
//FilesHelper.LogOpenFileCount();
|
||||
|
||||
//Keep existing connections open while unbinding the socket
|
||||
tcpAcceptor.setCloseOnDeactivation(false);
|
||||
onStop();
|
||||
tcpAcceptor.setCloseOnDeactivation(true);
|
||||
|
||||
//FilesHelper.LogOpenFileCount();
|
||||
|
||||
onStart();
|
||||
|
||||
//FilesHelper.LogOpenFileCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -330,14 +381,12 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
udpAcceptor.unbind();
|
||||
tcpAcceptor.unbind();
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return 1000;
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "LanLinkProvider";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -105,17 +105,17 @@ public class BackgroundService extends Service {
|
||||
@Override
|
||||
public void onConnectionReceived(final NetworkPackage identityPackage, final BaseLink link) {
|
||||
|
||||
Log.i("BackgroundService", "Connection accepted!");
|
||||
Log.i("KDE/BackgroundService", "Connection accepted!");
|
||||
|
||||
String deviceId = identityPackage.getString("deviceId");
|
||||
|
||||
Device device = devices.get(deviceId);
|
||||
|
||||
if (device != null) {
|
||||
Log.i("BackgroundService", "addLink, known device: " + deviceId);
|
||||
Log.i("KDE/BackgroundService", "addLink, known device: " + deviceId);
|
||||
device.addLink(identityPackage, link);
|
||||
} else {
|
||||
Log.i("BackgroundService", "addLink,unknown device: " + deviceId);
|
||||
Log.i("KDE/BackgroundService", "addLink,unknown device: " + deviceId);
|
||||
device = new Device(BackgroundService.this, identityPackage, link);
|
||||
devices.put(deviceId, device);
|
||||
device.addPairingCallback(devicePairingCallback);
|
||||
@@ -127,7 +127,7 @@ public class BackgroundService extends Service {
|
||||
@Override
|
||||
public void onConnectionLost(BaseLink link) {
|
||||
Device d = devices.get(link.getDeviceId());
|
||||
Log.i("onConnectionLost", "removeLink, deviceId: " + link.getDeviceId());
|
||||
Log.i("KDE/onConnectionLost", "removeLink, deviceId: " + link.getDeviceId());
|
||||
if (d != null) {
|
||||
d.removeLink(link);
|
||||
if (!d.isReachable() && !d.isPaired()) {
|
||||
@@ -136,7 +136,7 @@ public class BackgroundService extends Service {
|
||||
d.removePairingCallback(devicePairingCallback);
|
||||
}
|
||||
} else {
|
||||
Log.e("onConnectionLost","Removing connection to unknown device, this should not happen");
|
||||
Log.e("KDE/onConnectionLost","Removing connection to unknown device, this should not happen");
|
||||
}
|
||||
if (deviceListChangedCallback != null) deviceListChangedCallback.onDeviceListChanged();
|
||||
}
|
||||
@@ -147,34 +147,35 @@ public class BackgroundService extends Service {
|
||||
}
|
||||
|
||||
public void startDiscovery() {
|
||||
Log.i("BackgroundService","StartDiscovery");
|
||||
Log.i("KDE/BackgroundService","StartDiscovery");
|
||||
for (BaseLinkProvider a : linkProviders) {
|
||||
a.onStart();
|
||||
}
|
||||
}
|
||||
|
||||
public void stopDiscovery() {
|
||||
Log.i("BackgroundService","StopDiscovery");
|
||||
Log.i("KDE/BackgroundService","StopDiscovery");
|
||||
for (BaseLinkProvider a : linkProviders) {
|
||||
a.onStop();
|
||||
}
|
||||
}
|
||||
|
||||
public void onNetworkChange() {
|
||||
Log.i("BackgroundService","OnNetworkChange");
|
||||
Log.i("KDE/BackgroundService","OnNetworkChange");
|
||||
for (BaseLinkProvider a : linkProviders) {
|
||||
a.onNetworkChange();
|
||||
}
|
||||
}
|
||||
|
||||
public void addConnectionListener(BaseLinkProvider.ConnectionReceiver cr) {
|
||||
Log.i("BackgroundService","Registering connection listener");
|
||||
Log.i("KDE/BackgroundService","Registering connection listener");
|
||||
for (BaseLinkProvider a : linkProviders) {
|
||||
a.addConnectionReceiver(cr);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeConnectionListener(BaseLinkProvider.ConnectionReceiver cr) {
|
||||
Log.i("KDE/BackgroundService","Removing connection listener");
|
||||
for (BaseLinkProvider a : linkProviders) {
|
||||
a.removeConnectionReceiver(cr);
|
||||
}
|
||||
@@ -198,7 +199,7 @@ public class BackgroundService extends Service {
|
||||
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
||||
registerReceiver(new KdeConnectBroadcastReceiver(), filter);
|
||||
|
||||
Log.i("BackgroundService","Service not started yet, initializing...");
|
||||
Log.i("KDE/BackgroundService","Service not started yet, initializing...");
|
||||
|
||||
initializeRsaKeys();
|
||||
MainSettingsActivity.initializeDeviceName(this);
|
||||
@@ -223,7 +224,7 @@ public class BackgroundService extends Service {
|
||||
keyPair = keyGen.genKeyPair();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("initializeRsaKeys","Exception");
|
||||
Log.e("KDE/initializeRsaKeys","Exception");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -268,7 +269,7 @@ public class BackgroundService extends Service {
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
Log.i("BackgroundService", "Destroying");
|
||||
Log.i("KDE/BackgroundService", "Destroying");
|
||||
stopDiscovery();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
private final Context context;
|
||||
|
||||
private final String deviceId;
|
||||
private final String name;
|
||||
private String name;
|
||||
public PublicKey publicKey;
|
||||
private int notificationId;
|
||||
private int protocolVersion;
|
||||
@@ -93,7 +93,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
|
||||
this.context = context;
|
||||
this.deviceId = deviceId;
|
||||
this.name = settings.getString("deviceName", "unknown device");
|
||||
this.name = settings.getString("deviceName", context.getString(R.string.unknown_device));
|
||||
this.pairStatus = PairStatus.Paired;
|
||||
this.protocolVersion = NetworkPackage.ProtocolVersion; //We don't know it yet
|
||||
|
||||
@@ -102,7 +102,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
publicKey = KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(publicKeyBytes));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("Device","Exception");
|
||||
Log.e("KDE/Device","Exception");
|
||||
}
|
||||
|
||||
reloadPluginsFromSettings();
|
||||
@@ -115,7 +115,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
|
||||
this.context = context;
|
||||
this.deviceId = np.getString("deviceId");
|
||||
this.name = np.getString("deviceName", "unidentified device");
|
||||
this.name = np.getString("deviceName", context.getString(R.string.unknown_device));
|
||||
this.protocolVersion = np.getInt("protocolVersion");
|
||||
this.pairStatus = PairStatus.NotPaired;
|
||||
this.publicKey = null;
|
||||
@@ -200,7 +200,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
for (PairingCallback cb : pairingCallback) {
|
||||
cb.pairingFailed(context.getString(R.string.error_timed_out));
|
||||
}
|
||||
Log.e("Device","Unpairing (timeout A)");
|
||||
Log.e("KDE/Device","Unpairing (timeout A)");
|
||||
pairStatus = PairStatus.NotPaired;
|
||||
}
|
||||
}, 30*1000); //Time to wait for the other to accept
|
||||
@@ -212,7 +212,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
for (PairingCallback cb : pairingCallback) {
|
||||
cb.pairingFailed(context.getString(R.string.error_could_not_send_package));
|
||||
}
|
||||
Log.e("Device","Unpairing (sendFailed A)");
|
||||
Log.e("KDE/Device","Unpairing (sendFailed A)");
|
||||
pairStatus = PairStatus.NotPaired;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
|
||||
public void acceptPairing() {
|
||||
|
||||
Log.i("Device","Accepted pair request started by the other device");
|
||||
Log.i("KDE/Device","Accepted pair request started by the other device");
|
||||
|
||||
//Send our own public key
|
||||
NetworkPackage np = NetworkPackage.createPublicKeyPackage(context);
|
||||
@@ -294,7 +294,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
|
||||
public void rejectPairing() {
|
||||
|
||||
Log.i("Device","Rejected pair request started by the other device");
|
||||
Log.i("KDE/Device","Rejected pair request started by the other device");
|
||||
|
||||
//Log.e("Device","Unpairing (rejectPairing)");
|
||||
pairStatus = PairStatus.NotPaired;
|
||||
@@ -321,9 +321,18 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
}
|
||||
|
||||
public void addLink(NetworkPackage identityPackage, BaseLink link) {
|
||||
//FilesHelper.LogOpenFileCount();
|
||||
|
||||
this.protocolVersion = identityPackage.getInt("protocolVersion");
|
||||
|
||||
if (identityPackage.has("deviceName")) {
|
||||
this.name = identityPackage.getString("deviceName", this.name);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putString("deviceName", this.name);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
||||
links.add(link);
|
||||
|
||||
try {
|
||||
@@ -333,10 +342,10 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
link.setPrivateKey(privateKey);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("Device", "Exception reading our own private key"); //Should not happen
|
||||
Log.e("KDE/Device", "Exception reading our own private key"); //Should not happen
|
||||
}
|
||||
|
||||
Log.i("Device","addLink "+link.getLinkProvider().getName()+" -> "+getName() + " active links: "+ links.size());
|
||||
Log.i("KDE/Device","addLink "+link.getLinkProvider().getName()+" -> "+getName() + " active links: "+ links.size());
|
||||
|
||||
/*
|
||||
Collections.sort(links, new Comparator<BaseLink>() {
|
||||
@@ -355,9 +364,11 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
}
|
||||
|
||||
public void removeLink(BaseLink link) {
|
||||
//FilesHelper.LogOpenFileCount();
|
||||
|
||||
link.removePackageReceiver(this);
|
||||
links.remove(link);
|
||||
Log.i("Device","removeLink: "+link.getLinkProvider().getName() + " -> "+getName() + " active links: "+ links.size());
|
||||
Log.i("KDE/Device","removeLink: "+link.getLinkProvider().getName() + " -> "+getName() + " active links: "+ links.size());
|
||||
if (links.isEmpty()) {
|
||||
reloadPluginsFromSettings();
|
||||
}
|
||||
@@ -368,7 +379,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
|
||||
if (np.getType().equals(NetworkPackage.PACKAGE_TYPE_PAIR)) {
|
||||
|
||||
Log.i("Device","Pair package");
|
||||
Log.i("KDE/Device","Pair package");
|
||||
|
||||
boolean wantsPair = np.getBoolean("pair");
|
||||
|
||||
@@ -393,7 +404,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
publicKey = KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(publicKeyBytes));
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("Device","Pairing exception: Received incorrect key");
|
||||
Log.e("KDE/Device","Pairing exception: Received incorrect key");
|
||||
for (PairingCallback cb : pairingCallback) {
|
||||
cb.pairingFailed(context.getString(R.string.error_invalid_key));
|
||||
}
|
||||
@@ -402,7 +413,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
|
||||
if (pairStatus == PairStatus.Requested) { //We started pairing
|
||||
|
||||
Log.i("Pairing","Pair answer");
|
||||
Log.i("KDE/Pairing","Pair answer");
|
||||
|
||||
if (pairingTimer != null) pairingTimer.cancel();
|
||||
|
||||
@@ -410,7 +421,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
|
||||
} else {
|
||||
|
||||
Log.i("Pairing","Pair request");
|
||||
Log.i("KDE/Pairing","Pair request");
|
||||
|
||||
Intent intent = new Intent(context, PairActivity.class);
|
||||
intent.putExtra("deviceId", deviceId);
|
||||
@@ -439,7 +450,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
pairingTimer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.e("Device","Unpairing (timeout B)");
|
||||
Log.e("KDE/Device","Unpairing (timeout B)");
|
||||
pairStatus = PairStatus.NotPaired;
|
||||
notificationManager.cancel(notificationId);
|
||||
}
|
||||
@@ -449,7 +460,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
|
||||
}
|
||||
} else {
|
||||
Log.i("Pairing","Unpair request");
|
||||
Log.i("KDE/Pairing","Unpair request");
|
||||
|
||||
if (pairStatus == PairStatus.Requested) {
|
||||
pairingTimer.cancel();
|
||||
@@ -462,27 +473,30 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
reloadPluginsFromSettings();
|
||||
}
|
||||
|
||||
//Log.e("Device","Unpairing (unpair request)");
|
||||
pairStatus = PairStatus.NotPaired;
|
||||
for (PairingCallback cb : pairingCallback) cb.unpaired();
|
||||
|
||||
}
|
||||
} else if (!isPaired()) {
|
||||
|
||||
unpair();
|
||||
Log.e("onPackageReceived","Device not paired, ignoring package!");
|
||||
|
||||
} else {
|
||||
} else if (isPaired()) {
|
||||
|
||||
for (Plugin plugin : plugins.values()) {
|
||||
try {
|
||||
plugin.onPackageReceived(np);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("Device", "Exception in "+plugin.getDisplayName()+"'s onPackageReceived()");
|
||||
Log.e("KDE/Device", "Exception in "+plugin.getDisplayName()+"'s onPackageReceived()");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Log.e("KDE/onPackageReceived","Device not paired, ignoring package!");
|
||||
|
||||
if (pairStatus != PairStatus.Requested) {
|
||||
unpair();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -500,9 +514,9 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
public void sendFailure(Throwable e) {
|
||||
if (e != null) {
|
||||
e.printStackTrace();
|
||||
Log.e("sendPackage", "Exception: " + e.getMessage());
|
||||
Log.e("KDE/sendPackage", "Exception: " + e.getMessage());
|
||||
} else {
|
||||
Log.e("sendPackage", "Unknown (null) exception");
|
||||
Log.e("KDE/sendPackage", "Unknown (null) exception");
|
||||
}
|
||||
onFailure(e);
|
||||
}
|
||||
@@ -535,6 +549,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
//Make a copy to avoid concurrent modification exception if the original list changes
|
||||
ArrayList<BaseLink> mLinks = new ArrayList<BaseLink>(links);
|
||||
for (final BaseLink link : mLinks) {
|
||||
if (link == null) continue; //Since we made a copy, maybe somebody destroyed the link in the meanwhile
|
||||
if (useEncryption) {
|
||||
link.sendPackageEncrypted(np, callback, publicKey);
|
||||
} else {
|
||||
@@ -544,7 +559,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
}
|
||||
|
||||
if (!callback.success) {
|
||||
Log.e("sendPackage", "No device link (of "+mLinks.size()+" available) could send the package. Package lost!");
|
||||
Log.e("KDE/sendPackage", "No device link (of "+mLinks.size()+" available) could send the package. Package lost!");
|
||||
backtrace.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -572,13 +587,13 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
private synchronized void addPlugin(final String name) {
|
||||
Plugin existing = plugins.get(name);
|
||||
if (existing != null) {
|
||||
Log.w("addPlugin","plugin already present:" + name);
|
||||
Log.w("KDE/addPlugin","plugin already present:" + name);
|
||||
return;
|
||||
}
|
||||
|
||||
final Plugin plugin = PluginFactory.instantiatePluginForDevice(context, name, this);
|
||||
if (plugin == null) {
|
||||
Log.e("addPlugin","could not instantiate plugin: "+name);
|
||||
Log.e("KDE/addPlugin","could not instantiate plugin: "+name);
|
||||
failedPlugins.put(name, plugin);
|
||||
return;
|
||||
}
|
||||
@@ -593,7 +608,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
} catch (Exception e) {
|
||||
success = false;
|
||||
e.printStackTrace();
|
||||
Log.e("addPlugin", "Exception loading plugin " + name);
|
||||
Log.e("KDE/addPlugin", "Exception loading plugin " + name);
|
||||
}
|
||||
|
||||
if (success) {
|
||||
@@ -601,7 +616,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
failedPlugins.remove(name);
|
||||
plugins.put(name, plugin);
|
||||
} else {
|
||||
Log.e("addPlugin", "plugin failed to load " + name);
|
||||
Log.e("KDE/addPlugin", "plugin failed to load " + name);
|
||||
plugins.remove(name);
|
||||
failedPlugins.put(name, plugin);
|
||||
}
|
||||
@@ -633,7 +648,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
//Log.e("removePlugin","removed " + name);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("removePlugin","Exception calling onDestroy for plugin "+name);
|
||||
Log.e("KDE/removePlugin","Exception calling onDestroy for plugin "+name);
|
||||
}
|
||||
|
||||
for (PluginsChangedListener listener : pluginsChangedListeners) {
|
||||
|
@@ -20,8 +20,11 @@
|
||||
|
||||
package org.kde.kdeconnect.Helpers;
|
||||
|
||||
import android.util.Log;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class FilesHelper {
|
||||
|
||||
public static String getFileExt(String fileName) {
|
||||
@@ -73,4 +76,11 @@ public class FilesHelper {
|
||||
return toFileSystemSafeName(name, true, 255);
|
||||
}
|
||||
|
||||
public static int GetOpenFileCount() {
|
||||
return new File("/proc/self/fd").listFiles().length;
|
||||
}
|
||||
|
||||
public static void LogOpenFileCount() {
|
||||
Log.e("KDE/FileCount",""+GetOpenFileCount());
|
||||
}
|
||||
}
|
||||
|
@@ -81,7 +81,9 @@ public class StorageHelper {
|
||||
if (storage.exists() && storage.isDirectory()) {
|
||||
String mounts = null;
|
||||
try {
|
||||
mounts = new Scanner( new File("/proc/mounts") ).useDelimiter("\\A").next();
|
||||
Scanner scanner = new Scanner( new File("/proc/mounts") );
|
||||
mounts = scanner.useDelimiter("\\A").next();
|
||||
scanner.close();
|
||||
//Log.e("Mounts",mounts);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -90,7 +92,7 @@ public class StorageHelper {
|
||||
File dirs[] = storage.listFiles();
|
||||
for (File dir : dirs) {
|
||||
//Log.e("getStorageList", "path: "+dir.getAbsolutePath());
|
||||
if (dir.isDirectory()) {
|
||||
if (dir.isDirectory() && dir.canRead() && dir.canExecute()) {
|
||||
String path, path2;
|
||||
path2 = dir.getAbsolutePath();
|
||||
try {
|
||||
@@ -101,9 +103,10 @@ public class StorageHelper {
|
||||
}
|
||||
if (!path.startsWith("/storage/emulated") || dirs.length == 1) {
|
||||
if (!paths.contains(path) && !paths.contains(path2)) {
|
||||
if (mounts == null || mounts.contains(path) || mounts.contains(path2))
|
||||
list.add(0, new StorageInfo(path, false, true, cur_removable_number++));
|
||||
paths.add(path);
|
||||
if (mounts == null || mounts.contains(path) || mounts.contains(path2)) {
|
||||
list.add(0, new StorageInfo(path, false, true, cur_removable_number++));
|
||||
paths.add(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -136,6 +136,7 @@ public class MprisActivity extends ActionBarActivity {
|
||||
if(playerList.isEmpty()){
|
||||
findViewById(R.id.no_players).setVisibility(View.VISIBLE);
|
||||
spinner.setVisibility(View.GONE);
|
||||
((TextView) findViewById(R.id.now_playing_textview)).setText("");
|
||||
}else{
|
||||
findViewById(R.id.no_players).setVisibility(View.GONE);
|
||||
spinner.setVisibility(View.VISIBLE);
|
||||
|
@@ -184,19 +184,21 @@ public class MprisPlugin extends Plugin {
|
||||
|
||||
public void setPlayerStatusUpdatedHandler(String id, Handler h) {
|
||||
playerStatusUpdated.put(id, h);
|
||||
|
||||
h.dispatchMessage(new Message());
|
||||
|
||||
//Get the status if this is the first handler we have
|
||||
if (playerListUpdated.size() == 1) {
|
||||
requestPlayerStatus();
|
||||
}
|
||||
|
||||
h.dispatchMessage(new Message());
|
||||
}
|
||||
|
||||
public void setPlayerListUpdatedHandler(String id, Handler h) {
|
||||
if (playerList.size() > 0) {
|
||||
h.dispatchMessage(new Message());
|
||||
}
|
||||
|
||||
playerListUpdated.put(id,h);
|
||||
|
||||
h.dispatchMessage(new Message());
|
||||
|
||||
//Get the status if this is the first handler we have
|
||||
if (playerListUpdated.size() == 1) {
|
||||
requestPlayerList();
|
||||
}
|
||||
|
@@ -64,13 +64,14 @@ public class NotificationFilterActivity extends ActionBarActivity {
|
||||
res.moveToNext();
|
||||
i++;
|
||||
}
|
||||
res.close();
|
||||
appDatabase.close();
|
||||
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
|
||||
android.R.layout.simple_list_item_multiple_choice,android.R.id.text1, appName);
|
||||
listView.setAdapter(adapter);
|
||||
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||
for (i = 0 ; i < res.getCount(); i++){
|
||||
for (i = 0 ; i < isFiltered.length; i++){
|
||||
if (isFiltered[i]) {
|
||||
listView.setItemChecked(i, true);
|
||||
}
|
||||
@@ -85,6 +86,7 @@ public class NotificationFilterActivity extends ActionBarActivity {
|
||||
appDatabase.close();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Delete apps from database which are uninstalled
|
||||
@@ -101,6 +103,7 @@ public class NotificationFilterActivity extends ActionBarActivity {
|
||||
}
|
||||
res.moveToNext();
|
||||
}
|
||||
res.close();
|
||||
}
|
||||
appDatabase.close();
|
||||
|
||||
|
@@ -25,7 +25,6 @@ import android.app.AlertDialog;
|
||||
import android.app.Notification;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -35,19 +34,16 @@ import android.util.Log;
|
||||
import android.widget.Button;
|
||||
|
||||
import org.kde.kdeconnect.Helpers.AppsHelper;
|
||||
import org.kde.kdeconnect.Helpers.ImagesHelper;
|
||||
import org.kde.kdeconnect.NetworkPackage;
|
||||
import org.kde.kdeconnect.Plugins.Plugin;
|
||||
import org.kde.kdeconnect.UserInterface.DeviceActivity;
|
||||
import org.kde.kdeconnect.UserInterface.SettingsActivity;
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
public class NotificationsPlugin extends Plugin implements NotificationReceiver.NotificationListener {
|
||||
|
||||
/*
|
||||
private boolean sendIcons = false;
|
||||
|
||||
*/
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "plugin_notifications";
|
||||
@@ -253,7 +249,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
np.set("silent", true);
|
||||
np.set("requestAnswer", true); //For compatibility with old desktop versions of KDE Connect that don't support "silent"
|
||||
}
|
||||
|
||||
/*
|
||||
if (sendIcons) {
|
||||
try {
|
||||
Drawable drawableAppIcon = AppsHelper.appIconLookup(context, packageName);
|
||||
@@ -270,7 +266,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
Log.e("NotificationsPlugin", "Error retrieving icon");
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
np.set("id", id.serialize());
|
||||
np.set("appName", appName == null? packageName : appName);
|
||||
np.set("isClearable", statusBarNotification.isClearable());
|
||||
@@ -329,11 +325,11 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
@Override
|
||||
public boolean onPackageReceived(final NetworkPackage np) {
|
||||
if (!np.getType().equals(NetworkPackage.PACKAGE_TYPE_NOTIFICATION)) return false;
|
||||
|
||||
/*
|
||||
if (np.getBoolean("sendIcons")) {
|
||||
sendIcons = true;
|
||||
}
|
||||
|
||||
*/
|
||||
if (np.getBoolean("request")) {
|
||||
|
||||
NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() {
|
||||
|
@@ -90,51 +90,55 @@ public class SftpPlugin extends Plugin {
|
||||
np2.set("user", server.passwordAuth.getUser());
|
||||
np2.set("password", server.passwordAuth.getPassword());
|
||||
|
||||
//Kept for compatibility, but new desktop clients will read "multiPaths" instead,
|
||||
// that supports devices with more than one external storage
|
||||
//Kept for compatibility, in case "multiPaths" is not possible or the other end does not support it
|
||||
np2.set("path", Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||
|
||||
List<StorageHelper.StorageInfo> storageList = StorageHelper.getStorageList();
|
||||
ArrayList<String> paths = new ArrayList<String>();
|
||||
ArrayList<String> pathNames = new ArrayList<String>();
|
||||
File root = new File("/");
|
||||
if (root.canExecute() && root.canRead()) {
|
||||
List<StorageHelper.StorageInfo> storageList = StorageHelper.getStorageList();
|
||||
ArrayList<String> paths = new ArrayList<String>();
|
||||
ArrayList<String> pathNames = new ArrayList<String>();
|
||||
|
||||
for (StorageHelper.StorageInfo storage : storageList) {
|
||||
paths.add(storage.path);
|
||||
StringBuilder res = new StringBuilder();
|
||||
for (StorageHelper.StorageInfo storage : storageList) {
|
||||
paths.add(storage.path);
|
||||
StringBuilder res = new StringBuilder();
|
||||
|
||||
if (storageList.size() > 1) {
|
||||
if (!storage.removable) {
|
||||
res.append(context.getString(R.string.sftp_internal_storage));
|
||||
} else if (storage.number > 1) {
|
||||
res.append(context.getString(R.string.sftp_sdcard_num, storage.number));
|
||||
} else {
|
||||
res.append(context.getString(R.string.sftp_sdcard));
|
||||
}
|
||||
} else {
|
||||
res.append(context.getString(R.string.sftp_all_files));
|
||||
}
|
||||
String pathName = res.toString();
|
||||
if (storage.readonly) {
|
||||
res.append(" ");
|
||||
res.append(context.getString(R.string.sftp_readonly));
|
||||
}
|
||||
pathNames.add(res.toString());
|
||||
|
||||
//Shortcut for users that only want to browse camera pictures
|
||||
String dcim = storage.path + "/DCIM/Camera";
|
||||
if (new File(dcim).exists()) {
|
||||
paths.add(dcim);
|
||||
if (storageList.size() > 1) {
|
||||
pathNames.add(context.getString(R.string.sftp_camera) + "(" + pathName + ")");
|
||||
if (!storage.removable) {
|
||||
res.append(context.getString(R.string.sftp_internal_storage));
|
||||
} else if (storage.number > 1) {
|
||||
res.append(context.getString(R.string.sftp_sdcard_num, storage.number));
|
||||
} else {
|
||||
res.append(context.getString(R.string.sftp_sdcard));
|
||||
}
|
||||
} else {
|
||||
pathNames.add(context.getString(R.string.sftp_camera));
|
||||
res.append(context.getString(R.string.sftp_all_files));
|
||||
}
|
||||
String pathName = res.toString();
|
||||
if (storage.readonly) {
|
||||
res.append(" ");
|
||||
res.append(context.getString(R.string.sftp_readonly));
|
||||
}
|
||||
pathNames.add(res.toString());
|
||||
|
||||
//Shortcut for users that only want to browse camera pictures
|
||||
String dcim = storage.path + "/DCIM/Camera";
|
||||
if (new File(dcim).exists()) {
|
||||
paths.add(dcim);
|
||||
if (storageList.size() > 1) {
|
||||
pathNames.add(context.getString(R.string.sftp_camera) + "(" + pathName + ")");
|
||||
} else {
|
||||
pathNames.add(context.getString(R.string.sftp_camera));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (paths.size() > 0) {
|
||||
np2.set("multiPaths", paths);
|
||||
np2.set("pathNames", pathNames);
|
||||
}
|
||||
}
|
||||
|
||||
np2.set("multiPaths", paths);
|
||||
np2.set("pathNames", pathNames);
|
||||
|
||||
device.sendPackage(np2);
|
||||
|
||||
return true;
|
||||
|
@@ -144,56 +144,56 @@ public class ShareActivity extends ActionBarActivity {
|
||||
Device device = devicesList.get(i-1); //NOTE: -1 because of the title!
|
||||
|
||||
Bundle extras = intent.getExtras();
|
||||
if (extras.containsKey(Intent.EXTRA_STREAM)) {
|
||||
if (extras != null) {
|
||||
if (extras.containsKey(Intent.EXTRA_STREAM)) {
|
||||
|
||||
try {
|
||||
try {
|
||||
|
||||
ArrayList<Uri> uriList;
|
||||
if (!Intent.ACTION_SEND.equals(intent.getAction())) {
|
||||
uriList = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
||||
ArrayList<Uri> uriList;
|
||||
if (!Intent.ACTION_SEND.equals(intent.getAction())) {
|
||||
uriList = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
||||
} else {
|
||||
Uri uri = extras.getParcelable(Intent.EXTRA_STREAM);
|
||||
uriList = new ArrayList<Uri>();
|
||||
uriList.add(uri);
|
||||
}
|
||||
|
||||
queuedSendUriList(device, uriList);
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e("ShareActivity", "Exception");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if (extras.containsKey(Intent.EXTRA_TEXT)) {
|
||||
String text = extras.getString(Intent.EXTRA_TEXT);
|
||||
String subject = extras.getString(Intent.EXTRA_SUBJECT);
|
||||
|
||||
//Hack: Detect shared youtube videos, so we can open them in the browser instead of as text
|
||||
if (subject != null && subject.endsWith("YouTube")) {
|
||||
int index = text.indexOf(": http://youtu.be/");
|
||||
if (index > 0) {
|
||||
text = text.substring(index + 2); //Skip ": "
|
||||
}
|
||||
}
|
||||
|
||||
boolean isUrl;
|
||||
try {
|
||||
new URL(text);
|
||||
isUrl = true;
|
||||
} catch (Exception e) {
|
||||
isUrl = false;
|
||||
}
|
||||
NetworkPackage np = new NetworkPackage(NetworkPackage.PACKAGE_TYPE_SHARE);
|
||||
if (isUrl) {
|
||||
np.set("url", text);
|
||||
} else {
|
||||
Uri uri = extras.getParcelable(Intent.EXTRA_STREAM);
|
||||
uriList = new ArrayList<Uri>();
|
||||
uriList.add(uri);
|
||||
np.set("text", text);
|
||||
}
|
||||
|
||||
queuedSendUriList(device, uriList);
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e("ShareActivity", "Exception");
|
||||
e.printStackTrace();
|
||||
device.sendPackage(np);
|
||||
}
|
||||
|
||||
} else if (extras.containsKey(Intent.EXTRA_TEXT)) {
|
||||
String text = extras.getString(Intent.EXTRA_TEXT);
|
||||
String subject = extras.getString(Intent.EXTRA_SUBJECT);
|
||||
|
||||
//Hack: Detect shared youtube videos, so we can open them in the browser instead of as text
|
||||
if (subject != null && subject.endsWith("YouTube")) {
|
||||
int index = text.indexOf(": http://youtu.be/");
|
||||
if (index > 0) {
|
||||
text = text.substring(index+2); //Skip ": "
|
||||
}
|
||||
}
|
||||
|
||||
boolean isUrl;
|
||||
try {
|
||||
new URL(text);
|
||||
isUrl = true;
|
||||
} catch(Exception e) {
|
||||
isUrl = false;
|
||||
}
|
||||
NetworkPackage np = new NetworkPackage(NetworkPackage.PACKAGE_TYPE_SHARE);
|
||||
if (isUrl) {
|
||||
np.set("url", text);
|
||||
} else {
|
||||
np.set("text", text);
|
||||
}
|
||||
device.sendPackage(np);
|
||||
}
|
||||
|
||||
|
||||
|
||||
finish();
|
||||
}
|
||||
});
|
||||
@@ -235,12 +235,13 @@ public class ShareActivity extends ActionBarActivity {
|
||||
|
||||
try {
|
||||
size = new File(uri.getPath()).length();
|
||||
np.setPayload(inputStream, size);
|
||||
} catch(Exception e) {
|
||||
Log.e("ShareActivity", "Could not obtain file size");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
np.setPayload(inputStream, size);
|
||||
|
||||
}else{
|
||||
// Probably a content:// uri, so we query the Media content provider
|
||||
|
||||
|
@@ -141,8 +141,10 @@ public class SharePlugin extends Plugin {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
OutputStream output = null;
|
||||
boolean successul = true;
|
||||
try {
|
||||
OutputStream output = new FileOutputStream(destinationFullPath.getPath());
|
||||
output = new FileOutputStream(destinationFullPath.getPath());
|
||||
byte data[] = new byte[1024];
|
||||
long progress = 0, prevProgressPercentage = 0;
|
||||
int count;
|
||||
@@ -162,9 +164,17 @@ public class SharePlugin extends Plugin {
|
||||
}
|
||||
|
||||
output.flush();
|
||||
output.close();
|
||||
input.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
successul = false;
|
||||
Log.e("SharePlugin", "Receiver thread exception");
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try { output.close(); } catch (Exception e) {}
|
||||
try { input.close(); } catch (Exception e) {}
|
||||
}
|
||||
|
||||
try {
|
||||
Log.i("SharePlugin", "Transfer finished");
|
||||
|
||||
//Make sure it is added to the Android Gallery
|
||||
@@ -185,23 +195,25 @@ public class SharePlugin extends Plugin {
|
||||
|
||||
Resources res = context.getResources();
|
||||
|
||||
String message = successul? res.getString(R.string.received_file_title, device.getName()) : res.getString(R.string.received_file_fail_title, device.getName());
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
|
||||
.setContentTitle(res.getString(R.string.received_file_title, device.getName()))
|
||||
.setContentText(res.getString(R.string.received_file_text, filename))
|
||||
.setContentIntent(resultPendingIntent)
|
||||
.setTicker(res.getString(R.string.received_file_title, device.getName()))
|
||||
.setContentTitle(message)
|
||||
.setTicker(message)
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download_done)
|
||||
.setAutoCancel(true);
|
||||
|
||||
if (successul) {
|
||||
builder.setContentText(res.getString(R.string.received_file_text, filename))
|
||||
.setContentIntent(resultPendingIntent);
|
||||
}
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (prefs.getBoolean("share_notification_preference", true)) {
|
||||
builder.setDefaults(Notification.DEFAULT_ALL);
|
||||
}
|
||||
|
||||
Notification noti = builder.build();
|
||||
|
||||
notificationManager.notify(notificationId, noti);
|
||||
Notification notification = builder.build();
|
||||
notificationManager.notify(notificationId, notification);
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e("SharePlugin", "Receiver thread exception");
|
||||
|
@@ -207,6 +207,7 @@ public class TelephonyPlugin extends Plugin {
|
||||
public boolean onCreate() {
|
||||
//Log.e("TelephonyPlugin", "onCreate");
|
||||
IntentFilter filter = new IntentFilter("android.provider.Telephony.SMS_RECEIVED");
|
||||
filter.setPriority(500);
|
||||
filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
|
||||
context.registerReceiver(receiver, filter);
|
||||
return true;
|
||||
|
@@ -108,8 +108,11 @@ public class CustomDevicesActivity extends ListActivity {
|
||||
InputMethodManager inputManager = (InputMethodManager)
|
||||
getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
|
||||
InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
View focus = getCurrentFocus();
|
||||
if (focus != null) {
|
||||
inputManager.hideSoftInputFromWindow(focus.getWindowToken(),
|
||||
InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
}
|
||||
}
|
||||
|
||||
void saveList() {
|
||||
|
@@ -46,10 +46,12 @@ public class SmallEntryItem implements ListAdapter.Item {
|
||||
View v = layoutInflater.inflate(android.R.layout.simple_list_item_1, null);
|
||||
|
||||
TextView titleView = (TextView)v.findViewById(android.R.id.text1);
|
||||
if (titleView != null) titleView.setText(title);
|
||||
if (clickListener != null) {
|
||||
titleView.setOnClickListener(clickListener);
|
||||
v.setBackgroundDrawable(layoutInflater.getContext().getResources().getDrawable(R.drawable.abc_list_selector_holo_dark));
|
||||
if (titleView != null) {
|
||||
titleView.setText(title);
|
||||
if (clickListener != null) {
|
||||
titleView.setOnClickListener(clickListener);
|
||||
v.setBackgroundDrawable(layoutInflater.getContext().getResources().getDrawable(R.drawable.abc_list_selector_holo_dark));
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
|
@@ -45,10 +45,6 @@ import java.util.Collection;
|
||||
|
||||
public class MainActivity extends ActionBarActivity {
|
||||
|
||||
//
|
||||
// Action bar
|
||||
//
|
||||
|
||||
private MenuItem menuProgress;
|
||||
|
||||
@Override
|
||||
|
@@ -61,7 +61,7 @@ public class MainSettingsActivity extends PreferenceActivity {
|
||||
}
|
||||
|
||||
private void initPreferences(final EditTextPreference deviceNamePref) {
|
||||
final SharedPreferences sharedPreferences=PreferenceManager.getDefaultSharedPreferences(this);
|
||||
final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
deviceNamePref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newDeviceName) {
|
||||
@@ -99,16 +99,12 @@ public class MainSettingsActivity extends PreferenceActivity {
|
||||
* @param context the application context
|
||||
*/
|
||||
public static void initializeDeviceName(Context context){
|
||||
// I could have used getDefaultSharedPreferences(context).contains but we need to check
|
||||
// to checkAgainst empty String also.
|
||||
String deviceName=PreferenceManager.getDefaultSharedPreferences(context).getString(
|
||||
KEY_DEVICE_NAME_PREFERENCE,
|
||||
"");
|
||||
if(deviceName.isEmpty()){
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
// Could use prefrences.contains but would need to check for empty String anyway.
|
||||
String deviceName = preferences.getString(KEY_DEVICE_NAME_PREFERENCE, "");
|
||||
if (deviceName.isEmpty()){
|
||||
Log.i("MainSettingsActivity", "New device name: " + deviceName);
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putString(
|
||||
KEY_DEVICE_NAME_PREFERENCE,
|
||||
DeviceHelper.getDeviceName()).commit();
|
||||
preferences.edit().putString(KEY_DEVICE_NAME_PREFERENCE, DeviceHelper.getDeviceName()).commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -128,7 +128,9 @@ public class PairActivity extends ActionBarActivity {
|
||||
BackgroundService.RunCommand(PairActivity.this, new BackgroundService.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(BackgroundService service) {
|
||||
device.acceptPairing();
|
||||
if (device != null) {
|
||||
device.acceptPairing();
|
||||
}
|
||||
finish();
|
||||
}
|
||||
});
|
||||
@@ -141,7 +143,9 @@ public class PairActivity extends ActionBarActivity {
|
||||
BackgroundService.RunCommand(PairActivity.this, new BackgroundService.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(BackgroundService service) {
|
||||
device.rejectPairing();
|
||||
if (device != null) {
|
||||
device.rejectPairing();
|
||||
}
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
@@ -93,7 +93,11 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
if (pref.isEnabled()) {
|
||||
String pluginName = pref.getDependency(); //The parent pref will be named like the plugin
|
||||
Plugin plugin = device.getPlugin(pluginName, true);
|
||||
plugin.startPreferencesActivity(SettingsActivity.this);
|
||||
if (plugin != null) {
|
||||
plugin.startPreferencesActivity(SettingsActivity.this);
|
||||
} else { //Could happen if the device is not connected anymore
|
||||
finish(); //End this activity so we go to the "device not reachable" screen
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user