diff options
author | ByteHamster <info@bytehamster.com> | 2021-11-02 21:26:13 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2021-11-21 21:51:46 +0100 |
commit | 3f81e22eed78f6f0735f3639953fdec20acad302 (patch) | |
tree | b92d6bc9f8d5896473f6e8ab1d1191972ffbb65c /core | |
parent | b00e14545d472ddd1f13f7467e973dc5365ac77f (diff) | |
download | AntennaPod-3f81e22eed78f6f0735f3639953fdec20acad302.zip |
Bump to minimum SDK version 19 (Android 4.4)
Diffstat (limited to 'core')
5 files changed, 36 insertions, 66 deletions
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 415b9f1ed..60ccb5c9e 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 @@ -815,9 +815,8 @@ public class PlaybackService extends MediaBrowserServiceCompat { taskManager.startChapterLoader(newInfo.playable); break; case PAUSED: - if ((UserPreferences.isPersistNotify() || isCasting) && - android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - // do not remove notification on pause based on user pref and whether android version supports expanded notifications + if (UserPreferences.isPersistNotify() || isCasting) { + // do not remove notification on pause based on user pref // Change [Play] button to [Pause] updateNotificationAndMediaSession(newInfo.playable); } else if (!UserPreferences.isPersistNotify() && !isCasting) { @@ -1967,11 +1966,8 @@ public class PlaybackService extends MediaBrowserServiceCompat { PlaybackService.this.updateNotificationAndMediaSession(info.playable); } else { PlayerStatus status = info.playerStatus; - if ((status == PlayerStatus.PLAYING || - status == PlayerStatus.SEEKING || - status == PlayerStatus.PREPARING || - UserPreferences.isPersistNotify()) && - android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + if (status == PlayerStatus.PLAYING || status == PlayerStatus.SEEKING + || status == PlayerStatus.PREPARING || UserPreferences.isPersistNotify()) { PlaybackService.this.updateNotificationAndMediaSession(info.playable); } else if (!UserPreferences.isPersistNotify()) { stateManager.stopForeground(true); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java index 414b5c781..cf049ed80 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java @@ -1,7 +1,6 @@ package de.danoeh.antennapod.core.util; import android.app.Activity; -import android.os.Build; import android.os.StatFs; import android.util.Log; @@ -63,29 +62,15 @@ public class StorageUtils { */ public static long getFreeSpaceAvailable(String path) { StatFs stat = new StatFs(path); - long availableBlocks; - long blockSize; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - availableBlocks = stat.getAvailableBlocksLong(); - blockSize = stat.getBlockSizeLong(); - } else { - availableBlocks = stat.getAvailableBlocks(); - blockSize = stat.getBlockSize(); - } + long availableBlocks = stat.getAvailableBlocksLong(); + long blockSize = stat.getBlockSizeLong(); return availableBlocks * blockSize; } public static long getTotalSpaceAvailable(String path) { StatFs stat = new StatFs(path); - long blockCount; - long blockSize; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - blockCount = stat.getBlockCountLong(); - blockSize = stat.getBlockSizeLong(); - } else { - blockCount = stat.getBlockCount(); - blockSize = stat.getBlockSize(); - } + long blockCount = stat.getBlockCountLong(); + long blockSize = stat.getBlockSizeLong(); return blockCount * blockSize; } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java b/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java index ed3f1800d..5275e7080 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java +++ b/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java @@ -69,9 +69,6 @@ public abstract class WidgetUpdater { if (!PlayerWidget.isEnabled(context) || widgetState == null) { return; } - ComponentName playerWidget = new ComponentName(context, PlayerWidget.class); - AppWidgetManager manager = AppWidgetManager.getInstance(context); - int[] widgetIds = manager.getAppWidgetIds(playerWidget); PendingIntent startMediaPlayer; if (widgetState.media != null && widgetState.media.getMediaType() == MediaType.VIDEO @@ -158,36 +155,36 @@ public abstract class WidgetUpdater { views.setImageViewResource(R.id.butPlayExtended, R.drawable.ic_widget_play); } - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { - for (int id : widgetIds) { - Bundle options = manager.getAppWidgetOptions(id); - SharedPreferences prefs = context.getSharedPreferences(PlayerWidget.PREFS_NAME, Context.MODE_PRIVATE); - int minWidth = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH); - int columns = getCellsForSize(minWidth); - if (columns < 3) { - views.setViewVisibility(R.id.layout_center, View.INVISIBLE); - } else { - views.setViewVisibility(R.id.layout_center, View.VISIBLE); - } - boolean showRewind = prefs.getBoolean(PlayerWidget.KEY_WIDGET_REWIND + id, false); - boolean showFastForward = prefs.getBoolean(PlayerWidget.KEY_WIDGET_FAST_FORWARD + id, false); - boolean showSkip = prefs.getBoolean(PlayerWidget.KEY_WIDGET_SKIP + id, false); - - if (showRewind || showSkip || showFastForward) { - views.setInt(R.id.extendedButtonsContainer, "setVisibility", View.VISIBLE); - views.setInt(R.id.butPlay, "setVisibility", View.GONE); - views.setInt(R.id.butRew, "setVisibility", showRewind ? View.VISIBLE : View.GONE); - views.setInt(R.id.butFastForward, "setVisibility", showFastForward ? View.VISIBLE : View.GONE); - views.setInt(R.id.butSkip, "setVisibility", showSkip ? View.VISIBLE : View.GONE); - } - - int backgroundColor = prefs.getInt(PlayerWidget.KEY_WIDGET_COLOR + id, PlayerWidget.DEFAULT_COLOR); - views.setInt(R.id.widgetLayout, "setBackgroundColor", backgroundColor); + ComponentName playerWidget = new ComponentName(context, PlayerWidget.class); + AppWidgetManager manager = AppWidgetManager.getInstance(context); + int[] widgetIds = manager.getAppWidgetIds(playerWidget); - manager.updateAppWidget(id, views); + for (int id : widgetIds) { + Bundle options = manager.getAppWidgetOptions(id); + SharedPreferences prefs = context.getSharedPreferences(PlayerWidget.PREFS_NAME, Context.MODE_PRIVATE); + int minWidth = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH); + int columns = getCellsForSize(minWidth); + if (columns < 3) { + views.setViewVisibility(R.id.layout_center, View.INVISIBLE); + } else { + views.setViewVisibility(R.id.layout_center, View.VISIBLE); } - } else { - manager.updateAppWidget(playerWidget, views); + boolean showRewind = prefs.getBoolean(PlayerWidget.KEY_WIDGET_REWIND + id, false); + boolean showFastForward = prefs.getBoolean(PlayerWidget.KEY_WIDGET_FAST_FORWARD + id, false); + boolean showSkip = prefs.getBoolean(PlayerWidget.KEY_WIDGET_SKIP + id, false); + + if (showRewind || showSkip || showFastForward) { + views.setInt(R.id.extendedButtonsContainer, "setVisibility", View.VISIBLE); + views.setInt(R.id.butPlay, "setVisibility", View.GONE); + views.setInt(R.id.butRew, "setVisibility", showRewind ? View.VISIBLE : View.GONE); + views.setInt(R.id.butFastForward, "setVisibility", showFastForward ? View.VISIBLE : View.GONE); + views.setInt(R.id.butSkip, "setVisibility", showSkip ? View.VISIBLE : View.GONE); + } + + int backgroundColor = prefs.getInt(PlayerWidget.KEY_WIDGET_COLOR + id, PlayerWidget.DEFAULT_COLOR); + views.setInt(R.id.widgetLayout, "setBackgroundColor", backgroundColor); + + manager.updateAppWidget(id, views); } } diff --git a/core/src/main/res/layout/player_widget.xml b/core/src/main/res/layout/player_widget.xml index a70e98f0f..60d40e6b5 100644 --- a/core/src/main/res/layout/player_widget.xml +++ b/core/src/main/res/layout/player_widget.xml @@ -19,7 +19,6 @@ android:layout_width="@android:dimen/app_icon_size" android:layout_height="match_parent" android:contentDescription="@string/play_label" - android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:layout_margin="12dp" android:background="?android:attr/selectableItemBackground" @@ -31,9 +30,7 @@ android:id="@+id/layout_left" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" - android:layout_toLeftOf="@id/butPlay" android:layout_toStartOf="@id/butPlay" android:background="@android:color/transparent" android:gravity="fill_horizontal" @@ -97,7 +94,6 @@ android:layout_height="36dp" android:background="?android:attr/selectableItemBackground" android:contentDescription="@string/rewind_label" - android:layout_marginRight="2dp" android:layout_marginEnd="2dp" android:scaleType="fitXY" android:src="@drawable/ic_widget_fast_rewind" /> @@ -108,7 +104,6 @@ android:layout_height="36dp" android:background="?android:attr/selectableItemBackground" android:contentDescription="@string/play_label" - android:layout_marginRight="2dp" android:layout_marginEnd="2dp" android:scaleType="fitXY" android:src="@drawable/ic_widget_play" /> @@ -119,7 +114,6 @@ android:layout_height="36dp" android:background="?android:attr/selectableItemBackground" android:contentDescription="@string/fast_forward_label" - android:layout_marginRight="2dp" android:layout_marginEnd="2dp" android:scaleType="fitXY" android:src="@drawable/ic_widget_fast_forward" /> @@ -130,7 +124,6 @@ android:layout_height="36dp" android:background="?android:attr/selectableItemBackground" android:contentDescription="@string/skip_episode_label" - android:layout_marginRight="2dp" android:layout_marginEnd="2dp" android:scaleType="fitXY" android:src="@drawable/ic_widget_skip" /> diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 011a9fe52..1ab5b2184 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -597,7 +597,6 @@ <string name="export_success_title">Export successful</string> <string name="export_success_sum">The exported file was written to:\n\n%1$s</string> <string name="opml_import_ask_read_permission">Access to external storage is required to read the OPML file</string> - <string name="import_select_file">Select file to import</string> <string name="successful_import_label">Import successful</string> <string name="import_ok">Please press OK to restart AntennaPod</string> <string name="import_no_downgrade">This database was exported with a newer version of AntennaPod. Your current installation does not yet know how to handle this file.</string> |