diff options
37 files changed, 115 insertions, 66 deletions
diff --git a/app/build.gradle b/app/build.gradle index a2dc2d13b..6cbc9e64f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -91,8 +91,10 @@ dependencies { implementation project(':ui:app-start-intent') implementation project(':ui:common') implementation project(':ui:echo') + implementation project(':ui:episodes') implementation project(':ui:glide') implementation project(':ui:i18n') + implementation project(':ui:widget') implementation project(':ui:preferences') implementation project(':ui:statistics') diff --git a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java index 0c4e59931..09d96dd02 100644 --- a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java @@ -7,8 +7,8 @@ import androidx.test.filters.LargeTest; import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent; import de.danoeh.antennapod.storage.preferences.SleepTimerPreferences; -import de.danoeh.antennapod.core.widget.WidgetUpdater; import de.danoeh.antennapod.storage.database.PodDBAdapter; +import de.danoeh.antennapod.ui.widget.WidgetUpdater; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.junit.After; diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0f847f119..d7038444f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -142,28 +142,6 @@ </activity> <activity - android:name=".activity.WidgetConfigActivity" - android:label="@string/widget_settings" - android:exported="true"> - <intent-filter> - <action android:name="android.appwidget.action.APPWIDGET_CONFIGUR"/> - </intent-filter> - </activity> - - <receiver - android:name=".core.receiver.PlayerWidget" - android:exported="true"> - <intent-filter> - <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/> - <action android:name="de.danoeh.antennapod.FORCE_WIDGET_UPDATE"/> - <action android:name="de.danoeh.antennapod.STOP_WIDGET_UPDATE"/> - </intent-filter> - <meta-data - android:name="android.appwidget.provider" - android:resource="@xml/player_widget_info"/> - </receiver> - - <activity android:name=".activity.OpmlImportActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:label="@string/opml_import_label" diff --git a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java index 516ea29b8..6e0a84bf6 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -51,7 +51,6 @@ import de.danoeh.antennapod.ui.common.Converter; import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.ShareUtils; -import de.danoeh.antennapod.core.util.TimeSpeedConverter; import de.danoeh.antennapod.core.util.gui.PictureInPictureUtil; import de.danoeh.antennapod.core.util.playback.PlaybackController; import de.danoeh.antennapod.databinding.VideoplayerActivityBinding; @@ -65,6 +64,7 @@ import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.playback.base.PlayerStatus; import de.danoeh.antennapod.playback.cast.CastEnabledActivity; import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter; +import de.danoeh.antennapod.ui.episodes.TimeSpeedConverter; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.Disposable; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java index 0289e3fc2..f20399b3f 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java @@ -26,6 +26,8 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.android.material.elevation.SurfaceColors; import de.danoeh.antennapod.ui.appstartintent.MediaButtonStarter; +import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils; +import de.danoeh.antennapod.ui.episodes.TimeSpeedConverter; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -36,10 +38,8 @@ import java.util.List; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.core.util.ChapterUtils; import de.danoeh.antennapod.ui.common.Converter; -import de.danoeh.antennapod.core.util.TimeSpeedConverter; import de.danoeh.antennapod.core.util.playback.PlaybackController; import de.danoeh.antennapod.dialog.MediaPlayerErrorDialog; import de.danoeh.antennapod.dialog.SkipPreferenceDialog; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java index 4314cdd7b..da1e07e46 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -32,7 +32,6 @@ import com.bumptech.glide.request.RequestOptions; import com.google.android.material.snackbar.Snackbar; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.core.util.ChapterUtils; import de.danoeh.antennapod.ui.common.DateFormatter; import de.danoeh.antennapod.core.util.playback.PlaybackController; @@ -42,6 +41,7 @@ import de.danoeh.antennapod.model.feed.Chapter; import de.danoeh.antennapod.model.feed.EmbeddedChapterImage; import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.playback.Playable; +import de.danoeh.antennapod.ui.episodes.ImageResourceUtils; import io.reactivex.Maybe; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.Disposable; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java index b52ebcaae..3ad05eca5 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java @@ -20,11 +20,11 @@ import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.event.playback.PlaybackPositionEvent; import de.danoeh.antennapod.event.playback.PlaybackServiceEvent; import de.danoeh.antennapod.model.playback.MediaType; -import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.core.util.playback.PlaybackController; import de.danoeh.antennapod.playback.base.PlayerStatus; +import de.danoeh.antennapod.ui.episodes.ImageResourceUtils; import de.danoeh.antennapod.view.PlayButton; import io.reactivex.Maybe; import io.reactivex.android.schedulers.AndroidSchedulers; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java index 54c148aa3..28b845a21 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java @@ -44,7 +44,6 @@ import de.danoeh.antennapod.event.PlayerStatusEvent; import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.storage.preferences.UsageStatistics; import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface; import de.danoeh.antennapod.storage.preferences.UserPreferences; @@ -55,6 +54,7 @@ import de.danoeh.antennapod.ui.common.CircularProgressBar; import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.core.util.playback.PlaybackController; import de.danoeh.antennapod.core.util.gui.ShownotesCleaner; +import de.danoeh.antennapod.ui.episodes.ImageResourceUtils; import de.danoeh.antennapod.view.ShownotesWebView; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index 9c6ce8090..65e16dc5b 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -28,6 +28,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; import com.leinardi.android.speeddial.SpeedDialView; +import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -39,7 +40,6 @@ import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.adapter.EpisodeItemListAdapter; import de.danoeh.antennapod.adapter.QueueRecyclerAdapter; import de.danoeh.antennapod.core.dialog.ConfirmationDialog; -import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.core.menuhandler.MenuItemUtils; import de.danoeh.antennapod.storage.database.DBReader; import de.danoeh.antennapod.core.storage.DBWriter; diff --git a/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java b/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java index a57900da8..662830772 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java +++ b/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java @@ -27,7 +27,6 @@ import de.danoeh.antennapod.ui.common.DateFormatter; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.playback.MediaType; -import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface; import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.ui.common.Converter; @@ -35,6 +34,7 @@ import de.danoeh.antennapod.net.common.NetworkUtils; import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.ui.common.CircularProgressBar; import de.danoeh.antennapod.ui.common.ThemeUtils; +import de.danoeh.antennapod.ui.episodes.ImageResourceUtils; /** * Holds the view which shows FeedItems. diff --git a/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java b/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java index 64867466a..a15cf7cb3 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java +++ b/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java @@ -13,7 +13,6 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.adapter.CoverLoader; import de.danoeh.antennapod.adapter.actionbutton.ItemActionButton; -import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.ui.common.DateFormatter; import de.danoeh.antennapod.core.util.PlaybackStatus; import de.danoeh.antennapod.event.playback.PlaybackPositionEvent; @@ -23,6 +22,7 @@ import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterfa import de.danoeh.antennapod.ui.common.CircularProgressBar; import de.danoeh.antennapod.ui.common.SquareImageView; import de.danoeh.antennapod.ui.common.ThemeUtils; +import de.danoeh.antennapod.ui.episodes.ImageResourceUtils; public class HorizontalItemViewHolder extends RecyclerView.ViewHolder { public final CardView card; diff --git a/core/build.gradle b/core/build.gradle index ed4236e5b..fbf6654e5 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -39,6 +39,7 @@ dependencies { implementation project(':storage:preferences') implementation project(':ui:app-start-intent') implementation project(':ui:common') + implementation project(':ui:episodes') implementation project(':ui:i18n') implementation project(':ui:notifications') implementation project(':ui:widget') diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java index 66d7fde90..9ec1b5265 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java @@ -13,7 +13,6 @@ import androidx.annotation.NonNull; import androidx.media.AudioAttributesCompat; import androidx.media.AudioFocusRequestCompat; import androidx.media.AudioManagerCompat; -import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.event.PlayerErrorEvent; import de.danoeh.antennapod.event.playback.BufferUpdateEvent; import de.danoeh.antennapod.event.playback.SpeedChangedEvent; @@ -26,6 +25,7 @@ import de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer; import de.danoeh.antennapod.playback.base.PlayerStatus; import de.danoeh.antennapod.playback.base.RewindAfterPauseUtils; import de.danoeh.antennapod.storage.preferences.UserPreferences; +import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils; import org.greenrobot.eventbus.EventBus; import java.io.File; 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 4e95a904d..f40d51933 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 @@ -52,6 +52,7 @@ import androidx.media.MediaBrowserServiceCompat; import de.danoeh.antennapod.event.PlayerStatusEvent; import de.danoeh.antennapod.ui.notifications.NotificationUtils; +import de.danoeh.antennapod.ui.widget.WidgetUpdater; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -80,7 +81,6 @@ import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.net.common.NetworkUtils; import de.danoeh.antennapod.core.util.playback.PlayableUtils; import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; -import de.danoeh.antennapod.core.widget.WidgetUpdater; import de.danoeh.antennapod.event.MessageEvent; import de.danoeh.antennapod.event.PlayerErrorEvent; import de.danoeh.antennapod.event.playback.BufferUpdateEvent; 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 981757025..140f35c90 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 @@ -22,9 +22,9 @@ import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.ui.common.Converter; -import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; -import de.danoeh.antennapod.core.util.TimeSpeedConverter; import de.danoeh.antennapod.model.playback.Playable; +import de.danoeh.antennapod.ui.episodes.ImageResourceUtils; +import de.danoeh.antennapod.ui.episodes.TimeSpeedConverter; 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/service/playback/PlaybackServiceTaskManager.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java index c86d4a784..bee4619ef 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java @@ -10,7 +10,7 @@ import android.util.Log; import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent; import de.danoeh.antennapod.storage.preferences.SleepTimerPreferences; import de.danoeh.antennapod.core.util.ChapterUtils; -import de.danoeh.antennapod.core.widget.WidgetUpdater; +import de.danoeh.antennapod.ui.widget.WidgetUpdater; import io.reactivex.disposables.Disposable; import org.greenrobot.eventbus.EventBus; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java index 9ac35fdb7..b56a0481e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java @@ -21,12 +21,12 @@ import de.danoeh.antennapod.event.playback.PlaybackServiceEvent; import de.danoeh.antennapod.event.playback.SpeedChangedEvent; import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.model.playback.MediaType; -import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.storage.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer; import de.danoeh.antennapod.playback.base.PlayerStatus; +import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; diff --git a/settings.gradle b/settings.gradle index 3844ebf62..438cf5e3e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -40,6 +40,7 @@ include ':storage:preferences' include ':ui:app-start-intent' include ':ui:common' include ':ui:echo' +include ':ui:episodes' include ':ui:glide' include ':ui:i18n' include ':ui:notifications' diff --git a/ui/common/src/main/res/values/dimens.xml b/ui/common/src/main/res/values/dimens.xml index 68d0e59ab..5cfcd68b6 100644 --- a/ui/common/src/main/res/values/dimens.xml +++ b/ui/common/src/main/res/values/dimens.xml @@ -1,7 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <dimen name="widget_margin">0dp</dimen> - <dimen name="widget_inner_radius">4dp</dimen> <dimen name="external_player_height">64dp</dimen> <dimen name="text_size_micro">12sp</dimen> <dimen name="text_size_small">14sp</dimen> diff --git a/ui/echo/build.gradle b/ui/echo/build.gradle index 0175891a8..820ccb208 100644 --- a/ui/echo/build.gradle +++ b/ui/echo/build.gradle @@ -18,6 +18,7 @@ dependencies { implementation project(':storage:database') implementation project(":storage:preferences") implementation project(':ui:common') + implementation project(':ui:episodes') implementation project(':ui:glide') annotationProcessor "androidx.annotation:annotation:$annotationVersion" diff --git a/ui/echo/src/main/java/de/danoeh/antennapod/ui/echo/EchoActivity.java b/ui/echo/src/main/java/de/danoeh/antennapod/ui/echo/EchoActivity.java index da5121a98..bfe5fbf98 100644 --- a/ui/echo/src/main/java/de/danoeh/antennapod/ui/echo/EchoActivity.java +++ b/ui/echo/src/main/java/de/danoeh/antennapod/ui/echo/EchoActivity.java @@ -23,7 +23,6 @@ import androidx.core.view.WindowCompat; import com.bumptech.glide.Glide; import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.request.RequestOptions; -import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.storage.database.DBReader; import de.danoeh.antennapod.storage.database.StatisticsItem; @@ -36,6 +35,7 @@ import de.danoeh.antennapod.ui.echo.screens.RotatingSquaresScreen; import de.danoeh.antennapod.ui.echo.screens.StripesScreen; import de.danoeh.antennapod.ui.echo.screens.WaveformScreen; import de.danoeh.antennapod.ui.echo.screens.WavesScreen; +import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils; import io.reactivex.Flowable; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; diff --git a/ui/episodes/README.md b/ui/episodes/README.md new file mode 100644 index 000000000..2ecd6faef --- /dev/null +++ b/ui/episodes/README.md @@ -0,0 +1,3 @@ +# :ui:episodes + +Common classes that are needed everywhere we display information about episodes. diff --git a/ui/episodes/build.gradle b/ui/episodes/build.gradle new file mode 100644 index 000000000..9dfcd4903 --- /dev/null +++ b/ui/episodes/build.gradle @@ -0,0 +1,19 @@ +plugins { + id("com.android.library") +} +apply from: "../../common.gradle" + +android { + namespace "de.danoeh.antennapod.ui.episodes" +} + +dependencies { + implementation project(":model") + implementation project(":storage:preferences") + implementation project(":ui:common") + + annotationProcessor "androidx.annotation:annotation:$annotationVersion" + implementation "androidx.appcompat:appcompat:$appcompatVersion" + implementation "androidx.core:core:$coreVersion" + implementation "com.google.android.material:material:$googleMaterialVersion" +} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/util/ImageResourceUtils.java b/ui/episodes/src/main/java/de/danoeh/antennapod/ui/episodes/ImageResourceUtils.java index 4e9424b67..396df7b90 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/util/ImageResourceUtils.java +++ b/ui/episodes/src/main/java/de/danoeh/antennapod/ui/episodes/ImageResourceUtils.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.feed.util; +package de.danoeh.antennapod.ui.episodes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/util/PlaybackSpeedUtils.java b/ui/episodes/src/main/java/de/danoeh/antennapod/ui/episodes/PlaybackSpeedUtils.java index 6e026c91d..e3c5ab672 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/util/PlaybackSpeedUtils.java +++ b/ui/episodes/src/main/java/de/danoeh/antennapod/ui/episodes/PlaybackSpeedUtils.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.feed.util; +package de.danoeh.antennapod.ui.episodes; import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.FeedMedia; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/TimeSpeedConverter.java b/ui/episodes/src/main/java/de/danoeh/antennapod/ui/episodes/TimeSpeedConverter.java index 8fced8c13..450eca967 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/TimeSpeedConverter.java +++ b/ui/episodes/src/main/java/de/danoeh/antennapod/ui/episodes/TimeSpeedConverter.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.util; +package de.danoeh.antennapod.ui.episodes; import de.danoeh.antennapod.storage.preferences.UserPreferences; diff --git a/ui/widget/build.gradle b/ui/widget/build.gradle index 2488054a6..03183a323 100644 --- a/ui/widget/build.gradle +++ b/ui/widget/build.gradle @@ -2,6 +2,7 @@ plugins { id("com.android.library") } apply from: "../../common.gradle" +apply from: "../../playFlavor.gradle" android { namespace "de.danoeh.antennapod.ui.widget" @@ -10,10 +11,25 @@ android { vectorDrawables.useSupportLibrary false vectorDrawables.generatedDensities = ["xhdpi"] } + + lint { + disable "IconMissingDensityFolder" + } } dependencies { + implementation project(":model") + implementation project(":playback:base") + implementation project(':storage:preferences') + implementation project(':storage:database') + implementation project(":ui:app-start-intent") implementation project(":ui:common") + implementation project(":ui:episodes") + implementation project(':ui:glide') + implementation project(':ui:i18n') annotationProcessor "androidx.annotation:annotation:$annotationVersion" + implementation "androidx.appcompat:appcompat:$appcompatVersion" + implementation "androidx.work:work-runtime:$workManagerVersion" + implementation "com.github.bumptech.glide:glide:$glideVersion" } diff --git a/ui/widget/src/main/AndroidManifest.xml b/ui/widget/src/main/AndroidManifest.xml new file mode 100644 index 000000000..c0f03b6cc --- /dev/null +++ b/ui/widget/src/main/AndroidManifest.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> + + <application> + <activity + android:name=".WidgetConfigActivity" + android:label="@string/widget_settings" + android:exported="true"> + <intent-filter> + <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/> + </intent-filter> + </activity> + + <receiver + android:name=".PlayerWidget" + android:exported="true"> + <intent-filter> + <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/> + <action android:name="de.danoeh.antennapod.FORCE_WIDGET_UPDATE"/> + <action android:name="de.danoeh.antennapod.STOP_WIDGET_UPDATE"/> + </intent-filter> + <meta-data + android:name="android.appwidget.provider" + android:resource="@xml/player_widget_info"/> + </receiver> + </application> +</manifest> diff --git a/core/src/main/java/de/danoeh/antennapod/core/receiver/PlayerWidget.java b/ui/widget/src/main/java/de/danoeh/antennapod/ui/widget/PlayerWidget.java index c56ef831a..c548c075a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/receiver/PlayerWidget.java +++ b/ui/widget/src/main/java/de/danoeh/antennapod/ui/widget/PlayerWidget.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.receiver; +package de.danoeh.antennapod.ui.widget; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; @@ -9,7 +9,6 @@ import android.util.Log; import androidx.work.ExistingWorkPolicy; import androidx.work.OneTimeWorkRequest; import androidx.work.WorkManager; -import de.danoeh.antennapod.core.widget.WidgetUpdaterWorker; import java.util.Arrays; import java.util.concurrent.TimeUnit; diff --git a/app/src/main/java/de/danoeh/antennapod/activity/WidgetConfigActivity.java b/ui/widget/src/main/java/de/danoeh/antennapod/ui/widget/WidgetConfigActivity.java index bfdf6fb63..83fd308ba 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/WidgetConfigActivity.java +++ b/ui/widget/src/main/java/de/danoeh/antennapod/ui/widget/WidgetConfigActivity.java @@ -1,6 +1,8 @@ -package de.danoeh.antennapod.activity; +package de.danoeh.antennapod.ui.widget; +import android.app.Activity; import android.appwidget.AppWidgetManager; +import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; @@ -11,11 +13,10 @@ import android.widget.CheckBox; import android.widget.SeekBar; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.core.receiver.PlayerWidget; -import de.danoeh.antennapod.core.widget.WidgetUpdaterWorker; import de.danoeh.antennapod.ui.common.ThemeSwitcher; +import java.util.Locale; + public class WidgetConfigActivity extends AppCompatActivity { private int appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID; @@ -42,7 +43,7 @@ public class WidgetConfigActivity extends AppCompatActivity { Intent resultValue = new Intent(); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); - setResult(RESULT_CANCELED, resultValue); + setResult(Activity.RESULT_CANCELED, resultValue); if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { finish(); } @@ -55,7 +56,7 @@ public class WidgetConfigActivity extends AppCompatActivity { @Override public void onProgressChanged(SeekBar seekBar, int i, boolean b) { - opacityTextView.setText(seekBar.getProgress() + "%"); + opacityTextView.setText(String.format(Locale.getDefault(), "%d%%", seekBar.getProgress())); int color = getColorWithAlpha(PlayerWidget.DEFAULT_COLOR, opacitySeekBar.getProgress()); widgetPreview.setBackgroundColor(color); } @@ -91,7 +92,7 @@ public class WidgetConfigActivity extends AppCompatActivity { } private void setInitialState() { - SharedPreferences prefs = getSharedPreferences(PlayerWidget.PREFS_NAME, MODE_PRIVATE); + SharedPreferences prefs = getSharedPreferences(PlayerWidget.PREFS_NAME, Context.MODE_PRIVATE); ckPlaybackSpeed.setChecked(prefs.getBoolean(PlayerWidget.KEY_WIDGET_PLAYBACK_SPEED + appWidgetId, false)); ckRewind.setChecked(prefs.getBoolean(PlayerWidget.KEY_WIDGET_REWIND + appWidgetId, false)); ckFastForward.setChecked(prefs.getBoolean(PlayerWidget.KEY_WIDGET_FAST_FORWARD + appWidgetId, false)); @@ -122,7 +123,7 @@ public class WidgetConfigActivity extends AppCompatActivity { private void confirmCreateWidget() { int backgroundColor = getColorWithAlpha(PlayerWidget.DEFAULT_COLOR, opacitySeekBar.getProgress()); - SharedPreferences prefs = getSharedPreferences(PlayerWidget.PREFS_NAME, MODE_PRIVATE); + SharedPreferences prefs = getSharedPreferences(PlayerWidget.PREFS_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putInt(PlayerWidget.KEY_WIDGET_COLOR + appWidgetId, backgroundColor); editor.putBoolean(PlayerWidget.KEY_WIDGET_PLAYBACK_SPEED + appWidgetId, ckPlaybackSpeed.isChecked()); @@ -133,7 +134,7 @@ public class WidgetConfigActivity extends AppCompatActivity { Intent resultValue = new Intent(); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); - setResult(RESULT_OK, resultValue); + setResult(Activity.RESULT_OK, resultValue); finish(); WidgetUpdaterWorker.enqueueWork(this); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java b/ui/widget/src/main/java/de/danoeh/antennapod/ui/widget/WidgetUpdater.java index 23995d7fe..bb62d4a7b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java +++ b/ui/widget/src/main/java/de/danoeh/antennapod/ui/widget/WidgetUpdater.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.widget; +package de.danoeh.antennapod.ui.widget; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; @@ -19,19 +19,17 @@ import com.bumptech.glide.request.RequestOptions; import de.danoeh.antennapod.ui.appstartintent.MediaButtonStarter; import de.danoeh.antennapod.ui.common.Converter; +import de.danoeh.antennapod.storage.preferences.UserPreferences; import java.util.concurrent.TimeUnit; -import de.danoeh.antennapod.core.R; -import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.model.playback.MediaType; -import de.danoeh.antennapod.core.receiver.PlayerWidget; -import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; -import de.danoeh.antennapod.core.util.TimeSpeedConverter; import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.playback.base.PlayerStatus; import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter; import de.danoeh.antennapod.ui.appstartintent.PlaybackSpeedActivityStarter; import de.danoeh.antennapod.ui.appstartintent.VideoPlayerActivityStarter; +import de.danoeh.antennapod.ui.episodes.ImageResourceUtils; +import de.danoeh.antennapod.ui.episodes.TimeSpeedConverter; /** * Updates the state of the player widget. diff --git a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdaterWorker.java b/ui/widget/src/main/java/de/danoeh/antennapod/ui/widget/WidgetUpdaterWorker.java index 508d61e02..97b0790ac 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdaterWorker.java +++ b/ui/widget/src/main/java/de/danoeh/antennapod/ui/widget/WidgetUpdaterWorker.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.widget; +package de.danoeh.antennapod.ui.widget; import android.content.Context; import android.util.Log; @@ -8,11 +8,11 @@ import androidx.work.OneTimeWorkRequest; import androidx.work.WorkManager; import androidx.work.Worker; import androidx.work.WorkerParameters; -import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; -import de.danoeh.antennapod.storage.preferences.PlaybackPreferences; import de.danoeh.antennapod.storage.database.DBReader; +import de.danoeh.antennapod.storage.preferences.PlaybackPreferences; import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.playback.base.PlayerStatus; +import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils; public class WidgetUpdaterWorker extends Worker { diff --git a/core/src/main/res/drawable-hdpi/ic_widget_preview.png b/ui/widget/src/main/res/drawable-hdpi/ic_widget_preview.png Binary files differindex 3c1e08a31..3c1e08a31 100644 --- a/core/src/main/res/drawable-hdpi/ic_widget_preview.png +++ b/ui/widget/src/main/res/drawable-hdpi/ic_widget_preview.png diff --git a/app/src/main/res/layout/activity_widget_config.xml b/ui/widget/src/main/res/layout/activity_widget_config.xml index 325b5cec5..04be2dfa2 100644 --- a/app/src/main/res/layout/activity_widget_config.xml +++ b/ui/widget/src/main/res/layout/activity_widget_config.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - tools:context="de.danoeh.antennapod.activity.WidgetConfigActivity"> + tools:context="de.danoeh.antennapod.ui.widget.WidgetConfigActivity"> <FrameLayout android:layout_width="match_parent" diff --git a/core/src/main/res/layout/player_widget.xml b/ui/widget/src/main/res/layout/player_widget.xml index 616e61e91..616e61e91 100644 --- a/core/src/main/res/layout/player_widget.xml +++ b/ui/widget/src/main/res/layout/player_widget.xml diff --git a/ui/widget/src/main/res/values/dimens.xml b/ui/widget/src/main/res/values/dimens.xml new file mode 100644 index 000000000..d0c504ac5 --- /dev/null +++ b/ui/widget/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <dimen name="widget_margin">0dp</dimen> + <dimen name="widget_inner_radius">4dp</dimen> +</resources> diff --git a/app/src/main/res/xml/player_widget_info.xml b/ui/widget/src/main/res/xml/player_widget_info.xml index 25f4e274a..0bbec5dda 100644 --- a/app/src/main/res/xml/player_widget_info.xml +++ b/ui/widget/src/main/res/xml/player_widget_info.xml @@ -8,5 +8,5 @@ android:minWidth="250dp" android:minResizeWidth="40dp" android:widgetFeatures="reconfigurable" - android:configure="de.danoeh.antennapod.activity.WidgetConfigActivity"> + android:configure="de.danoeh.antennapod.ui.widget.WidgetConfigActivity"> </appwidget-provider> |