Move widget setup code to widget module (#6996)

This commit is contained in:
ByteHamster 2024-03-25 23:45:09 +01:00 committed by GitHub
parent 160089d3ff
commit 130da46f5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 115 additions and 66 deletions

View File

@ -91,8 +91,10 @@ dependencies {
implementation project(':ui:app-start-intent') implementation project(':ui:app-start-intent')
implementation project(':ui:common') implementation project(':ui:common')
implementation project(':ui:echo') implementation project(':ui:echo')
implementation project(':ui:episodes')
implementation project(':ui:glide') implementation project(':ui:glide')
implementation project(':ui:i18n') implementation project(':ui:i18n')
implementation project(':ui:widget')
implementation project(':ui:preferences') implementation project(':ui:preferences')
implementation project(':ui:statistics') implementation project(':ui:statistics')

View File

@ -7,8 +7,8 @@ import androidx.test.filters.LargeTest;
import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent; import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent;
import de.danoeh.antennapod.storage.preferences.SleepTimerPreferences; 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.storage.database.PodDBAdapter;
import de.danoeh.antennapod.ui.widget.WidgetUpdater;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.junit.After; import org.junit.After;

View File

@ -141,28 +141,6 @@
</intent-filter> </intent-filter>
</activity> </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 <activity
android:name=".activity.OpmlImportActivity" android:name=".activity.OpmlImportActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"

View File

@ -51,7 +51,6 @@ import de.danoeh.antennapod.ui.common.Converter;
import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.IntentUtils;
import de.danoeh.antennapod.core.util.ShareUtils; 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.gui.PictureInPictureUtil;
import de.danoeh.antennapod.core.util.playback.PlaybackController; import de.danoeh.antennapod.core.util.playback.PlaybackController;
import de.danoeh.antennapod.databinding.VideoplayerActivityBinding; 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.base.PlayerStatus;
import de.danoeh.antennapod.playback.cast.CastEnabledActivity; import de.danoeh.antennapod.playback.cast.CastEnabledActivity;
import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter; import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter;
import de.danoeh.antennapod.ui.episodes.TimeSpeedConverter;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;

View File

@ -26,6 +26,8 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.elevation.SurfaceColors; import com.google.android.material.elevation.SurfaceColors;
import de.danoeh.antennapod.ui.appstartintent.MediaButtonStarter; 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.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
@ -36,10 +38,8 @@ import java.util.List;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; 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.core.util.ChapterUtils;
import de.danoeh.antennapod.ui.common.Converter; 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.core.util.playback.PlaybackController;
import de.danoeh.antennapod.dialog.MediaPlayerErrorDialog; import de.danoeh.antennapod.dialog.MediaPlayerErrorDialog;
import de.danoeh.antennapod.dialog.SkipPreferenceDialog; import de.danoeh.antennapod.dialog.SkipPreferenceDialog;

View File

@ -32,7 +32,6 @@ import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; 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.core.util.ChapterUtils;
import de.danoeh.antennapod.ui.common.DateFormatter; import de.danoeh.antennapod.ui.common.DateFormatter;
import de.danoeh.antennapod.core.util.playback.PlaybackController; 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.EmbeddedChapterImage;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.model.playback.Playable;
import de.danoeh.antennapod.ui.episodes.ImageResourceUtils;
import io.reactivex.Maybe; import io.reactivex.Maybe;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;

View File

@ -20,11 +20,11 @@ import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.event.playback.PlaybackPositionEvent; import de.danoeh.antennapod.event.playback.PlaybackPositionEvent;
import de.danoeh.antennapod.event.playback.PlaybackServiceEvent; import de.danoeh.antennapod.event.playback.PlaybackServiceEvent;
import de.danoeh.antennapod.model.playback.MediaType; 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.core.service.playback.PlaybackService;
import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.model.playback.Playable;
import de.danoeh.antennapod.core.util.playback.PlaybackController; import de.danoeh.antennapod.core.util.playback.PlaybackController;
import de.danoeh.antennapod.playback.base.PlayerStatus; import de.danoeh.antennapod.playback.base.PlayerStatus;
import de.danoeh.antennapod.ui.episodes.ImageResourceUtils;
import de.danoeh.antennapod.view.PlayButton; import de.danoeh.antennapod.view.PlayButton;
import io.reactivex.Maybe; import io.reactivex.Maybe;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;

View File

@ -44,7 +44,6 @@ import de.danoeh.antennapod.event.PlayerStatusEvent;
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; 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.storage.preferences.UsageStatistics;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface; import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface;
import de.danoeh.antennapod.storage.preferences.UserPreferences; 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.ui.common.ThemeUtils;
import de.danoeh.antennapod.core.util.playback.PlaybackController; import de.danoeh.antennapod.core.util.playback.PlaybackController;
import de.danoeh.antennapod.core.util.gui.ShownotesCleaner; import de.danoeh.antennapod.core.util.gui.ShownotesCleaner;
import de.danoeh.antennapod.ui.episodes.ImageResourceUtils;
import de.danoeh.antennapod.view.ShownotesWebView; import de.danoeh.antennapod.view.ShownotesWebView;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;

View File

@ -28,6 +28,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import com.leinardi.android.speeddial.SpeedDialView; import com.leinardi.android.speeddial.SpeedDialView;
import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; 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.EpisodeItemListAdapter;
import de.danoeh.antennapod.adapter.QueueRecyclerAdapter; import de.danoeh.antennapod.adapter.QueueRecyclerAdapter;
import de.danoeh.antennapod.core.dialog.ConfirmationDialog; 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.core.menuhandler.MenuItemUtils;
import de.danoeh.antennapod.storage.database.DBReader; import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;

View File

@ -27,7 +27,6 @@ import de.danoeh.antennapod.ui.common.DateFormatter;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.model.playback.MediaType; 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.net.download.serviceinterface.DownloadServiceInterface;
import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.ui.common.Converter; 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.model.playback.Playable;
import de.danoeh.antennapod.ui.common.CircularProgressBar; import de.danoeh.antennapod.ui.common.CircularProgressBar;
import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.ui.common.ThemeUtils;
import de.danoeh.antennapod.ui.episodes.ImageResourceUtils;
/** /**
* Holds the view which shows FeedItems. * Holds the view which shows FeedItems.

View File

@ -13,7 +13,6 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.CoverLoader; import de.danoeh.antennapod.adapter.CoverLoader;
import de.danoeh.antennapod.adapter.actionbutton.ItemActionButton; 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.ui.common.DateFormatter;
import de.danoeh.antennapod.core.util.PlaybackStatus; import de.danoeh.antennapod.core.util.PlaybackStatus;
import de.danoeh.antennapod.event.playback.PlaybackPositionEvent; 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.CircularProgressBar;
import de.danoeh.antennapod.ui.common.SquareImageView; import de.danoeh.antennapod.ui.common.SquareImageView;
import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.ui.common.ThemeUtils;
import de.danoeh.antennapod.ui.episodes.ImageResourceUtils;
public class HorizontalItemViewHolder extends RecyclerView.ViewHolder { public class HorizontalItemViewHolder extends RecyclerView.ViewHolder {
public final CardView card; public final CardView card;

View File

@ -39,6 +39,7 @@ dependencies {
implementation project(':storage:preferences') implementation project(':storage:preferences')
implementation project(':ui:app-start-intent') implementation project(':ui:app-start-intent')
implementation project(':ui:common') implementation project(':ui:common')
implementation project(':ui:episodes')
implementation project(':ui:i18n') implementation project(':ui:i18n')
implementation project(':ui:notifications') implementation project(':ui:notifications')
implementation project(':ui:widget') implementation project(':ui:widget')

View File

@ -13,7 +13,6 @@ import androidx.annotation.NonNull;
import androidx.media.AudioAttributesCompat; import androidx.media.AudioAttributesCompat;
import androidx.media.AudioFocusRequestCompat; import androidx.media.AudioFocusRequestCompat;
import androidx.media.AudioManagerCompat; import androidx.media.AudioManagerCompat;
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
import de.danoeh.antennapod.event.PlayerErrorEvent; import de.danoeh.antennapod.event.PlayerErrorEvent;
import de.danoeh.antennapod.event.playback.BufferUpdateEvent; import de.danoeh.antennapod.event.playback.BufferUpdateEvent;
import de.danoeh.antennapod.event.playback.SpeedChangedEvent; 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.PlayerStatus;
import de.danoeh.antennapod.playback.base.RewindAfterPauseUtils; import de.danoeh.antennapod.playback.base.RewindAfterPauseUtils;
import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import java.io.File; import java.io.File;

View File

@ -52,6 +52,7 @@ import androidx.media.MediaBrowserServiceCompat;
import de.danoeh.antennapod.event.PlayerStatusEvent; import de.danoeh.antennapod.event.PlayerStatusEvent;
import de.danoeh.antennapod.ui.notifications.NotificationUtils; import de.danoeh.antennapod.ui.notifications.NotificationUtils;
import de.danoeh.antennapod.ui.widget.WidgetUpdater;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; 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.net.common.NetworkUtils;
import de.danoeh.antennapod.core.util.playback.PlayableUtils; import de.danoeh.antennapod.core.util.playback.PlayableUtils;
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; 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.MessageEvent;
import de.danoeh.antennapod.event.PlayerErrorEvent; import de.danoeh.antennapod.event.PlayerErrorEvent;
import de.danoeh.antennapod.event.playback.BufferUpdateEvent; import de.danoeh.antennapod.event.playback.BufferUpdateEvent;

View File

@ -22,9 +22,9 @@ import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver;
import de.danoeh.antennapod.ui.common.Converter; 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.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 de.danoeh.antennapod.ui.notifications.NotificationUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;

View File

@ -10,7 +10,7 @@ import android.util.Log;
import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent; import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent;
import de.danoeh.antennapod.storage.preferences.SleepTimerPreferences; import de.danoeh.antennapod.storage.preferences.SleepTimerPreferences;
import de.danoeh.antennapod.core.util.ChapterUtils; 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 io.reactivex.disposables.Disposable;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;

View File

@ -21,12 +21,12 @@ import de.danoeh.antennapod.event.playback.PlaybackServiceEvent;
import de.danoeh.antennapod.event.playback.SpeedChangedEvent; import de.danoeh.antennapod.event.playback.SpeedChangedEvent;
import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.model.feed.FeedPreferences;
import de.danoeh.antennapod.model.playback.MediaType; 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.storage.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.model.playback.Playable;
import de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer; import de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer;
import de.danoeh.antennapod.playback.base.PlayerStatus; import de.danoeh.antennapod.playback.base.PlayerStatus;
import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;

View File

@ -40,6 +40,7 @@ include ':storage:preferences'
include ':ui:app-start-intent' include ':ui:app-start-intent'
include ':ui:common' include ':ui:common'
include ':ui:echo' include ':ui:echo'
include ':ui:episodes'
include ':ui:glide' include ':ui:glide'
include ':ui:i18n' include ':ui:i18n'
include ':ui:notifications' include ':ui:notifications'

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="widget_margin">0dp</dimen>
<dimen name="widget_inner_radius">4dp</dimen>
<dimen name="external_player_height">64dp</dimen> <dimen name="external_player_height">64dp</dimen>
<dimen name="text_size_micro">12sp</dimen> <dimen name="text_size_micro">12sp</dimen>
<dimen name="text_size_small">14sp</dimen> <dimen name="text_size_small">14sp</dimen>

View File

@ -18,6 +18,7 @@ dependencies {
implementation project(':storage:database') implementation project(':storage:database')
implementation project(":storage:preferences") implementation project(":storage:preferences")
implementation project(':ui:common') implementation project(':ui:common')
implementation project(':ui:episodes')
implementation project(':ui:glide') implementation project(':ui:glide')
annotationProcessor "androidx.annotation:annotation:$annotationVersion" annotationProcessor "androidx.annotation:annotation:$annotationVersion"

View File

@ -23,7 +23,6 @@ import androidx.core.view.WindowCompat;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions; 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.model.feed.FeedItem;
import de.danoeh.antennapod.storage.database.DBReader; import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.storage.database.StatisticsItem; 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.StripesScreen;
import de.danoeh.antennapod.ui.echo.screens.WaveformScreen; import de.danoeh.antennapod.ui.echo.screens.WaveformScreen;
import de.danoeh.antennapod.ui.echo.screens.WavesScreen; import de.danoeh.antennapod.ui.echo.screens.WavesScreen;
import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils;
import io.reactivex.Flowable; import io.reactivex.Flowable;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;

3
ui/episodes/README.md Normal file
View File

@ -0,0 +1,3 @@
# :ui:episodes
Common classes that are needed everywhere we display information about episodes.

19
ui/episodes/build.gradle Normal file
View File

@ -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"
}

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.core.feed.util; package de.danoeh.antennapod.ui.episodes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;

View File

@ -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.Feed;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.core.util; package de.danoeh.antennapod.ui.episodes;
import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;

View File

@ -2,6 +2,7 @@ plugins {
id("com.android.library") id("com.android.library")
} }
apply from: "../../common.gradle" apply from: "../../common.gradle"
apply from: "../../playFlavor.gradle"
android { android {
namespace "de.danoeh.antennapod.ui.widget" namespace "de.danoeh.antennapod.ui.widget"
@ -10,10 +11,25 @@ android {
vectorDrawables.useSupportLibrary false vectorDrawables.useSupportLibrary false
vectorDrawables.generatedDensities = ["xhdpi"] vectorDrawables.generatedDensities = ["xhdpi"]
} }
lint {
disable "IconMissingDensityFolder"
}
} }
dependencies { 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:common")
implementation project(":ui:episodes")
implementation project(':ui:glide')
implementation project(':ui:i18n')
annotationProcessor "androidx.annotation:annotation:$annotationVersion" annotationProcessor "androidx.annotation:annotation:$annotationVersion"
implementation "androidx.appcompat:appcompat:$appcompatVersion"
implementation "androidx.work:work-runtime:$workManagerVersion"
implementation "com.github.bumptech.glide:glide:$glideVersion"
} }

View File

@ -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>

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.core.receiver; package de.danoeh.antennapod.ui.widget;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider; import android.appwidget.AppWidgetProvider;
@ -9,7 +9,6 @@ import android.util.Log;
import androidx.work.ExistingWorkPolicy; import androidx.work.ExistingWorkPolicy;
import androidx.work.OneTimeWorkRequest; import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager; import androidx.work.WorkManager;
import de.danoeh.antennapod.core.widget.WidgetUpdaterWorker;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;

View File

@ -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.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Color; import android.graphics.Color;
@ -11,11 +13,10 @@ import android.widget.CheckBox;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity; 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 de.danoeh.antennapod.ui.common.ThemeSwitcher;
import java.util.Locale;
public class WidgetConfigActivity extends AppCompatActivity { public class WidgetConfigActivity extends AppCompatActivity {
private int appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID; private int appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
@ -42,7 +43,7 @@ public class WidgetConfigActivity extends AppCompatActivity {
Intent resultValue = new Intent(); Intent resultValue = new Intent();
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
setResult(RESULT_CANCELED, resultValue); setResult(Activity.RESULT_CANCELED, resultValue);
if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
finish(); finish();
} }
@ -55,7 +56,7 @@ public class WidgetConfigActivity extends AppCompatActivity {
@Override @Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) { 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()); int color = getColorWithAlpha(PlayerWidget.DEFAULT_COLOR, opacitySeekBar.getProgress());
widgetPreview.setBackgroundColor(color); widgetPreview.setBackgroundColor(color);
} }
@ -91,7 +92,7 @@ public class WidgetConfigActivity extends AppCompatActivity {
} }
private void setInitialState() { 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)); ckPlaybackSpeed.setChecked(prefs.getBoolean(PlayerWidget.KEY_WIDGET_PLAYBACK_SPEED + appWidgetId, false));
ckRewind.setChecked(prefs.getBoolean(PlayerWidget.KEY_WIDGET_REWIND + appWidgetId, false)); ckRewind.setChecked(prefs.getBoolean(PlayerWidget.KEY_WIDGET_REWIND + appWidgetId, false));
ckFastForward.setChecked(prefs.getBoolean(PlayerWidget.KEY_WIDGET_FAST_FORWARD + 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() { private void confirmCreateWidget() {
int backgroundColor = getColorWithAlpha(PlayerWidget.DEFAULT_COLOR, opacitySeekBar.getProgress()); 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(); SharedPreferences.Editor editor = prefs.edit();
editor.putInt(PlayerWidget.KEY_WIDGET_COLOR + appWidgetId, backgroundColor); editor.putInt(PlayerWidget.KEY_WIDGET_COLOR + appWidgetId, backgroundColor);
editor.putBoolean(PlayerWidget.KEY_WIDGET_PLAYBACK_SPEED + appWidgetId, ckPlaybackSpeed.isChecked()); editor.putBoolean(PlayerWidget.KEY_WIDGET_PLAYBACK_SPEED + appWidgetId, ckPlaybackSpeed.isChecked());
@ -133,7 +134,7 @@ public class WidgetConfigActivity extends AppCompatActivity {
Intent resultValue = new Intent(); Intent resultValue = new Intent();
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
setResult(RESULT_OK, resultValue); setResult(Activity.RESULT_OK, resultValue);
finish(); finish();
WidgetUpdaterWorker.enqueueWork(this); WidgetUpdaterWorker.enqueueWork(this);
} }

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.core.widget; package de.danoeh.antennapod.ui.widget;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.appwidget.AppWidgetManager; 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.appstartintent.MediaButtonStarter;
import de.danoeh.antennapod.ui.common.Converter; import de.danoeh.antennapod.ui.common.Converter;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
import java.util.concurrent.TimeUnit; 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.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.model.playback.Playable;
import de.danoeh.antennapod.playback.base.PlayerStatus; import de.danoeh.antennapod.playback.base.PlayerStatus;
import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter; import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter;
import de.danoeh.antennapod.ui.appstartintent.PlaybackSpeedActivityStarter; import de.danoeh.antennapod.ui.appstartintent.PlaybackSpeedActivityStarter;
import de.danoeh.antennapod.ui.appstartintent.VideoPlayerActivityStarter; 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. * Updates the state of the player widget.

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.core.widget; package de.danoeh.antennapod.ui.widget;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
@ -8,11 +8,11 @@ import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager; import androidx.work.WorkManager;
import androidx.work.Worker; import androidx.work.Worker;
import androidx.work.WorkerParameters; 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.database.DBReader;
import de.danoeh.antennapod.storage.preferences.PlaybackPreferences;
import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.model.playback.Playable;
import de.danoeh.antennapod.playback.base.PlayerStatus; import de.danoeh.antennapod.playback.base.PlayerStatus;
import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils;
public class WidgetUpdaterWorker extends Worker { public class WidgetUpdaterWorker extends Worker {

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -6,7 +6,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context="de.danoeh.antennapod.activity.WidgetConfigActivity"> tools:context="de.danoeh.antennapod.ui.widget.WidgetConfigActivity">
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -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>

View File

@ -8,5 +8,5 @@
android:minWidth="250dp" android:minWidth="250dp"
android:minResizeWidth="40dp" android:minResizeWidth="40dp"
android:widgetFeatures="reconfigurable" android:widgetFeatures="reconfigurable"
android:configure="de.danoeh.antennapod.activity.WidgetConfigActivity"> android:configure="de.danoeh.antennapod.ui.widget.WidgetConfigActivity">
</appwidget-provider> </appwidget-provider>