diff --git a/res/values/strings.xml b/res/values/strings.xml index 100bce6e..0e1faa49 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,220 +1,221 @@ Telephony notifier Send notifications for SMS and calls Battery report Periodically report battery status Filesystem expose Allows to browse this device\'s filesystem remotely Clipboard sync Share the clipboard content Remote input Use your phone or tablet as a touchpad and keyboard Receive remote keypresses Receive keypress events from remote devices Multimedia controls Provides a remote control for your media player Run Command Trigger remote commands from your phone or tablet Ping Send and receive pings Notification sync Access your notifications from other devices Receive notifications Receive notifications from the other device and display them on Android Share and receive Share files and URLs between devices This feature is not available in your Android version No devices OK Cancel Open settings You need to grant permission to access notifications Send ping Multimedia control remotekeyboard_editing_only Handle remote keys only when editing There is no active remote keyboard connection, establish one in kdeconnect Remote keyboard connection is active There is more than one remote keyboard connection, select the device to configure Remote input 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 2 fingers to scroll. Use a long press to drag\'n drop. Set two finger tap action Set three finger tap action Set touchpad sensitivity mousepad_double_tap_key mousepad_triple_tap_key mousepad_sensitivity_key Reverse Scrolling Direction mousepad_scroll_direction Right click Middle click Nothing right middle default right middle none Slowest Above Slowest Default Above Default Fastest slowest aboveSlowest default aboveDefault fastest Connected devices Available devices Remembered devices Plugins failed to load (tap for more info): Plugin settings Unpair Paired device not reachable Pair new device Unknown device Device not reachable Pairing already requested Device already paired Could not send package Timed out Canceled by user Canceled by other peer Invalid key received Encryption Info The other device doesn\'t use a recent version of KDE Connect, using the legacy encryption method. SHA1 fingerprint of your device certificate is: SHA1 fingerprint of remote device certificate is: Pair requested Pairing request from %1s Received link from %1s Tap to open \'%1s\' Incoming file from %1s %1s Sending file to %1s Sending files to %1s %1s Sent %1$d out of %2$d files Received file from %1s Failed receiving file from %1s Tap to open \'%1s\' Sent file to %1s %1s Failed to send file to %1s %1s Tap to answer Reconnect Send Right Click Send Middle Click Show Keyboard Device not paired Request pairing Accept Reject Device Pair device Remote control KDE Connect Settings Play Previous Rewind Fast-forward Next Volume Multimedia Settings Forward/rewind buttons Adjust the time to fast forward/rewind when pressed. mpris_interval_time 10 seconds 20 seconds 30 seconds 1 minute 2 minutes 10000000 10000000 20000000 30000000 60000000 120000000 Share To... This device uses an old protocol version This device uses a newer protocol version General Settings Settings %s settings Device name %s Invalid device name Received text, saved to clipboard Custom device list Pair a new device Unpair %s Add devices by IP Noisy notifications Vibrate and play a sound when receiving a file Customize destination directory Received files will appear in Downloads Files will be stored in the directory below Destination directory Notification filter Notifications will be synchronized for the selected apps. Internal storage All files SD card %d SD card (read only) Camera pictures Add host/IP Hostname or IP No players found Use this option only if your device is not automatically detected. Enter IP address or hostname below and touch the button to add it to the list. Touch an existing item to remove it from the list. %1$s on %2$s Send files KDE Connect Devices Other devices running KDE Connect in your same network should appear here. Device paired Rename device Rename Refresh This paired device is not reachable. Make sure it is connected to your same network. It looks like you are on a mobile data connection. KDE Connect only works on local networks. There are no file browsers installed. Send SMS Send text messages from your desktop This plugin is not supported by the device Find my phone Find my tablet Rings this device so you can find it Found Open Close You need to grant permissions to access the storage Some Plugins need permissions to work (tap for more info): This plugin needs permissions to work You need to grant extra permissions to enable all functions Some plugins have features disabled because of lack of permission (tap for more info): To access your files from your PC the app needs permission to access your phone\'s storage To share files between your phone and your desktop you need to give access to the phone\'s storage To read and write SMS from your desktop you need to give permission to SMS To see phone calls and SMS from the desktop you need to give permission to phone calls and SMS To see a contact name instead of a phone number you need to give access to the phone\'s contacts + Select a ringtone diff --git a/res/xml/findmyphoneplugin_preferences.xml b/res/xml/findmyphoneplugin_preferences.xml new file mode 100644 index 00000000..2a040c6e --- /dev/null +++ b/res/xml/findmyphoneplugin_preferences.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/src/org/kde/kdeconnect/Plugins/FindMyPhonePlugin/FindMyPhoneActivity.java b/src/org/kde/kdeconnect/Plugins/FindMyPhonePlugin/FindMyPhoneActivity.java index 3d1c7fcc..8383d1d1 100644 --- a/src/org/kde/kdeconnect/Plugins/FindMyPhonePlugin/FindMyPhoneActivity.java +++ b/src/org/kde/kdeconnect/Plugins/FindMyPhonePlugin/FindMyPhoneActivity.java @@ -1,92 +1,111 @@ +/* Copyright 2018 Nicolas Fella + * Copyright 2015 David Edmundson + * + * 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 . +*/ package org.kde.kdeconnect.Plugins.FindMyPhonePlugin; import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.media.AudioManager; import android.media.MediaPlayer; import android.media.RingtoneManager; import android.net.Uri; import android.os.Bundle; +import android.preference.PreferenceManager; import android.util.Log; import android.view.View; import android.view.Window; import android.view.WindowManager; import org.kde.kdeconnect_tp.R; public class FindMyPhoneActivity extends Activity { private MediaPlayer mediaPlayer; private int previousVolume; private AudioManager audioManager; @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (mediaPlayer != null) { // If this activity was already open and we received the ring packet again, just finish it finish(); } // otherwise the activity will become active again } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_find_my_phone); audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); Window window = this.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); findViewById(R.id.bFindMyPhone).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); } @Override protected void onStart() { super.onStart(); try { // Make sure we are heard even when the phone is silent, restore original volume later previousVolume = audioManager.getStreamVolume(AudioManager.STREAM_ALARM); audioManager.setStreamVolume(AudioManager.STREAM_ALARM, audioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM), 0); - Uri alert = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE); - if (alert == null) { - alert = RingtoneManager.getValidRingtoneUri(getApplicationContext()); - } + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + String ringtone = prefs.getString("select_ringtone", ""); mediaPlayer = new MediaPlayer(); - mediaPlayer.setDataSource(this, alert); + mediaPlayer.setDataSource(this, Uri.parse(ringtone)); mediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); mediaPlayer.setLooping(true); mediaPlayer.prepare(); mediaPlayer.start(); } catch (Exception e) { Log.e("FindMyPhoneActivity", "Exception", e); } } @Override protected void onStop() { super.onStop(); if (mediaPlayer != null) { mediaPlayer.stop(); } audioManager.setStreamVolume(AudioManager.STREAM_ALARM, previousVolume, 0); } } diff --git a/src/org/kde/kdeconnect/Plugins/FindMyPhonePlugin/FindMyPhonePlugin.java b/src/org/kde/kdeconnect/Plugins/FindMyPhonePlugin/FindMyPhonePlugin.java index 0ea140c8..e88cae73 100644 --- a/src/org/kde/kdeconnect/Plugins/FindMyPhonePlugin/FindMyPhonePlugin.java +++ b/src/org/kde/kdeconnect/Plugins/FindMyPhonePlugin/FindMyPhonePlugin.java @@ -1,49 +1,69 @@ +/* + * Copyright 2015 David Edmundson + * + * 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 . +*/ + package org.kde.kdeconnect.Plugins.FindMyPhonePlugin; import android.content.Intent; import org.kde.kdeconnect.Helpers.DeviceHelper; import org.kde.kdeconnect.NetworkPackage; import org.kde.kdeconnect.Plugins.Plugin; import org.kde.kdeconnect_tp.R; - -/** - * Created by vineet on 1/11/14. - * and David Edmundson 2015 - */ public class FindMyPhonePlugin extends Plugin { - public final static String PACKAGE_TYPE_FINDMYPHONE = "kdeconnect.findmyphone"; public final static String PACKAGE_TYPE_FINDMYPHONE_REQUEST = "kdeconnect.findmyphone.request"; @Override public String getDisplayName() { return DeviceHelper.isTablet() ? context.getString(R.string.findmyphone_title_tablet) : context.getString(R.string.findmyphone_title); } @Override public String getDescription() { return context.getString(R.string.findmyphone_description); } @Override public boolean onPackageReceived(NetworkPackage np) { - Intent intent = new Intent(context,FindMyPhoneActivity.class); + Intent intent = new Intent(context, FindMyPhoneActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); return true; } @Override public String[] getSupportedPackageTypes() { return new String[]{PACKAGE_TYPE_FINDMYPHONE_REQUEST}; } @Override public String[] getOutgoingPackageTypes() { return new String[0]; } + + @Override + public boolean hasSettings() { + return true; + } + }