2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 21:55:10 +00:00

Now translatable

This commit is contained in:
Albert Vaca
2018-05-15 00:37:24 +02:00
parent a7a5beb7e8
commit f234b79486
3 changed files with 18 additions and 12 deletions

View File

@@ -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>

View File

@@ -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();

View File

@@ -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)
);
}