2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-09-01 06:35:09 +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="pref_plugin_mprisreceiver_desc">Control your phones media players from another device</string>
<string name="dark_theme">Dark theme</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> </resources>

View File

@@ -272,7 +272,7 @@ public class BackgroundService extends Service {
Log.i("KDE/BackgroundService", "Service not started yet, initializing..."); Log.i("KDE/BackgroundService", "Service not started yet, initializing...");
initializeSecurityParameters(); initializeSecurityParameters();
NotificationHelper.initializeChannels((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)); NotificationHelper.initializeChannels(this);
loadRememberedDevicesFromSettings(); loadRememberedDevicesFromSettings();
registerLinkProviders(); registerLinkProviders();

View File

@@ -3,6 +3,9 @@ package org.kde.kdeconnect.Helpers;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationChannel; import android.app.NotificationChannel;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.content.Context;
import org.kde.kdeconnect_tp.R;
public class NotificationHelper { 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) { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O) {
return; return;
} }
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
{ manager.createNotificationChannel(new NotificationChannel(
NotificationChannel channel = new NotificationChannel(Channels.DEFAULT, "Other notifications", NotificationManager.IMPORTANCE_DEFAULT); Channels.DEFAULT,
channel.setDescription("Rest of KDE Connect notifications"); context.getString(R.string.notification_channel_default),
manager.createNotificationChannel(channel); NotificationManager.IMPORTANCE_DEFAULT)
} );
{ manager.createNotificationChannel(new NotificationChannel(
NotificationChannel channel = new NotificationChannel(Channels.PERSISTENT, "Persistent indicator", NotificationManager.IMPORTANCE_MIN); Channels.PERSISTENT,
channel.setDescription("Always present running indicator"); context.getString(R.string.notification_channel_persistent),
manager.createNotificationChannel(channel); NotificationManager.IMPORTANCE_DEFAULT)
} );
} }