diff options
37 files changed, 136 insertions, 64 deletions
diff --git a/app/build.gradle b/app/build.gradle index bc918ab3f..6a6e097c7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -165,6 +165,7 @@ dependencies { System.out.println("app: free build hack, skipping some dependencies") } implementation project(':ui:app-start-intent') + implementation project(':ui:common') annotationProcessor "androidx.annotation:annotation:$annotationVersion" implementation "androidx.appcompat:appcompat:$appcompatVersion" diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index 147700e77..69f5fb264 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -41,7 +41,7 @@ import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.util.StorageUtils; -import de.danoeh.antennapod.core.util.ThemeUtils; +import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.core.util.download.AutoUpdateManager; import de.danoeh.antennapod.dialog.RatingDialog; import de.danoeh.antennapod.fragment.AddFeedFragment; diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java index 4fa8acc43..a267938d3 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java @@ -20,9 +20,9 @@ import de.danoeh.antennapod.core.glide.ApGlideSettings; import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.EmbeddedChapterImage; import de.danoeh.antennapod.core.util.IntentUtils; -import de.danoeh.antennapod.core.util.ThemeUtils; +import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.core.util.playback.Playable; -import de.danoeh.antennapod.view.CircularProgressBar; +import de.danoeh.antennapod.ui.common.CircularProgressBar; public class ChaptersListAdapter extends RecyclerView.Adapter<ChaptersListAdapter.ChapterHolder> { private Playable media; diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java index 0c4aaf6ed..d6801e1b5 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java @@ -20,7 +20,7 @@ import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequester; -import de.danoeh.antennapod.core.util.ThemeUtils; +import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.view.viewholder.DownloadItemViewHolder; /** diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadlistAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadlistAdapter.java index 268a21409..9d63d8ad7 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadlistAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadlistAdapter.java @@ -15,8 +15,8 @@ import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.service.download.DownloadRequest; import de.danoeh.antennapod.core.service.download.DownloadStatus; import de.danoeh.antennapod.core.service.download.Downloader; -import de.danoeh.antennapod.core.util.ThemeUtils; -import de.danoeh.antennapod.view.CircularProgressBar; +import de.danoeh.antennapod.ui.common.ThemeUtils; +import de.danoeh.antennapod.ui.common.CircularProgressBar; public class DownloadlistAdapter extends BaseAdapter { diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/FeedSearchResultAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/FeedSearchResultAdapter.java index 2e5ba31c9..dbb9ce0d0 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/FeedSearchResultAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/FeedSearchResultAdapter.java @@ -10,7 +10,7 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.fragment.FeedItemlistFragment; -import de.danoeh.antennapod.view.SquareImageView; +import de.danoeh.antennapod.ui.common.SquareImageView; import java.lang.ref.WeakReference; import java.util.ArrayList; diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java b/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java index efaff1da3..e1e8f1c2e 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java @@ -28,7 +28,7 @@ import de.danoeh.antennapod.core.storage.DownloadRequester; import de.danoeh.antennapod.core.util.FeedItemPermutors; import de.danoeh.antennapod.core.util.LongList; import de.danoeh.antennapod.core.util.SortOrder; -import de.danoeh.antennapod.core.util.ThemeUtils; +import de.danoeh.antennapod.ui.common.ThemeUtils; import java.util.ArrayList; import java.util.Arrays; diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/FilterDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/FilterDialog.java index 80df87891..779248e2f 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/FilterDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/FilterDialog.java @@ -16,7 +16,7 @@ import java.util.Set; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.feed.FeedItemFilter; import de.danoeh.antennapod.core.feed.FeedItemFilterGroup; -import de.danoeh.antennapod.view.RecursiveRadioGroup; +import de.danoeh.antennapod.ui.common.RecursiveRadioGroup; public abstract class FilterDialog { diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java index 8a87fef25..29172bb5e 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java @@ -20,7 +20,7 @@ import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.core.feed.SubscriptionsFilter; import de.danoeh.antennapod.core.feed.SubscriptionsFilterGroup; import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.view.RecursiveRadioGroup; +import de.danoeh.antennapod.ui.common.RecursiveRadioGroup; public class SubscriptionsFilterDialog { public static void showDialog(Context context) { 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 d70f3756e..671184625 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AudioPlayerFragment.java @@ -47,7 +47,7 @@ import de.danoeh.antennapod.dialog.SkipPreferenceDialog; import de.danoeh.antennapod.dialog.SleepTimerDialog; import de.danoeh.antennapod.dialog.VariableSpeedDialog; import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler; -import de.danoeh.antennapod.view.PlaybackSpeedIndicatorView; +import de.danoeh.antennapod.ui.common.PlaybackSpeedIndicatorView; 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/FeedInfoFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java index ddfcd06ad..dd8a02893 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java @@ -45,7 +45,7 @@ import de.danoeh.antennapod.core.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.StatisticsItem; import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.IntentUtils; -import de.danoeh.antennapod.core.util.ThemeUtils; +import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.core.util.syndication.HtmlToPlainText; import de.danoeh.antennapod.fragment.preferences.StatisticsFragment; import de.danoeh.antennapod.menuhandler.FeedMenuHandler; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java index 8e14214d2..5293f7ddd 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java @@ -58,7 +58,7 @@ import de.danoeh.antennapod.core.storage.DownloadRequester; import de.danoeh.antennapod.core.util.FeedItemPermutors; import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.Optional; -import de.danoeh.antennapod.core.util.ThemeUtils; +import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.core.util.gui.MoreContentListFooterUtil; import de.danoeh.antennapod.dialog.EpisodesApplyActionFragment; import de.danoeh.antennapod.dialog.FilterDialog; 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 e50425566..2fc3d4f0e 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java @@ -57,7 +57,7 @@ import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DownloadRequester; import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.DateUtils; -import de.danoeh.antennapod.core.util.ThemeUtils; +import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.core.util.playback.PlaybackController; import de.danoeh.antennapod.core.util.playback.Timeline; import de.danoeh.antennapod.view.ShownotesWebView; diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java index 9c54a529b..fbfdf537f 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java @@ -9,7 +9,7 @@ import androidx.appcompat.widget.SearchView; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.core.util.ThemeUtils; +import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.fragment.SearchFragment; import java.util.HashMap; 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 35744227f..5e49783d9 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 @@ -30,8 +30,8 @@ import de.danoeh.antennapod.core.storage.DownloadRequester; import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.DateUtils; import de.danoeh.antennapod.core.util.NetworkUtils; -import de.danoeh.antennapod.core.util.ThemeUtils; -import de.danoeh.antennapod.view.CircularProgressBar; +import de.danoeh.antennapod.ui.common.ThemeUtils; +import de.danoeh.antennapod.ui.common.CircularProgressBar; /** * Holds the view which shows FeedItems. diff --git a/app/src/main/res/layout/audioplayer_fragment.xml b/app/src/main/res/layout/audioplayer_fragment.xml index c7eb624de..62e0a5e3a 100644 --- a/app/src/main/res/layout/audioplayer_fragment.xml +++ b/app/src/main/res/layout/audioplayer_fragment.xml @@ -156,7 +156,7 @@ android:scaleType="fitCenter" tools:srcCompat="@drawable/ic_av_play_white_24dp"/> - <de.danoeh.antennapod.view.CircularProgressBar + <de.danoeh.antennapod.ui.common.CircularProgressBar android:layout_width="@dimen/audioplayer_playercontrols_length_big" android:layout_height="@dimen/audioplayer_playercontrols_length_big" android:layout_marginLeft="16dp" @@ -164,7 +164,8 @@ android:layout_marginRight="16dp" android:layout_marginEnd="16dp" android:layout_centerHorizontal="true" - android:layout_centerVertical="true"/> + android:layout_centerVertical="true" + app:foregroundColor="?attr/action_icon_color"/> <ProgressBar style="?android:attr/progressBarStyle" @@ -205,7 +206,7 @@ android:textColor="?android:attr/textColorSecondary" android:clickable="false"/> - <de.danoeh.antennapod.view.PlaybackSpeedIndicatorView + <de.danoeh.antennapod.ui.common.PlaybackSpeedIndicatorView android:id="@+id/butPlaybackSpeed" android:layout_width="@dimen/audioplayer_playercontrols_length" android:layout_height="@dimen/audioplayer_playercontrols_length" @@ -214,7 +215,8 @@ android:layout_centerVertical="true" android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@string/playback_speed" - tools:srcCompat="@drawable/ic_playback_speed_white"/> + tools:srcCompat="@drawable/ic_playback_speed_white" + app:foregroundColor="?attr/action_icon_color"/> <TextView android:id="@+id/txtvPlaybackSpeed" diff --git a/app/src/main/res/layout/cover_fragment.xml b/app/src/main/res/layout/cover_fragment.xml index 5460d0609..0ec46cbcd 100644 --- a/app/src/main/res/layout/cover_fragment.xml +++ b/app/src/main/res/layout/cover_fragment.xml @@ -10,7 +10,7 @@ android:padding="8dp" android:gravity="center"> - <de.danoeh.antennapod.view.SquareImageView + <de.danoeh.antennapod.ui.common.SquareImageView android:id="@+id/imgvCover" android:layout_width="0dp" android:layout_height="200dp" diff --git a/app/src/main/res/layout/filter_dialog_row.xml b/app/src/main/res/layout/filter_dialog_row.xml index 5011812d9..914525387 100644 --- a/app/src/main/res/layout/filter_dialog_row.xml +++ b/app/src/main/res/layout/filter_dialog_row.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<de.danoeh.antennapod.view.RecursiveRadioGroup +<de.danoeh.antennapod.ui.common.RecursiveRadioGroup xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" @@ -58,4 +58,4 @@ android:layout_gravity="center_vertical" android:checked="true" /> -</de.danoeh.antennapod.view.RecursiveRadioGroup> +</de.danoeh.antennapod.ui.common.RecursiveRadioGroup> diff --git a/app/src/main/res/layout/quick_feed_discovery.xml b/app/src/main/res/layout/quick_feed_discovery.xml index dd720afed..9ef3db180 100644 --- a/app/src/main/res/layout/quick_feed_discovery.xml +++ b/app/src/main/res/layout/quick_feed_discovery.xml @@ -34,7 +34,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - <de.danoeh.antennapod.view.WrappingGridView + <de.danoeh.antennapod.ui.common.WrappingGridView android:id="@+id/discover_grid" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/quick_feed_discovery_item.xml b/app/src/main/res/layout/quick_feed_discovery_item.xml index e1c91f9d8..cb03b6677 100644 --- a/app/src/main/res/layout/quick_feed_discovery_item.xml +++ b/app/src/main/res/layout/quick_feed_discovery_item.xml @@ -7,7 +7,7 @@ android:padding="4dp" android:clipToPadding="false"> - <de.danoeh.antennapod.view.SquareImageView + <de.danoeh.antennapod.ui.common.SquareImageView android:id="@+id/discovery_cover" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/app/src/main/res/layout/searchlist_item_feed.xml b/app/src/main/res/layout/searchlist_item_feed.xml index 607a3197f..c16911f99 100644 --- a/app/src/main/res/layout/searchlist_item_feed.xml +++ b/app/src/main/res/layout/searchlist_item_feed.xml @@ -7,7 +7,7 @@ android:padding="4dp" android:clipToPadding="false"> - <de.danoeh.antennapod.view.SquareImageView + <de.danoeh.antennapod.ui.common.SquareImageView android:id="@+id/discovery_cover" android:layout_width="match_parent" android:layout_height="96dp" diff --git a/app/src/main/res/layout/secondary_action.xml b/app/src/main/res/layout/secondary_action.xml index 73ca174a6..e5bff480e 100644 --- a/app/src/main/res/layout/secondary_action.xml +++ b/app/src/main/res/layout/secondary_action.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="48dp" android:layout_height="48dp" android:layout_marginRight="12dp" @@ -19,9 +20,10 @@ tools:ignore="ContentDescription" tools:src="@sample/secondaryaction"/> - <de.danoeh.antennapod.view.CircularProgressBar + <de.danoeh.antennapod.ui.common.CircularProgressBar android:id="@+id/secondaryActionProgress" android:layout_width="40dp" android:layout_gravity="center" - android:layout_height="40dp"/> + android:layout_height="40dp" + app:foregroundColor="?attr/action_icon_color"/> </FrameLayout> diff --git a/app/src/main/res/layout/subscription_item.xml b/app/src/main/res/layout/subscription_item.xml index e0c821868..7fa738f12 100644 --- a/app/src/main/res/layout/subscription_item.xml +++ b/app/src/main/res/layout/subscription_item.xml @@ -8,7 +8,7 @@ android:layout_height="match_parent" android:foreground="?attr/selectableItemBackground"> - <de.danoeh.antennapod.view.SquareImageView + <de.danoeh.antennapod.ui.common.SquareImageView android:id="@+id/imgvCover" android:layout_width="fill_parent" android:layout_height="fill_parent" diff --git a/core/build.gradle b/core/build.gradle index 1b1eb0a2f..29cef1cef 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -72,6 +72,7 @@ android { dependencies { implementation project(':ui:app-start-intent') + implementation project(':ui:common') annotationProcessor "androidx.annotation:annotation:$annotationVersion" implementation "androidx.appcompat:appcompat:$appcompatVersion" 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 e1b4c967c..ae8d1a45e 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 @@ -32,8 +32,8 @@ import de.danoeh.antennapod.core.service.playback.PlaybackServiceMediaPlayer; import de.danoeh.antennapod.core.service.playback.PlayerStatus; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.util.Optional; -import de.danoeh.antennapod.core.util.ThemeUtils; import de.danoeh.antennapod.core.util.playback.Playable.PlayableUtils; +import de.danoeh.antennapod.ui.common.ThemeUtils; import io.reactivex.Maybe; import io.reactivex.MaybeOnSubscribe; import io.reactivex.Observable; diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml index cceacf99e..91ecae93d 100644 --- a/core/src/main/res/values/attrs.xml +++ b/core/src/main/res/values/attrs.xml @@ -64,12 +64,4 @@ <attr name="ic_notifications" format="reference"/> <attr name="seek_background" format="color" /> <attr name="ic_share" format="reference"/> - - <declare-styleable name="SquareImageView"> - <attr name="direction" format="enum"> - <enum name="width" value="0"/> - <enum name="height" value="1"/> - <enum name="minimum" value="2"/> - </attr> - </declare-styleable> </resources> diff --git a/settings.gradle b/settings.gradle index fc57f08b0..0298c7b2a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,4 @@ include ':app' include ':core' include ':ui:app-start-intent' +include ':ui:common' diff --git a/ui/common/README.md b/ui/common/README.md new file mode 100644 index 000000000..d96f1cf55 --- /dev/null +++ b/ui/common/README.md @@ -0,0 +1,3 @@ +# :ui:common + +This module provides basic UI functionality that is needed in multiple modules. UI elements that are only used in a single module should not be defined here. diff --git a/ui/common/build.gradle b/ui/common/build.gradle new file mode 100644 index 000000000..fabd8937f --- /dev/null +++ b/ui/common/build.gradle @@ -0,0 +1,50 @@ +apply plugin: "com.android.library" + +android { + compileSdkVersion rootProject.ext.compileSdkVersion + + defaultConfig { + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + + multiDexEnabled false + + testApplicationId "de.danoeh.antennapod.core.tests" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile("proguard-android.txt") + } + debug { + // debug build has method count over 64k single-dex threshold. + // For building debug build to use on Android < 21 (pre-Android 5) devices, + // you need to manually change class + // de.danoeh.antennapod.PodcastApp to extend MultiDexApplication . + // See Issue #2813 + multiDexEnabled true + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + testOptions { + unitTests { + includeAndroidResources = true + } + } + + lintOptions { + warningsAsErrors true + abortOnError true + } +} + +dependencies { + annotationProcessor "androidx.annotation:annotation:$annotationVersion" + implementation "androidx.appcompat:appcompat:$appcompatVersion" +} diff --git a/ui/common/src/main/AndroidManifest.xml b/ui/common/src/main/AndroidManifest.xml new file mode 100644 index 000000000..bae316f55 --- /dev/null +++ b/ui/common/src/main/AndroidManifest.xml @@ -0,0 +1 @@ +<manifest package="de.danoeh.antennapod.ui.common" /> diff --git a/app/src/main/java/de/danoeh/antennapod/view/CircularProgressBar.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/CircularProgressBar.java index 2fd570ece..a693c28b0 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/CircularProgressBar.java +++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/CircularProgressBar.java @@ -1,14 +1,14 @@ -package de.danoeh.antennapod.view; +package de.danoeh.antennapod.ui.common; import android.content.Context; +import android.content.res.TypedArray; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import androidx.annotation.Nullable; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.core.util.ThemeUtils; public class CircularProgressBar extends View { public static final float MINIMUM_PERCENTAGE = 0.005f; @@ -23,20 +23,20 @@ public class CircularProgressBar extends View { public CircularProgressBar(Context context) { super(context); - setup(); + setup(null); } public CircularProgressBar(Context context, @Nullable AttributeSet attrs) { super(context, attrs); - setup(); + setup(attrs); } public CircularProgressBar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - setup(); + setup(attrs); } - private void setup() { + private void setup(@Nullable AttributeSet attrs) { paintBackground.setAntiAlias(true); paintBackground.setStyle(Paint.Style.STROKE); @@ -44,7 +44,9 @@ public class CircularProgressBar extends View { paintProgress.setStyle(Paint.Style.STROKE); paintProgress.setStrokeCap(Paint.Cap.ROUND); - int color = ThemeUtils.getColorFromAttr(getContext(), R.attr.action_icon_color); + TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.CircularProgressBar); + int color = typedArray.getColor(R.styleable.CircularProgressBar_foregroundColor, Color.GREEN); + typedArray.recycle(); paintProgress.setColor(color); paintBackground.setColor(color); } diff --git a/app/src/main/java/de/danoeh/antennapod/view/PlaybackSpeedIndicatorView.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/PlaybackSpeedIndicatorView.java index d7f1eac1d..c93ca01f5 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/PlaybackSpeedIndicatorView.java +++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/PlaybackSpeedIndicatorView.java @@ -1,15 +1,15 @@ -package de.danoeh.antennapod.view; +package de.danoeh.antennapod.ui.common; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import androidx.annotation.Nullable; -import de.danoeh.antennapod.R; public class PlaybackSpeedIndicatorView extends View { private static final float DEG_2_RAD = (float) (Math.PI / 180); @@ -19,37 +19,37 @@ public class PlaybackSpeedIndicatorView extends View { private final Paint arcPaint = new Paint(); private final Paint indicatorPaint = new Paint(); private final Path trianglePath = new Path(); + private final RectF arcBounds = new RectF(); private float angle = VALUE_UNSET; private float targetAngle = VALUE_UNSET; private float degreePerFrame = 2; private float paddingArc = 20; private float paddingIndicator = 10; - private RectF arcBounds = new RectF(); public PlaybackSpeedIndicatorView(Context context) { super(context); - setup(); + setup(null); } public PlaybackSpeedIndicatorView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); - setup(); + setup(attrs); } public PlaybackSpeedIndicatorView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - setup(); + setup(attrs); } - private void setup() { + private void setup(@Nullable AttributeSet attrs) { setSpeed(1.0f); // Set default angle to 1.0 targetAngle = VALUE_UNSET; // Do not move to first value that is set externally - int[] colorAttrs = new int[] {R.attr.action_icon_color }; - TypedArray a = getContext().obtainStyledAttributes(colorAttrs); - arcPaint.setColor(a.getColor(0, 0xffffffff)); - indicatorPaint.setColor(a.getColor(0, 0xffffffff)); - a.recycle(); + TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.PlaybackSpeedIndicatorView); + int color = typedArray.getColor(R.styleable.PlaybackSpeedIndicatorView_foregroundColor, Color.GREEN); + typedArray.recycle(); + arcPaint.setColor(color); + indicatorPaint.setColor(color); arcPaint.setAntiAlias(true); arcPaint.setStyle(Paint.Style.STROKE); diff --git a/app/src/main/java/de/danoeh/antennapod/view/RecursiveRadioGroup.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/RecursiveRadioGroup.java index ee5e7c51d..94ef73ffc 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/RecursiveRadioGroup.java +++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/RecursiveRadioGroup.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.view; +package de.danoeh.antennapod.ui.common; import android.content.Context; import android.util.AttributeSet; diff --git a/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/SquareImageView.java index c256ede9e..dce15af18 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/SquareImageView.java +++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/SquareImageView.java @@ -1,10 +1,9 @@ -package de.danoeh.antennapod.view; +package de.danoeh.antennapod.ui.common; import android.content.Context; import android.content.res.TypedArray; import androidx.appcompat.widget.AppCompatImageView; import android.util.AttributeSet; -import de.danoeh.antennapod.core.R; /** * From http://stackoverflow.com/a/19449488/6839 diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/ThemeUtils.java index 44b31f0be..392d09e07 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java +++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/ThemeUtils.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.util; +package de.danoeh.antennapod.ui.common; import android.content.Context; import androidx.annotation.AttrRes; diff --git a/app/src/main/java/de/danoeh/antennapod/view/WrappingGridView.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/WrappingGridView.java index 37792b4d1..4c8bb994c 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/WrappingGridView.java +++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/WrappingGridView.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.view; +package de.danoeh.antennapod.ui.common; import android.content.Context; import android.util.AttributeSet; diff --git a/ui/common/src/main/res/values/styleable.xml b/ui/common/src/main/res/values/styleable.xml new file mode 100644 index 000000000..3542cc1b5 --- /dev/null +++ b/ui/common/src/main/res/values/styleable.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <declare-styleable name="SquareImageView"> + <attr name="direction" format="enum"> + <enum name="width" value="0"/> + <enum name="height" value="1"/> + <enum name="minimum" value="2"/> + </attr> + </declare-styleable> + + <declare-styleable name="CircularProgressBar"> + <attr name="foregroundColor" format="color" /> + </declare-styleable> + + <declare-styleable name="PlaybackSpeedIndicatorView"> + <attr name="foregroundColor" /> <!-- format omitted to avoid double definition --> + </declare-styleable> +</resources> |