Merge pull request #6237 from ByteHamster/tinted-theme

Add support for Material You tinted theme
This commit is contained in:
ByteHamster 2022-12-18 18:17:03 +01:00 committed by GitHub
commit 3acec11322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 527 additions and 627 deletions

View File

@ -131,10 +131,14 @@
<activity
android:name=".activity.PreferenceActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="false"
android:label="@string/settings_label">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.danoeh.antennapod.activity.MainActivity"/>
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
</intent-filter>
</activity>
<activity

View File

@ -5,6 +5,7 @@ import android.content.Intent;
import android.os.StrictMode;
import androidx.multidex.MultiDexApplication;
import com.google.android.material.color.DynamicColors;
import com.joanzapata.iconify.Iconify;
import com.joanzapata.iconify.fonts.FontAwesomeModule;
import com.joanzapata.iconify.fonts.MaterialModule;
@ -64,6 +65,8 @@ public class PodcastApp extends MultiDexApplication {
.logNoSubscriberMessages(false)
.sendNoSubscriberEvent(false)
.installDefaultEventBus();
DynamicColors.applyToActivitiesIfAvailable(this);
}
public static void forceRestart() {

View File

@ -3,12 +3,9 @@ package de.danoeh.antennapod.activity;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.ProgressBar;
@ -29,14 +26,8 @@ public class SplashActivity extends AppCompatActivity {
setContentView(R.layout.splash);
ProgressBar progressBar = findViewById(R.id.progressBar);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Drawable wrapDrawable = DrawableCompat.wrap(progressBar.getIndeterminateDrawable());
DrawableCompat.setTint(wrapDrawable, 0xffffffff);
progressBar.setIndeterminateDrawable(DrawableCompat.unwrap(wrapDrawable));
} else {
progressBar.getIndeterminateDrawable().setColorFilter(
new PorterDuffColorFilter(0xffffffff, PorterDuff.Mode.SRC_IN));
}
Completable.create(subscriber -> {
// Trigger schema updates

View File

@ -14,12 +14,12 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.FitCenter;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.elevation.SurfaceColors;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.model.feed.Chapter;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.model.feed.EmbeddedChapterImage;
import de.danoeh.antennapod.core.util.IntentUtils;
import de.danoeh.antennapod.ui.common.ThemeUtils;
import de.danoeh.antennapod.model.playback.Playable;
import de.danoeh.antennapod.ui.common.CircularProgressBar;
@ -85,8 +85,8 @@ public class ChaptersListAdapter extends RecyclerView.Adapter<ChaptersListAdapte
});
if (position == currentChapterIndex) {
int playingBackGroundColor = ThemeUtils.getColorFromAttr(context, R.attr.currently_playing_background);
holder.itemView.setBackgroundColor(playingBackGroundColor);
float density = context.getResources().getDisplayMetrics().density;
holder.itemView.setBackgroundColor(SurfaceColors.getColorForElevation(context, 8 * density));
float progress = ((float) (currentChapterPosition - sc.getStart())) / duration;
progress = Math.max(progress, CircularProgressBar.MINIMUM_PERCENTAGE);
progress = Math.min(progress, CircularProgressBar.MAXIMUM_PERCENTAGE);

View File

@ -8,7 +8,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Toast;
import androidx.core.content.ContextCompat;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
@ -93,7 +92,7 @@ public class DownloadLogAdapter extends BaseAdapter {
}
if (status.isSuccessful()) {
holder.icon.setTextColor(ContextCompat.getColor(context, R.color.download_success_green));
holder.icon.setTextColor(ThemeUtils.getColorFromAttr(context, R.attr.icon_green));
holder.icon.setText("{fa-check-circle}");
holder.icon.setContentDescription(context.getString(R.string.download_successful));
holder.secondaryActionButton.setVisibility(View.INVISIBLE);
@ -101,10 +100,10 @@ public class DownloadLogAdapter extends BaseAdapter {
holder.tapForDetails.setVisibility(View.GONE);
} else {
if (status.getReason() == DownloadError.ERROR_PARSER_EXCEPTION_DUPLICATE) {
holder.icon.setTextColor(ContextCompat.getColor(context, R.color.download_warning_yellow));
holder.icon.setTextColor(ThemeUtils.getColorFromAttr(context, R.attr.icon_yellow));
holder.icon.setText("{fa-exclamation-circle}");
} else {
holder.icon.setTextColor(ContextCompat.getColor(context, R.color.download_failed_red));
holder.icon.setTextColor(ThemeUtils.getColorFromAttr(context, R.attr.icon_red));
holder.icon.setText("{fa-times-circle}");
}
holder.icon.setContentDescription(context.getString(R.string.error_label));

View File

@ -6,7 +6,6 @@ import android.content.res.TypedArray;
import android.os.Build;
import androidx.appcompat.app.AlertDialog;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import androidx.core.content.ContextCompat;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
@ -31,6 +30,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import de.danoeh.antennapod.model.download.ProxyConfig;
import de.danoeh.antennapod.ui.common.ThemeUtils;
import io.reactivex.Completable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
@ -299,7 +299,7 @@ public class ProxyDialog {
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
() -> {
txtvMessage.setTextColor(ContextCompat.getColor(context, R.color.download_success_green));
txtvMessage.setTextColor(ThemeUtils.getColorFromAttr(context, R.attr.icon_green));
String message = String.format("%s %s", "{fa-check}",
context.getString(R.string.proxy_test_successful));
txtvMessage.setText(message);
@ -307,7 +307,7 @@ public class ProxyDialog {
},
error -> {
error.printStackTrace();
txtvMessage.setTextColor(ContextCompat.getColor(context, R.color.download_failed_red));
txtvMessage.setTextColor(ThemeUtils.getColorFromAttr(context, R.attr.icon_red));
String message = String.format("%s %s: %s", "{fa-close}",
context.getString(R.string.proxy_test_failed), error.getMessage());
txtvMessage.setText(message);

View File

@ -6,7 +6,6 @@ import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
@ -19,7 +18,6 @@ import androidx.activity.result.contract.ActivityResultContracts;
import androidx.activity.result.contract.ActivityResultContracts.GetContent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import androidx.documentfile.provider.DocumentFile;
import androidx.fragment.app.Fragment;
@ -105,9 +103,6 @@ public class AddFeedFragment extends Fragment {
});
viewBinding.addLocalFolderButton.setOnClickListener(v -> {
if (Build.VERSION.SDK_INT < 21) {
return;
}
try {
addLocalFolderLauncher.launch(null);
} catch (ActivityNotFoundException e) {
@ -116,10 +111,6 @@ public class AddFeedFragment extends Fragment {
.showSnackbarAbovePlayer(R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG);
}
});
if (Build.VERSION.SDK_INT < 21) {
viewBinding.addLocalFolderButton.setVisibility(View.GONE);
}
viewBinding.searchButton.setOnClickListener(view -> performSearch());
return viewBinding.getRoot();
@ -205,9 +196,6 @@ public class AddFeedFragment extends Fragment {
}
private Feed addLocalFolder(Uri uri) {
if (Build.VERSION.SDK_INT < 21) {
return null;
}
getActivity().getContentResolver()
.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
DocumentFile documentFile = DocumentFile.fromTreeUri(getContext(), uri);
@ -227,7 +215,6 @@ public class AddFeedFragment extends Fragment {
}
private static class AddLocalFolder extends ActivityResultContracts.OpenDocumentTree {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@NonNull
@Override
public Intent createIntent(@NonNull final Context context, @Nullable final Uri input) {

View File

@ -121,7 +121,8 @@ public class AudioPlayerFragment extends Fragment implements
getChildFragmentManager().beginTransaction()
.replace(R.id.playerFragment, externalPlayerFragment, ExternalPlayerFragment.TAG)
.commit();
root.findViewById(R.id.playerFragment).setBackgroundColor(SurfaceColors.getColorForElevation(getContext(), 8));
root.findViewById(R.id.playerFragment).setBackgroundColor(
SurfaceColors.getColorForElevation(getContext(), 8 * getResources().getDisplayMetrics().density));
butPlaybackSpeed = root.findViewById(R.id.butPlaybackSpeed);
txtvPlaybackSpeed = root.findViewById(R.id.txtvPlaybackSpeed);

View File

@ -1,6 +1,5 @@
package de.danoeh.antennapod.fragment;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
@ -80,9 +79,7 @@ public class DownloadLogFragment extends BottomSheetDialogFragment
adapter = new DownloadLogAdapter(getActivity());
viewBinding.list.setAdapter(adapter);
viewBinding.list.setOnItemClickListener(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
viewBinding.list.setNestedScrollingEnabled(true);
}
EventBus.getDefault().register(this);
return viewBinding.getRoot();
}

View File

@ -7,7 +7,6 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.LightingColorFilter;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
@ -22,7 +21,6 @@ import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import androidx.appcompat.content.res.AppCompatResources;
import com.google.android.material.appbar.MaterialToolbar;
@ -290,7 +288,7 @@ public class FeedInfoFragment extends Fragment implements MaterialToolbar.OnMenu
}
boolean handled = FeedMenuHandler.onOptionsItemClicked(getContext(), item, feed);
if (item.getItemId() == R.id.reconnect_local_folder && Build.VERSION.SDK_INT >= 21) {
if (item.getItemId() == R.id.reconnect_local_folder) {
MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(getContext());
alert.setMessage(R.string.reconnect_local_folder_warning);
alert.setPositiveButton(android.R.string.ok, (dialog, which) -> {
@ -329,7 +327,7 @@ public class FeedInfoFragment extends Fragment implements MaterialToolbar.OnMenu
}
private void reconnectLocalFolder(Uri uri) {
if (Build.VERSION.SDK_INT < 21 || feed == null) {
if (feed == null) {
return;
}
@ -353,7 +351,6 @@ public class FeedInfoFragment extends Fragment implements MaterialToolbar.OnMenu
}
private static class AddLocalFolder extends ActivityResultContracts.OpenDocumentTree {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@NonNull
@Override
public Intent createIntent(@NonNull final Context context, @Nullable final Uri input) {

View File

@ -44,6 +44,16 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat {
return true;
});
if (Build.VERSION.SDK_INT < 31) {
findPreference(UserPreferences.PREF_TINTED_COLORS).setVisible(false);
}
findPreference(UserPreferences.PREF_TINTED_COLORS)
.setOnPreferenceChangeListener(
(preference, newValue) -> {
ActivityCompat.recreate(getActivity());
return true;
});
findPreference(UserPreferences.PREF_SHOW_TIME_LEFT)
.setOnPreferenceChangeListener(
(preference, newValue) -> {

View File

@ -1,16 +1,14 @@
package de.danoeh.antennapod.preferences;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Build;
import androidx.preference.SwitchPreferenceCompat;
import androidx.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.TextView;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.ui.common.ThemeUtils;
public class MasterSwitchPreference extends SwitchPreferenceCompat {
@ -18,7 +16,6 @@ public class MasterSwitchPreference extends SwitchPreferenceCompat {
super(context, attrs, defStyleAttr);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public MasterSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@ -36,10 +33,7 @@ public class MasterSwitchPreference extends SwitchPreferenceCompat {
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
TypedValue typedValue = new TypedValue();
getContext().getTheme().resolveAttribute(R.attr.master_switch_background, typedValue, true);
holder.itemView.setBackgroundColor(typedValue.data);
holder.itemView.setBackgroundColor(ThemeUtils.getColorFromAttr(getContext(), R.attr.colorSurfaceVariant));
TextView title = (TextView) holder.findViewById(android.R.id.title);
if (title != null) {
title.setTypeface(title.getTypeface(), Typeface.BOLD);

View File

@ -6,6 +6,7 @@ import android.graphics.Paint;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.ui.common.ThemeUtils;
public class ChapterSeekBar extends androidx.appcompat.widget.AppCompatSeekBar {
@ -42,11 +43,9 @@ public class ChapterSeekBar extends androidx.appcompat.widget.AppCompatSeekBar {
dividerPos = null;
density = context.getResources().getDisplayMetrics().density;
paintBackground.setColor(ThemeUtils.getColorFromAttr(getContext(),
de.danoeh.antennapod.core.R.attr.currently_playing_background));
paintBackground.setColor(ThemeUtils.getColorFromAttr(getContext(), R.attr.colorSurfaceVariant));
paintBackground.setAlpha(128);
paintProgressPrimary.setColor(ThemeUtils.getColorFromAttr(getContext(),
de.danoeh.antennapod.core.R.attr.colorPrimary));
paintProgressPrimary.setColor(ThemeUtils.getColorFromAttr(getContext(), R.attr.colorPrimary));
}
/**

View File

@ -21,7 +21,6 @@ package de.danoeh.antennapod.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@ -31,7 +30,6 @@ import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.viewpager2.widget.ViewPager2;
import de.danoeh.antennapod.R;
@ -75,7 +73,6 @@ public class NestedScrollableHost extends FrameLayout {
setAttributes(context, attrs);
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public NestedScrollableHost(@NonNull Context context, @Nullable AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);

View File

@ -6,7 +6,6 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ContextMenu;
@ -63,9 +62,7 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene
getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
// Use cached resources, even if they have expired
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}
getSettings().setUseWideViewPort(false);
getSettings().setLoadWithOverviewMode(true);
setOnLongClickListener(this);

View File

@ -14,6 +14,7 @@ import android.widget.TextView;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.elevation.SurfaceColors;
import com.joanzapata.iconify.Iconify;
import de.danoeh.antennapod.R;
@ -138,7 +139,8 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder {
duration.setVisibility(media.getDuration() > 0 ? View.VISIBLE : View.GONE);
if (PlaybackStatus.isCurrentlyPlaying(media)) {
itemView.setBackgroundColor(ThemeUtils.getColorFromAttr(activity, R.attr.currently_playing_background));
float density = activity.getResources().getDisplayMetrics().density;
itemView.setBackgroundColor(SurfaceColors.getColorForElevation(activity, 8 * density));
} else {
itemView.setBackgroundResource(ThemeUtils.getDrawableFromAttr(activity, R.attr.selectableItemBackground));
}

View File

@ -8,6 +8,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.elevation.SurfaceColors;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.CoverLoader;
@ -56,6 +57,8 @@ public class HorizontalItemViewHolder extends RecyclerView.ViewHolder {
this.item = item;
card.setAlpha(1.0f);
float density = activity.getResources().getDisplayMetrics().density;
card.setCardBackgroundColor(SurfaceColors.getColorForElevation(activity, 1 * density));
new CoverLoader(activity)
.withUri(ImageResourceUtils.getEpisodeListImageLocation(item))
.withFallbackUri(item.getFeed().getImageUrl())
@ -73,9 +76,7 @@ public class HorizontalItemViewHolder extends RecyclerView.ViewHolder {
setProgressBar(false, 0);
} else {
if (PlaybackStatus.isCurrentlyPlaying(media)) {
card.setCardBackgroundColor(ThemeUtils.getColorFromAttr(activity, R.attr.card_background_playing));
} else {
card.setCardBackgroundColor(ThemeUtils.getColorFromAttr(activity, R.attr.card_background));
card.setCardBackgroundColor(ThemeUtils.getColorFromAttr(activity, R.attr.colorSurfaceVariant));
}
if (item.getMedia().getDuration() > 0 && item.getMedia().getPosition() > 0) {

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape
android:shape="rectangle">
<corners
android:radius="8dp"
android:topRightRadius="8dp"
android:bottomRightRadius="8dp"
android:bottomLeftRadius="8dp" />
<solid android:color="@android:color/white"/>
</shape>
</item>
<item>
<shape
android:shape="rectangle">
<corners
android:radius="8dp"
android:topRightRadius="8dp"
android:bottomRightRadius="8dp"
android:bottomLeftRadius="8dp" />
<stroke
android:width="1dp"
android:color="?android:attr/textColorSecondary" />
<solid android:color="@android:color/transparent"/>
</shape>
</item>
</ripple>

View File

@ -1,9 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<selector>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape
android:shape="rectangle">
<corners
android:radius="8dp"
android:topRightRadius="8dp"
android:bottomRightRadius="8dp"
android:bottomLeftRadius="8dp" />
<solid android:color="@android:color/white"/>
</shape>
</item>
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
<shape
android:shape="rectangle">
<corners
android:radius="8dp"
@ -12,10 +22,8 @@
android:bottomLeftRadius="8dp" />
<stroke
android:width="1dp"
android:color="@android:color/darker_gray" />
android:color="?android:attr/textColorSecondary" />
<solid android:color="@android:color/transparent"/>
</shape>
</item>
</selector>
</ripple>

View File

@ -11,7 +11,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="?attr/background_elevated"
android:elevation="8dp"
tools:layout_height="@dimen/external_player_height" />

View File

@ -29,31 +29,31 @@
android:gravity="center_vertical">
<com.joanzapata.iconify.widget.IconTextView
android:id="@+id/txtvIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:padding="2dp"
android:id="@+id/txtvIcon"
android:textSize="18sp"
android:gravity="center" />
<TextView
android:id="@+id/txtvTitle"
style="@style/AntennaPod.TextView.ListItemPrimaryTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="@sample/episodes.json/data/title"
android:maxLines="1"
android:ellipsize="end"
style="@style/AntennaPod.TextView.ListItemPrimaryTitle"
tools:text="@sample/episodes.json/data/title"
tools:background="@android:color/holo_blue_light" />
</LinearLayout>
<TextView
android:id="@+id/status"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
tools:text="Media file - 01/01/1970" />
<TextView
@ -61,7 +61,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@color/download_failed_red"
android:textColor="?attr/icon_red"
tools:text="@string/design_time_downloaded_log_failure_reason" />
<TextView
@ -74,5 +74,7 @@
</LinearLayout>
<include layout="@layout/secondary_action"/>
<include
layout="@layout/secondary_action" />
</LinearLayout>

View File

@ -17,9 +17,9 @@
<ImageView
android:id="@+id/imgvCover"
android:contentDescription="@string/media_player"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/media_player"
android:adjustViewBounds="true"
android:cropToPadding="true"
android:maxWidth="96dp"
@ -27,7 +27,6 @@
android:background="@color/non_square_icon_background"
tools:src="@tools:sample/avatars" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -40,22 +39,22 @@
android:id="@+id/txtvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Base.TextAppearance.AppCompat.Body1"
android:ellipsize="end"
android:maxLines="1"
style="@style/Base.TextAppearance.AppCompat.Body1"
tools:text="Episode title that is too long and will cause the text to wrap" />
<TextView
android:id="@+id/txtvAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextAppearance.AppCompat.Body1"
android:textColor="?android:attr/textColorSecondary"
android:ellipsize="end"
android:maxLines="1"
style="@style/TextAppearance.AppCompat.Body1"
tools:text="Episode author that is too long and will cause the text to wrap" />
</LinearLayout>
</LinearLayout>
<de.danoeh.antennapod.view.PlayButton
android:id="@+id/butPlay"
@ -63,9 +62,9 @@
android:layout_height="match_parent"
android:contentDescription="@string/pause_label"
android:background="?attr/selectableItemBackground"
app:srcCompat="@drawable/ic_play_48dp"
android:scaleType="fitCenter"
android:padding="8dp"
app:srcCompat="@drawable/ic_play_48dp"
tools:src="@drawable/ic_play_48dp" />
</LinearLayout>
@ -74,8 +73,8 @@
android:id="@+id/episodeProgress"
android:layout_width="match_parent"
android:layout_height="4dp"
style="?attr/progressBarTheme"
android:indeterminate="false"
style="?android:attr/progressBarStyleHorizontal"
tools:progress="100" />
</LinearLayout>

View File

@ -23,7 +23,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/image_readability_tint"
style="@style/BigBlurryBackground"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.6" />

View File

@ -26,7 +26,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/image_readability_tint"
style="@style/BigBlurryBackground"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.6" />

View File

@ -145,7 +145,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:background="@color/download_failed_red"
android:background="?attr/icon_red"
android:gravity="center"
android:textColor="@color/white"
android:visibility="gone"

View File

@ -109,8 +109,7 @@
android:layout_width="14sp"
android:layout_height="14sp"
android:contentDescription="@string/is_inbox_label"
app:srcCompat="@drawable/ic_inbox"
app:tint="?attr/colorAccent" />
app:srcCompat="@drawable/ic_inbox" />
<ImageView
android:id="@+id/ivIsVideo"
@ -214,7 +213,7 @@
android:layout_weight="1"
android:max="100"
android:layout_margin="4dp"
style="?attr/progressBarTheme"
style="?android:attr/progressBarStyleHorizontal"
tools:background="@android:color/holo_blue_light" />
<TextView

View File

@ -58,7 +58,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/download_failed_red"
android:textColor="?attr/icon_red"
android:textSize="@dimen/text_size_small"
android:maxLines="2"
android:ellipsize="end"

View File

@ -7,9 +7,9 @@
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/deviceName"
@ -31,15 +31,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/AntennaPod.TextView.Heading"
android:layout_marginTop="16dp"
android:text="@string/gpodnetauth_existing_devices"/>
android:text="@string/gpodnetauth_existing_devices"
style="@style/AntennaPod.TextView.Heading" />
<TextView
android:id="@+id/deviceSelectError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/download_failed_red"
android:textColor="?attr/icon_red"
android:textSize="@dimen/text_size_small"
android:visibility="gone"
tools:text="Error message"
@ -55,7 +55,7 @@
android:id="@+id/progbarCreateDevice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/download_failed_red"
android:textColor="?attr/icon_red"
android:visibility="gone" />
</LinearLayout>

View File

@ -34,7 +34,7 @@
android:layout_height="80dp"
android:layout_marginBottom="8dp"
android:layout_gravity="start"
android:src="@drawable/ic_curved_arrow" />
app:srcCompat="@drawable/ic_curved_arrow" />
<ImageView
android:id="@+id/icon"
@ -42,7 +42,7 @@
android:layout_height="64dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="16dp"
android:src="@mipmap/ic_launcher" />
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"

View File

@ -58,8 +58,7 @@
android:layout_toLeftOf="@id/txtvCount"
android:visibility="gone"
app:srcCompat="@drawable/ic_error"
app:tint="@color/download_failed_red"
tools:background="@android:color/holo_green_dark"
app:tint="?attr/icon_red"
tools:text="!" />
<TextView

View File

@ -51,7 +51,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:textColor="@color/download_failed_red"
android:textColor="?attr/icon_red"
android:layout_marginBottom="16dp" />
<Button

View File

@ -3,29 +3,29 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/transparentBackground">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="4dp"
android:layout_margin="32dp"
android:elevation="16dp"
android:id="@+id/card">
<FrameLayout
android:orientation="vertical"
android:id="@+id/transparentBackground"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="32dp"
android:elevation="16dp"
app:cardCornerRadius="4dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ProgressBar
style="?android:attr/progressBarStyle"
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_gravity="center"/>
android:layout_gravity="center"
style="?android:attr/progressBarStyle" />
<LinearLayout
android:id="@+id/feed_display_container"
@ -40,9 +40,9 @@
<ImageView
android:id="@+id/backgroundImage"
style="@style/BigBlurryBackground"
android:layout_width="match_parent"
android:layout_height="@dimen/feeditemlist_header_height"/>
android:layout_height="@dimen/feeditemlist_header_height"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/coverImage"
@ -61,7 +61,6 @@
<TextView
android:id="@+id/titleLabel"
style="@style/AntennaPod.TextView.Heading"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
@ -80,6 +79,7 @@
android:shadowColor="@color/black"
android:shadowRadius="3"
android:textColor="@color/white"
style="@style/AntennaPod.TextView.Heading"
tools:text="Podcast title" />
<TextView
@ -103,6 +103,7 @@
android:textColor="@color/white"
android:textSize="@dimen/text_size_small"
tools:text="Podcast author" />
</RelativeLayout>
<LinearLayout
@ -164,5 +165,7 @@
</LinearLayout>
</FrameLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>

View File

@ -11,6 +11,11 @@
android:key="prefTheme"
android:summary="@string/pref_set_theme_sum"
android:defaultValue="system"/>
<SwitchPreferenceCompat
android:title="@string/pref_tinted_theme_title"
android:key="prefTintedColors"
android:summary="@string/pref_tinted_theme_message"
android:defaultValue="false" />
<Preference
android:key="prefHiddenDrawerItems"
android:summary="@string/pref_nav_drawer_items_sum"

View File

@ -2,7 +2,7 @@ android {
compileSdk 31
defaultConfig {
minSdk 19
minSdk 21
targetSdk 31
multiDexEnabled true

View File

@ -9,40 +9,48 @@ 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 R.style.Theme_AntennaPod_Dark;
return dynamic ? R.style.Theme_AntennaPod_Dynamic_Dark : R.style.Theme_AntennaPod_Dark;
case BLACK:
return R.style.Theme_AntennaPod_TrueBlack;
return dynamic ? R.style.Theme_AntennaPod_Dynamic_TrueBlack : R.style.Theme_AntennaPod_TrueBlack;
case LIGHT: // fall-through
default:
return R.style.Theme_AntennaPod_Light;
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 R.style.Theme_AntennaPod_Dark_NoTitle;
return dynamic ? R.style.Theme_AntennaPod_Dynamic_Dark_NoTitle : R.style.Theme_AntennaPod_Dark_NoTitle;
case BLACK:
return R.style.Theme_AntennaPod_TrueBlack_NoTitle;
return dynamic ? R.style.Theme_AntennaPod_Dynamic_TrueBlack_NoTitle
: R.style.Theme_AntennaPod_TrueBlack_NoTitle;
case LIGHT: // fall-through
default:
return R.style.Theme_AntennaPod_Light_NoTitle;
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 R.style.Theme_AntennaPod_Dark_Translucent;
return dynamic ? R.style.Theme_AntennaPod_Dynamic_Dark_Translucent
: R.style.Theme_AntennaPod_Dark_Translucent;
case BLACK:
return R.style.Theme_AntennaPod_TrueBlack_Translucent;
return dynamic ? R.style.Theme_AntennaPod_Dynamic_TrueBlack_Translucent
: R.style.Theme_AntennaPod_TrueBlack_Translucent;
case LIGHT: // fall-through
default:
return R.style.Theme_AntennaPod_Light_Translucent;
return dynamic ? R.style.Theme_AntennaPod_Dynamic_Light_Translucent
: R.style.Theme_AntennaPod_Light_Translucent;
}
}

View File

@ -7,7 +7,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.IBinder;
import android.text.TextUtils;
import android.util.Log;
@ -135,11 +134,9 @@ public class DownloadService extends Service {
cancelDownloadReceiverFilter.addAction(ACTION_CANCEL_DOWNLOAD);
registerReceiver(cancelDownloadReceiver, cancelDownloadReceiverFilter);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
connectionMonitor = new ConnectionStateMonitor();
connectionMonitor.enable(getApplicationContext());
}
}
public static boolean isDownloadingFeeds() {
if (!isRunning) {
@ -206,9 +203,7 @@ public class DownloadService extends Service {
}
unregisterReceiver(cancelDownloadReceiver);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
connectionMonitor.disable(getApplicationContext());
}
EventBus.getDefault().postSticky(DownloadEvent.refresh(Collections.emptyList()));
cancelNotificationUpdater();

View File

@ -4,7 +4,6 @@ import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.os.Build;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import de.danoeh.antennapod.core.ClientConfig;
@ -37,9 +36,7 @@ public class DownloadServiceNotification {
.setShowWhen(false)
.setContentIntent(ClientConfig.downloadServiceCallbacks.getNotificationContentIntent(context))
.setSmallIcon(R.drawable.ic_notification_sync);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
notificationCompatBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
}
Log.d(TAG, "Notification set up");
}
@ -208,9 +205,7 @@ public class DownloadServiceNotification {
.setSmallIcon(iconId)
.setContentIntent(intent)
.setAutoCancel(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
}
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(id, builder.build());
Log.d(TAG, "Download report notification was posted");
@ -232,9 +227,7 @@ public class DownloadServiceNotification {
.setSmallIcon(R.drawable.ic_notification_key)
.setAutoCancel(true)
.setContentIntent(ClientConfig.downloadServiceCallbacks.getAuthentificationNotificationContentIntent(context, downloadRequest));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
}
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(downloadRequest.getSource().hashCode(), builder.build());
}

View File

@ -1168,20 +1168,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
| PlaybackStateCompat.ACTION_SEEK_TO
| PlaybackStateCompat.ACTION_SET_PLAYBACK_SPEED;
if (useSkipToPreviousForRewindInLockscreen()) {
// Workaround to fool Android so that Lockscreen will expose a skip-to-previous button,
// which will be used for rewind.
// The workaround is used for pre Lollipop (Androidv5) devices.
// For Androidv5+, lockscreen widges are really notifications (compact),
// with an independent codepath
//
// @see #sessionCallback in the backing callback, skipToPrevious implementation
// is actually the same as rewind. So no new inconsistency is created.
// @see #setupNotification() for the method to create Androidv5+ lockscreen UI
// with notification (compact)
capabilities = capabilities | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS;
}
UiModeManager uiModeManager = (UiModeManager) getApplicationContext()
.getSystemService(Context.UI_MODE_SERVICE);
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) {
@ -1216,14 +1202,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
mediaSession.setPlaybackState(sessionState.build());
}
private static boolean useSkipToPreviousForRewindInLockscreen() {
// showRewindOnCompactNotification() corresponds to the "Set Lockscreen Buttons"
// Settings in UI.
// Hence, from user perspective, he/she is setting the buttons for Lockscreen
return (UserPreferences.showRewindOnCompactNotification() &&
(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP));
}
private void updateNotificationAndMediaSession(final Playable p) {
setupNotification(p);
updateMediaSessionMetadata(p);

View File

@ -1,6 +1,5 @@
package de.danoeh.antennapod.core.service.playback;
import android.annotation.TargetApi;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
@ -110,7 +109,6 @@ public class PlaybackServiceNotificationBuilder {
return defaultIcon;
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static Bitmap getBitmap(VectorDrawable vectorDrawable) {
Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
@ -124,7 +122,7 @@ public class PlaybackServiceNotificationBuilder {
Drawable drawable = ContextCompat.getDrawable(context, drawableId);
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && drawable instanceof VectorDrawable) {
} else if (drawable instanceof VectorDrawable) {
return getBitmap((VectorDrawable) drawable);
} else {
return null;

View File

@ -6,7 +6,6 @@ import android.net.Uri;
import android.provider.DocumentsContract;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
@ -21,10 +20,6 @@ public class FastDocumentFile {
private final long lastModified;
public static List<FastDocumentFile> list(Context context, Uri folderUri) {
if (android.os.Build.VERSION.SDK_INT < 21) {
return Collections.emptyList();
}
Uri childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(folderUri,
DocumentsContract.getDocumentId(folderUri));
Cursor cursor = context.getContentResolver().query(childrenUri, new String[] {

View File

@ -4,12 +4,8 @@ import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.os.Build;
import android.util.Log;
import androidx.annotation.RequiresApi;
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public class ConnectionStateMonitor
extends ConnectivityManager.NetworkCallback
implements ConnectivityManager.OnNetworkActiveListener {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?attr/currently_playing_background">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/black"/>
<corners android:radius="32dp"/>
</shape>
</item>
<item>
<selector>
<item android:state_selected="true">
<shape android:shape="rectangle">
<solid android:color="?attr/drawer_activated_color"/>
<corners android:radius="32dp"/>
</shape>
</item>
<item android:drawable="@android:color/transparent" />
</selector>
</item>
</ripple>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

View File

@ -1,16 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?attr/colorSurfaceVariant">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="?attr/currently_playing_background"/>
<solid android:color="@color/black"/>
<corners android:radius="32dp"/>
</shape>
</item>
<item>
<selector>
<item android:state_selected="true">
<shape android:shape="rectangle">
<solid android:color="?attr/drawer_activated_color" />
<solid android:color="?attr/colorSurfaceVariant"/>
<corners android:radius="32dp"/>
</shape>
</item>
<item android:drawable="@android:color/transparent" />
</selector>
</item>
</ripple>

View File

@ -8,7 +8,7 @@
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="@color/accent_dark"/>
<solid android:color="?attr/colorAccent"/>
</shape>
</clip>
</item>

View File

@ -8,7 +8,7 @@
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="@color/accent_light"/>
<solid android:color="?attr/colorAccent"/>
</shape>
</clip>
</item>

View File

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

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light">
<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 -->

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light">
<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>

View File

@ -1,11 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="navigation_up" format="reference"/>
<attr name="dragview_background" format="reference"/>
<attr name="progressBarTheme" format="reference"/>
<attr name="master_switch_background" format="color"/>
<attr name="currently_playing_background" format="color"/>
<attr name="drawer_activated_color" format="color"/>
<attr name="action_icon_color" format="color"/>
<attr name="scrollbar_thumb" format="reference"/>
<attr name="background_color" format="color"/>
@ -16,6 +12,4 @@
<attr name="icon_green" format="color" />
<attr name="icon_purple" format="color" />
<attr name="icon_gray" format="color" />
<attr name="card_background" format="color" />
<attr name="card_background_playing" format="color" />
</resources>

View File

@ -7,9 +7,6 @@
<color name="light_gray">#bfbfbf</color>
<color name="medium_gray">#afafaf</color>
<color name="black">#000000</color>
<color name="download_success_green">#248800</color>
<color name="download_warning_yellow">#F59F00</color>
<color name="download_failed_red">#B00020</color>
<color name="image_readability_tint">#80000000</color>
<color name="feed_image_bg">#50000000</color>
<color name="feed_text_bg">#ccbfbfbf</color>
@ -19,21 +16,13 @@
<color name="background_elevated_light">#EFEEEE</color>
<color name="background_darktheme">#21272b</color>
<color name="background_elevated_darktheme">#2D3337</color>
<color name="highlight_light">#46C6C6C6</color>
<color name="highlight_dark">#43707070</color>
<color name="highlight_trueblack">#43707070</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_light_alpha">#250078C2</color>
<color name="accent_dark">#3D8BFF</color>
<color name="accent_dark_alpha">#253D8BFF</color>
<color name="icon_background_gradient_start">#0ba2ff</color>
<color name="icon_background_gradient_end">#0878ff</color>
<color name="master_switch_background_light">#DDDDDD</color>
<color name="master_switch_background_dark">#191919</color>
</resources>

View File

@ -1,36 +1,24 @@
<?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.Light" parent="Theme.Base.AntennaPod.Light">
<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.Light" parent="Theme.Material3.Light">
<item name="colorPrimary">@color/accent_light</item>
<item name="colorAccent">@color/accent_light</item>
<item name="colorSecondary">@color/accent_light</item>
<item name="colorOnSecondary">@color/white</item>
<style name="Theme.Base.AntennaPod.Dynamic.Light" parent="Theme.Material3.DynamicColors.Light">
<item name="progressBarTheme">@style/ProgressBarLight</item>
<item name="colorPrimaryDark">@color/accent_light</item>
<item name="colorPrimaryContainer">@color/accent_light</item>
<item name="colorOnPrimaryContainer">@color/white</item>
<item name="android:windowBackground">@color/background_light</item>
<item name="colorSurface">@color/background_light</item>
<item name="background_color">@color/background_light</item>
<item name="actionBarStyle">@style/Widget.AntennaPod.ActionBar.Light</item>
<item name="actionBarStyle">@style/Widget.AntennaPod.ActionBar</item>
<item name="background_elevated">@color/background_elevated_light</item>
<item name="master_switch_background">@color/master_switch_background_light</item>
<item name="currently_playing_background">@color/highlight_light</item>
<item name="action_icon_color">@color/black</item>
<item name="drawer_activated_color">@color/accent_light_alpha</item>
<item name="android:textAllCaps">false</item>
<item name="android:textColorHint">@color/grey600</item>
<item name="seek_background">@color/seek_background_light</item>
<item name="navigation_up">@drawable/navigation_up</item>
<item name="dragview_background">@drawable/ic_drag_lighttheme</item>
<item name="scrollbar_thumb">@drawable/scrollbar_thumb_light</item>
<item name="card_background">#EFEEEE</item>
<item name="card_background_playing">#D8D8D8</item>
<item name="icon_red">#CF1800</item>
<item name="icon_yellow">#F59F00</item>
<item name="icon_green">#008537</item>
@ -38,40 +26,36 @@
<item name="icon_gray">#25365A</item>
<item name="android:splitMotionEvents">false</item>
<item name="android:fitsSystemWindows">false</item>
<item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item>
<item name="android:windowContentTransitions">true</item>
</style>
<style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark">
<style name="Theme.AntennaPod.Light" parent="Theme.AntennaPod.Dynamic.Light">
<item name="colorPrimary">@color/accent_light</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:windowBackground">@color/background_light</item>
<item name="colorSurface">@color/background_light</item>
<item name="colorSurfaceVariant">#B8E4FF</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.Dark" parent="Theme.Material3.Dark">
<item name="colorAccent">@color/accent_dark</item>
<item name="colorSecondary">@color/accent_dark</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorPrimary">@color/accent_dark</item>
<item name="colorPrimaryDark">@color/background_darktheme</item>
<item name="colorPrimaryContainer">@color/accent_dark</item>
<item name="colorOnPrimaryContainer">@color/black</item>
<item name="android:windowBackground">@color/background_darktheme</item>
<item name="colorSurface">@color/background_darktheme</item>
<item name="background_color">@color/background_darktheme</item>
<item name="actionBarStyle">@style/Widget.AntennaPod.ActionBar.Dark</item>
<item name="background_elevated">@color/background_elevated_darktheme</item>
<item name="colorControlNormal">@color/white</item>
<style name="Theme.Base.AntennaPod.Dynamic.Dark" parent="Theme.Material3.DynamicColors.Dark">
<item name="progressBarTheme">@style/ProgressBarDark</item>
<item name="drawer_activated_color">@color/accent_dark_alpha</item>
<item name="master_switch_background">@color/master_switch_background_dark</item>
<item name="currently_playing_background">@color/highlight_dark</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="android:textColorHint">@color/medium_gray</item>
<item name="seek_background">@color/seek_background_dark</item>
<item name="navigation_up">@drawable/navigation_up_dark</item>
<item name="dragview_background">@drawable/ic_drag_darktheme</item>
<item name="scrollbar_thumb">@drawable/scrollbar_thumb_dark</item>
<item name="card_background">#2d3337</item>
<item name="card_background_playing">#444D53</item>
<item name="icon_red">#CF1800</item>
<item name="icon_yellow">#F59F00</item>
<item name="icon_green">#008537</item>
@ -79,31 +63,49 @@
<item name="icon_gray">#CDD9E4</item>
<item name="android:splitMotionEvents">false</item>
<item name="android:fitsSystemWindows">false</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">@color/background_darktheme</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:navigationBarColor">@color/background_darktheme</item>
</style>
<style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack">
<!-- Room for API dependent attributes -->
<style name="Theme.AntennaPod.Dark" parent="Theme.AntennaPod.Dynamic.Dark">
<item name="colorPrimary">@color/accent_dark</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:windowBackground">@color/background_darktheme</item>
<item name="colorSurface">@color/background_darktheme</item>
<item name="colorSurfaceVariant">#1B3B6A</item>
</style>
<style name="Theme.Base.AntennaPod.TrueBlack" parent="Theme.AntennaPod.Dark">
<item name="colorPrimaryDark">@color/black</item>
<item name="actionBarStyle">@style/Widget.AntennaPod.ActionBar.Black</item>
<item name="drawer_activated_color">@color/highlight_trueblack</item>
<item name="currently_playing_background">@color/highlight_trueblack</item>
<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="android:windowBackground">@color/black</item>
<item name="colorSurface">@color/black</item>
<item name="background_color">@color/black</item>
<item name="android:actionBarStyle">@color/black</item>
<item name="background_elevated">@color/black</item>
<item name="android:textColorHint">@color/medium_gray</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">@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:windowBackground">@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">
@ -112,6 +114,12 @@
<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>
@ -124,8 +132,36 @@
<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" tools:targetApi="lollipop">@android:color/transparent</item>
<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>
@ -136,7 +172,18 @@
</style>
<style name="Theme.AntennaPod.Dark.Translucent" parent="Theme.AntennaPod.Dark.NoTitle">
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
<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>
@ -147,7 +194,7 @@
</style>
<style name="Theme.AntennaPod.TrueBlack.Translucent" parent="Theme.AntennaPod.TrueBlack.NoTitle">
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
<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>
@ -166,7 +213,7 @@
<item name="android:windowBackground">@drawable/bg_splash</item>
<item name="colorPrimary">@color/icon_background_gradient_start</item>
<item name="colorPrimaryDark">@color/icon_background_gradient_start</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">@color/icon_background_gradient_end</item>
<item name="android:navigationBarColor">@color/icon_background_gradient_end</item>
</style>
<style name="Theme.AntennaPod.VideoPlayer" parent="@style/Theme.AntennaPod.Dark">
@ -199,14 +246,6 @@
<item name="android:ellipsize">end</item>
</style>
<style name="BigBlurryBackground">
<item name="android:scaleType">centerCrop</item>
<!-- <item name="android:tint">@color/image_readability_tint</item> -->
<!-- Reactivate when Glide's tinting has been fixed for Android 5.x
Remove color filter from ItemlistFragment -->
</style>
<style name="ProgressBarLight">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@drawable/progress_bar_horizontal_light</item>
@ -226,16 +265,9 @@
<item name="fastScrollVerticalTrackDrawable">@drawable/scrollbar_track</item>
</style>
<style name="Widget.AntennaPod.ActionBar.Light" parent="Widget.Material3.Light.ActionBar.Solid">
<item name="background">@color/background_light</item>
</style>
<style name="Widget.AntennaPod.ActionBar.Dark" parent="Widget.Material3.Light.ActionBar.Solid">
<item name="background">@color/background_darktheme</item>
</style>
<style name="Widget.AntennaPod.ActionBar.Black" parent="Widget.Material3.Light.ActionBar.Solid">
<item name="background">@color/black</item>
<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">

View File

@ -1,31 +1,15 @@
package de.danoeh.antennapod.net.ssl;
import android.os.Build;
import okhttp3.CipherSuite;
import okhttp3.ConnectionSpec;
import okhttp3.OkHttpClient;
import javax.net.ssl.X509TrustManager;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class SslClientSetup {
public static void installCertificates(OkHttpClient.Builder builder) {
X509TrustManager trustManager = BackportTrustManager.create();
builder.sslSocketFactory(new AntennaPodSslSocketFactory(trustManager), trustManager);
ConnectionSpec tlsSpec = ConnectionSpec.MODERN_TLS;
if (BuildConfig.FLAVOR.equals("play") && Build.VERSION.SDK_INT < 21) {
// workaround for Android 4.x for certain web sites.
// see: https://github.com/square/okhttp/issues/4053#issuecomment-402579554
List<CipherSuite> cipherSuites = new ArrayList<>(ConnectionSpec.MODERN_TLS.cipherSuites());
cipherSuites.add(CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA);
cipherSuites.add(CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA);
tlsSpec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
.cipherSuites(cipherSuites.toArray(new CipherSuite[0]))
.build();
}
builder.connectionSpecs(Arrays.asList(tlsSpec, ConnectionSpec.CLEARTEXT));
builder.connectionSpecs(Arrays.asList(ConnectionSpec.MODERN_TLS, ConnectionSpec.CLEARTEXT));
}
}

View File

@ -48,6 +48,7 @@ public class UserPreferences {
// User Interface
public static final String PREF_THEME = "prefTheme";
public static final String PREF_TINTED_COLORS = "prefTintedColors";
public static final String PREF_HIDDEN_DRAWER_ITEMS = "prefHiddenDrawerItems";
public static final String PREF_DRAWER_FEED_ORDER = "prefDrawerFeedOrder";
public static final String PREF_DRAWER_FEED_COUNTER = "prefDrawerFeedIndicator";
@ -170,6 +171,10 @@ public class UserPreferences {
}
}
public static boolean getIsThemeColorTinted() {
return Build.VERSION.SDK_INT >= 31 && prefs.getBoolean(PREF_TINTED_COLORS, false);
}
public static List<String> getHiddenDrawerItems() {
String hiddenItems = prefs.getString(PREF_HIDDEN_DRAWER_ITEMS, "");
return new ArrayList<>(Arrays.asList(TextUtils.split(hiddenItems, ",")));

View File

@ -18,11 +18,7 @@ public class PlaybackSpeedActivityStarter {
this.context = context;
intent = new Intent(INTENT);
intent.setPackage(context.getPackageName());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
} else {
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
}
}
public Intent getIntent() {

View File

@ -18,10 +18,8 @@ public class VideoPlayerActivityStarter {
this.context = context;
intent = new Intent(INTENT);
intent.setPackage(context.getPackageName());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
}
}
public Intent getIntent() {
return intent;

View File

@ -20,7 +20,6 @@
package de.danoeh.antennapod.ui.common;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@ -29,7 +28,6 @@ import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
@ -60,7 +58,6 @@ public class TriangleLabelView extends View {
init(context, attrs);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public TriangleLabelView(final Context context, final AttributeSet attrs,
final int defStyleAttr, final int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);

View File

@ -431,6 +431,8 @@
<string name="user_interface_label">User Interface</string>
<string name="user_interface_sum">Appearance, Subscriptions, Lockscreen</string>
<string name="pref_set_theme_title">Select Theme</string>
<string name="pref_tinted_theme_title">Use Tinted Colors</string>
<string name="pref_tinted_theme_message">Tint app colors based on the background image</string>
<string name="pref_nav_drawer_items_title">Set Navigation Drawer items</string>
<string name="pref_nav_drawer_items_sum">Change which items appear in the navigation drawer.</string>
<string name="pref_nav_drawer_feed_order_title">Set Subscription Order</string>