From 201bb0fe9137da7ae97928f0b81280c89ed423a6 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Fri, 22 Nov 2019 18:50:32 +0100 Subject: [PATCH] Bumped minimum API version to 16 --- .../java/de/danoeh/antennapod/PodcastApp.java | 59 +++++++++---------- .../activity/MediaplayerActivity.java | 7 +-- .../activity/VideoplayerActivity.java | 11 ++-- .../dialog/VariableSpeedDialog.java | 14 ++--- .../fragment/ExternalPlayerFragment.java | 6 +- .../PlaybackPreferencesFragment.java | 16 ----- build.gradle | 2 +- .../download/AntennapodHttpClient.java | 2 +- .../antennapod/core/storage/PodDBAdapter.java | 4 +- core/src/main/res/values/arrays.xml | 10 ---- 10 files changed, 47 insertions(+), 84 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java index 16c3dcf1b..4e6b8fa29 100644 --- a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java +++ b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java @@ -1,7 +1,6 @@ package de.danoeh.antennapod; import android.app.Application; -import android.os.Build; import android.os.StrictMode; import com.joanzapata.iconify.Iconify; @@ -25,45 +24,43 @@ public class PodcastApp extends Application { } } - private static PodcastApp singleton; + private static PodcastApp singleton; - public static PodcastApp getInstance() { - return singleton; - } + public static PodcastApp getInstance() { + return singleton; + } - @Override - public void onCreate() { - super.onCreate(); + @Override + public void onCreate() { + super.onCreate(); - Thread.setDefaultUncaughtExceptionHandler(new CrashReportWriter()); + Thread.setDefaultUncaughtExceptionHandler(new CrashReportWriter()); - if(BuildConfig.DEBUG) { - StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder() - .detectLeakedSqlLiteObjects() - .penaltyLog() - .penaltyDropBox(); - builder.detectActivityLeaks(); - builder.detectLeakedClosableObjects(); - if(Build.VERSION.SDK_INT >= 16) { - builder.detectLeakedRegistrationObjects(); - } - StrictMode.setVmPolicy(builder.build()); - } + if (BuildConfig.DEBUG) { + StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder() + .detectLeakedSqlLiteObjects() + .penaltyLog() + .penaltyDropBox() + .detectActivityLeaks() + .detectLeakedClosableObjects() + .detectLeakedRegistrationObjects(); + StrictMode.setVmPolicy(builder.build()); + } - singleton = this; + singleton = this; - ClientConfig.initialize(this); + ClientConfig.initialize(this); - Iconify.with(new FontAwesomeModule()); - Iconify.with(new MaterialModule()); + Iconify.with(new FontAwesomeModule()); + Iconify.with(new MaterialModule()); SPAUtil.sendSPAppsQueryFeedsIntent(this); - EventBus.builder() - .addIndex(new ApEventBusIndex()) - .addIndex(new ApCoreEventBusIndex()) - .logNoSubscriberMessages(false) - .sendNoSubscriberEvent(false) - .installDefaultEventBus(); + EventBus.builder() + .addIndex(new ApEventBusIndex()) + .addIndex(new ApCoreEventBusIndex()) + .logNoSubscriberMessages(false) + .sendNoSubscriberEvent(false) + .installDefaultEventBus(); } } diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java index d71a0f872..538ed1231 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -391,10 +391,9 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements | Intent.FLAG_ACTIVITY_NEW_TASK); View cover = findViewById(R.id.imgvCover); - if (cover != null && Build.VERSION.SDK_INT >= 16) { - ActivityOptionsCompat options = ActivityOptionsCompat. - makeSceneTransitionAnimation(MediaplayerActivity.this, - cover, "coverTransition"); + if (cover != null) { + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation(MediaplayerActivity.this, cover, "coverTransition"); startActivity(intent, options.toBundle()); } else { startActivity(intent); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java index 2d28ea561..0c6ae2645 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -151,10 +151,7 @@ public class VideoplayerActivity extends MediaplayerActivity { videoview.getHolder().addCallback(surfaceHolderCallback); videoframe.setOnTouchListener(onVideoviewTouched); videoOverlay.setOnTouchListener((view, motionEvent) -> true); // To suppress touches directly below the slider - - if (Build.VERSION.SDK_INT >= 16) { - videoview.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); - } + videoview.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); videoOverlay.setFitsSystemWindows(true); setupVideoControlsToggler(); @@ -351,9 +348,9 @@ public class VideoplayerActivity extends MediaplayerActivity { controls.startAnimation(animation); } } - int videoviewFlag = (Build.VERSION.SDK_INT >= 16) ? View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION : 0; - getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | videoviewFlag); + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE + | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); videoOverlay.setFitsSystemWindows(true); videoOverlay.setVisibility(View.GONE); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java index a5c78b511..512b75483 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java @@ -45,14 +45,12 @@ public class VariableSpeedDialog { builder.setTitle(R.string.no_playback_plugin_title); builder.setMessage(R.string.no_playback_plugin_or_sonic_msg); - if (Build.VERSION.SDK_INT >= 16) { - builder.setPositiveButton(R.string.enable_sonic, (dialog, which) -> { - UserPreferences.enableSonic(); - if (showSpeedSelector) { - showSpeedSelectorDialog(context); - } - }); - } + builder.setPositiveButton(R.string.enable_sonic, (dialog, which) -> { + UserPreferences.enableSonic(); + if (showSpeedSelector) { + showSpeedSelectorDialog(context); + } + }); if (IntentUtils.isCallable(context.getApplicationContext(), playStoreIntent)) { builder.setNegativeButton(R.string.download_plugin_label, (dialog, which) -> { try { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java index 5a5bdc081..ce2232a55 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java @@ -71,9 +71,9 @@ public class ExternalPlayerFragment extends Fragment { if (controller != null && controller.getMedia() != null) { Intent intent = PlaybackService.getPlayerActivityIntent(getActivity(), controller.getMedia()); - if (Build.VERSION.SDK_INT >= 16 && controller.getMedia().getMediaType() == MediaType.AUDIO) { - ActivityOptionsCompat options = ActivityOptionsCompat. - makeSceneTransitionAnimation(getActivity(), imgvCover, "coverTransition"); + if (controller.getMedia().getMediaType() == MediaType.AUDIO) { + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation(getActivity(), imgvCover, "coverTransition"); startActivity(intent, options.toBundle()); } else { startActivity(intent); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java index 5d9af14bd..b82bba89b 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java @@ -41,12 +41,6 @@ public class PlaybackPreferencesFragment extends PreferenceFragmentCompat { ((PreferenceActivity) getActivity()).getSupportActionBar().setTitle(R.string.playback_pref); } - @Override - public void onResume() { - super.onResume(); - checkSonicItemVisibility(); - } - private void setupPlaybackScreen() { final Activity activity = getActivity(); @@ -130,14 +124,4 @@ public class PlaybackPreferencesFragment extends PreferenceFragmentCompat { } pref.setEntries(entries); } - - - - private void checkSonicItemVisibility() { - if (Build.VERSION.SDK_INT < 16) { - ListPreference p = (ListPreference) findPreference(UserPreferences.PREF_MEDIA_PLAYER); - p.setEntries(R.array.media_player_options_no_sonic); - p.setEntryValues(R.array.media_player_values_no_sonic); - } - } } diff --git a/build.gradle b/build.gradle index f03d2d721..c71e5522f 100644 --- a/build.gradle +++ b/build.gradle @@ -41,7 +41,7 @@ subprojects { project.ext { compileSdkVersion = 28 - minSdkVersion = 14 + minSdkVersion = 16 targetSdkVersion = 28 workManagerVersion = "1.0.1" diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/AntennapodHttpClient.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/AntennapodHttpClient.java index 2082b95d1..bf990f69d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/AntennapodHttpClient.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/AntennapodHttpClient.java @@ -142,7 +142,7 @@ public class AntennapodHttpClient { }); } } - if (16 <= Build.VERSION.SDK_INT && Build.VERSION.SDK_INT < 21) { + if (Build.VERSION.SDK_INT < 21) { builder.sslSocketFactory(new CustomSslSocketFactory(), trustManager()); } 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 a37f357ae..1aff73564 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 @@ -327,9 +327,7 @@ public class PodDBAdapter { SQLiteDatabase newDb; try { newDb = SingletonHolder.dbHelper.getWritableDatabase(); - if (Build.VERSION.SDK_INT >= 16) { - newDb.disableWriteAheadLogging(); - } + newDb.disableWriteAheadLogging(); } catch (SQLException ex) { Log.e(TAG, Log.getStackTraceString(ex)); newDb = SingletonHolder.dbHelper.getReadableDatabase(); diff --git a/core/src/main/res/values/arrays.xml b/core/src/main/res/values/arrays.xml index 3a6a45e6d..facde2c59 100644 --- a/core/src/main/res/values/arrays.xml +++ b/core/src/main/res/values/arrays.xml @@ -233,16 +233,6 @@ exoplayer - - @string/media_player_builtin - @string/media_player_exoplayer - - - - builtin - exoplayer - - @string/hide_unplayed_episodes_label @string/hide_paused_episodes_label