summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2023-05-05 19:42:51 +0200
committerByteHamster <info@bytehamster.com>2023-05-05 19:43:45 +0200
commitf8be7d596d098e534039908ade8270e13168fd23 (patch)
treeaa168885671cf49293c8a5eec088f0fedfaaa54b /core/src
parent967e289f91f51d0b5a91fdd598c3f42bd995299a (diff)
parentb063f0508f6e6439509f22769374c57f77cb499f (diff)
downloadAntennaPod-f8be7d596d098e534039908ade8270e13168fd23.zip
Merge branch 'master' into develop
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java6
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java2
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java25
-rw-r--r--core/src/main/res/drawable-nodpi/ic_monochrome.pngbin27923 -> 0 bytes
-rw-r--r--core/src/main/res/drawable-nodpi/teaser.pngbin208621 -> 168091 bytes
-rw-r--r--core/src/main/res/mipmap-anydpi-v26/ic_launcher.xml2
-rw-r--r--core/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.pngbin0 -> 10627 bytes
-rw-r--r--core/src/main/res/values/styles.xml2
8 files changed, 29 insertions, 8 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java b/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java
index e91e24ec6..08bdd39bc 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java
@@ -37,7 +37,11 @@ public class MediaButtonReceiver extends BroadcastReceiver {
serviceIntent.putExtra(EXTRA_KEYCODE, event.getKeyCode());
serviceIntent.putExtra(EXTRA_SOURCE, event.getSource());
serviceIntent.putExtra(EXTRA_HARDWAREBUTTON, event.getEventTime() > 0 || event.getDownTime() > 0);
- ContextCompat.startForegroundService(context, serviceIntent);
+ try {
+ ContextCompat.startForegroundService(context, serviceIntent);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java
index 4ff4472ba..9dc846cc2 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java
@@ -620,7 +620,7 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
// Still did not get back the audio focus. Now actually pause.
pause(true, false);
}
- }, 10000);
+ }, 30000);
}
} else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) {
Log.d(TAG, "Gained audio focus");
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
index da23ebf53..42631296b 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
@@ -318,9 +318,14 @@ public class PlaybackService extends MediaBrowserServiceCompat {
public BrowserRoot onGetRoot(@NonNull String clientPackageName, int clientUid, Bundle rootHints) {
Log.d(TAG, "OnGetRoot: clientPackageName=" + clientPackageName +
"; clientUid=" + clientUid + " ; rootHints=" + rootHints);
- return new BrowserRoot(
- getResources().getString(R.string.app_name), // Name visible in Android Auto
- null); // Bundle of optional extras
+ if (rootHints != null && rootHints.getBoolean(BrowserRoot.EXTRA_RECENT)) {
+ Bundle extras = new Bundle();
+ extras.putBoolean(BrowserRoot.EXTRA_RECENT, true);
+ return new BrowserRoot(getResources().getString(R.string.recently_played_episodes), extras);
+ }
+
+ // Name visible in Android Auto
+ return new BrowserRoot(getResources().getString(R.string.app_name), null);
}
private void loadQueueForMediaSession() {
@@ -394,8 +399,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
});
}
- private List<MediaBrowserCompat.MediaItem> loadChildrenSynchronous(@NonNull String parentId)
- throws InterruptedException {
+ private List<MediaBrowserCompat.MediaItem> loadChildrenSynchronous(@NonNull String parentId) {
List<MediaBrowserCompat.MediaItem> mediaItems = new ArrayList<>();
if (parentId.equals(getResources().getString(R.string.app_name))) {
mediaItems.add(createBrowsableMediaItem(R.string.queue_label, R.drawable.ic_playlist_play_black,
@@ -423,6 +427,13 @@ public class PlaybackService extends MediaBrowserServiceCompat {
} else if (parentId.startsWith("FeedId:")) {
long feedId = Long.parseLong(parentId.split(":")[1]);
feedItems = DBReader.getFeedItemList(DBReader.getFeed(feedId));
+ } else if (parentId.equals(getString(R.string.recently_played_episodes))) {
+ Playable playable = PlaybackPreferences.createInstanceFromPreferences(this);
+ if (playable instanceof FeedMedia) {
+ feedItems = Collections.singletonList(((FeedMedia) playable).getItem());
+ } else {
+ return null;
+ }
} else {
Log.e(TAG, "Parent ID not found: " + parentId);
return null;
@@ -1485,6 +1496,10 @@ public class PlaybackService extends MediaBrowserServiceCompat {
}
if (transientPause) {
transientPause = false;
+ if (Build.VERSION.SDK_INT >= 31) {
+ stateManager.stopService();
+ return;
+ }
if (!bluetooth && UserPreferences.isUnpauseOnHeadsetReconnect()) {
mediaPlayer.resume();
} else if (bluetooth && UserPreferences.isUnpauseOnBluetoothReconnect()) {
diff --git a/core/src/main/res/drawable-nodpi/ic_monochrome.png b/core/src/main/res/drawable-nodpi/ic_monochrome.png
deleted file mode 100644
index 883d02e9e..000000000
--- a/core/src/main/res/drawable-nodpi/ic_monochrome.png
+++ /dev/null
Binary files differ
diff --git a/core/src/main/res/drawable-nodpi/teaser.png b/core/src/main/res/drawable-nodpi/teaser.png
index d339ed512..61e3d919d 100644
--- a/core/src/main/res/drawable-nodpi/teaser.png
+++ b/core/src/main/res/drawable-nodpi/teaser.png
Binary files differ
diff --git a/core/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/core/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index 728c403fb..9764d2aa9 100644
--- a/core/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/core/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -2,5 +2,5 @@
<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="@drawable/ic_monochrome" />
+ <monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon> \ No newline at end of file
diff --git a/core/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png b/core/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png
new file mode 100644
index 000000000..ae9ba36ea
--- /dev/null
+++ b/core/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png
Binary files differ
diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml
index 45f13931e..6e1335706 100644
--- a/core/src/main/res/values/styles.xml
+++ b/core/src/main/res/values/styles.xml
@@ -31,6 +31,7 @@
<style name="Theme.AntennaPod.Light" parent="Theme.AntennaPod.Dynamic.Light">
<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>
@@ -71,6 +72,7 @@
<style name="Theme.AntennaPod.Dark" parent="Theme.AntennaPod.Dynamic.Dark">
<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>