2018-02-22 00:50:11 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2015 David Edmundson <david@davidedmundson.co.uk>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License or (at your option) version 3 or any later version
|
|
|
|
* accepted by the membership of KDE e.V. (or its successor approved
|
|
|
|
* by the membership of KDE e.V.), which shall act as a proxy
|
|
|
|
* defined in Section 14 of version 3 of the license.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-09-11 16:54:43 +02:00
|
|
|
package org.kde.kdeconnect.Plugins.FindMyPhonePlugin;
|
|
|
|
|
|
|
|
import android.content.Intent;
|
|
|
|
|
2016-06-28 20:00:19 +02:00
|
|
|
import org.kde.kdeconnect.Helpers.DeviceHelper;
|
2015-09-11 16:54:43 +02:00
|
|
|
import org.kde.kdeconnect.NetworkPackage;
|
|
|
|
import org.kde.kdeconnect.Plugins.Plugin;
|
|
|
|
import org.kde.kdeconnect_tp.R;
|
|
|
|
|
|
|
|
public class FindMyPhonePlugin extends Plugin {
|
2016-05-31 17:19:39 +02:00
|
|
|
|
|
|
|
public final static String PACKAGE_TYPE_FINDMYPHONE_REQUEST = "kdeconnect.findmyphone.request";
|
|
|
|
|
2015-09-11 16:54:43 +02:00
|
|
|
@Override
|
|
|
|
public String getDisplayName() {
|
2016-06-28 20:00:19 +02:00
|
|
|
return DeviceHelper.isTablet() ? context.getString(R.string.findmyphone_title_tablet) : context.getString(R.string.findmyphone_title);
|
2015-09-11 16:54:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getDescription() {
|
|
|
|
return context.getString(R.string.findmyphone_description);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onPackageReceived(NetworkPackage np) {
|
|
|
|
|
2018-02-22 00:50:11 +01:00
|
|
|
Intent intent = new Intent(context, FindMyPhoneActivity.class);
|
2016-06-02 15:35:44 +02:00
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
context.startActivity(intent);
|
|
|
|
return true;
|
2015-09-11 16:54:43 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String[] getSupportedPackageTypes() {
|
2016-05-31 17:19:39 +02:00
|
|
|
return new String[]{PACKAGE_TYPE_FINDMYPHONE_REQUEST};
|
2015-09-11 16:54:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String[] getOutgoingPackageTypes() {
|
|
|
|
return new String[0];
|
|
|
|
}
|
2018-02-22 00:50:11 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasSettings() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-09-11 16:54:43 +02:00
|
|
|
}
|