mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-30 21:55:10 +00:00
Now translatable
This commit is contained in:
@@ -244,5 +244,7 @@
|
||||
<string name="pref_plugin_mprisreceiver_desc">Control your phones media players from another device</string>
|
||||
|
||||
<string name="dark_theme">Dark theme</string>
|
||||
<string name="notification_channel_default">Other notifications</string>
|
||||
<string name="notification_channel_persistent">Persistent indicator</string>
|
||||
|
||||
</resources>
|
||||
|
@@ -272,7 +272,7 @@ public class BackgroundService extends Service {
|
||||
Log.i("KDE/BackgroundService", "Service not started yet, initializing...");
|
||||
|
||||
initializeSecurityParameters();
|
||||
NotificationHelper.initializeChannels((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE));
|
||||
NotificationHelper.initializeChannels(this);
|
||||
loadRememberedDevicesFromSettings();
|
||||
registerLinkProviders();
|
||||
|
||||
|
@@ -3,6 +3,9 @@ package org.kde.kdeconnect.Helpers;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
public class NotificationHelper {
|
||||
|
||||
@@ -29,24 +32,25 @@ public class NotificationHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static void initializeChannels(NotificationManager manager) {
|
||||
public static void initializeChannels(Context context) {
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
{
|
||||
NotificationChannel channel = new NotificationChannel(Channels.DEFAULT, "Other notifications", NotificationManager.IMPORTANCE_DEFAULT);
|
||||
channel.setDescription("Rest of KDE Connect notifications");
|
||||
manager.createNotificationChannel(channel);
|
||||
}
|
||||
manager.createNotificationChannel(new NotificationChannel(
|
||||
Channels.DEFAULT,
|
||||
context.getString(R.string.notification_channel_default),
|
||||
NotificationManager.IMPORTANCE_DEFAULT)
|
||||
);
|
||||
|
||||
{
|
||||
NotificationChannel channel = new NotificationChannel(Channels.PERSISTENT, "Persistent indicator", NotificationManager.IMPORTANCE_MIN);
|
||||
channel.setDescription("Always present running indicator");
|
||||
manager.createNotificationChannel(channel);
|
||||
}
|
||||
manager.createNotificationChannel(new NotificationChannel(
|
||||
Channels.PERSISTENT,
|
||||
context.getString(R.string.notification_channel_persistent),
|
||||
NotificationManager.IMPORTANCE_DEFAULT)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user