Merge pull request #5521 from ByteHamster/sdk-bump
Bump to minimum SDK version 19 (Android 4.4)
This commit is contained in:
commit
b4f1f44c28
|
@ -73,7 +73,6 @@
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
<category android:name="android.intent.category.APP_MUSIC" />
|
<category android:name="android.intent.category.APP_MUSIC" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.LightingColorFilter;
|
import android.graphics.LightingColorFilter;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
|
@ -451,8 +450,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
final int MAX_LINES_COLLAPSED = 10;
|
final int MAX_LINES_COLLAPSED = 10;
|
||||||
description.setMaxLines(MAX_LINES_COLLAPSED);
|
description.setMaxLines(MAX_LINES_COLLAPSED);
|
||||||
description.setOnClickListener(v -> {
|
description.setOnClickListener(v -> {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
|
if (description.getMaxLines() > MAX_LINES_COLLAPSED) {
|
||||||
&& description.getMaxLines() > MAX_LINES_COLLAPSED) {
|
|
||||||
description.setMaxLines(MAX_LINES_COLLAPSED);
|
description.setMaxLines(MAX_LINES_COLLAPSED);
|
||||||
} else {
|
} else {
|
||||||
description.setMaxLines(2000);
|
description.setMaxLines(2000);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package de.danoeh.antennapod.dialog;
|
package de.danoeh.antennapod.dialog;
|
||||||
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
@ -118,9 +117,7 @@ public class VariableSpeedDialog extends BottomSheetDialogFragment {
|
||||||
@NonNull
|
@NonNull
|
||||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
Chip chip = new Chip(getContext());
|
Chip chip = new Chip(getContext());
|
||||||
if (Build.VERSION.SDK_INT >= 17) {
|
chip.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
||||||
chip.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
|
||||||
}
|
|
||||||
return new ViewHolder(chip);
|
return new ViewHolder(chip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,18 +195,10 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat {
|
||||||
// add a button
|
// add a button
|
||||||
builder.setNegativeButton(R.string.no, null);
|
builder.setNegativeButton(R.string.no, null);
|
||||||
builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> {
|
builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> {
|
||||||
if (Build.VERSION.SDK_INT >= 19) {
|
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
intent.setType("*/*");
|
||||||
intent.setType("*/*");
|
restoreDatabaseLauncher.launch(intent);
|
||||||
restoreDatabaseLauncher.launch(intent);
|
});
|
||||||
} else {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
|
||||||
intent.setType("*/*");
|
|
||||||
restoreDatabaseLauncher.launch(Intent.createChooser(intent,
|
|
||||||
getString(R.string.import_select_file)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// create and show the alert dialog
|
// create and show the alert dialog
|
||||||
builder.show();
|
builder.show();
|
||||||
|
@ -318,20 +310,18 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat {
|
||||||
|
|
||||||
private void openExportPathPicker(String contentType, String title,
|
private void openExportPathPicker(String contentType, String title,
|
||||||
final ActivityResultLauncher<Intent> result, ExportWriter writer) {
|
final ActivityResultLauncher<Intent> result, ExportWriter writer) {
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
Intent intentPickAction = new Intent(Intent.ACTION_CREATE_DOCUMENT)
|
||||||
Intent intentPickAction = new Intent(Intent.ACTION_CREATE_DOCUMENT)
|
.addCategory(Intent.CATEGORY_OPENABLE)
|
||||||
.addCategory(Intent.CATEGORY_OPENABLE)
|
.setType(contentType)
|
||||||
.setType(contentType)
|
.putExtra(Intent.EXTRA_TITLE, title);
|
||||||
.putExtra(Intent.EXTRA_TITLE, title);
|
|
||||||
|
|
||||||
// Creates an implicit intent to launch a file manager which lets
|
// Creates an implicit intent to launch a file manager which lets
|
||||||
// the user choose a specific directory to export to.
|
// the user choose a specific directory to export to.
|
||||||
try {
|
try {
|
||||||
result.launch(intentPickAction);
|
result.launch(intentPickAction);
|
||||||
return;
|
return;
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Log.e(TAG, "No activity found. Should never happen...");
|
Log.e(TAG, "No activity found. Should never happen...");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are using a SDK lower than API 21 or the implicit intent failed
|
// If we are using a SDK lower than API 21 or the implicit intent failed
|
||||||
|
|
|
@ -2,7 +2,7 @@ android {
|
||||||
compileSdkVersion 31
|
compileSdkVersion 31
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 19
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
|
|
||||||
multiDexEnabled false
|
multiDexEnabled false
|
||||||
|
|
|
@ -815,9 +815,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
taskManager.startChapterLoader(newInfo.playable);
|
taskManager.startChapterLoader(newInfo.playable);
|
||||||
break;
|
break;
|
||||||
case PAUSED:
|
case PAUSED:
|
||||||
if ((UserPreferences.isPersistNotify() || isCasting) &&
|
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
|
||||||
// do not remove notification on pause based on user pref and whether android version supports expanded notifications
|
|
||||||
// Change [Play] button to [Pause]
|
// Change [Play] button to [Pause]
|
||||||
updateNotificationAndMediaSession(newInfo.playable);
|
updateNotificationAndMediaSession(newInfo.playable);
|
||||||
} else if (!UserPreferences.isPersistNotify() && !isCasting) {
|
} else if (!UserPreferences.isPersistNotify() && !isCasting) {
|
||||||
|
@ -1967,11 +1966,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
PlaybackService.this.updateNotificationAndMediaSession(info.playable);
|
PlaybackService.this.updateNotificationAndMediaSession(info.playable);
|
||||||
} else {
|
} else {
|
||||||
PlayerStatus status = info.playerStatus;
|
PlayerStatus status = info.playerStatus;
|
||||||
if ((status == PlayerStatus.PLAYING ||
|
if (status == PlayerStatus.PLAYING || status == PlayerStatus.SEEKING
|
||||||
status == PlayerStatus.SEEKING ||
|
|| status == PlayerStatus.PREPARING || UserPreferences.isPersistNotify()) {
|
||||||
status == PlayerStatus.PREPARING ||
|
|
||||||
UserPreferences.isPersistNotify()) &&
|
|
||||||
android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
|
||||||
PlaybackService.this.updateNotificationAndMediaSession(info.playable);
|
PlaybackService.this.updateNotificationAndMediaSession(info.playable);
|
||||||
} else if (!UserPreferences.isPersistNotify()) {
|
} else if (!UserPreferences.isPersistNotify()) {
|
||||||
stateManager.stopForeground(true);
|
stateManager.stopForeground(true);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package de.danoeh.antennapod.core.util;
|
package de.danoeh.antennapod.core.util;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.StatFs;
|
import android.os.StatFs;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
@ -63,29 +62,15 @@ public class StorageUtils {
|
||||||
*/
|
*/
|
||||||
public static long getFreeSpaceAvailable(String path) {
|
public static long getFreeSpaceAvailable(String path) {
|
||||||
StatFs stat = new StatFs(path);
|
StatFs stat = new StatFs(path);
|
||||||
long availableBlocks;
|
long availableBlocks = stat.getAvailableBlocksLong();
|
||||||
long blockSize;
|
long blockSize = stat.getBlockSizeLong();
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
|
||||||
availableBlocks = stat.getAvailableBlocksLong();
|
|
||||||
blockSize = stat.getBlockSizeLong();
|
|
||||||
} else {
|
|
||||||
availableBlocks = stat.getAvailableBlocks();
|
|
||||||
blockSize = stat.getBlockSize();
|
|
||||||
}
|
|
||||||
return availableBlocks * blockSize;
|
return availableBlocks * blockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getTotalSpaceAvailable(String path) {
|
public static long getTotalSpaceAvailable(String path) {
|
||||||
StatFs stat = new StatFs(path);
|
StatFs stat = new StatFs(path);
|
||||||
long blockCount;
|
long blockCount = stat.getBlockCountLong();
|
||||||
long blockSize;
|
long blockSize = stat.getBlockSizeLong();
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
|
||||||
blockCount = stat.getBlockCountLong();
|
|
||||||
blockSize = stat.getBlockSizeLong();
|
|
||||||
} else {
|
|
||||||
blockCount = stat.getBlockCount();
|
|
||||||
blockSize = stat.getBlockSize();
|
|
||||||
}
|
|
||||||
return blockCount * blockSize;
|
return blockCount * blockSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,6 @@ public abstract class WidgetUpdater {
|
||||||
if (!PlayerWidget.isEnabled(context) || widgetState == null) {
|
if (!PlayerWidget.isEnabled(context) || widgetState == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ComponentName playerWidget = new ComponentName(context, PlayerWidget.class);
|
|
||||||
AppWidgetManager manager = AppWidgetManager.getInstance(context);
|
|
||||||
int[] widgetIds = manager.getAppWidgetIds(playerWidget);
|
|
||||||
|
|
||||||
PendingIntent startMediaPlayer;
|
PendingIntent startMediaPlayer;
|
||||||
if (widgetState.media != null && widgetState.media.getMediaType() == MediaType.VIDEO
|
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);
|
views.setImageViewResource(R.id.butPlayExtended, R.drawable.ic_widget_play);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
|
ComponentName playerWidget = new ComponentName(context, PlayerWidget.class);
|
||||||
for (int id : widgetIds) {
|
AppWidgetManager manager = AppWidgetManager.getInstance(context);
|
||||||
Bundle options = manager.getAppWidgetOptions(id);
|
int[] widgetIds = manager.getAppWidgetIds(playerWidget);
|
||||||
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) {
|
for (int id : widgetIds) {
|
||||||
views.setInt(R.id.extendedButtonsContainer, "setVisibility", View.VISIBLE);
|
Bundle options = manager.getAppWidgetOptions(id);
|
||||||
views.setInt(R.id.butPlay, "setVisibility", View.GONE);
|
SharedPreferences prefs = context.getSharedPreferences(PlayerWidget.PREFS_NAME, Context.MODE_PRIVATE);
|
||||||
views.setInt(R.id.butRew, "setVisibility", showRewind ? View.VISIBLE : View.GONE);
|
int minWidth = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH);
|
||||||
views.setInt(R.id.butFastForward, "setVisibility", showFastForward ? View.VISIBLE : View.GONE);
|
int columns = getCellsForSize(minWidth);
|
||||||
views.setInt(R.id.butSkip, "setVisibility", showSkip ? View.VISIBLE : View.GONE);
|
if (columns < 3) {
|
||||||
}
|
views.setViewVisibility(R.id.layout_center, View.INVISIBLE);
|
||||||
|
} else {
|
||||||
int backgroundColor = prefs.getInt(PlayerWidget.KEY_WIDGET_COLOR + id, PlayerWidget.DEFAULT_COLOR);
|
views.setViewVisibility(R.id.layout_center, View.VISIBLE);
|
||||||
views.setInt(R.id.widgetLayout, "setBackgroundColor", backgroundColor);
|
|
||||||
|
|
||||||
manager.updateAppWidget(id, views);
|
|
||||||
}
|
}
|
||||||
} else {
|
boolean showRewind = prefs.getBoolean(PlayerWidget.KEY_WIDGET_REWIND + id, false);
|
||||||
manager.updateAppWidget(playerWidget, views);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
android:layout_width="@android:dimen/app_icon_size"
|
android:layout_width="@android:dimen/app_icon_size"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:contentDescription="@string/play_label"
|
android:contentDescription="@string/play_label"
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_margin="12dp"
|
android:layout_margin="12dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
|
@ -31,9 +30,7 @@
|
||||||
android:id="@+id/layout_left"
|
android:id="@+id/layout_left"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_toLeftOf="@id/butPlay"
|
|
||||||
android:layout_toStartOf="@id/butPlay"
|
android:layout_toStartOf="@id/butPlay"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:gravity="fill_horizontal"
|
android:gravity="fill_horizontal"
|
||||||
|
@ -97,7 +94,6 @@
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:contentDescription="@string/rewind_label"
|
android:contentDescription="@string/rewind_label"
|
||||||
android:layout_marginRight="2dp"
|
|
||||||
android:layout_marginEnd="2dp"
|
android:layout_marginEnd="2dp"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:src="@drawable/ic_widget_fast_rewind" />
|
android:src="@drawable/ic_widget_fast_rewind" />
|
||||||
|
@ -108,7 +104,6 @@
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:contentDescription="@string/play_label"
|
android:contentDescription="@string/play_label"
|
||||||
android:layout_marginRight="2dp"
|
|
||||||
android:layout_marginEnd="2dp"
|
android:layout_marginEnd="2dp"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:src="@drawable/ic_widget_play" />
|
android:src="@drawable/ic_widget_play" />
|
||||||
|
@ -119,7 +114,6 @@
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:contentDescription="@string/fast_forward_label"
|
android:contentDescription="@string/fast_forward_label"
|
||||||
android:layout_marginRight="2dp"
|
|
||||||
android:layout_marginEnd="2dp"
|
android:layout_marginEnd="2dp"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:src="@drawable/ic_widget_fast_forward" />
|
android:src="@drawable/ic_widget_fast_forward" />
|
||||||
|
@ -130,7 +124,6 @@
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:contentDescription="@string/skip_episode_label"
|
android:contentDescription="@string/skip_episode_label"
|
||||||
android:layout_marginRight="2dp"
|
|
||||||
android:layout_marginEnd="2dp"
|
android:layout_marginEnd="2dp"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:src="@drawable/ic_widget_skip" />
|
android:src="@drawable/ic_widget_skip" />
|
||||||
|
|
|
@ -597,7 +597,6 @@
|
||||||
<string name="export_success_title">Export successful</string>
|
<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="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="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="successful_import_label">Import successful</string>
|
||||||
<string name="import_ok">Please press OK to restart AntennaPod</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>
|
<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>
|
||||||
|
|
Loading…
Reference in New Issue