Differential D13505 Diff 41919 src/org/kde/kdeconnect/Plugins/FindRemoteDevicePlugin/FindRemoteDevicePlugin.java
Changeset View
Changeset View
Standalone View
Standalone View
src/org/kde/kdeconnect/Plugins/FindRemoteDevicePlugin/FindRemoteDevicePlugin.java
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2014 Albert Vaca Cintora <albertvaka@gmail.com> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2 of | ||||
7 | * the License or (at your option) version 3 or any later version | ||||
8 | * accepted by the membership of KDE e.V. (or its successor approved | ||||
9 | * by the membership of KDE e.V.), which shall act as a proxy | ||||
10 | * defined in Section 14 of version 3 of the license. | ||||
11 | * | ||||
12 | * This program is distributed in the hope that it will be useful, | ||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
15 | * GNU General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU General Public License | ||||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | */ | ||||
20 | | ||||
21 | package org.kde.kdeconnect.Plugins.FindRemoteDevicePlugin; | ||||
22 | | ||||
23 | import android.app.Activity; | ||||
24 | | ||||
25 | import org.kde.kdeconnect.NetworkPacket; | ||||
26 | import org.kde.kdeconnect.Plugins.FindMyPhonePlugin.FindMyPhonePlugin; | ||||
27 | import org.kde.kdeconnect.Plugins.Plugin; | ||||
28 | import org.kde.kdeconnect_tp.R; | ||||
29 | | ||||
30 | | ||||
31 | public class FindRemoteDevicePlugin extends Plugin { | ||||
32 | | ||||
33 | @Override | ||||
34 | public String getDisplayName() { | ||||
35 | return context.getResources().getString(R.string.pref_plugin_findremotedevice); | ||||
36 | } | ||||
37 | | ||||
38 | @Override | ||||
39 | public String getDescription() { | ||||
40 | return context.getResources().getString(R.string.pref_plugin_findremotedevice_desc); | ||||
41 | } | ||||
42 | | ||||
43 | @Override | ||||
44 | public boolean onPacketReceived(NetworkPacket np) { | ||||
45 | return true; | ||||
46 | } | ||||
47 | | ||||
48 | @Override | ||||
49 | public String getActionName() { | ||||
50 | return context.getString(R.string.ring); | ||||
51 | } | ||||
52 | | ||||
53 | @Override | ||||
54 | public void startMainActivity(Activity activity) { | ||||
55 | if (device != null) { | ||||
56 | device.sendPacket(new NetworkPacket(FindMyPhonePlugin.PACKET_TYPE_FINDMYPHONE_REQUEST)); | ||||
57 | } | ||||
58 | } | ||||
59 | | ||||
60 | @Override | ||||
61 | public boolean hasMainActivity() { | ||||
62 | return true; | ||||
63 | } | ||||
64 | | ||||
65 | @Override | ||||
66 | public boolean displayInContextMenu() { | ||||
67 | return true; | ||||
68 | } | ||||
69 | | ||||
70 | @Override | ||||
71 | public String[] getSupportedPacketTypes() { | ||||
72 | return new String[]{}; | ||||
73 | } | ||||
74 | | ||||
75 | @Override | ||||
76 | public String[] getOutgoingPacketTypes() { | ||||
77 | return new String[]{FindMyPhonePlugin.PACKET_TYPE_FINDMYPHONE_REQUEST}; | ||||
78 | } | ||||
79 | | ||||
80 | } |