mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-31 22:25:08 +00:00
Give filetransfer an own NotificationChannel
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/icon"
|
||||
android:label="KDE Connect"
|
||||
android:supportsRtl="true"
|
||||
|
@@ -247,5 +247,6 @@
|
||||
<string name="notification_channel_default">Other notifications</string>
|
||||
<string name="notification_channel_persistent">Persistent indicator</string>
|
||||
<string name="notification_channel_media_control">Media control</string>
|
||||
<string name="notification_channel_filetransfer">File transfer</string>
|
||||
|
||||
</resources>
|
||||
|
@@ -4,6 +4,9 @@ import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
@@ -13,6 +16,7 @@ public class NotificationHelper {
|
||||
public final static String PERSISTENT = "persistent";
|
||||
public final static String DEFAULT = "default";
|
||||
public final static String MEDIA_CONTROL = "media_control";
|
||||
public final static String FILETRANSFER = "filetransfer";
|
||||
}
|
||||
|
||||
public static void notifyCompat(NotificationManager notificationManager, int notificationId, Notification notification) {
|
||||
@@ -60,6 +64,15 @@ public class NotificationHelper {
|
||||
NotificationManager.IMPORTANCE_LOW)
|
||||
);
|
||||
|
||||
NotificationChannel fileTransfer = new NotificationChannel(
|
||||
Channels.FILETRANSFER,
|
||||
context.getString(R.string.notification_channel_filetransfer),
|
||||
NotificationManager.IMPORTANCE_LOW);
|
||||
|
||||
fileTransfer.enableVibration(false);
|
||||
|
||||
manager.createNotificationChannel(fileTransfer);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -55,7 +55,7 @@ public class ShareNotification {
|
||||
this.filename = filename;
|
||||
notificationId = (int) System.currentTimeMillis();
|
||||
notificationManager = (NotificationManager) device.getContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
builder = new NotificationCompat.Builder(device.getContext(), NotificationHelper.Channels.DEFAULT)
|
||||
builder = new NotificationCompat.Builder(device.getContext(), NotificationHelper.Channels.FILETRANSFER)
|
||||
.setContentTitle(device.getContext().getResources().getString(R.string.incoming_file_title, device.getName()))
|
||||
.setContentText(device.getContext().getResources().getString(R.string.incoming_file_text, filename))
|
||||
.setTicker(device.getContext().getResources().getString(R.string.incoming_file_title, device.getName()))
|
||||
|
Reference in New Issue
Block a user