diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-03-17 12:06:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-17 12:06:41 +0100 |
commit | 17f5a5d1b85f07bada36abe6541ed0fc1e1d83a2 (patch) | |
tree | e0813fb457b766f6edc532ad28a63f200f629763 /core | |
parent | 8dc8cc64a8a6de3adfba1aaf0a0306f90727a2c4 (diff) | |
download | AntennaPod-17f5a5d1b85f07bada36abe6541ed0fc1e1d83a2.zip |
Move notification icons and widget icons to separate modules (#6995)
Diffstat (limited to 'core')
9 files changed, 9 insertions, 127 deletions
diff --git a/core/build.gradle b/core/build.gradle index 4385b7cd6..3a0a5e196 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -40,7 +40,8 @@ dependencies { implementation project(':ui:app-start-intent') implementation project(':ui:common') implementation project(':ui:i18n') - implementation project(':ui:png-icons') + implementation project(':ui:notifications') + implementation project(':ui:widget') annotationProcessor "androidx.annotation:annotation:$annotationVersion" implementation "androidx.appcompat:appcompat:$appcompatVersion" diff --git a/core/src/main/java/de/danoeh/antennapod/core/ClientConfigurator.java b/core/src/main/java/de/danoeh/antennapod/core/ClientConfigurator.java index ff8e7a6c0..86d65bbff 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/ClientConfigurator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/ClientConfigurator.java @@ -12,10 +12,10 @@ import de.danoeh.antennapod.core.sync.SyncService; import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueSink; import de.danoeh.antennapod.core.util.NetworkUtils; import de.danoeh.antennapod.core.util.download.NetworkConnectionChangeHandler; -import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.danoeh.antennapod.net.ssl.SslProviderInstaller; import de.danoeh.antennapod.storage.database.PodDBAdapter; +import de.danoeh.antennapod.ui.notifications.NotificationUtils; import java.io.File; public class ClientConfigurator { diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateWorker.java b/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateWorker.java index 4f9efdb9c..6eba80c94 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateWorker.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateWorker.java @@ -26,12 +26,12 @@ import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.util.NetworkUtils; import de.danoeh.antennapod.core.util.download.FeedUpdateManager; -import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.danoeh.antennapod.model.download.DownloadError; import de.danoeh.antennapod.model.download.DownloadResult; import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest; +import de.danoeh.antennapod.ui.notifications.NotificationUtils; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/EpisodeDownloadWorker.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/EpisodeDownloadWorker.java index e80f9b47f..d35a838dc 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/EpisodeDownloadWorker.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/EpisodeDownloadWorker.java @@ -20,7 +20,6 @@ import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.service.download.handler.MediaDownloadedHandler; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBWriter; -import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.danoeh.antennapod.event.MessageEvent; import de.danoeh.antennapod.model.download.DownloadError; import de.danoeh.antennapod.model.download.DownloadResult; @@ -28,6 +27,7 @@ import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest; import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface; import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter; +import de.danoeh.antennapod.ui.notifications.NotificationUtils; import org.apache.commons.io.FileUtils; import org.greenrobot.eventbus.EventBus; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/NewEpisodesNotification.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/NewEpisodesNotification.java index 01038435d..ab24b5a84 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/NewEpisodesNotification.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/NewEpisodesNotification.java @@ -19,9 +19,9 @@ import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.FeedCounter; import de.danoeh.antennapod.model.feed.FeedPreferences; -import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.danoeh.antennapod.storage.database.PodDBAdapter; +import de.danoeh.antennapod.ui.notifications.NotificationUtils; import java.util.Map; public class NewEpisodesNotification { diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index 067f8abff..8ffc377e8 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -47,6 +47,7 @@ import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import androidx.media.MediaBrowserServiceCompat; +import de.danoeh.antennapod.ui.notifications.NotificationUtils; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -73,7 +74,6 @@ import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.FeedUtil; import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.NetworkUtils; -import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.danoeh.antennapod.core.util.playback.PlayableUtils; import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; import de.danoeh.antennapod.core.widget.WidgetUpdater; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java index 471dc7454..de57f17df 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java @@ -24,8 +24,8 @@ import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.core.util.TimeSpeedConverter; -import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.danoeh.antennapod.model.playback.Playable; +import de.danoeh.antennapod.ui.notifications.NotificationUtils; import java.util.ArrayList; import java.util.concurrent.ExecutionException; diff --git a/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java b/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java index dc6b7ff80..86730b58c 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java @@ -25,6 +25,7 @@ import de.danoeh.antennapod.event.FeedUpdateRunningEvent; import de.danoeh.antennapod.event.MessageEvent; import de.danoeh.antennapod.model.feed.FeedItemFilter; import de.danoeh.antennapod.model.feed.SortOrder; +import de.danoeh.antennapod.ui.notifications.NotificationUtils; import org.apache.commons.lang3.StringUtils; import org.greenrobot.eventbus.EventBus; @@ -45,7 +46,6 @@ import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueStorage; import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.LongList; import de.danoeh.antennapod.net.common.UrlChecker; -import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java deleted file mode 100644 index d870cb1f8..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java +++ /dev/null @@ -1,119 +0,0 @@ -package de.danoeh.antennapod.core.util.gui; - -import android.content.Context; - -import androidx.core.app.NotificationChannelCompat; -import androidx.core.app.NotificationChannelGroupCompat; -import androidx.core.app.NotificationManagerCompat; - -import java.util.Arrays; -import java.util.List; - -import de.danoeh.antennapod.core.R; -import de.danoeh.antennapod.storage.preferences.UserPreferences; - -public class NotificationUtils { - public static final String CHANNEL_ID_USER_ACTION = "user_action"; - public static final String CHANNEL_ID_DOWNLOADING = "downloading"; - public static final String CHANNEL_ID_PLAYING = "playing"; - public static final String CHANNEL_ID_DOWNLOAD_ERROR = "error"; - public static final String CHANNEL_ID_SYNC_ERROR = "sync_error"; - public static final String CHANNEL_ID_EPISODE_NOTIFICATIONS = "episode_notifications"; - - public static final String GROUP_ID_ERRORS = "group_errors"; - public static final String GROUP_ID_NEWS = "group_news"; - - public static void createChannels(final Context context) { - final NotificationManagerCompat mNotificationManager = NotificationManagerCompat.from(context); - - final List<NotificationChannelGroupCompat> channelGroups = Arrays.asList( - createGroupErrors(context), - createGroupNews(context)); - mNotificationManager.createNotificationChannelGroupsCompat(channelGroups); - - final List<NotificationChannelCompat> channels = Arrays.asList( - createChannelUserAction(context), - createChannelDownloading(context), - createChannelPlaying(context), - createChannelError(context), - createChannelSyncError(context), - createChannelEpisodeNotification(context)); - mNotificationManager.createNotificationChannelsCompat(channels); - } - - private static NotificationChannelCompat createChannelUserAction(final Context c) { - return new NotificationChannelCompat.Builder( - CHANNEL_ID_USER_ACTION, NotificationManagerCompat.IMPORTANCE_HIGH) - .setName(c.getString(R.string.notification_channel_user_action)) - .setDescription(c.getString(R.string.notification_channel_user_action_description)) - .setGroup(GROUP_ID_ERRORS) - .build(); - } - - private static NotificationChannelCompat createChannelDownloading(final Context c) { - return new NotificationChannelCompat.Builder( - CHANNEL_ID_DOWNLOADING, NotificationManagerCompat.IMPORTANCE_LOW) - .setName(c.getString(R.string.notification_channel_downloading)) - .setDescription(c.getString(R.string.notification_channel_downloading_description)) - .setShowBadge(false) - .build(); - } - - private static NotificationChannelCompat createChannelPlaying(final Context c) { - return new NotificationChannelCompat.Builder( - CHANNEL_ID_PLAYING, NotificationManagerCompat.IMPORTANCE_LOW) - .setName(c.getString(R.string.notification_channel_playing)) - .setDescription(c.getString(R.string.notification_channel_playing_description)) - .setShowBadge(false) - .build(); - } - - private static NotificationChannelCompat createChannelError(final Context c) { - final NotificationChannelCompat.Builder notificationChannel = new NotificationChannelCompat.Builder( - CHANNEL_ID_DOWNLOAD_ERROR, NotificationManagerCompat.IMPORTANCE_HIGH) - .setName(c.getString(R.string.notification_channel_download_error)) - .setDescription(c.getString(R.string.notification_channel_download_error_description)) - .setGroup(GROUP_ID_ERRORS); - - if (!UserPreferences.getShowDownloadReportRaw()) { - // Migration from app managed setting: disable notification - notificationChannel.setImportance(NotificationManagerCompat.IMPORTANCE_NONE); - } - return notificationChannel.build(); - } - - private static NotificationChannelCompat createChannelSyncError(final Context c) { - final NotificationChannelCompat.Builder notificationChannel = new NotificationChannelCompat.Builder( - CHANNEL_ID_SYNC_ERROR, NotificationManagerCompat.IMPORTANCE_HIGH) - .setName(c.getString(R.string.notification_channel_sync_error)) - .setDescription(c.getString(R.string.notification_channel_sync_error_description)) - .setGroup(GROUP_ID_ERRORS); - - if (!UserPreferences.getGpodnetNotificationsEnabledRaw()) { - // Migration from app managed setting: disable notification - notificationChannel.setImportance(NotificationManagerCompat.IMPORTANCE_NONE); - } - return notificationChannel.build(); - } - - private static NotificationChannelCompat createChannelEpisodeNotification(final Context c) { - return new NotificationChannelCompat.Builder( - CHANNEL_ID_EPISODE_NOTIFICATIONS, NotificationManagerCompat.IMPORTANCE_DEFAULT) - .setName(c.getString(R.string.notification_channel_new_episode)) - .setDescription(c.getString(R.string.notification_channel_new_episode_description)) - .setGroup(GROUP_ID_NEWS) - .build(); - } - - private static NotificationChannelGroupCompat createGroupErrors(final Context c) { - return new NotificationChannelGroupCompat.Builder(GROUP_ID_ERRORS) - .setName(c.getString(R.string.notification_group_errors)) - .build(); - } - - private static NotificationChannelGroupCompat createGroupNews(final Context c) { - return new NotificationChannelGroupCompat.Builder(GROUP_ID_NEWS) - .setName(c.getString(R.string.notification_group_news)) - .build(); - } -} |