Merge branch 'stable'
BIN
res/drawable-hdpi-v11/ic_notification.png
Normal file
|
After Width: | Height: | Size: 469 B |
BIN
res/drawable-hdpi/ic_notification.png
Normal file
|
After Width: | Height: | Size: 686 B |
BIN
res/drawable-mdpi-v11/ic_notification.png
Normal file
|
After Width: | Height: | Size: 313 B |
BIN
res/drawable-mdpi/ic_notification.png
Normal file
|
After Width: | Height: | Size: 462 B |
BIN
res/drawable-xhdpi-v11/ic_notification.png
Normal file
|
After Width: | Height: | Size: 552 B |
BIN
res/drawable-xhdpi/ic_notification.png
Normal file
|
After Width: | Height: | Size: 936 B |
BIN
res/drawable-xxhdpi-v11/ic_notification.png
Normal file
|
After Width: | Height: | Size: 931 B |
BIN
res/drawable-xxhdpi/ic_notification.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
res/drawable-xxxhdpi-v11/ic_notification.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
res/drawable-xxxhdpi/ic_notification.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
@@ -511,7 +511,7 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
.setContentText(res.getString(R.string.tap_to_answer))
|
||||
.setContentIntent(pendingIntent)
|
||||
.setTicker(res.getString(R.string.pair_requested))
|
||||
.setSmallIcon(android.R.drawable.ic_menu_help)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setAutoCancel(true)
|
||||
.setDefaults(Notification.DEFAULT_ALL)
|
||||
.build();
|
||||
|
||||
@@ -77,7 +77,7 @@ public class PingPlugin extends Plugin {
|
||||
.setContentText(message)
|
||||
.setContentIntent(resultPendingIntent)
|
||||
.setTicker(message)
|
||||
.setSmallIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setAutoCancel(true)
|
||||
.setDefaults(Notification.DEFAULT_ALL)
|
||||
.build();
|
||||
|
||||
@@ -47,7 +47,6 @@ import android.widget.Toast;
|
||||
import org.kde.kdeconnect.Device;
|
||||
import org.kde.kdeconnect.Helpers.FilesHelper;
|
||||
import org.kde.kdeconnect.NetworkPackage;
|
||||
import org.kde.kdeconnect.Plugins.MprisPlugin.MprisActivity;
|
||||
import org.kde.kdeconnect.Plugins.Plugin;
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
@@ -59,6 +58,8 @@ import java.util.ArrayList;
|
||||
|
||||
public class SharePlugin extends Plugin {
|
||||
|
||||
final static boolean openUrlsDirectly = true;
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return context.getResources().getString(R.string.pref_plugin_sharereceiver);
|
||||
@@ -261,34 +262,35 @@ public class SharePlugin extends Plugin {
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
//Do not launch url directly, show a notification instead
|
||||
if (openUrlsDirectly) {
|
||||
context.startActivity(browserIntent);
|
||||
} else {
|
||||
Resources res = context.getResources();
|
||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
|
||||
stackBuilder.addNextIntent(browserIntent);
|
||||
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(
|
||||
0,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
);
|
||||
|
||||
Resources res = context.getResources();
|
||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
|
||||
stackBuilder.addNextIntent(browserIntent);
|
||||
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(
|
||||
0,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
);
|
||||
Notification noti = new NotificationCompat.Builder(context)
|
||||
.setContentTitle(res.getString(R.string.received_url_title, device.getName()))
|
||||
.setContentText(res.getString(R.string.received_url_text, url))
|
||||
.setContentIntent(resultPendingIntent)
|
||||
.setTicker(res.getString(R.string.received_url_title, device.getName()))
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setAutoCancel(true)
|
||||
.setDefaults(Notification.DEFAULT_ALL)
|
||||
.build();
|
||||
|
||||
Notification noti = new NotificationCompat.Builder(context)
|
||||
.setContentTitle(res.getString(R.string.received_url_title, device.getName()))
|
||||
.setContentText(res.getString(R.string.received_url_text, url))
|
||||
.setContentIntent(resultPendingIntent)
|
||||
.setTicker(res.getString(R.string.received_url_title, device.getName()))
|
||||
.setSmallIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setAutoCancel(true)
|
||||
.setDefaults(Notification.DEFAULT_ALL)
|
||||
.build();
|
||||
|
||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
try {
|
||||
notificationManager.notify((int)System.currentTimeMillis(), 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!/
|
||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
try {
|
||||
notificationManager.notify((int) System.currentTimeMillis(), 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!/
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
Log.e("SharePlugin", "Error: Nothing attached!");
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ public class DeviceFragment extends Fragment {
|
||||
boolean reachable = device.isReachable();
|
||||
|
||||
rootView.findViewById(R.id.pairing_buttons).setVisibility(paired ? View.GONE : View.VISIBLE);
|
||||
rootView.findViewById(R.id.unpair_message).setVisibility((paired && !reachable)? View.VISIBLE : View.GONE);
|
||||
rootView.findViewById(R.id.unpair_message).setVisibility((paired && !reachable) ? View.VISIBLE : View.GONE);
|
||||
|
||||
try {
|
||||
ArrayList<ListAdapter.Item> items = new ArrayList<>();
|
||||
@@ -350,14 +350,16 @@ public class DeviceFragment extends Fragment {
|
||||
ListAdapter adapter = new ListAdapter(mActivity, items);
|
||||
buttonsList.setAdapter(adapter);
|
||||
|
||||
mActivity.invalidateOptionsMenu();
|
||||
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
//Ignore: The activity was closed while we were trying to update it
|
||||
} catch (ConcurrentModificationException e) {
|
||||
Log.e("DeviceActivity", "ConcurrentModificationException");
|
||||
this.run(); //Try again
|
||||
}
|
||||
|
||||
mActivity.invalidateOptionsMenu();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
|
||||
//Restore scroll
|
||||
list.setSelectionFromTop(index, top);
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
//Ignore: The activity was closed while we were trying to update it
|
||||
} finally {
|
||||
listRefreshCalledThisFrame = false;
|
||||
|
||||