diff options
16 files changed, 10 insertions, 373 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java b/app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java index 647ab911f..459cd2478 100644 --- a/app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java @@ -368,7 +368,6 @@ public class DBReaderTest { @Test public void testGetFeedItemlistCheckChaptersFalse() throws Exception { - Context context = InstrumentationRegistry.getTargetContext(); List<Feed> feeds = DBTestUtils.saveFeedlist(10, 10, false, false, 0); for (Feed feed : feeds) { for (FeedItem item : feed.getItems()) { diff --git a/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java index 936337cbf..4365fa0ae 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java @@ -98,15 +98,6 @@ public class UITestUtils { return String.format("%s/files/%d", server.getBaseUrl(), id); } - private File newBitmapFile(String name) throws IOException { - File imgFile = new File(destDir, name); - Bitmap bitmap = Bitmap.createBitmap(128, 128, Bitmap.Config.ARGB_8888); - FileOutputStream out = new FileOutputStream(imgFile); - bitmap.compress(Bitmap.CompressFormat.PNG, 1, out); - out.close(); - return imgFile; - } - private File newMediaFile(String name) throws IOException { File mediaFile = new File(hostedMediaDir, name); if (mediaFile.exists()) { 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 191999cf7..0acfe60bf 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 @@ -33,19 +33,6 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat { } private void setupInterfaceScreen() { - - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { - // disable expanded notification option on unsupported android versions - findPreference(PREF_EXPANDED_NOTIFICATION).setEnabled(false); - findPreference(PREF_EXPANDED_NOTIFICATION).setOnPreferenceClickListener( - preference -> { - Toast toast = Toast.makeText(getActivity(), - R.string.pref_expand_notify_unsupport_toast, Toast.LENGTH_SHORT); - toast.show(); - return true; - } - ); - } findPreference(UserPreferences.PREF_THEME) .setOnPreferenceChangeListener( (preference, newValue) -> { diff --git a/app/src/main/res/layout/audio_controls.xml b/app/src/main/res/layout/audio_controls.xml index 5049db215..25e914c55 100644 --- a/app/src/main/res/layout/audio_controls.xml +++ b/app/src/main/res/layout/audio_controls.xml @@ -43,7 +43,7 @@ android:textStyle="bold" android:textColor="@color/status_progress" android:textSize="24sp" - android:background="@drawable/borderless_button_dark"/> + android:background="?android:attr/selectableItemBackground"/> <Button android:id="@+id/butIncSpeed" @@ -57,7 +57,7 @@ android:textStyle="bold" android:textColor="@color/status_progress" android:textSize="24sp" - android:background="@drawable/borderless_button_dark"/> + android:background="?android:attr/selectableItemBackground"/> <SeekBar android:id="@+id/playback_speed" diff --git a/app/src/play/res/layout/media_router_controller.xml b/app/src/play/res/layout/media_router_controller.xml index 9489173a3..bdb1b1cc2 100644 --- a/app/src/play/res/layout/media_router_controller.xml +++ b/app/src/play/res/layout/media_router_controller.xml @@ -17,7 +17,7 @@ android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:contentDescription="@string/mr_controller_play" - android:background="?attr/selectableItemBackgroundBorderless"/> + android:background="?android:attr/selectableItemBackground"/> <LinearLayout android:id="@+id/mrc_control_title_container" android:orientation="vertical" diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java b/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java index 2d9de1894..e6f2176f7 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java @@ -159,14 +159,10 @@ public class PlayerWidgetJobService extends SafeJobIntentService { if (status == PlayerStatus.PLAYING) { views.setImageViewResource(R.id.butPlay, R.drawable.ic_pause_white_24dp); - if (Build.VERSION.SDK_INT >= 15) { - views.setContentDescription(R.id.butPlay, getString(R.string.pause_label)); - } + views.setContentDescription(R.id.butPlay, getString(R.string.pause_label)); } else { views.setImageViewResource(R.id.butPlay, R.drawable.ic_play_arrow_white_24dp); - if (Build.VERSION.SDK_INT >= 15) { - views.setContentDescription(R.id.butPlay, getString(R.string.play_label)); - } + views.setContentDescription(R.id.butPlay, getString(R.string.play_label)); } views.setOnClickPendingIntent(R.id.butPlay, createMediaButtonIntent()); } else { diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java index 6219fe78c..174b43846 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java @@ -25,10 +25,11 @@ import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; -import de.danoeh.antennapod.core.util.IntList; import de.danoeh.antennapod.core.util.TimeSpeedConverter; import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.danoeh.antennapod.core.util.playback.Playable; +import java.util.ArrayList; +import org.apache.commons.lang3.ArrayUtils; public class PlaybackServiceNotificationBuilder { private static final String TAG = "PlaybackSrvNotification"; @@ -151,7 +152,7 @@ public class PlaybackServiceNotificationBuilder { private void addActions(NotificationCompat.Builder notification, MediaSessionCompat.Token mediaSessionToken, PlayerStatus playerStatus, boolean isCasting) { - IntList compactActionList = new IntList(); + ArrayList<Integer> compactActionList = new ArrayList<>(); int numActions = 0; // we start and 0 and then increment by 1 for each call to addAction @@ -218,7 +219,7 @@ public class PlaybackServiceNotificationBuilder { KeyEvent.KEYCODE_MEDIA_STOP, numActions); notification.setStyle(new androidx.media.app.NotificationCompat.MediaStyle() .setMediaSession(mediaSessionToken) - .setShowActionsInCompactView(compactActionList.toArray()) + .setShowActionsInCompactView(ArrayUtils.toPrimitive(compactActionList.toArray(new Integer[0]))) .setShowCancelButton(true) .setCancelButtonIntent(stopButtonPendingIntent)); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java index 8b87d7c54..c2076c669 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java @@ -510,17 +510,6 @@ public final class DBReader { /** * Loads the download log for a particular feed from the database. * - * @param feed Feed for which the download log is loaded - * @return A list with DownloadStatus objects that represent the feed's download log, - * newest events first. - */ - public static List<DownloadStatus> getFeedDownloadLog(Feed feed) { - return getFeedDownloadLog(feed.getId()); - } - - /** - * Loads the download log for a particular feed from the database. - * * @param feedId Feed id for which the download log is loaded * @return A list with DownloadStatus objects that represent the feed's download log, * newest events first. diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java index 65e6bbbca..91f656bf1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java @@ -379,18 +379,6 @@ public final class DBTasks { return result; } - /** - * Loads the queue from the database and checks if the specified FeedItem is in the queue. - * This method should NOT be executed in the GUI thread. - * - * @param context Used for accessing the DB. - * @param feedItemId ID of the FeedItem - */ - public static boolean isInQueue(Context context, final long feedItemId) { - LongList queue = DBReader.getQueueIDList(); - return queue.contains(feedItemId); - } - private static Feed searchFeedByIdentifyingValueOrID(PodDBAdapter adapter, Feed feed) { if (feed.getId() != 0) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java index 96c3a46da..909bd625a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java @@ -904,49 +904,6 @@ public class PodDBAdapter { null, null); } - /** - * Returns a cursor for a DB query in the FeedImages table for given IDs. - * - * @param imageIds IDs of the images - * @return The cursor of the query - */ - public final Cursor getImageCursor(String... imageIds) { - int length = imageIds.length; - if (length > IN_OPERATOR_MAXIMUM) { - Log.w(TAG, "Length of id array is larger than " - + IN_OPERATOR_MAXIMUM + ". Creating multiple cursors"); - int numCursors = (int) (((double) length) / (IN_OPERATOR_MAXIMUM)) + 1; - Cursor[] cursors = new Cursor[numCursors]; - for (int i = 0; i < numCursors; i++) { - int neededLength; - String[] parts; - final int elementsLeft = length - i * IN_OPERATOR_MAXIMUM; - - if (elementsLeft >= IN_OPERATOR_MAXIMUM) { - neededLength = IN_OPERATOR_MAXIMUM; - parts = Arrays.copyOfRange(imageIds, i - * IN_OPERATOR_MAXIMUM, (i + 1) - * IN_OPERATOR_MAXIMUM); - } else { - neededLength = elementsLeft; - parts = Arrays.copyOfRange(imageIds, i - * IN_OPERATOR_MAXIMUM, (i * IN_OPERATOR_MAXIMUM) - + neededLength); - } - - cursors[i] = db.rawQuery("SELECT * FROM " - + TABLE_NAME_FEED_IMAGES + " WHERE " + KEY_ID + " IN " - + buildInOperator(neededLength), parts); - } - Cursor result = new MergeCursor(cursors); - result.moveToFirst(); - return result; - } else { - return db.query(TABLE_NAME_FEED_IMAGES, null, KEY_ID + " IN " - + buildInOperator(length), imageIds, null, null, null); - } - } - public final Cursor getSimpleChaptersOfFeedItemCursor(final FeedItem item) { return db.query(TABLE_NAME_SIMPLECHAPTERS, null, KEY_FEEDITEM + "=?", new String[]{String.valueOf(item.getId())}, null, diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/IntList.java b/core/src/main/java/de/danoeh/antennapod/core/util/IntList.java deleted file mode 100644 index 1da5417c1..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/util/IntList.java +++ /dev/null @@ -1,240 +0,0 @@ -package de.danoeh.antennapod.core.util; - -import java.util.Arrays; - -/** - * Fast and memory efficient int list - */ -public final class IntList { - - private int[] values; - private int size; - - /** - * Constructs an empty instance with a default initial capacity. - */ - public IntList() { - this(4); - } - - /** - * Constructs an empty instance. - * - * @param initialCapacity {@code >= 0;} initial capacity of the list - */ - private IntList(int initialCapacity) { - if(initialCapacity < 0) { - throw new IllegalArgumentException("initial capacity must be 0 or higher"); - } - values = new int[initialCapacity]; - size = 0; - } - - @Override - public int hashCode() { - int hashCode = 1; - for (int i = 0; i < size; i++) { - int value = values[i]; - hashCode = 31 * hashCode + value; - } - return hashCode; - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - if (! (other instanceof IntList)) { - return false; - } - IntList otherList = (IntList) other; - if (size != otherList.size) { - return false; - } - for (int i = 0; i < size; i++) { - if (values[i] != otherList.values[i]) { - return false; - } - } - return true; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(size * 5 + 10); - sb.append("IntList{"); - for (int i = 0; i < size; i++) { - if (i != 0) { - sb.append(", "); - } - sb.append(values[i]); - } - sb.append("}"); - return sb.toString(); - } - - /** - * Gets the number of elements in this list. - */ - public int size() { - return size; - } - - /** - * Gets the indicated value. - * - * @param n {@code >= 0, < size();} which element - * @return the indicated element's value - */ - public int get(int n) { - if (n >= size) { - throw new IndexOutOfBoundsException("n >= size()"); - } else if(n < 0) { - throw new IndexOutOfBoundsException("n < 0"); - } - return values[n]; - } - - /** - * Sets the value at the given index. - * - * @param index the index at which to put the specified object. - * @param value the object to add. - * @return the previous element at the index. - */ - public int set(int index, int value) { - if (index >= size) { - throw new IndexOutOfBoundsException("n >= size()"); - } else if(index < 0) { - throw new IndexOutOfBoundsException("n < 0"); - } - int result = values[index]; - values[index] = value; - return result; - } - - /** - * Adds an element to the end of the list. This will increase the - * list's capacity if necessary. - * - * @param value the value to add - */ - public void add(int value) { - growIfNeeded(); - values[size++] = value; - } - - /** - * Inserts element into specified index, moving elements at and above - * that index up one. May not be used to insert at an index beyond the - * current size (that is, insertion as a last element is legal but - * no further). - * - * @param n {@code >= 0, <=size();} index of where to insert - * @param value value to insert - */ - public void insert(int n, int value) { - if (n > size) { - throw new IndexOutOfBoundsException("n > size()"); - } else if(n < 0) { - throw new IndexOutOfBoundsException("n < 0"); - } - - growIfNeeded(); - - System.arraycopy (values, n, values, n+1, size - n); - values[n] = value; - size++; - } - - /** - * Removes value from this list. - * - * @param value value to remove - * return {@code true} if the value was removed, {@code false} otherwise - */ - public boolean remove(int value) { - for (int i = 0; i < size; i++) { - if (values[i] == value) { - size--; - System.arraycopy(values, i+1, values, i, size-i); - return true; - } - } - return false; - } - - /** - * Removes an element at a given index, shifting elements at greater - * indicies down one. - * - * @param index index of element to remove - */ - public void removeIndex(int index) { - if (index >= size) { - throw new IndexOutOfBoundsException("n >= size()"); - } else if(index < 0) { - throw new IndexOutOfBoundsException("n < 0"); - } - size--; - System.arraycopy (values, index + 1, values, index, size - index); - } - - /** - * Increases size of array if needed - */ - private void growIfNeeded() { - if (size == values.length) { - // Resize. - int[] newArray = new int[size * 3 / 2 + 10]; - System.arraycopy(values, 0, newArray, 0, size); - values = newArray; - } - } - - /** - * Returns the index of the given value, or -1 if the value does not - * appear in the list. - * - * @param value value to find - * @return index of value or -1 - */ - private int indexOf(int value) { - for (int i = 0; i < size; i++) { - if (values[i] == value) { - return i; - } - } - return -1; - } - - /** - * Removes all values from this list. - */ - public void clear() { - values = new int[4]; - size = 0; - } - - - /** - * Returns true if the given value is contained in the list - * - * @param value value to look for - * @return {@code true} if this list contains {@code value}, {@code false} otherwise - */ - public boolean contains(int value) { - return indexOf(value) >= 0; - } - - /** - * Returns an array with a copy of this list's values - * - * @return array with a copy of this list's values - */ - public int[] toArray() { - return Arrays.copyOf(values, size); - - } -} diff --git a/core/src/main/res/drawable/borderless_button_dark.xml b/core/src/main/res/drawable/borderless_button_dark.xml deleted file mode 100644 index 3a44d81a2..000000000 --- a/core/src/main/res/drawable/borderless_button_dark.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_pressed="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/selection_background_color_dark" /> - </shape> - </item> - <item android:state_focused="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/selection_background_color_dark" /> - </shape> - </item> - <item> - <shape android:shape="rectangle"> - <solid android:color="@android:color/transparent" /> - </shape> - </item> -</selector>
\ No newline at end of file diff --git a/core/src/main/res/values-v16/colors.xml b/core/src/main/res/values-v16/colors.xml deleted file mode 100644 index 4154280e8..000000000 --- a/core/src/main/res/values-v16/colors.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <color name="selection_background_color_dark">#484B4D</color> -</resources>
\ No newline at end of file diff --git a/core/src/main/res/values-v16/styles.xml b/core/src/main/res/values-v16/styles.xml deleted file mode 100644 index 947e43f38..000000000 --- a/core/src/main/res/values-v16/styles.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - - <style name="AntennaPod.TextView.Heading" parent="@android:style/TextAppearance.Medium"> - <item name="android:textSize">@dimen/text_size_large</item> - <item name="android:textColor">?android:attr/textColorPrimary</item> - <item name="android:fontFamily">sans-serif-light</item> - </style> -</resources>
\ No newline at end of file diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml index fe571539a..755bbac58 100644 --- a/core/src/main/res/values/attrs.xml +++ b/core/src/main/res/values/attrs.xml @@ -28,7 +28,6 @@ <attr name="ic_folder" format="reference"/> <attr name="type_audio" format="reference"/> <attr name="type_video" format="reference"/> - <attr name="borderless_button" format="reference"/> <attr name="overlay_drawable" format="reference"/> <attr name="dragview_background" format="reference"/> <attr name="dragview_float_background" format="reference"/> diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index a638917f4..2ccd48353 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -279,6 +279,7 @@ <style name="AntennaPod.TextView.Heading" parent="@android:style/TextAppearance.Medium"> <item name="android:textSize">@dimen/text_size_large</item> <item name="android:textColor">?android:attr/textColorPrimary</item> + <item name="android:fontFamily">sans-serif-light</item> </style> <style name="AntennaPod.TextView.ListItemPrimaryTitle" parent="@android:style/TextAppearance.Small"> |