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
@@ -141,28 +141,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0dp
- 4dp
64dp
12sp
14sp
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
similarity index 97%
rename from core/src/main/java/de/danoeh/antennapod/core/feed/util/ImageResourceUtils.java
rename to 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
similarity index 98%
rename from core/src/main/java/de/danoeh/antennapod/core/feed/util/PlaybackSpeedUtils.java
rename to 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
similarity index 93%
rename from core/src/main/java/de/danoeh/antennapod/core/util/TimeSpeedConverter.java
rename to 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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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
similarity index 97%
rename from core/src/main/java/de/danoeh/antennapod/core/receiver/PlayerWidget.java
rename to 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
similarity index 93%
rename from app/src/main/java/de/danoeh/antennapod/activity/WidgetConfigActivity.java
rename to 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
similarity index 97%
rename from core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java
rename to 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
similarity index 95%
rename from core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdaterWorker.java
rename to 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
similarity index 100%
rename from core/src/main/res/drawable-hdpi/ic_widget_preview.png
rename to 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
similarity index 98%
rename from app/src/main/res/layout/activity_widget_config.xml
rename to 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">
+
+ 0dp
+ 4dp
+
diff --git a/app/src/main/res/xml/player_widget_info.xml b/ui/widget/src/main/res/xml/player_widget_info.xml
similarity index 86%
rename from app/src/main/res/xml/player_widget_info.xml
rename to 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">