Merge branch 'develop' into remove-prestissimo

This commit is contained in:
H. Lehmann 2019-11-22 22:18:52 +01:00 committed by GitHub
commit c6fb84fa1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 57 additions and 135 deletions

View File

@ -29,7 +29,7 @@ public class GPodnetServiceTest {
private static final String PW = "";
@Before
protected void setUp() {
public void setUp() {
service = new GpodnetService();
}

View File

@ -44,7 +44,7 @@ public class AutoDownloadTest {
public void setUp() throws Exception {
context = ApplicationProvider.getApplicationContext();
stubFeedsServer = new UITestUtils(context);;
stubFeedsServer = new UITestUtils(context);
stubFeedsServer.setup();
dbTasksCallbacksOrig = ClientConfig.dbTasksCallbacks;
@ -130,7 +130,7 @@ public class AutoDownloadTest {
}
private void useDownloadAlgorithm(final AutomaticDownloadAlgorithm downloadAlgorithm) {
DBTasksCallbacks dbTasksCallbacksStub = new DBTasksCallbacks() {
ClientConfig.dbTasksCallbacks = new DBTasksCallbacks() {
@Override
public AutomaticDownloadAlgorithm getAutomaticDownloadAlgorithm() {
return downloadAlgorithm;
@ -141,7 +141,6 @@ public class AutoDownloadTest {
return dbTasksCallbacksOrig.getEpisodeCacheCleanupAlgorithm();
}
};
ClientConfig.dbTasksCallbacks = dbTasksCallbacksStub;
}
private class StubDownloadAlgorithm implements AutomaticDownloadAlgorithm {

View File

@ -322,15 +322,11 @@ public class DBWriterTest {
feed.setImageUrl("url");
List<File> itemFiles = new ArrayList<>();
// create items with downloaded media files
for (int i = 0; i < 10; i++) {
FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed);
feed.getItems().add(item);
File enc = new File(destFolder, "file " + i);
itemFiles.add(enc);
FeedMedia media = new FeedMedia(0, item, 1, 1, 1, "mime_type", enc.getAbsolutePath(), "download_url", false, null, 0, 0);
item.setMedia(media);
}
@ -387,15 +383,11 @@ public class DBWriterTest {
feed.setImageUrl("url");
List<File> itemFiles = new ArrayList<>();
// create items with downloaded media files
for (int i = 0; i < 10; i++) {
FeedItem item = new FeedItem(0, "Item " + i, "Item" + i, "url", new Date(), FeedItem.PLAYED, feed);
feed.getItems().add(item);
File enc = new File(destFolder, "file " + i);
itemFiles.add(enc);
FeedMedia media = new FeedMedia(0, item, 1, 1, 1, "mime_type", enc.getAbsolutePath(), "download_url", false, null, 0, 0);
item.setMedia(media);
}

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

@ -317,8 +317,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
fragment = new AddFeedFragment();
break;
case SubscriptionFragment.TAG:
SubscriptionFragment subscriptionFragment = new SubscriptionFragment();
fragment = subscriptionFragment;
fragment = new SubscriptionFragment();
break;
default:
// default to the queue

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

@ -32,15 +32,12 @@ public class VariableSpeedDialog {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
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);
}
});
builder.setNeutralButton(R.string.close_label, null);
builder.show();
}

View File

@ -101,7 +101,6 @@ public class CombinedSearchFragment extends Fragment {
inflater.inflate(R.menu.itunes_search, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem);
MenuItemUtils.adjustTextColor(getActivity(), sv);
sv.setQueryHint(getString(R.string.search_label));
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override

View File

@ -169,7 +169,6 @@ public abstract class EpisodesListFragment extends Fragment {
MenuItem searchItem = menu.findItem(R.id.action_search);
final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem);
MenuItemUtils.adjustTextColor(getActivity(), sv);
sv.setQueryHint(getString(R.string.search_hint));
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override

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

@ -185,7 +185,6 @@ public class FeedItemlistFragment extends ListFragment {
MenuItem searchItem = menu.findItem(R.id.action_search);
final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem);
MenuItemUtils.adjustTextColor(getActivity(), sv);
sv.setQueryHint(getString(R.string.search_hint));
searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override

View File

@ -100,7 +100,6 @@ public class FyydSearchFragment extends Fragment {
inflater.inflate(R.menu.itunes_search, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem);
MenuItemUtils.adjustTextColor(getActivity(), sv);
sv.setQueryHint(getString(R.string.search_fyyd_label));
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override

View File

@ -144,7 +144,6 @@ public class ItemDescriptionFragment extends Fragment {
}
};
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public boolean onContextItemSelected(MenuItem item) {

View File

@ -150,7 +150,6 @@ public class ItunesSearchFragment extends Fragment {
inflater.inflate(R.menu.itunes_search, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem);
MenuItemUtils.adjustTextColor(getActivity(), sv);
sv.setQueryHint(getString(R.string.search_itunes_label));
sv.setOnQueryTextListener(new androidx.appcompat.widget.SearchView.OnQueryTextListener() {
@Override

View File

@ -288,7 +288,6 @@ public class QueueFragment extends Fragment {
MenuItem searchItem = menu.findItem(R.id.action_search);
final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem);
MenuItemUtils.adjustTextColor(getActivity(), sv);
sv.setQueryHint(getString(R.string.search_hint));
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override

View File

@ -54,7 +54,6 @@ public abstract class PodcastListFragment extends Fragment {
inflater.inflate(R.menu.gpodder_podcasts, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem);
MenuItemUtils.adjustTextColor(getActivity(), sv);
sv.setQueryHint(getString(R.string.gpodnet_search_hint));
sv.setOnQueryTextListener(new androidx.appcompat.widget.SearchView.OnQueryTextListener() {
@Override

View File

@ -50,7 +50,6 @@ public class SearchListFragment extends PodcastListFragment {
// parent already inflated menu
MenuItem searchItem = menu.findItem(R.id.action_search);
final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem);
MenuItemUtils.adjustTextColor(getActivity(), sv);
sv.setQueryHint(getString(R.string.gpodnet_search_hint));
sv.setQuery(query, false);
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

View File

@ -40,7 +40,6 @@ public class TagListFragment extends ListFragment {
inflater.inflate(R.menu.gpodder_podcasts, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem);
MenuItemUtils.adjustTextColor(getActivity(), sv);
sv.setQueryHint(getString(R.string.gpodnet_search_hint));
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override

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

@ -2,14 +2,8 @@ package de.danoeh.antennapod.menuhandler;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Build;
import androidx.appcompat.widget.SearchView;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences;
/**
@ -17,18 +11,6 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
*/
public class MenuItemUtils extends de.danoeh.antennapod.core.menuhandler.MenuItemUtils {
public static void adjustTextColor(Context context, SearchView sv) {
if(Build.VERSION.SDK_INT < 14) {
EditText searchEditText = sv.findViewById(R.id.search_src_text);
if (UserPreferences.getTheme() == de.danoeh.antennapod.R.style.Theme_AntennaPod_Dark
|| UserPreferences.getTheme() == R.style.Theme_AntennaPod_TrueBlack) {
searchEditText.setTextColor(Color.WHITE);
} else {
searchEditText.setTextColor(Color.BLACK);
}
}
}
@SuppressWarnings("ResourceType")
public static void refreshLockItem(Context context, Menu menu) {
final MenuItem queueLock = menu.findItem(de.danoeh.antennapod.R.id.queue_lock);

View File

@ -88,7 +88,7 @@ public class AspectRatioVideoView extends VideoView {
mVideoWidth = videoWidth;
mVideoHeight = videoHeight;
/**
/*
* If this isn't set the video is stretched across the
* SurfaceHolders display surface (i.e. the SurfaceHolder
* as the same size and the video is drawn to fit this

View File

@ -20,7 +20,7 @@
tools:listitem="@layout/gpodnet_podcast_listitem" />
<TextView
android:id="@id/android:empty"
android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"

View File

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

View File

@ -304,7 +304,7 @@ public class UserPreferences {
}
public enum EnqueueLocation {
BACK, FRONT, AFTER_CURRENTLY_PLAYING;
BACK, FRONT, AFTER_CURRENTLY_PLAYING
}
@NonNull
@ -566,8 +566,7 @@ public class UserPreferences {
prefs.edit().putString(PREF_IMAGE_CACHE_SIZE, IMAGE_CACHE_DEFAULT_VALUE).apply();
cacheSizeInt = Integer.parseInt(IMAGE_CACHE_DEFAULT_VALUE);
}
int cacheSizeMB = cacheSizeInt * 1024 * 1024;
return cacheSizeMB;
return cacheSizeInt * 1024 * 1024;
}
public static int getFastForwardSecs() {
@ -791,8 +790,7 @@ public class UserPreferences {
}
public static String getMediaPlayer() {
String s = prefs.getString(PREF_MEDIA_PLAYER, "blaah");
return s;
return prefs.getString(PREF_MEDIA_PLAYER, PREF_MEDIA_PLAYER_EXOPLAYER);
}
public static boolean useSonic() {

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

@ -25,7 +25,7 @@ public enum SortOrder {
SMART_SHUFFLE_NEW_OLD(105, INTER_FEED);
public enum Scope {
INTRA_FEED, INTER_FEED;
INTRA_FEED, INTER_FEED
}
public final int code;

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>