Commit 2108fa1b authored by Geoffrey Métais's avatar Geoffrey Métais

Notifications channel for recommendations

parent d4999185
......@@ -565,4 +565,6 @@
<string name="unsaved_set_deleted_message">Unsaved equalizer-set deleted.</string>
<string name="equalizer_new_preset_name">New</string>
<string name="settings_ml_block_scan">Medialibray is scanning your devices right now</string>
<string name="recommendations">Recommendations</string>
<string name="recommendations_desc">Recommendations cards on launcher</string>
</resources>
......@@ -26,6 +26,7 @@ import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.media.session.MediaSession;
import android.os.Build;
......@@ -172,19 +173,29 @@ public class NotificationHelper {
@RequiresApi(api = Build.VERSION_CODES.O)
public static void createNotificationChannels() {
final NotificationManager notificationManager = (NotificationManager) VLCApplication.getAppContext().getSystemService(Context.NOTIFICATION_SERVICE);
final Resources res = VLCApplication.getAppResources();
// Playback channel
CharSequence name = VLCApplication.getAppResources().getString(R.string.playback);
String description = VLCApplication.getAppResources().getString(R.string.playback_controls);
CharSequence name = res.getString(R.string.playback);
String description = res.getString(R.string.playback_controls);
NotificationChannel channel = new NotificationChannel("vlc_playback", name, NotificationManager.IMPORTANCE_LOW);
channel.setDescription(description);
channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
notificationManager.createNotificationChannel(channel);
// Scan channel
name = VLCApplication.getAppResources().getString(R.string.medialibrary_scan);
description = VLCApplication.getAppResources().getString(R.string.Medialibrary_progress);
name = res.getString(R.string.medialibrary_scan);
description = res.getString(R.string.Medialibrary_progress);
channel = new NotificationChannel("vlc_medialibrary", name, NotificationManager.IMPORTANCE_LOW);
channel.setDescription(description);
channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
notificationManager.createNotificationChannel(channel);
// Recommendations channel
if (AndroidDevices.isAndroidTv) {
name = res.getString(R.string.recommendations);
description = res.getString(R.string.recommendations_desc);
channel = new NotificationChannel("vlc_recommendations", name, NotificationManager.IMPORTANCE_LOW);
channel.setDescription(description);
channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
notificationManager.createNotificationChannel(channel);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment