summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/build.gradle1
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/OpmlImportActivity.java1
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java3
-rw-r--r--build.gradle5
-rw-r--r--core/build.gradle1
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java168
-rw-r--r--model/build.gradle1
-rw-r--r--parser/feed/build.gradle2
-rw-r--r--ui/app-start-intent/build.gradle1
-rw-r--r--ui/png-icons/build.gradle1
10 files changed, 93 insertions, 91 deletions
diff --git a/app/build.gradle b/app/build.gradle
index fddf37c02..69f05c642 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -121,6 +121,7 @@ dependencies {
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
implementation "androidx.appcompat:appcompat:$appcompatVersion"
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
+ implementation "androidx.core:core:$coreVersion"
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation "androidx.media:media:$mediaVersion"
implementation "androidx.preference:preference:$preferenceVersion"
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportActivity.java
index 2b8064270..a6810715c 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportActivity.java
@@ -205,6 +205,7 @@ public class OpmlImportActivity extends AppCompatActivity {
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode != PERMISSION_REQUEST_READ_EXTERNAL_STORAGE) {
return;
}
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java
index 7c79d0962..04b9677e2 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/UserInterfacePreferencesFragment.java
@@ -5,6 +5,7 @@ import android.os.Build;
import android.os.Bundle;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.app.AlertDialog;
+import androidx.core.app.ActivityCompat;
import androidx.preference.PreferenceFragmentCompat;
import android.widget.ListView;
import de.danoeh.antennapod.R;
@@ -39,7 +40,7 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat {
findPreference(UserPreferences.PREF_THEME)
.setOnPreferenceChangeListener(
(preference, newValue) -> {
- getActivity().recreate();
+ ActivityCompat.recreate(getActivity());
return true;
});
diff --git a/build.gradle b/build.gradle
index b0c87c6c1..f6992882c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -39,8 +39,9 @@ subprojects {
project.ext {
// AndroidX
- annotationVersion = "1.1.0"
- appcompatVersion = "1.2.0"
+ annotationVersion = "1.2.0"
+ appcompatVersion = "1.3.1"
+ coreVersion = "1.5.0"
mediaVersion = "1.1.0"
preferenceVersion = "1.1.1"
workManagerVersion = "2.3.4"
diff --git a/core/build.gradle b/core/build.gradle
index b0eb1d51e..953a85a97 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -32,6 +32,7 @@ dependencies {
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
implementation "androidx.appcompat:appcompat:$appcompatVersion"
+ implementation "androidx.core:core:$coreVersion"
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation "androidx.media:media:$mediaVersion"
implementation "androidx.preference:preference:$preferenceVersion"
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java
index 5895c5933..2d5c7d01f 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java
@@ -1,12 +1,13 @@
package de.danoeh.antennapod.core.util.gui;
-
-import android.app.NotificationChannel;
-import android.app.NotificationChannelGroup;
-import android.app.NotificationManager;
import android.content.Context;
-import android.os.Build;
-import androidx.annotation.RequiresApi;
+
+import androidx.core.app.NotificationChannelCompat;
+import androidx.core.app.NotificationChannelGroupCompat;
+import androidx.core.app.NotificationManagerCompat;
+
+import java.util.Arrays;
+import java.util.List;
import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.preferences.UserPreferences;
@@ -23,113 +24,112 @@ public class NotificationUtils {
public static final String GROUP_ID_ERRORS = "group_errors";
public static final String GROUP_ID_NEWS = "group_news";
- public static void createChannels(Context context) {
- if (Build.VERSION.SDK_INT < 26) {
- return;
- }
- NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
-
- if (mNotificationManager != null) {
- mNotificationManager.createNotificationChannelGroup(createGroupErrors(context));
- mNotificationManager.createNotificationChannelGroup(createGroupNews(context));
-
- mNotificationManager.createNotificationChannel(createChannelUserAction(context));
- mNotificationManager.createNotificationChannel(createChannelDownloading(context));
- mNotificationManager.createNotificationChannel(createChannelPlaying(context));
- mNotificationManager.createNotificationChannel(createChannelError(context));
- mNotificationManager.createNotificationChannel(createChannelSyncError(context));
- mNotificationManager.createNotificationChannel(createChannelAutoDownload(context));
- mNotificationManager.createNotificationChannel(createChannelEpisodeNotification(context));
- }
+ public static void createChannels(final Context context) {
+ final NotificationManagerCompat mNotificationManager = NotificationManagerCompat.from(context);
+
+ final List<NotificationChannelGroupCompat> channelGroups = Arrays.asList(
+ createGroupErrors(context),
+ createGroupNews(context));
+ mNotificationManager.createNotificationChannelGroupsCompat(channelGroups);
+
+ final List<NotificationChannelCompat> channels = Arrays.asList(
+ createChannelUserAction(context),
+ createChannelDownloading(context),
+ createChannelPlaying(context),
+ createChannelError(context),
+ createChannelSyncError(context),
+ createChannelAutoDownload(context),
+ createChannelEpisodeNotification(context));
+ mNotificationManager.createNotificationChannelsCompat(channels);
}
- @RequiresApi(api = Build.VERSION_CODES.O)
- private static NotificationChannel createChannelUserAction(Context c) {
- NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID_USER_ACTION,
- c.getString(R.string.notification_channel_user_action), NotificationManager.IMPORTANCE_HIGH);
- notificationChannel.setDescription(c.getString(R.string.notification_channel_user_action_description));
- notificationChannel.setGroup(GROUP_ID_ERRORS);
- return notificationChannel;
+ private static NotificationChannelCompat createChannelUserAction(final Context c) {
+ return new NotificationChannelCompat.Builder(
+ CHANNEL_ID_USER_ACTION, NotificationManagerCompat.IMPORTANCE_HIGH)
+ .setName(c.getString(R.string.notification_channel_user_action))
+ .setDescription(c.getString(R.string.notification_channel_user_action_description))
+ .setGroup(GROUP_ID_ERRORS)
+ .build();
}
- @RequiresApi(api = Build.VERSION_CODES.O)
- private static NotificationChannel createChannelDownloading(Context c) {
- NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID_DOWNLOADING,
- c.getString(R.string.notification_channel_downloading), NotificationManager.IMPORTANCE_LOW);
- notificationChannel.setDescription(c.getString(R.string.notification_channel_downloading_description));
- notificationChannel.setShowBadge(false);
- return notificationChannel;
+ private static NotificationChannelCompat createChannelDownloading(final Context c) {
+ return new NotificationChannelCompat.Builder(
+ CHANNEL_ID_DOWNLOADING, NotificationManagerCompat.IMPORTANCE_LOW)
+ .setName(c.getString(R.string.notification_channel_downloading))
+ .setDescription(c.getString(R.string.notification_channel_downloading_description))
+ .setShowBadge(false)
+ .build();
}
- @RequiresApi(api = Build.VERSION_CODES.O)
- private static NotificationChannel createChannelPlaying(Context c) {
- NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID_PLAYING,
- c.getString(R.string.notification_channel_playing), NotificationManager.IMPORTANCE_LOW);
- notificationChannel.setDescription(c.getString(R.string.notification_channel_playing_description));
- notificationChannel.setShowBadge(false);
- return notificationChannel;
+ private static NotificationChannelCompat createChannelPlaying(final Context c) {
+ return new NotificationChannelCompat.Builder(
+ CHANNEL_ID_PLAYING, NotificationManagerCompat.IMPORTANCE_LOW)
+ .setName(c.getString(R.string.notification_channel_playing))
+ .setDescription(c.getString(R.string.notification_channel_playing_description))
+ .setShowBadge(false)
+ .build();
}
- @RequiresApi(api = Build.VERSION_CODES.O)
- private static NotificationChannel createChannelError(Context c) {
- NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID_DOWNLOAD_ERROR,
- c.getString(R.string.notification_channel_download_error), NotificationManager.IMPORTANCE_HIGH);
- notificationChannel.setDescription(c.getString(R.string.notification_channel_download_error_description));
- notificationChannel.setGroup(GROUP_ID_ERRORS);
+ private static NotificationChannelCompat createChannelError(final Context c) {
+ final NotificationChannelCompat.Builder notificationChannel = new NotificationChannelCompat.Builder(
+ CHANNEL_ID_DOWNLOAD_ERROR, NotificationManagerCompat.IMPORTANCE_HIGH)
+ .setName(c.getString(R.string.notification_channel_download_error))
+ .setDescription(c.getString(R.string.notification_channel_download_error_description))
+ .setGroup(GROUP_ID_ERRORS);
if (!UserPreferences.getShowDownloadReportRaw()) {
// Migration from app managed setting: disable notification
- notificationChannel.setImportance(NotificationManager.IMPORTANCE_NONE);
+ notificationChannel.setImportance(NotificationManagerCompat.IMPORTANCE_NONE);
}
- return notificationChannel;
+ return notificationChannel.build();
}
- @RequiresApi(api = Build.VERSION_CODES.O)
- private static NotificationChannel createChannelSyncError(Context c) {
- NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID_SYNC_ERROR,
- c.getString(R.string.notification_channel_sync_error), NotificationManager.IMPORTANCE_HIGH);
- notificationChannel.setDescription(c.getString(R.string.notification_channel_sync_error_description));
- notificationChannel.setGroup(GROUP_ID_ERRORS);
+ private static NotificationChannelCompat createChannelSyncError(final Context c) {
+ final NotificationChannelCompat.Builder notificationChannel = new NotificationChannelCompat.Builder(
+ CHANNEL_ID_SYNC_ERROR, NotificationManagerCompat.IMPORTANCE_HIGH)
+ .setName(c.getString(R.string.notification_channel_sync_error))
+ .setDescription(c.getString(R.string.notification_channel_sync_error_description))
+ .setGroup(GROUP_ID_ERRORS);
if (!UserPreferences.getGpodnetNotificationsEnabledRaw()) {
// Migration from app managed setting: disable notification
- notificationChannel.setImportance(NotificationManager.IMPORTANCE_NONE);
+ notificationChannel.setImportance(NotificationManagerCompat.IMPORTANCE_NONE);
}
- return notificationChannel;
+ return notificationChannel.build();
}
- @RequiresApi(api = Build.VERSION_CODES.O)
- private static NotificationChannel createChannelAutoDownload(Context c) {
- NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID_AUTO_DOWNLOAD,
- c.getString(R.string.notification_channel_auto_download), NotificationManager.IMPORTANCE_NONE);
- notificationChannel.setDescription(c.getString(R.string.notification_channel_episode_auto_download));
- notificationChannel.setGroup(GROUP_ID_NEWS);
+ private static NotificationChannelCompat createChannelAutoDownload(final Context c) {
+ final NotificationChannelCompat.Builder notificationChannel = new NotificationChannelCompat.Builder(
+ CHANNEL_ID_AUTO_DOWNLOAD, NotificationManagerCompat.IMPORTANCE_NONE)
+ .setName(c.getString(R.string.notification_channel_auto_download))
+ .setDescription(c.getString(R.string.notification_channel_episode_auto_download))
+ .setGroup(GROUP_ID_NEWS);
if (UserPreferences.getShowAutoDownloadReportRaw()) {
// Migration from app managed setting: enable notification
- notificationChannel.setImportance(NotificationManager.IMPORTANCE_DEFAULT);
+ notificationChannel.setImportance(NotificationManagerCompat.IMPORTANCE_DEFAULT);
}
- return notificationChannel;
+ return notificationChannel.build();
}
- @RequiresApi(api = Build.VERSION_CODES.O)
- private static NotificationChannel createChannelEpisodeNotification(Context c) {
- NotificationChannel channel = new NotificationChannel(CHANNEL_ID_EPISODE_NOTIFICATIONS,
- c.getString(R.string.notification_channel_new_episode), NotificationManager.IMPORTANCE_DEFAULT);
- channel.setDescription(c.getString(R.string.notification_channel_new_episode_description));
- channel.setGroup(GROUP_ID_NEWS);
- return channel;
+ private static NotificationChannelCompat createChannelEpisodeNotification(final Context c) {
+ return new NotificationChannelCompat.Builder(
+ CHANNEL_ID_EPISODE_NOTIFICATIONS, NotificationManagerCompat.IMPORTANCE_DEFAULT)
+ .setName(c.getString(R.string.notification_channel_new_episode))
+ .setDescription(c.getString(R.string.notification_channel_new_episode_description))
+ .setGroup(GROUP_ID_NEWS)
+ .build();
}
- @RequiresApi(api = Build.VERSION_CODES.O)
- private static NotificationChannelGroup createGroupErrors(Context c) {
- return new NotificationChannelGroup(GROUP_ID_ERRORS,
- c.getString(R.string.notification_group_errors));
+ private static NotificationChannelGroupCompat createGroupErrors(final Context c) {
+ return new NotificationChannelGroupCompat.Builder(GROUP_ID_ERRORS)
+ .setName(c.getString(R.string.notification_group_errors))
+ .build();
}
- @RequiresApi(api = Build.VERSION_CODES.O)
- private static NotificationChannelGroup createGroupNews(Context c) {
- return new NotificationChannelGroup(GROUP_ID_NEWS,
- c.getString(R.string.notification_group_news));
+ private static NotificationChannelGroupCompat createGroupNews(final Context c) {
+ return new NotificationChannelGroupCompat.Builder(GROUP_ID_NEWS)
+ .setName(c.getString(R.string.notification_group_news))
+ .build();
}
}
diff --git a/model/build.gradle b/model/build.gradle
index 3abbd8e24..6f956a2d5 100644
--- a/model/build.gradle
+++ b/model/build.gradle
@@ -3,7 +3,6 @@ apply from: "../common.gradle"
dependencies {
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
- implementation "androidx.appcompat:appcompat:$appcompatVersion"
implementation "androidx.media:media:$mediaVersion"
implementation "org.apache.commons:commons-lang3:$commonslangVersion"
diff --git a/parser/feed/build.gradle b/parser/feed/build.gradle
index 3f6ea4aa3..4909d3fac 100644
--- a/parser/feed/build.gradle
+++ b/parser/feed/build.gradle
@@ -12,7 +12,7 @@ dependencies {
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
- implementation "androidx.core:core:$appcompatVersion"
+ implementation "androidx.core:core:$coreVersion"
implementation "org.apache.commons:commons-lang3:$commonslangVersion"
implementation "commons-io:commons-io:$commonsioVersion"
diff --git a/ui/app-start-intent/build.gradle b/ui/app-start-intent/build.gradle
index 5390b85d8..2f6d821b1 100644
--- a/ui/app-start-intent/build.gradle
+++ b/ui/app-start-intent/build.gradle
@@ -3,5 +3,4 @@ apply from: "../../common.gradle"
dependencies {
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
- implementation "androidx.appcompat:appcompat:$appcompatVersion"
}
diff --git a/ui/png-icons/build.gradle b/ui/png-icons/build.gradle
index 180f80804..f0d9f7a57 100644
--- a/ui/png-icons/build.gradle
+++ b/ui/png-icons/build.gradle
@@ -10,5 +10,4 @@ android {
dependencies {
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
- implementation "androidx.appcompat:appcompat:$appcompatVersion"
}