mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-29 05:07:40 +00:00
Merge branch 'master' into sslmaster
This commit is contained in:
commit
3e9509123e
@ -32,6 +32,7 @@
|
||||
<string name="mousepad_info">Moveu un dit per la pantalla per a moure el cursor del ratolí. Toqueu per un clic, i empreu dos/tres dits pels botons dret i mig. Empreu un toc llarg per arrossegar i deixar anar.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Estableix l\'acció de tocar amb dos dits</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Estableix l\'acció de tocar amb tres dits</string>
|
||||
<string name="mousepad_scroll_direction_title">Inverteix la direcció del desplaçament</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Clic dret</item>
|
||||
<item>Clic del mig</item>
|
||||
|
@ -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">Ferneingabe</string>
|
||||
<string name="pref_plugin_mousepad_desc">Verwendet Ihr Handy als Maus und Tastatur</string>
|
||||
<string name="pref_plugin_mpris">Multimedia-Bedienung</string>
|
||||
<string name="pref_plugin_mpris_desc">Audio und Video mit Ihrem Telefon steuern</string>
|
||||
@ -27,6 +28,7 @@
|
||||
<string name="no_permissions">Sie müssen die Erlaubnis zum Zugriff auf Benachrichtigungen erteilen</string>
|
||||
<string name="send_ping">Ping senden</string>
|
||||
<string name="open_mpris_controls">Multimedia-Bedienung</string>
|
||||
<string name="open_mousepad">Ferneingabe</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Rechtsklick</item>
|
||||
<item>Mittelklick</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="mousepad_info">Move a finger on the screen to move the mouse cursor. Tap for a click, and use two/three fingers for right and middle buttons. Use a long press to drag\'n drop.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Set two finger tap action</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Set three finger tap action</string>
|
||||
<string name="mousepad_scroll_direction_title">Reverse Scrolling Direction</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Right click</item>
|
||||
<item>Middle click</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="mousepad_info">Mueva un dedo sobre la pantalla para mover el cursor del ratón. Pulse para ejecutar un clic y use dos/tres dedos para emular los botones derecho y central. Use una pulsación larga para arrastrar y soltar.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Establecer la acción al pulsar con dos dedos</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Establecer la acción al pulsar con tres dedos</string>
|
||||
<string name="mousepad_scroll_direction_title">Invertir dirección de desplazamiento</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Clic derecho</item>
|
||||
<item>Clic del botón central</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="mousepad_info">Liikuta hiiren osoitinta liikuttamalla sormeasi näytöllä. Napsauta napauttamalla yhdellä sormella, käytä oikeaa painiketta kahdella sormella ja keskipainiketta kolmella. Vedä ja pudota painamalla pitkään.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Aseta kahden sormen napautuksen toiminto</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Aseta kolmen sormen napautuksen toiminto</string>
|
||||
<string name="mousepad_scroll_direction_title">Käänteinen vierityssuunta</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Oikea napsautus</item>
|
||||
<item>Keskinapsautus</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="mousepad_info">Mova un dedo na pantalla para mover o cursor. Toque para facer clic, e use dous ou tres dedos para os botóns secundario e central. Prema durante un tempo para arrastrar e soltar.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Definir a acción de tocar con dous dedos</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Definir a acción de tocar con tres dedos</string>
|
||||
<string name="mousepad_scroll_direction_title">Inverter a dirección de desprazamento</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Clic dereito</item>
|
||||
<item>Clic central</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<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>
|
||||
<string name="mousepad_triple_tap_settings_title">Imposta azione per il tocco a tre dita</string>
|
||||
<string name="mousepad_scroll_direction_title">Inverti direzione di scorrimento</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Clic destro</item>
|
||||
<item>Clic centrale</item>
|
||||
|
@ -1,15 +1,102 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="pref_plugin_telephony">Telefono žinutės ir skambučiai</string>
|
||||
<string name="pref_plugin_telephony_desc">Siųsti pranešimus apie SMS ir skambučius</string>
|
||||
<string name="pref_plugin_battery">Akumuliatoriaus ataskaita</string>
|
||||
<string name="pref_plugin_sftp">Failų sistemos naršymas</string>
|
||||
<string name="pref_plugin_clipboard">Iškarpinės sinchronizavimas</string>
|
||||
<string name="pref_plugin_mousepad">Nuotolinis įvedimas</string>
|
||||
<string name="pref_plugin_mpris">Įvairialypės terpės valdikliai</string>
|
||||
<string name="pref_plugin_runcommand">Vykdyti komandą</string>
|
||||
<string name="pref_plugin_ping">Ryšio patikrinimas</string>
|
||||
<string name="pref_plugin_notifications">Pranešimų sinchronizavimas</string>
|
||||
<string name="pref_plugin_sharereceiver">Dalintis ir gauti</string>
|
||||
<string name="device_list_empty">Įrenginių nerasta</string>
|
||||
<string name="ok">Gerai</string>
|
||||
<string name="cancel">Atšaukti</string>
|
||||
<string name="open_settings">Atverti nuostatas</string>
|
||||
<string name="send_ping">Tikrinti ryšį</string>
|
||||
<string name="open_mpris_controls">Garso ir vaizdo kūrinių grojimo valdymas</string>
|
||||
<string name="open_mousepad">Nuotolinis įvedimas</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Right click</item>
|
||||
<item>Middle click</item>
|
||||
<item>Nothing</item>
|
||||
<item>Nieko</item>
|
||||
</string-array>
|
||||
<string name="category_connected_devices">Prijungti įrenginiai</string>
|
||||
<string name="category_not_paired_devices">Pasiekiami įrenginiai</string>
|
||||
<string name="category_remembered_devices">Įsimintieji įrenginiai</string>
|
||||
<string name="device_menu_plugins">Papildinio nuostatos</string>
|
||||
<string name="device_menu_unpair">Atrišti</string>
|
||||
<string name="device_not_reachable">Nepavyksta pasiekti suporuoto įrenginio</string>
|
||||
<string name="unknown_device">Nežinomas įrenginys</string>
|
||||
<string name="error_not_reachable">Įrenginys nepasiekiamas</string>
|
||||
<string name="error_already_requested">Jau paprašyta suporuoti</string>
|
||||
<string name="error_already_paired">Įrenginys jau suporuotas</string>
|
||||
<string name="error_could_not_send_package">Nepavyksta išsiųsti paketo</string>
|
||||
<string name="error_timed_out">Skirtasis laikas baigėsi</string>
|
||||
<string name="error_canceled_by_user">Naudotojas atšaukė užduotį</string>
|
||||
<string name="error_canceled_by_other_peer">Porininkas atšaukė užduotį</string>
|
||||
<string name="error_invalid_key">Gautas netinkamas raktas</string>
|
||||
<string name="pair_requested">Paprašyta suporuoti</string>
|
||||
<string name="tap_to_answer">Norėdami atsakyti, palieskite</string>
|
||||
<string name="reconnect">Prisijungti iš naujo</string>
|
||||
<string name="show_keyboard">Rodyti klaviatūrą</string>
|
||||
<string name="device_not_paired">Įrenginys nesuporuotas</string>
|
||||
<string name="request_pairing">Bandyti suporuoti</string>
|
||||
<string name="pairing_accept">Priimti</string>
|
||||
<string name="pairing_reject">Atmesti</string>
|
||||
<string name="device">Įrenginys</string>
|
||||
<string name="pair_device">Suporuoti įrenginį</string>
|
||||
<string name="remote_control">Nuotolinis valdymas</string>
|
||||
<string name="settings">„KDE Connect“ nuostatos</string>
|
||||
<string name="mpris_play">Groti</string>
|
||||
<string name="mpris_previous">Ankstesnis</string>
|
||||
<string name="mpris_rew">Atsukti</string>
|
||||
<string name="mpris_ff">Prasukti</string>
|
||||
<string name="mpris_next">Tolesnis</string>
|
||||
<string name="mpris_volume">Garsumas</string>
|
||||
<string name="mpris_settings">Įvairialypės terpės nuostatos</string>
|
||||
<string name="mpris_time_settings_title">Prasukimo ir atsukimo mygtukai</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 sekundžių</item>
|
||||
<item>20 sekundžių</item>
|
||||
<item>30 sekundžių</item>
|
||||
<item>1 minutė</item>
|
||||
<item>2 minutės</item>
|
||||
</string-array>
|
||||
<string name="share_to">Dalintis...</string>
|
||||
<string name="general_settings">Bendrosios nuostatos</string>
|
||||
<string name="plugin_settings">Nuostatos</string>
|
||||
<string name="plugin_settings_with_name">%s nuostatos</string>
|
||||
<string name="device_name">Įrenginio pavadinimas</string>
|
||||
<string name="device_name_preference_summary">%s</string>
|
||||
<string name="invalid_device_name">Netinkamas įrenginio pavadinimas</string>
|
||||
<string name="custom_devices_settings">Savitas įrenginių sąrašas</string>
|
||||
<string name="pair_device_action">Suporuoti naują įrenginį</string>
|
||||
<string name="unpair_device_action">Atrišti %s</string>
|
||||
<string name="custom_device_list">Pridėti įrenginį pagal IP</string>
|
||||
<string name="sftp_all_files">Visi failai</string>
|
||||
<string name="sftp_sdcard_num">SD kortelė %d</string>
|
||||
<string name="sftp_sdcard">SD kortelė</string>
|
||||
<string name="sftp_readonly">(tik skaitymui)</string>
|
||||
<string name="sftp_camera">Nuotraukos</string>
|
||||
<string name="add_host">Pridėti kompiuterį / IP</string>
|
||||
<string name="add_host_hint">Adresas arba IP</string>
|
||||
<string name="mpris_player_on_device">%1$s - %2$s</string>
|
||||
<string name="send_files">Siųsti failus</string>
|
||||
<string name="pairing_title">„KDE Connect“ įrenginiai</string>
|
||||
<string name="pairing_description">Čia turėtų pasirodyti to kiti paties tinklo įrenginiai, kuriuose veikia „KDE Connect“</string>
|
||||
<string name="device_paired">Įrenginys suporuotas</string>
|
||||
<string name="device_rename_title">Pervadinti įrenginį</string>
|
||||
<string name="device_rename_confirm">Pervadinti</string>
|
||||
<string name="refresh">Atnaujinti</string>
|
||||
<string name="unreachable_description">Šis suporuotas įrenginys nepasiekiamas. Patikrinkite, ar jis prisijungęs prie to paties tinklo.</string>
|
||||
<string name="pref_plugin_telepathy">Siųsti SMS</string>
|
||||
<string name="plugin_not_supported">Telefonas nepalaiko šio papildinio</string>
|
||||
<string name="findmyphone_title">Rasti telefoną</string>
|
||||
<string name="findmyphone_description">Telefonas skambės, tad galėsite jį rasti.</string>
|
||||
<string name="findmyphone_found">Radau</string>
|
||||
<string name="open">Atverti</string>
|
||||
<string name="close">Užverti</string>
|
||||
</resources>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="mousepad_info">Veeg met een vinger op het scherm om de muiscursor te verplaatsen. Tik om te klikken en gebruik twee/drie vingers voor rechter en middelste knop. Druk lang voor slepen en loslaten.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Tikactie met twee vingers instellen</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Tikactie met drie vingers instellen</string>
|
||||
<string name="mousepad_scroll_direction_title">Schuifrichting omdraaien</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Rechter muisklik</item>
|
||||
<item>Middelste muisklik</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="mousepad_info">Przesuń palcem po ekranie, aby przesunąć wskaźnik myszy. Stuknij, aby wywołać naciśniecie lewym przyciskiem myszy i użyj dwóch/trzech palców, aby wywołać naciśniecie prawym i środkowym przyciskiem myszy. Przyciśnij na dłużej, aby przeciągnąć i upuścić.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Ustaw działanie po dwukrotnym stuknięciu palcem</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Ustaw działanie po trzykrotnym stuknięciu palcem</string>
|
||||
<string name="mousepad_scroll_direction_title">Odwróć stronę przewijania</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Naciśnięcie prawym</item>
|
||||
<item>Naciśnięcie środkowym</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="mousepad_info">Mova um dedo pelo tela para mover o ponteiro do mouse. Dê um toque para clicar e use dois/três dedos para os botões da direita e do meio. Use uma pressão longa para arrastar e soltar.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Definir a ação do toque com dois dedos</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Definir a ação do toque com três dedos</string>
|
||||
<string name="mousepad_scroll_direction_title">Direção de rolagem inversa</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Botão direito</item>
|
||||
<item>Botão do meio</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="mousepad_info">Mova um dedo pelo ecrã para mover o cursor do rato. Dê um toque para carregar no botão esquerdo e use dois/três dedos para os botões direito e do meio. Use uma pressão longa para arrastar e largar.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Definir a acção do toque com dois dedos</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Definir a acção do toque com três dedos</string>
|
||||
<string name="mousepad_scroll_direction_title">Direcção de Deslocamento Inversa</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Botão direito</item>
|
||||
<item>Botão do meio</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<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 name="mousepad_scroll_direction_title">Obrátený smer rolovania</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Kliknutie pravým tlačidlom</item>
|
||||
<item>Stredný klik</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="mousepad_info">Flytta fingret på skärmen för att röra muspekaren. Rör för att klicka, och använd två eller tre fingrar för höger- och mittenknapparna. Använd en längre beröring för drag och släpp.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Ställ in åtgärd vid två fingerberöringar</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Ställ in åtgärd vid tre fingerberöringar</string>
|
||||
<string name="mousepad_scroll_direction_title">Omvänd rullningsriktning</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Högerklick</item>
|
||||
<item>Mittenklick</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="mousepad_info">Проведіть по екрану пальцем, щоб пересунути вказівник миші. Дотик одним пальцем означатиме клацання, дотиком двома або трьома пальцями можна імітувати праву і середню кнопки. Для перетягування зі скиданням скористайтеся тривалим натисканням.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Встановлення дії для торкання двома пальцями</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Встановлення дії для торкання трьома пальцями</string>
|
||||
<string name="mousepad_scroll_direction_title">Зворотний напрямок гортання</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Клацання правою</item>
|
||||
<item>Клацання середньою</item>
|
||||
|
@ -678,7 +678,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
Plugin existing = plugins.get(pluginKey);
|
||||
if (existing != null) {
|
||||
//Log.w("KDE/addPlugin","plugin already present:" + pluginKey);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
final Plugin plugin = PluginFactory.instantiatePluginForDevice(context, pluginKey, this);
|
||||
|
@ -24,12 +24,17 @@ import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.service.notification.StatusBarNotification;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.TaskStackBuilder;
|
||||
import android.util.Log;
|
||||
|
||||
import org.kde.kdeconnect.Helpers.AppsHelper;
|
||||
@ -77,47 +82,45 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hasPermission()) {
|
||||
NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(NotificationReceiver service) {
|
||||
try {
|
||||
service.addListener(NotificationsPlugin.this);
|
||||
StatusBarNotification[] notifications = service.getActiveNotifications();
|
||||
for (StatusBarNotification notification : notifications) {
|
||||
sendNotification(notification, true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
if (hasPermission()) {
|
||||
NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(NotificationReceiver service) {
|
||||
try {
|
||||
service.addListener(NotificationsPlugin.this);
|
||||
StatusBarNotification[] notifications = service.getActiveNotifications();
|
||||
for (StatusBarNotification notification : notifications) {
|
||||
sendNotification(notification, true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("NotificationsPlugin", "Exception");
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("NotificationsPlugin", "Exception");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// request all existing notifications
|
||||
NetworkPackage np = new NetworkPackage(NetworkPackage.PACKAGE_TYPE_NOTIFICATION);
|
||||
np.set("request", true);
|
||||
device.sendPackage(np);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(NotificationReceiver service) {
|
||||
service.removeListener(NotificationsPlugin.this);
|
||||
}
|
||||
});
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(NotificationReceiver service) {
|
||||
service.removeListener(NotificationsPlugin.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -262,53 +265,84 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
*/
|
||||
if (np.getBoolean("request")) {
|
||||
|
||||
NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() {
|
||||
private void sendCurrentNotifications(NotificationReceiver service) {
|
||||
StatusBarNotification[] notifications = service.getActiveNotifications();
|
||||
for (StatusBarNotification notification : notifications) {
|
||||
sendNotification(notification, true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() {
|
||||
private void sendCurrentNotifications(NotificationReceiver service) {
|
||||
StatusBarNotification[] notifications = service.getActiveNotifications();
|
||||
for (StatusBarNotification notification : notifications) {
|
||||
sendNotification(notification, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onServiceStart(final NotificationReceiver service) {
|
||||
try {
|
||||
//If service just started, this call will throw an exception because the answer is not ready yet
|
||||
sendCurrentNotifications(service);
|
||||
} catch(Exception e) {
|
||||
Log.e("onPackageReceived","Error when answering 'request': Service failed to start. Retrying in 100ms...");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
Log.e("onPackageReceived","Error when answering 'request': Service failed to start. Retrying...");
|
||||
sendCurrentNotifications(service);
|
||||
} catch (Exception e) {
|
||||
Log.e("onPackageReceived","Error when answering 'request': Service failed to start twice!");
|
||||
e.printStackTrace();
|
||||
@Override
|
||||
public void onServiceStart(final NotificationReceiver service) {
|
||||
try {
|
||||
//If service just started, this call will throw an exception because the answer is not ready yet
|
||||
sendCurrentNotifications(service);
|
||||
} catch(Exception e) {
|
||||
Log.e("onPackageReceived","Error when answering 'request': Service failed to start. Retrying in 100ms...");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
Log.e("onPackageReceived","Error when answering 'request': Service failed to start. Retrying...");
|
||||
sendCurrentNotifications(service);
|
||||
} catch (Exception e) {
|
||||
Log.e("onPackageReceived","Error when answering 'request': Service failed to start twice!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
} else if (np.has("cancel")) {
|
||||
|
||||
NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(NotificationReceiver service) {
|
||||
String dismissedId = np.getString("cancel");
|
||||
cancelNotificationCompat(service, dismissedId);
|
||||
}
|
||||
});
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(NotificationReceiver service) {
|
||||
String dismissedId = np.getString("cancel");
|
||||
cancelNotificationCompat(service, dismissedId);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
if (!np.has("ticker") || !np.has("appName") || !np.has("id")) {
|
||||
Log.e("NotificationsPlugin", "Received notification package lacks properties");
|
||||
} else {
|
||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
|
||||
stackBuilder.addParentStack(MaterialActivity.class);
|
||||
stackBuilder.addNextIntent(new Intent(context, MaterialActivity.class));
|
||||
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(
|
||||
0,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
);
|
||||
|
||||
Log.w("NotificationsPlugin", "Nothing to do");
|
||||
Notification noti = new NotificationCompat.Builder(context)
|
||||
.setContentTitle(np.getString("appName"))
|
||||
.setContentText(np.getString("ticker"))
|
||||
.setContentIntent(resultPendingIntent)
|
||||
.setTicker(np.getString("ticker"))
|
||||
.setSmallIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setAutoCancel(true)
|
||||
.setLocalOnly(true) // to avoid bouncing the notification back to other kdeconnect nodes
|
||||
.setDefaults(Notification.DEFAULT_ALL)
|
||||
.build();
|
||||
|
||||
|
||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
try {
|
||||
// tag all incoming notifications
|
||||
notificationManager.notify("kdeconnectId:" + np.getString("id", "0"), np.getInt("id", 0), noti);
|
||||
} catch (Exception e) {
|
||||
//4.1 will throw an exception about not having the VIBRATE permission, ignore it.
|
||||
//https://android.googlesource.com/platform/frameworks/base/+/android-4.2.1_r1.2%5E%5E!/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -382,16 +416,20 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
}
|
||||
|
||||
public static String getNotificationKeyCompat(StatusBarNotification statusBarNotification) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
return statusBarNotification.getKey();
|
||||
String result;
|
||||
// first check if it's one of our remoteIds
|
||||
String tag = statusBarNotification.getTag();
|
||||
if (tag != null && tag.startsWith("kdeconnectId:"))
|
||||
result = Integer.toString(statusBarNotification.getId());
|
||||
else if (Build.VERSION.SDK_INT >= 21) {
|
||||
result = statusBarNotification.getKey();
|
||||
} else {
|
||||
String packageName = statusBarNotification.getPackageName();
|
||||
String tag = statusBarNotification.getTag();
|
||||
int id = statusBarNotification.getId();
|
||||
String safePackageName = (packageName == null) ? "" : packageName;
|
||||
String safeTag = (tag == null) ? "" : tag;
|
||||
return safePackageName + ":" + safeTag + ":" + id;
|
||||
result = safePackageName + ":" + safeTag + ":" + id;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user