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/settings.gradle b/settings.gradle index 5e7e973f4..9c74a57c5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -42,5 +42,6 @@ include ':ui:common' include ':ui:echo' include ':ui:glide' include ':ui:i18n' -include ':ui:png-icons' +include ':ui:notifications' include ':ui:statistics' +include ':ui:widget' diff --git a/ui/notifications/README.md b/ui/notifications/README.md new file mode 100644 index 000000000..553570703 --- /dev/null +++ b/ui/notifications/README.md @@ -0,0 +1,6 @@ +# :ui:notifications + +This module contains generic notification-related resources, for example the notification channel IDs and notification icons. The icons specified in this module are rasterized to png. This is necessary to support old Android versions that do not support VectorDrawables. This is only needed for notification icons - for the icons within the app, appcompat handles drawing the vectors. + +This module is not meant for all notification handling (this should be done in the respective modules), just generic setup code and icons. + diff --git a/ui/notifications/build.gradle b/ui/notifications/build.gradle new file mode 100644 index 000000000..2a54372c2 --- /dev/null +++ b/ui/notifications/build.gradle @@ -0,0 +1,21 @@ +plugins { + id("com.android.library") +} +apply from: "../../common.gradle" + +android { + namespace "de.danoeh.antennapod.ui.notifications" + + defaultConfig { + vectorDrawables.useSupportLibrary false + vectorDrawables.generatedDensities = ["xhdpi"] + } +} + +dependencies { + implementation project(':storage:preferences') + implementation project(':ui:i18n') + + annotationProcessor "androidx.annotation:annotation:$annotationVersion" + implementation "androidx.core:core:$coreVersion" +} diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java b/ui/notifications/src/main/java/de/danoeh/antennapod/ui/notifications/NotificationUtils.java similarity index 98% rename from core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java rename to ui/notifications/src/main/java/de/danoeh/antennapod/ui/notifications/NotificationUtils.java index d870cb1f8..93cf6baf1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java +++ b/ui/notifications/src/main/java/de/danoeh/antennapod/ui/notifications/NotificationUtils.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.util.gui; +package de.danoeh.antennapod.ui.notifications; import android.content.Context; @@ -9,7 +9,6 @@ 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 { diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_fast_forward.xml b/ui/notifications/src/main/res/drawable/ic_notification_fast_forward.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_fast_forward.xml rename to ui/notifications/src/main/res/drawable/ic_notification_fast_forward.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_fast_rewind.xml b/ui/notifications/src/main/res/drawable/ic_notification_fast_rewind.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_fast_rewind.xml rename to ui/notifications/src/main/res/drawable/ic_notification_fast_rewind.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_next_chapter.xml b/ui/notifications/src/main/res/drawable/ic_notification_next_chapter.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_next_chapter.xml rename to ui/notifications/src/main/res/drawable/ic_notification_next_chapter.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_pause.xml b/ui/notifications/src/main/res/drawable/ic_notification_pause.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_pause.xml rename to ui/notifications/src/main/res/drawable/ic_notification_pause.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_play.xml b/ui/notifications/src/main/res/drawable/ic_notification_play.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_play.xml rename to ui/notifications/src/main/res/drawable/ic_notification_play.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_playback_speed.xml b/ui/notifications/src/main/res/drawable/ic_notification_playback_speed.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_playback_speed.xml rename to ui/notifications/src/main/res/drawable/ic_notification_playback_speed.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_skip.xml b/ui/notifications/src/main/res/drawable/ic_notification_skip.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_skip.xml rename to ui/notifications/src/main/res/drawable/ic_notification_skip.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_sleep.xml b/ui/notifications/src/main/res/drawable/ic_notification_sleep.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_sleep.xml rename to ui/notifications/src/main/res/drawable/ic_notification_sleep.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_sleep_off.xml b/ui/notifications/src/main/res/drawable/ic_notification_sleep_off.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_sleep_off.xml rename to ui/notifications/src/main/res/drawable/ic_notification_sleep_off.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_stream.xml b/ui/notifications/src/main/res/drawable/ic_notification_stream.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_stream.xml rename to ui/notifications/src/main/res/drawable/ic_notification_stream.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_sync.xml b/ui/notifications/src/main/res/drawable/ic_notification_sync.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_sync.xml rename to ui/notifications/src/main/res/drawable/ic_notification_sync.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_notification_sync_error.xml b/ui/notifications/src/main/res/drawable/ic_notification_sync_error.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_notification_sync_error.xml rename to ui/notifications/src/main/res/drawable/ic_notification_sync_error.xml diff --git a/ui/png-icons/README.md b/ui/png-icons/README.md deleted file mode 100644 index c05a5348f..000000000 --- a/ui/png-icons/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# :ui:png-icons - -This module provides icon resources. It is necessary to support old Android versions that do not support VectorDrawables. The module generates png versions of all contained icons automatically. This is only needed for notification icons - for the icons within the app, appcompat handles drawing the vectors. diff --git a/ui/widget/README.md b/ui/widget/README.md new file mode 100644 index 000000000..9d07c0eef --- /dev/null +++ b/ui/widget/README.md @@ -0,0 +1,4 @@ +# :ui:widget + +This module manages the widget. The icons specified in this module are rasterized to png. This is necessary to support old Android versions that do not support VectorDrawables. This is only needed for external icons - for the icons within the app, appcompat handles drawing the vectors. + diff --git a/ui/png-icons/build.gradle b/ui/widget/build.gradle similarity index 86% rename from ui/png-icons/build.gradle rename to ui/widget/build.gradle index a9cbffcbb..f474b0028 100644 --- a/ui/png-icons/build.gradle +++ b/ui/widget/build.gradle @@ -4,7 +4,7 @@ plugins { apply from: "../../common.gradle" android { - namespace "de.danoeh.antennapod.ui.pngicons" + namespace "de.danoeh.antennapod.ui.widget" defaultConfig { vectorDrawables.useSupportLibrary false diff --git a/ui/png-icons/src/main/res/drawable/ic_widget_fast_forward.xml b/ui/widget/src/main/res/drawable/ic_widget_fast_forward.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_widget_fast_forward.xml rename to ui/widget/src/main/res/drawable/ic_widget_fast_forward.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_widget_fast_rewind.xml b/ui/widget/src/main/res/drawable/ic_widget_fast_rewind.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_widget_fast_rewind.xml rename to ui/widget/src/main/res/drawable/ic_widget_fast_rewind.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_widget_pause.xml b/ui/widget/src/main/res/drawable/ic_widget_pause.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_widget_pause.xml rename to ui/widget/src/main/res/drawable/ic_widget_pause.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_widget_play.xml b/ui/widget/src/main/res/drawable/ic_widget_play.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_widget_play.xml rename to ui/widget/src/main/res/drawable/ic_widget_play.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_widget_playback_speed.xml b/ui/widget/src/main/res/drawable/ic_widget_playback_speed.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_widget_playback_speed.xml rename to ui/widget/src/main/res/drawable/ic_widget_playback_speed.xml diff --git a/ui/png-icons/src/main/res/drawable/ic_widget_skip.xml b/ui/widget/src/main/res/drawable/ic_widget_skip.xml similarity index 100% rename from ui/png-icons/src/main/res/drawable/ic_widget_skip.xml rename to ui/widget/src/main/res/drawable/ic_widget_skip.xml