Move theme to :ui:common module (#6997)

This enables creating Activities outside the app and core modules
This commit is contained in:
ByteHamster
2024-03-17 18:43:55 +01:00
committed by GitHub
parent 17f5a5d1b8
commit 0cbd97b5cb
76 changed files with 39 additions and 36 deletions

View File

@ -8,10 +8,12 @@ android {
}
dependencies {
implementation project(":storage:preferences")
implementation project(":ui:i18n")
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
implementation "androidx.appcompat:appcompat:$appcompatVersion"
implementation "androidx.viewpager2:viewpager2:$viewPager2Version"
implementation "com.google.android.material:material:$googleMaterialVersion"
implementation "androidx.core:core-splashscreen:1.0.0"
}

View File

@ -0,0 +1,123 @@
package de.danoeh.antennapod.ui.common;
import android.content.Context;
import android.content.res.Resources;
import java.util.Locale;
/** Provides methods for converting various units. */
public final class Converter {
/** Class shall not be instantiated. */
private Converter() {
}
private static final int HOURS_MIL = 3600000;
private static final int MINUTES_MIL = 60000;
private static final int SECONDS_MIL = 1000;
/**
* Converts milliseconds to a string containing hours, minutes and seconds.
*/
public static String getDurationStringLong(int duration) {
if (duration <= 0) {
return "00:00:00";
} else {
int[] hms = millisecondsToHms(duration);
return String.format(Locale.getDefault(), "%02d:%02d:%02d", hms[0], hms[1], hms[2]);
}
}
private static int[] millisecondsToHms(long duration) {
int h = (int) (duration / HOURS_MIL);
long rest = duration - h * HOURS_MIL;
int m = (int) (rest / MINUTES_MIL);
rest -= m * MINUTES_MIL;
int s = (int) (rest / SECONDS_MIL);
return new int[] {h, m, s};
}
/**
* Converts milliseconds to a string containing hours and minutes or minutes and seconds.
*/
public static String getDurationStringShort(int duration, boolean durationIsInHours) {
int firstPartBase = durationIsInHours ? HOURS_MIL : MINUTES_MIL;
int firstPart = duration / firstPartBase;
int leftoverFromFirstPart = duration - firstPart * firstPartBase;
int secondPart = leftoverFromFirstPart / (durationIsInHours ? MINUTES_MIL : SECONDS_MIL);
return String.format(Locale.getDefault(), "%02d:%02d", firstPart, secondPart);
}
/**
* Converts long duration string (HH:MM:SS) to milliseconds.
*/
public static int durationStringLongToMs(String input) {
String[] parts = input.split(":");
if (parts.length != 3) {
return 0;
}
return Integer.parseInt(parts[0]) * 3600 * 1000
+ Integer.parseInt(parts[1]) * 60 * 1000
+ Integer.parseInt(parts[2]) * 1000;
}
/**
* Converts short duration string (XX:YY) to milliseconds. If durationIsInHours is true then the
* format is HH:MM, otherwise it's MM:SS.
*/
public static int durationStringShortToMs(String input, boolean durationIsInHours) {
String[] parts = input.split(":");
if (parts.length != 2) {
return 0;
}
int modifier = durationIsInHours ? 60 : 1;
return Integer.parseInt(parts[0]) * 60 * 1000 * modifier
+ Integer.parseInt(parts[1]) * 1000 * modifier;
}
/**
* Converts milliseconds to a localized string containing hours and minutes.
*/
public static String getDurationStringLocalized(Context context, long duration) {
return getDurationStringLocalized(context.getResources(), duration, false);
}
public static String getDurationStringLocalized(Resources resources, long duration, boolean includeDays) {
String result = "";
int h = (int) (duration / HOURS_MIL);
int d = h / 24;
if (!includeDays) {
d = 0;
} else if (d > 0) {
String days = resources.getQuantityString(R.plurals.time_days_quantified, d, d);
result += days.replace(" ", "\u00A0") + " ";
h -= d * 24;
}
int rest = (int) (duration - (d * 24 + h) * HOURS_MIL);
int m = rest / MINUTES_MIL;
if (h > 0) {
String hours = resources.getQuantityString(R.plurals.time_hours_quantified, h, h);
result += hours.replace(" ", "\u00A0");
if (d == 0) {
result += " ";
}
}
if (d == 0) {
String minutes = resources.getQuantityString(R.plurals.time_minutes_quantified, m, m);
result += minutes.replace(" ", "\u00A0");
}
return result;
}
/**
* Converts seconds to a localized representation.
* @param time The time in seconds
* @return "HH:MM hours"
*/
public static String shortLocalizedDuration(Context context, long time) {
float hours = (float) time / 3600f;
return String.format(Locale.getDefault(), "%.1f ", hours) + context.getString(R.string.time_hours);
}
}

View File

@ -0,0 +1,39 @@
package de.danoeh.antennapod.ui.common;
import android.content.Context;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
/**
* Formats dates.
*/
public class DateFormatter {
private DateFormatter() {
}
public static String formatAbbrev(final Context context, final Date date) {
if (date == null) {
return "";
}
GregorianCalendar now = new GregorianCalendar();
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
boolean withinLastYear = now.get(Calendar.YEAR) == cal.get(Calendar.YEAR);
int format = android.text.format.DateUtils.FORMAT_ABBREV_ALL;
if (withinLastYear) {
format |= android.text.format.DateUtils.FORMAT_NO_YEAR;
}
return android.text.format.DateUtils.formatDateTime(context, date.getTime(), format);
}
public static String formatForAccessibility(final Date date) {
if (date == null) {
return "";
}
return DateFormat.getDateInstance(DateFormat.LONG).format(date);
}
}

View File

@ -0,0 +1,72 @@
package de.danoeh.antennapod.ui.common;
import android.content.Context;
import android.content.res.Configuration;
import androidx.annotation.StyleRes;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
public abstract class ThemeSwitcher {
@StyleRes
public static int getTheme(Context context) {
boolean dynamic = UserPreferences.getIsThemeColorTinted();
switch (readThemeValue(context)) {
case DARK:
return dynamic ? R.style.Theme_AntennaPod_Dynamic_Dark : R.style.Theme_AntennaPod_Dark;
case BLACK:
return dynamic ? R.style.Theme_AntennaPod_Dynamic_TrueBlack : R.style.Theme_AntennaPod_TrueBlack;
case LIGHT: // fall-through
default:
return dynamic ? R.style.Theme_AntennaPod_Dynamic_Light : R.style.Theme_AntennaPod_Light;
}
}
@StyleRes
public static int getNoTitleTheme(Context context) {
boolean dynamic = UserPreferences.getIsThemeColorTinted();
switch (readThemeValue(context)) {
case DARK:
return dynamic ? R.style.Theme_AntennaPod_Dynamic_Dark_NoTitle : R.style.Theme_AntennaPod_Dark_NoTitle;
case BLACK:
return dynamic ? R.style.Theme_AntennaPod_Dynamic_TrueBlack_NoTitle
: R.style.Theme_AntennaPod_TrueBlack_NoTitle;
case LIGHT: // fall-through
default:
return dynamic ? R.style.Theme_AntennaPod_Dynamic_Light_NoTitle
: R.style.Theme_AntennaPod_Light_NoTitle;
}
}
@StyleRes
public static int getTranslucentTheme(Context context) {
boolean dynamic = UserPreferences.getIsThemeColorTinted();
switch (readThemeValue(context)) {
case DARK:
return dynamic ? R.style.Theme_AntennaPod_Dynamic_Dark_Translucent
: R.style.Theme_AntennaPod_Dark_Translucent;
case BLACK:
return dynamic ? R.style.Theme_AntennaPod_Dynamic_TrueBlack_Translucent
: R.style.Theme_AntennaPod_TrueBlack_Translucent;
case LIGHT: // fall-through
default:
return dynamic ? R.style.Theme_AntennaPod_Dynamic_Light_Translucent
: R.style.Theme_AntennaPod_Light_Translucent;
}
}
private static UserPreferences.ThemePreference readThemeValue(Context context) {
UserPreferences.ThemePreference theme = UserPreferences.getTheme();
if (theme == UserPreferences.ThemePreference.SYSTEM) {
int nightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (nightMode == Configuration.UI_MODE_NIGHT_YES) {
theme = UserPreferences.ThemePreference.DARK;
} else {
theme = UserPreferences.ThemePreference.LIGHT;
}
}
if (theme == UserPreferences.ThemePreference.DARK && UserPreferences.getIsBlackTheme()) {
theme = UserPreferences.ThemePreference.BLACK;
}
return theme;
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Difference to Material Components: alpha is 0.3 instead of 0.08 -->
<item android:alpha="0.3" android:color="?attr/colorPrimary" android:state_checked="true"/>
<item android:color="@android:color/transparent" android:state_checked="false"/>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#D2404040" />
<corners android:radius="18dp" />
</shape>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="30dp"
android:viewportWidth="3"
android:viewportHeight="4.5">
<path
android:pathData="M 0.75 0.25 A 0.5 0.5 0 0 0 0.25 0.75 A 0.5 0.5 135 0 0 0.75 1.25 A 0.5 0.5 0 0 0 1.25 0.75 A 0.5 0.5 45 0 0 0.75 0.25 z M 2.25 0.25 A 0.5 0.5 0 0 0 1.75 0.75 A 0.5 0.5 0 0 0 2.25 1.25 A 0.5 0.5 0 0 0 2.75 0.75 A 0.5 0.5 0 0 0 2.25 0.25 z M 0.75 1.75 A 0.5 0.5 0 0 0 0.25 2.25 A 0.5 0.5 0 0 0 0.75 2.75 A 0.5 0.5 0 0 0 1.25 2.25 A 0.5 0.5 0 0 0 0.75 1.75 z M 2.25 1.75 A 0.5 0.5 0 0 0 1.75 2.25 A 0.5 0.5 0 0 0 2.25 2.75 A 0.5 0.5 0 0 0 2.75 2.25 A 0.5 0.5 0 0 0 2.25 1.75 z M 0.75 3.25 A 0.5 0.5 0 0 0 0.25 3.75 A 0.5 0.5 45 0 0 0.75 4.25 A 0.5 0.5 45 0 0 1.25 3.75 A 0.5 0.5 0 0 0 0.75 3.25 z M 2.25 3.25 A 0.5 0.5 0 0 0 1.75 3.75 A 0.5 0.5 45 0 0 2.25 4.25 A 0.5 0.5 45 0 0 2.75 3.75 A 0.5 0.5 0 0 0 2.25 3.25 z"
android:fillColor="#a9a9a9"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="30dp"
android:viewportWidth="3"
android:viewportHeight="4.5">
<path
android:pathData="M 0.75 0.25 A 0.5 0.5 0 0 0 0.25 0.75 A 0.5 0.5 135 0 0 0.75 1.25 A 0.5 0.5 0 0 0 1.25 0.75 A 0.5 0.5 45 0 0 0.75 0.25 z M 2.25 0.25 A 0.5 0.5 0 0 0 1.75 0.75 A 0.5 0.5 0 0 0 2.25 1.25 A 0.5 0.5 0 0 0 2.75 0.75 A 0.5 0.5 0 0 0 2.25 0.25 z M 0.75 1.75 A 0.5 0.5 0 0 0 0.25 2.25 A 0.5 0.5 0 0 0 0.75 2.75 A 0.5 0.5 0 0 0 1.25 2.25 A 0.5 0.5 0 0 0 0.75 1.75 z M 2.25 1.75 A 0.5 0.5 0 0 0 1.75 2.25 A 0.5 0.5 0 0 0 2.25 2.75 A 0.5 0.5 0 0 0 2.75 2.25 A 0.5 0.5 0 0 0 2.25 1.75 z M 0.75 3.25 A 0.5 0.5 0 0 0 0.25 3.75 A 0.5 0.5 45 0 0 0.75 4.25 A 0.5 0.5 45 0 0 1.25 3.75 A 0.5 0.5 0 0 0 0.75 3.25 z M 2.25 3.25 A 0.5 0.5 0 0 0 1.75 3.75 A 0.5 0.5 45 0 0 2.25 4.25 A 0.5 0.5 45 0 0 2.75 3.75 A 0.5 0.5 0 0 0 2.25 3.25 z"
android:fillColor="#9d9d9d"/>
</vector>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:oneshot="false">
<item android:duration="1000">
<aapt:attr name="android:drawable">
<layer-list>
<item android:drawable="@drawable/launcher_animate_bg" />
<item android:drawable="@drawable/launcher_animate_wave1" />
<item android:drawable="@drawable/launcher_animate_wave2" />
</layer-list>
</aapt:attr>
</item>
<item android:duration="80">
<aapt:attr name="android:drawable">
<layer-list>
<item android:drawable="@drawable/launcher_animate_bg" />
<item android:drawable="@drawable/launcher_animate_wave1" />
</layer-list>
</aapt:attr>
</item>
<item android:duration="200">
<aapt:attr name="android:drawable">
<layer-list>
<item android:drawable="@drawable/launcher_animate_bg" />
</layer-list>
</aapt:attr>
</item>
<item android:duration="80">
<aapt:attr name="android:drawable">
<layer-list>
<item android:drawable="@drawable/launcher_animate_bg" />
<item android:drawable="@drawable/launcher_animate_wave1" />
</layer-list>
</aapt:attr>
</item>
</animation-list>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="#19FFFFFF"/>
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="?attr/colorAccent"/>
</shape>
</clip>
</item>
</layer-list>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="#19212121"/>
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="?attr/colorAccent"/>
</shape>
</clip>
</item>
</layer-list>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/scrollbar_thumb_pressed_dark"/>
<item android:drawable="@drawable/scrollbar_thumb_default"/>
</selector>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<size android:height="24dp" android:width="24dp"/>
</shape>
</item>
<item android:gravity="end">
<shape android:shape="rectangle">
<solid android:color="#99666666"/>
<size android:height="4dp" android:width="4dp"/>
</shape>
</item>
</layer-list>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/scrollbar_thumb_pressed_light"/>
<item android:drawable="@drawable/scrollbar_thumb_default"/>
</selector>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<size android:height="24dp" android:width="24dp"/>
</shape>
</item>
<item android:gravity="end">
<shape android:shape="rectangle">
<solid android:color="@color/accent_dark"/>
<size android:height="4dp" android:width="4dp"/>
</shape>
</item>
</layer-list>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<size android:height="24dp" android:width="24dp"/>
</shape>
</item>
<item android:gravity="end">
<shape android:shape="rectangle">
<solid android:color="@color/accent_light"/>
<size android:height="4dp" android:width="4dp"/>
</shape>
</item>
</layer-list>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/transparent"/>
</selector>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Derived from https://github.com/androidx/androidx/blob/8cb282cc/preference/preference/res/layout/preference_widget_switch_compat.xml -->
<com.google.android.material.materialswitch.MaterialSwitch
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/switchWidget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:focusable="false" />

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 854 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.AntennaPod.Dynamic.Light" parent="Theme.Base.AntennaPod.Dynamic.Light">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
<!-- To make icons visible -->
<item name="android:navigationBarColor">@color/grey600</item>
</style>
</resources>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.AntennaPod.Dynamic.Light" parent="Theme.Base.AntennaPod.Dynamic.Light">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:navigationBarColor">@color/background_light</item>
<item name="android:navigationBarDividerColor">@color/navigation_bar_divider_light</item>
<item name="android:windowLightNavigationBar">true</item>
</style>
</resources>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="dragview_background" format="reference"/>
<attr name="progressBarTheme" format="reference"/>
<attr name="action_icon_color" format="color"/>
<attr name="scrollbar_thumb" format="reference"/>
<attr name="background_color" format="color"/>
<attr name="background_elevated" format="color"/>
<attr name="seek_background" format="color" />
<attr name="icon_red" format="color" />
<attr name="icon_yellow" format="color" />
<attr name="icon_green" format="color" />
<attr name="icon_purple" format="color" />
<attr name="icon_gray" format="color" />
</resources>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white">#FFFFFF</color>
<color name="grey100">#f5f5f5</color>
<color name="grey600">#757575</color>
<color name="light_gray">#bfbfbf</color>
<color name="medium_gray">#afafaf</color>
<color name="black">#000000</color>
<color name="image_readability_tint">#80000000</color>
<color name="feed_image_bg">#50000000</color>
<color name="feed_text_bg">#55333333</color>
<!-- Theme colors -->
<color name="background_light">#FFFFFF</color>
<color name="background_elevated_light">#EFEEEE</color>
<color name="background_darktheme">#21272b</color>
<color name="background_elevated_darktheme">#2D3337</color>
<color name="non_square_icon_background">#22777777</color>
<color name="seek_background_light">#90000000</color>
<color name="seek_background_dark">#905B5B5B</color>
<color name="navigation_bar_divider_light">#1F000000</color>
<color name="accent_light">#0078C2</color>
<color name="accent_dark">#3D8BFF</color>
<color name="gradient_000">#364ff3</color>
<color name="gradient_025">#2E6FF6</color>
<color name="gradient_075">#1EB0FC</color>
<color name="gradient_100">#16d0ff</color>
</resources>

View File

@ -0,0 +1,30 @@
<?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>
<dimen name="text_size_navdrawer">16sp</dimen>
<dimen name="text_size_large">22sp</dimen>
<dimen name="thumbnail_length_itemlist">56dp</dimen>
<dimen name="thumbnail_length_queue_item">56dp</dimen>
<dimen name="thumbnail_length_onlinefeedview">92dp</dimen>
<dimen name="feeditemlist_header_height">132dp</dimen>
<dimen name="thumbnail_length_navlist">40dp</dimen>
<dimen name="listitem_iconwithtext_height">48dp</dimen>
<dimen name="listitem_iconwithtext_textleftpadding">16dp</dimen>
<dimen name="listitem_threeline_textleftpadding">16dp</dimen>
<dimen name="listitem_threeline_textrightpadding">8dp</dimen>
<dimen name="listitem_threeline_verticalpadding">8dp</dimen>
<dimen name="list_vertical_padding">8dp</dimen>
<dimen name="listitem_icon_leftpadding">16dp</dimen>
<dimen name="audioplayer_playercontrols_length">48dp</dimen>
<dimen name="audioplayer_playercontrols_length_big">64dp</dimen>
<dimen name="audioplayer_playercontrols_margin">12dp</dimen>
<dimen name="nav_drawer_max_screen_size">480dp</dimen>
</resources>

View File

@ -0,0 +1,314 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.AntennaPod.Dynamic.Light" parent="Theme.Base.AntennaPod.Dynamic.Light">
<!-- Room for API dependent attributes -->
<!-- To make icons visible on API 21-23. Overwritten in API-specific folder -->
<item name="android:statusBarColor">@color/grey600</item>
<item name="android:navigationBarColor">@color/grey600</item>
</style>
<style name="Theme.Base.AntennaPod.Dynamic.Light" parent="Theme.Material3.DynamicColors.Light">
<item name="progressBarTheme">@style/ProgressBarLight</item>
<item name="background_color">@color/background_light</item>
<item name="actionBarStyle">@style/Widget.AntennaPod.ActionBar</item>
<item name="background_elevated">@color/background_elevated_light</item>
<item name="action_icon_color">@color/black</item>
<item name="android:textAllCaps">false</item>
<item name="seek_background">@color/seek_background_light</item>
<item name="dragview_background">@drawable/ic_drag_lighttheme</item>
<item name="scrollbar_thumb">@drawable/scrollbar_thumb_light</item>
<item name="icon_red">#CF1800</item>
<item name="icon_yellow">#F59F00</item>
<item name="icon_green">#008537</item>
<item name="icon_purple">#5F1984</item>
<item name="icon_gray">#25365A</item>
<item name="android:splitMotionEvents">false</item>
<item name="android:fitsSystemWindows">false</item>
<item name="android:windowContentTransitions">true</item>
<item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
</style>
<style name="Theme.AntennaPod.Light" parent="Theme.AntennaPod.Dynamic.Light">
<item name="isMaterial3DynamicColorApplied">false</item>
<item name="colorPrimary">@color/accent_light</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorAccent">@color/accent_light</item>
<item name="colorSecondary">@color/accent_light</item>
<item name="colorOnSecondary">@color/white</item>
<item name="colorPrimaryDark">@color/accent_light</item>
<item name="colorPrimaryContainer">@color/accent_light</item>
<item name="colorOnPrimaryContainer">@color/white</item>
<item name="android:colorBackground">@color/background_light</item>
<item name="colorSurface">@color/background_light</item>
<item name="colorSurfaceVariant">#D3DCE0</item>
</style>
<style name="Theme.AntennaPod.Dynamic.Dark" parent="Theme.Base.AntennaPod.Dynamic.Dark">
<!-- Room for API dependent attributes -->
</style>
<style name="Theme.Base.AntennaPod.Dynamic.Dark" parent="Theme.Material3.DynamicColors.Dark">
<item name="progressBarTheme">@style/ProgressBarDark</item>
<item name="background_color">@color/background_darktheme</item>
<item name="actionBarStyle">@style/Widget.AntennaPod.ActionBar</item>
<item name="background_elevated">@color/background_elevated_darktheme</item>
<item name="action_icon_color">@color/white</item>
<item name="android:textAllCaps">false</item>
<item name="seek_background">@color/seek_background_dark</item>
<item name="dragview_background">@drawable/ic_drag_darktheme</item>
<item name="scrollbar_thumb">@drawable/scrollbar_thumb_dark</item>
<item name="icon_red">#CF1800</item>
<item name="icon_yellow">#F59F00</item>
<item name="icon_green">#008537</item>
<item name="icon_purple">#AA55D8</item>
<item name="icon_gray">#CDD9E4</item>
<item name="android:splitMotionEvents">false</item>
<item name="android:fitsSystemWindows">false</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:navigationBarColor">@color/background_darktheme</item>
<item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
</style>
<style name="Theme.AntennaPod.Dark" parent="Theme.AntennaPod.Dynamic.Dark">
<item name="isMaterial3DynamicColorApplied">false</item>
<item name="colorPrimary">@color/accent_dark</item>
<item name="colorOnPrimary">@color/black</item>
<item name="colorAccent">@color/accent_dark</item>
<item name="colorSecondary">@color/accent_dark</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorPrimaryDark">@color/accent_dark</item>
<item name="colorPrimaryContainer">@color/accent_dark</item>
<item name="colorOnPrimaryContainer">@color/black</item>
<item name="android:colorBackground">@color/background_darktheme</item>
<item name="colorSurface">@color/background_darktheme</item>
<item name="colorSurfaceVariant">#2F3B4F</item>
</style>
<style name="Theme.AntennaPod.Dynamic.TrueBlack" parent="Theme.AntennaPod.Dynamic.Dark">
<item name="android:textColorPrimary">@color/white</item>
<item name="android:color">@color/white</item>
<item name="android:colorBackground">@color/black</item>
<item name="colorSurface">@color/black</item>
<item name="background_color">@color/black</item>
<item name="background_elevated">@color/black</item>
<item name="android:navigationBarColor">@color/black</item>
</style>
<style name="Theme.AntennaPod.TrueBlack" parent="Theme.AntennaPod.Dark">
<item name="android:textColorPrimary">@color/white</item>
<item name="android:color">@color/white</item>
<item name="android:colorBackground">@color/black</item>
<item name="colorSurface">@color/black</item>
<item name="background_color">@color/black</item>
<item name="background_elevated">@color/black</item>
<item name="android:navigationBarColor">@color/black</item>
</style>
<style name="Theme.AntennaPod.Dynamic.Light.NoTitle" parent="Theme.AntennaPod.Dynamic.Light">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="Theme.AntennaPod.Light.NoTitle" parent="Theme.AntennaPod.Light">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="Theme.AntennaPod.Dynamic.Dark.NoTitle" parent="Theme.AntennaPod.Dynamic.Dark">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="Theme.AntennaPod.Dark.NoTitle" parent="Theme.AntennaPod.Dark">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="Theme.AntennaPod.TrueBlack.NoTitle" parent="Theme.AntennaPod.TrueBlack">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="Theme.AntennaPod.Dynamic.TrueBlack.NoTitle" parent="Theme.AntennaPod.Dynamic.TrueBlack">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="Theme.AntennaPod.Dynamic.Light.Translucent" parent="Theme.AntennaPod.Dynamic.Light.NoTitle">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowAnimationStyle">@style/AnimationFade</item>
<item name="android:fitsSystemWindows">true</item>
</style>
<style name="Theme.AntennaPod.Light.Translucent" parent="Theme.AntennaPod.Light.NoTitle">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowAnimationStyle">@style/AnimationFade</item>
<item name="android:fitsSystemWindows">true</item>
</style>
<style name="Theme.AntennaPod.Dynamic.Dark.Translucent" parent="Theme.AntennaPod.Dynamic.Dark.NoTitle">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowAnimationStyle">@style/AnimationFade</item>
<item name="android:fitsSystemWindows">true</item>
</style>
<style name="Theme.AntennaPod.Dark.Translucent" parent="Theme.AntennaPod.Dark.NoTitle">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowAnimationStyle">@style/AnimationFade</item>
<item name="android:fitsSystemWindows">true</item>
</style>
<style name="Theme.AntennaPod.Dynamic.TrueBlack.Translucent" parent="Theme.AntennaPod.Dynamic.TrueBlack.NoTitle">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowAnimationStyle">@style/AnimationFade</item>
<item name="android:fitsSystemWindows">true</item>
</style>
<style name="Theme.AntennaPod.TrueBlack.Translucent" parent="Theme.AntennaPod.TrueBlack.NoTitle">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowAnimationStyle">@style/AnimationFade</item>
<item name="android:fitsSystemWindows">true</item>
</style>
<style name="AnimationFade">
<item name="android:windowEnterAnimation">@android:anim/fade_in</item>
<item name="android:windowExitAnimation">@android:anim/fade_out</item>
</style>
<style name="Theme.AntennaPod.Splash" parent="Theme.SplashScreen">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:fitsSystemWindows">true</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:enforceNavigationBarContrast" tools:targetApi="q">false</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/launcher_animate</item>
</style>
<style name="Theme.AntennaPod.VideoPlayer" parent="@style/Theme.AntennaPod.Dark">
<item name="windowActionBarOverlay">true</item>
</style>
<style name="AntennaPod.TextView.Heading" parent="@android:style/TextAppearance.Medium">
<item name="android:textSize">@dimen/text_size_large</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="AntennaPod.TextView.ListItemPrimaryTitle" parent="@style/TextAppearance.Material3.BodyLarge">
<item name="android:textColor">?attr/colorOnSurface</item>
<item name="android:maxLines">2</item>
<item name="android:ellipsize">end</item>
<item name="lineHeight">20sp</item>
<item name="android:lineHeight" tools:targetApi="p">20sp</item>
</style>
<style name="AntennaPod.TextView.ListItemSecondaryTitle" parent="@style/TextAppearance.Material3.BodyMedium">
<item name="android:textColor">?attr/colorOnSurfaceVariant</item>
<item name="android:lines">1</item>
<item name="android:ellipsize">end</item>
</style>
<style name="AntennaPod.TextView.ListItemBody" parent="@style/TextAppearance.Material3.BodyMedium">
<item name="android:textColor">?attr/colorOnSurfaceVariant</item>
<item name="lineHeight">18sp</item>
<item name="android:lineHeight" tools:targetApi="p">18sp</item>
</style>
<style name="OutlinedButtonBetterContrast" parent="Widget.Material3.Button.OutlinedButton">
<item name="backgroundTint">@color/button_bg_selector</item>
</style>
<style name="ProgressBarLight">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@drawable/progress_bar_horizontal_light</item>
</style>
<style name="ProgressBarDark">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@drawable/progress_bar_horizontal_dark</item>
</style>
<style name="FastScrollRecyclerView" parent="android:Widget">
<item name="android:scrollbars">none</item>
<item name="fastScrollEnabled">true</item>
<item name="fastScrollHorizontalThumbDrawable">?attr/scrollbar_thumb</item>
<item name="fastScrollHorizontalTrackDrawable">@drawable/scrollbar_track</item>
<item name="fastScrollVerticalThumbDrawable">?attr/scrollbar_thumb</item>
<item name="fastScrollVerticalTrackDrawable">@drawable/scrollbar_track</item>
</style>
<style name="Widget.AntennaPod.ActionBar" parent="Widget.Material3.Light.ActionBar.Solid">
<item name="background">?android:attr/colorBackground</item>
<item name="elevation">0dp</item>
</style>
<style name="AddPodcastTextView">
<item name="android:drawablePadding">8dp</item>
<item name="android:paddingTop">8dp</item>
<item name="android:paddingBottom">8dp</item>
<item name="android:background">?android:attr/selectableItemBackground</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:clickable">true</item>
</style>
<style name="TextPill">
<item name="android:background">@drawable/bg_pill_translucent</item>
<item name="android:layout_margin">8dp</item>
<item name="android:textColor">@color/white</item>
<item name="android:textAlignment">center</item>
<item name="android:paddingStart">8dp</item>
<item name="android:paddingEnd">8dp</item>
</style>
<style name="AppPreferenceThemeOverlay" parent="@style/PreferenceThemeOverlay">
<item name="switchPreferenceCompatStyle">@style/AppSwitchPreference</item>
</style>
<style name="AppSwitchPreference" parent="@style/Preference.SwitchPreferenceCompat.Material">
<item name="widgetLayout">@layout/preference_material_switch</item>
</style>
</resources>

View File

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

View File

@ -26,9 +26,9 @@ import com.bumptech.glide.request.RequestOptions;
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.StatisticsItem;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.ui.common.Converter;
import de.danoeh.antennapod.ui.echo.databinding.EchoActivityBinding;
import de.danoeh.antennapod.ui.echo.screens.BubbleScreen;
import de.danoeh.antennapod.ui.echo.screens.FinalShareScreen;

View File

@ -11,8 +11,8 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.StatisticsItem;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.util.DateFormatter;
import de.danoeh.antennapod.ui.common.Converter;
import de.danoeh.antennapod.ui.common.DateFormatter;
import de.danoeh.antennapod.core.util.ReleaseScheduleGuesser;
import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedItemFilter;

View File

@ -3,7 +3,7 @@ package de.danoeh.antennapod.ui.statistics.subscriptions;
import android.text.format.DateFormat;
import androidx.fragment.app.Fragment;
import de.danoeh.antennapod.core.storage.StatisticsItem;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.ui.common.Converter;
import de.danoeh.antennapod.ui.statistics.PieChartView;
import de.danoeh.antennapod.ui.statistics.R;
import de.danoeh.antennapod.ui.statistics.StatisticsListAdapter;

View File

@ -13,5 +13,7 @@ android {
}
dependencies {
implementation project(":ui:common")
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
}