Bumped minimum API version to 16

This commit is contained in:
ByteHamster 2019-11-22 18:50:32 +01:00
parent a5ee83f373
commit 201bb0fe91
10 changed files with 47 additions and 84 deletions

View File

@ -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();
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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 {

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -41,7 +41,7 @@ subprojects {
project.ext {
compileSdkVersion = 28
minSdkVersion = 14
minSdkVersion = 16
targetSdkVersion = 28
workManagerVersion = "1.0.1"

View File

@ -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());
}

View File

@ -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();

View File

@ -233,16 +233,6 @@
<item>exoplayer</item>
</string-array>
<string-array name="media_player_options_no_sonic">
<item>@string/media_player_builtin</item>
<item>@string/media_player_exoplayer</item>
</string-array>
<string-array name="media_player_values_no_sonic">
<item>builtin</item>
<item>exoplayer</item>
</string-array>
<string-array name="episode_filter_options">
<item>@string/hide_unplayed_episodes_label</item>
<item>@string/hide_paused_episodes_label</item>