Differential D10332 Diff 27746 src/org/kde/kdeconnect/Plugins/FindMyPhonePlugin/FindMyPhonePlugin.java
Changeset View
Changeset View
Standalone View
Standalone View
src/org/kde/kdeconnect/Plugins/FindMyPhonePlugin/FindMyPhonePlugin.java
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2015 David Edmundson <david@davidedmundson.co.uk> | ||||
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 | | ||||
1 | package org.kde.kdeconnect.Plugins.FindMyPhonePlugin; | 21 | package org.kde.kdeconnect.Plugins.FindMyPhonePlugin; | ||
2 | 22 | | |||
3 | import android.content.Intent; | 23 | import android.content.Intent; | ||
4 | 24 | | |||
5 | import org.kde.kdeconnect.Helpers.DeviceHelper; | 25 | import org.kde.kdeconnect.Helpers.DeviceHelper; | ||
6 | import org.kde.kdeconnect.NetworkPackage; | 26 | import org.kde.kdeconnect.NetworkPackage; | ||
7 | import org.kde.kdeconnect.Plugins.Plugin; | 27 | import org.kde.kdeconnect.Plugins.Plugin; | ||
8 | import org.kde.kdeconnect_tp.R; | 28 | import org.kde.kdeconnect_tp.R; | ||
9 | 29 | | |||
10 | | ||||
11 | /** | | |||
12 | * Created by vineet on 1/11/14. | | |||
13 | * and David Edmundson 2015 | | |||
14 | */ | | |||
15 | public class FindMyPhonePlugin extends Plugin { | 30 | public class FindMyPhonePlugin extends Plugin { | ||
16 | 31 | | |||
17 | public final static String PACKAGE_TYPE_FINDMYPHONE = "kdeconnect.findmyphone"; | | |||
18 | public final static String PACKAGE_TYPE_FINDMYPHONE_REQUEST = "kdeconnect.findmyphone.request"; | 32 | public final static String PACKAGE_TYPE_FINDMYPHONE_REQUEST = "kdeconnect.findmyphone.request"; | ||
19 | 33 | | |||
20 | @Override | 34 | @Override | ||
21 | public String getDisplayName() { | 35 | public String getDisplayName() { | ||
22 | return DeviceHelper.isTablet() ? context.getString(R.string.findmyphone_title_tablet) : context.getString(R.string.findmyphone_title); | 36 | return DeviceHelper.isTablet() ? context.getString(R.string.findmyphone_title_tablet) : context.getString(R.string.findmyphone_title); | ||
23 | } | 37 | } | ||
24 | 38 | | |||
25 | @Override | 39 | @Override | ||
26 | public String getDescription() { | 40 | public String getDescription() { | ||
27 | return context.getString(R.string.findmyphone_description); | 41 | return context.getString(R.string.findmyphone_description); | ||
28 | } | 42 | } | ||
29 | 43 | | |||
30 | @Override | 44 | @Override | ||
31 | public boolean onPackageReceived(NetworkPackage np) { | 45 | public boolean onPackageReceived(NetworkPackage np) { | ||
32 | 46 | | |||
33 | Intent intent = new Intent(context,FindMyPhoneActivity.class); | 47 | Intent intent = new Intent(context, FindMyPhoneActivity.class); | ||
34 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 48 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
35 | context.startActivity(intent); | 49 | context.startActivity(intent); | ||
36 | return true; | 50 | return true; | ||
37 | 51 | | |||
38 | } | 52 | } | ||
39 | 53 | | |||
40 | @Override | 54 | @Override | ||
41 | public String[] getSupportedPackageTypes() { | 55 | public String[] getSupportedPackageTypes() { | ||
42 | return new String[]{PACKAGE_TYPE_FINDMYPHONE_REQUEST}; | 56 | return new String[]{PACKAGE_TYPE_FINDMYPHONE_REQUEST}; | ||
43 | } | 57 | } | ||
44 | 58 | | |||
45 | @Override | 59 | @Override | ||
46 | public String[] getOutgoingPackageTypes() { | 60 | public String[] getOutgoingPackageTypes() { | ||
47 | return new String[0]; | 61 | return new String[0]; | ||
48 | } | 62 | } | ||
63 | | ||||
64 | @Override | ||||
65 | public boolean hasSettings() { | ||||
66 | return true; | ||||
67 | } | ||||
68 | | ||||
49 | } | 69 | } |