Merge branch 'develop' into ci-release-build
This commit is contained in:
commit
87a52e594f
|
@ -162,14 +162,14 @@ dependencies {
|
|||
implementation "commons-io:commons-io:$commonsioVersion"
|
||||
implementation "org.jsoup:jsoup:$jsoupVersion"
|
||||
implementation "com.github.bumptech.glide:glide:$glideVersion"
|
||||
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
|
||||
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
||||
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttpVersion"
|
||||
implementation "com.squareup.okio:okio:$okioVersion"
|
||||
implementation "de.greenrobot:eventbus:$eventbusVersion"
|
||||
implementation "io.reactivex:rxandroid:$rxAndroidVersion"
|
||||
implementation "io.reactivex:rxjava:$rxJavaVersion"
|
||||
// And ProGuard rules for RxJava!
|
||||
implementation "com.artemzin.rxjava:proguard-rules:$rxJavaRulesVersion"
|
||||
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
|
||||
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
|
||||
|
||||
implementation "com.joanzapata.iconify:android-iconify-fontawesome:$iconifyVersion"
|
||||
implementation "com.joanzapata.iconify:android-iconify-material:$iconifyVersion"
|
||||
implementation("com.afollestad.material-dialogs:commons:$materialDialogsVersion") {
|
||||
|
@ -184,7 +184,7 @@ dependencies {
|
|||
|
||||
implementation "com.github.AntennaPod:AntennaPod-AudioPlayer:$audioPlayerVersion"
|
||||
|
||||
implementation 'com.github.mfietz:fyydlin:v0.3'
|
||||
implementation 'com.github.mfietz:fyydlin:v0.4.1'
|
||||
implementation 'com.github.ByteHamster:SearchPreference:v1.0.8'
|
||||
|
||||
androidTestImplementation "com.jayway.android.robotium:robotium-solo:$robotiumSoloVersion"
|
||||
|
|
|
@ -391,10 +391,6 @@
|
|||
android:resource="@xml/provider_paths"/>
|
||||
</provider>
|
||||
|
||||
<meta-data
|
||||
android:name="de.danoeh.antennapod.core.glide.ApGlideModule"
|
||||
android:value="GlideModule" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.car.application"
|
||||
android:resource="@xml/automotive_app_desc"/>
|
||||
|
|
|
@ -21,10 +21,10 @@ import java.nio.charset.Charset;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import rx.Single;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Displays the 'about' screen
|
||||
|
@ -35,7 +35,7 @@ public class AboutActivity extends AppCompatActivity {
|
|||
|
||||
private WebView webView;
|
||||
private LinearLayout webViewContainer;
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -69,7 +69,7 @@ public class AboutActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void loadAsset(String filename) {
|
||||
subscription = Single.create(subscriber -> {
|
||||
disposable = Single.create(subscriber -> {
|
||||
InputStream input = null;
|
||||
try {
|
||||
TypedArray res = AboutActivity.this.getTheme().obtainStyledAttributes(
|
||||
|
@ -115,7 +115,7 @@ public class AboutActivity extends AppCompatActivity {
|
|||
IOUtils.closeQuietly(input);
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
webViewData ->
|
||||
|
@ -146,8 +146,8 @@ public class AboutActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
if (webViewContainer != null && webView != null) {
|
||||
webViewContainer.removeAllViews();
|
||||
|
|
|
@ -18,6 +18,7 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.joanzapata.iconify.Iconify;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -36,10 +37,11 @@ import de.danoeh.antennapod.core.util.IntentUtils;
|
|||
import de.danoeh.antennapod.core.util.LangUtils;
|
||||
import de.danoeh.antennapod.core.util.syndication.HtmlToPlainText;
|
||||
import de.danoeh.antennapod.menuhandler.FeedMenuHandler;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Maybe;
|
||||
import io.reactivex.MaybeOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Displays information about a feed.
|
||||
|
@ -59,7 +61,7 @@ public class FeedInfoActivity extends AppCompatActivity {
|
|||
private TextView txtvAuthor;
|
||||
private TextView txtvUrl;
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
|
||||
private final View.OnClickListener copyUrlToClipboard = new View.OnClickListener() {
|
||||
|
@ -104,33 +106,38 @@ public class FeedInfoActivity extends AppCompatActivity {
|
|||
|
||||
txtvUrl.setOnClickListener(copyUrlToClipboard);
|
||||
|
||||
subscription = Observable.fromCallable(()-> DBReader.getFeed(feedId))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Maybe.create((MaybeOnSubscribe<Feed>) emitter -> {
|
||||
Feed feed = DBReader.getFeed(feedId);
|
||||
if (feed != null) {
|
||||
emitter.onSuccess(feed);
|
||||
} else {
|
||||
emitter.onComplete();
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
if (result == null) {
|
||||
Log.e(TAG, "Activity was started with invalid arguments");
|
||||
finish();
|
||||
}
|
||||
feed = result;
|
||||
Log.d(TAG, "Language is " + feed.getLanguage());
|
||||
Log.d(TAG, "Author is " + feed.getAuthor());
|
||||
Log.d(TAG, "URL is " + feed.getDownload_url());
|
||||
Glide.with(FeedInfoActivity.this)
|
||||
.load(feed.getImageLocation())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(imgvCover);
|
||||
Glide.with(FeedInfoActivity.this)
|
||||
.load(feed.getImageLocation())
|
||||
.placeholder(R.color.image_readability_tint)
|
||||
.error(R.color.image_readability_tint)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.transform(new FastBlurTransformation(FeedInfoActivity.this))
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.image_readability_tint)
|
||||
.error(R.color.image_readability_tint)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.transform(new FastBlurTransformation())
|
||||
.dontAnimate())
|
||||
.into(imgvBackground);
|
||||
|
||||
txtvTitle.setText(feed.getTitle());
|
||||
|
@ -167,14 +174,17 @@ public class FeedInfoActivity extends AppCompatActivity {
|
|||
}, error -> {
|
||||
Log.d(TAG, Log.getStackTraceString(error));
|
||||
finish();
|
||||
}, () -> {
|
||||
Log.e(TAG, "Activity was started with invalid arguments");
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
@ -24,9 +23,9 @@ import android.widget.ImageView;
|
|||
import android.widget.RadioButton;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
||||
|
@ -42,10 +41,11 @@ import de.danoeh.antennapod.core.storage.DBWriter;
|
|||
import de.danoeh.antennapod.core.storage.DownloadRequestException;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
import de.danoeh.antennapod.menuhandler.FeedMenuHandler;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Maybe;
|
||||
import io.reactivex.MaybeOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Displays information about a feed.
|
||||
|
@ -69,7 +69,7 @@ public class FeedSettingsActivity extends AppCompatActivity {
|
|||
private Spinner spnAutoDelete;
|
||||
private boolean filterInclude = true;
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
private boolean authInfoChanged = false;
|
||||
|
||||
|
@ -139,31 +139,36 @@ public class FeedSettingsActivity extends AppCompatActivity {
|
|||
filterTextChanged = true;
|
||||
});
|
||||
|
||||
subscription = Observable.fromCallable(()-> DBReader.getFeed(feedId))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Maybe.create((MaybeOnSubscribe<Feed>) emitter -> {
|
||||
Feed feed = DBReader.getFeed(feedId);
|
||||
if (feed != null) {
|
||||
emitter.onSuccess(feed);
|
||||
} else {
|
||||
emitter.onComplete();
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
if (result == null) {
|
||||
Log.e(TAG, "Activity was started with invalid arguments");
|
||||
finish();
|
||||
}
|
||||
feed = result;
|
||||
FeedPreferences prefs = feed.getPreferences();
|
||||
Glide.with(FeedSettingsActivity.this)
|
||||
.load(feed.getImageLocation())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(imgvCover);
|
||||
Glide.with(FeedSettingsActivity.this)
|
||||
.load(feed.getImageLocation())
|
||||
.placeholder(R.color.image_readability_tint)
|
||||
.error(R.color.image_readability_tint)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.transform(new FastBlurTransformation(FeedSettingsActivity.this))
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.image_readability_tint)
|
||||
.error(R.color.image_readability_tint)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.transform(new FastBlurTransformation())
|
||||
.dontAnimate())
|
||||
.into(imgvBackground);
|
||||
|
||||
txtvTitle.setText(feed.getTitle());
|
||||
|
@ -245,6 +250,9 @@ public class FeedSettingsActivity extends AppCompatActivity {
|
|||
}, error -> {
|
||||
Log.d(TAG, Log.getStackTraceString(error));
|
||||
finish();
|
||||
}, () -> {
|
||||
Log.e(TAG, "Activity was started with invalid arguments");
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -282,8 +290,8 @@ public class FeedSettingsActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@ import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
|||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
||||
import de.danoeh.antennapod.core.util.Flavors;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
import de.danoeh.antennapod.core.util.StorageUtils;
|
||||
import de.danoeh.antennapod.core.util.download.AutoUpdateManager;
|
||||
import de.danoeh.antennapod.core.util.gui.NotificationUtils;
|
||||
import de.danoeh.antennapod.dialog.RatingDialog;
|
||||
import de.danoeh.antennapod.dialog.RenameFeedDialog;
|
||||
|
@ -69,10 +69,10 @@ import de.danoeh.antennapod.fragment.QueueFragment;
|
|||
import de.danoeh.antennapod.fragment.SubscriptionFragment;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* The activity that is shown when the user launches the app.
|
||||
|
@ -122,7 +122,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
|||
|
||||
private ProgressDialog pd;
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
private long lastBackButtonPressTime = 0;
|
||||
|
||||
|
@ -474,7 +474,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
DBTasks.checkShouldRefreshFeeds(getApplicationContext());
|
||||
AutoUpdateManager.checkShouldRefreshFeeds(getApplicationContext());
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent.hasExtra(EXTRA_FEED_ID) ||
|
||||
|
@ -491,8 +491,8 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
|||
super.onStop();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
EventBus.getDefault().unregister(this);
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
if(pd != null) {
|
||||
pd.dismiss();
|
||||
|
@ -750,8 +750,8 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
|||
};
|
||||
|
||||
private void loadData() {
|
||||
subscription = Observable.fromCallable(DBReader::getNavDrawerData)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(DBReader::getNavDrawerData)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
boolean handleIntent = (navDrawerData == null);
|
||||
|
|
|
@ -47,9 +47,11 @@ import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
|||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.core.util.Consumer;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
||||
import de.danoeh.antennapod.core.util.Flavors;
|
||||
import de.danoeh.antennapod.core.util.Function;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
import de.danoeh.antennapod.core.util.ShareUtils;
|
||||
import de.danoeh.antennapod.core.util.StorageUtils;
|
||||
|
@ -62,11 +64,10 @@ import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
|||
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;
|
||||
import de.danoeh.antennapod.dialog.SleepTimerDialog;
|
||||
import de.danoeh.antennapod.dialog.VariableSpeedDialog;
|
||||
import rx.Observable;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.functions.Action1;
|
||||
import rx.functions.Func1;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -95,6 +96,8 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
|
||||
private boolean isFavorite = false;
|
||||
|
||||
private Disposable disposable;
|
||||
|
||||
private PlaybackController newPlaybackController() {
|
||||
return new PlaybackController(this, false) {
|
||||
|
||||
|
@ -287,6 +290,9 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
controller.release();
|
||||
controller = null; // prevent leak
|
||||
}
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
|
@ -638,7 +644,6 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
if (controller != null) {
|
||||
controller.init();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -724,8 +729,8 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
R.string.pref_rewind);
|
||||
|
||||
private final Supplier<Integer> getPrefSecsFn;
|
||||
private final Func1<MediaplayerActivity, TextView> getTextViewFn;
|
||||
private final Action1<Integer> setPrefSecsFn;
|
||||
private final Function<MediaplayerActivity, TextView> getTextViewFn;
|
||||
private final Consumer<Integer> setPrefSecsFn;
|
||||
private final int titleResourceID;
|
||||
|
||||
/**
|
||||
|
@ -737,7 +742,7 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
* @param setPrefSecsFn Handle to function that sets the preference (setting) for the skip delta value (and optionally updates the button label with the current values)
|
||||
* @param titleResourceID ID of the resource string with the title for a view
|
||||
*/
|
||||
SkipDirection(Supplier<Integer> getPrefSecsFn, Func1<MediaplayerActivity, TextView> getTextViewFn, Action1<Integer> setPrefSecsFn, int titleResourceID) {
|
||||
SkipDirection(Supplier<Integer> getPrefSecsFn, Function<MediaplayerActivity, TextView> getTextViewFn, Consumer<Integer> setPrefSecsFn, int titleResourceID) {
|
||||
this.getPrefSecsFn = getPrefSecsFn;
|
||||
this.getTextViewFn = getTextViewFn;
|
||||
this.setPrefSecsFn = setPrefSecsFn;
|
||||
|
@ -756,10 +761,10 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
* @param activity MediaplyerActivity that contains textview to update the display of the skip delta setting (or null if nothing to update)
|
||||
*/
|
||||
public void setPrefSkipSeconds(int seconds, @Nullable Activity activity) {
|
||||
setPrefSecsFn.call(seconds);
|
||||
setPrefSecsFn.accept(seconds);
|
||||
|
||||
if (activity != null && activity instanceof MediaplayerActivity) {
|
||||
TextView tv = getTextViewFn.call((MediaplayerActivity)activity);
|
||||
TextView tv = getTextViewFn.apply((MediaplayerActivity)activity);
|
||||
if (tv != null) tv.setText(String.valueOf(seconds));
|
||||
}
|
||||
}
|
||||
|
@ -940,22 +945,27 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
|
||||
private void checkFavorite() {
|
||||
Playable playable = controller.getMedia();
|
||||
if (playable != null && playable instanceof FeedMedia) {
|
||||
FeedItem feedItem = ((FeedMedia) playable).getItem();
|
||||
if (feedItem != null) {
|
||||
Observable.fromCallable(() -> DBReader.getFeedItem(feedItem.getId()))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
item -> {
|
||||
boolean isFav = item.isTagged(FeedItem.TAG_FAVORITE);
|
||||
if (isFavorite != isFav) {
|
||||
isFavorite = isFav;
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
}
|
||||
if (!(playable instanceof FeedMedia)) {
|
||||
return;
|
||||
}
|
||||
FeedItem feedItem = ((FeedMedia) playable).getItem();
|
||||
if (feedItem == null) {
|
||||
return;
|
||||
}
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
disposable = Observable.fromCallable(() -> DBReader.getFeedItem(feedItem.getId()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
item -> {
|
||||
boolean isFav = item.isTagged(FeedItem.TAG_FAVORITE);
|
||||
if (isFavorite != isFav) {
|
||||
isFavorite = isFav;
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
}
|
||||
|
||||
void playExternalMedia(Intent intent, MediaType type) {
|
||||
|
|
|
@ -46,9 +46,9 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
|
|||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||
import de.danoeh.antennapod.core.service.playback.PlayerStatus;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
import de.danoeh.antennapod.core.util.download.AutoUpdateManager;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||
import de.danoeh.antennapod.dialog.RenameFeedDialog;
|
||||
|
@ -63,10 +63,10 @@ import de.danoeh.antennapod.fragment.QueueFragment;
|
|||
import de.danoeh.antennapod.fragment.SubscriptionFragment;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Activity for playing files that do not require a video surface.
|
||||
|
@ -106,7 +106,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
private ViewPager pager;
|
||||
private MediaplayerInfoPagerAdapter pagerAdapter;
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
|
@ -127,8 +127,8 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
if(pagerAdapter != null) {
|
||||
pagerAdapter.setController(null);
|
||||
}
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
saveCurrentFragment();
|
||||
|
@ -187,7 +187,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
pagerAdapter.onMediaChanged(media);
|
||||
pagerAdapter.setController(controller);
|
||||
}
|
||||
DBTasks.checkShouldRefreshFeeds(getApplicationContext());
|
||||
AutoUpdateManager.checkShouldRefreshFeeds(getApplicationContext());
|
||||
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
EventBus.getDefault().register(this);
|
||||
|
@ -472,8 +472,8 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
private DBReader.NavDrawerData navDrawerData;
|
||||
|
||||
private void loadData() {
|
||||
subscription = Observable.fromCallable(DBReader::getNavDrawerData)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(DBReader::getNavDrawerData)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
navDrawerData = result;
|
||||
|
|
|
@ -28,6 +28,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
@ -65,10 +66,10 @@ import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer;
|
|||
import de.danoeh.antennapod.core.util.syndication.HtmlToPlainText;
|
||||
import de.danoeh.antennapod.dialog.AuthenticationDialog;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Downloads a feed from a feed URL and parses it. Subclasses can display the
|
||||
|
@ -97,15 +98,15 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||
|
||||
private Button subscribeButton;
|
||||
|
||||
private Subscription download;
|
||||
private Subscription parser;
|
||||
private Subscription updater;
|
||||
private Disposable download;
|
||||
private Disposable parser;
|
||||
private Disposable updater;
|
||||
private final EventDistributor.EventListener listener = new EventDistributor.EventListener() {
|
||||
@Override
|
||||
public void update(EventDistributor eventDistributor, Integer arg) {
|
||||
if ((arg & EventDistributor.FEED_LIST_UPDATE) != 0) {
|
||||
updater = Observable.fromCallable(DBReader::getFeedList)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
feeds -> {
|
||||
|
@ -212,13 +213,13 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if(updater != null) {
|
||||
updater.unsubscribe();
|
||||
updater.dispose();
|
||||
}
|
||||
if(download != null) {
|
||||
download.unsubscribe();
|
||||
download.dispose();
|
||||
}
|
||||
if(parser != null) {
|
||||
parser.unsubscribe();
|
||||
parser.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,7 +274,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||
downloader.call();
|
||||
return downloader.getResult();
|
||||
})
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(this::checkDownloadResult,
|
||||
error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
|
@ -331,7 +332,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||
Log.d(TAG, "Deleted feed source file. Result: " + rc);
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.computation())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
if(result != null) {
|
||||
|
@ -397,11 +398,12 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||
if (StringUtils.isNotBlank(feed.getImageUrl())) {
|
||||
Glide.with(this)
|
||||
.load(feed.getImageUrl())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(cover);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ import android.widget.ProgressBar;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
||||
import rx.Completable;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Completable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Shows the AntennaPod logo while waiting for the main activity to start
|
||||
|
@ -38,9 +38,9 @@ public class SplashActivity extends AppCompatActivity {
|
|||
// Trigger schema updates
|
||||
PodDBAdapter.getInstance().open();
|
||||
PodDBAdapter.getInstance().close();
|
||||
subscriber.onCompleted();
|
||||
subscriber.onComplete();
|
||||
})
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(() -> {
|
||||
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||
|
|
|
@ -20,10 +20,10 @@ import de.danoeh.antennapod.adapter.StatisticsListAdapter;
|
|||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Displays the 'statistics' screen
|
||||
|
@ -35,7 +35,7 @@ public class StatisticsActivity extends AppCompatActivity
|
|||
private static final String PREF_NAME = "StatisticsActivityPrefs";
|
||||
private static final String PREF_COUNT_ALL = "countAll";
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
private TextView totalTimeTextView;
|
||||
private ListView feedStatisticsList;
|
||||
private ProgressBar progressBar;
|
||||
|
@ -119,21 +119,19 @@ public class StatisticsActivity extends AppCompatActivity
|
|||
}
|
||||
|
||||
private void loadStatistics() {
|
||||
if (subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
subscription = Observable.fromCallable(() -> DBReader.getStatistics(countAll))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(() -> DBReader.getStatistics(countAll))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
if (result != null) {
|
||||
totalTimeTextView.setText(Converter
|
||||
.shortLocalizedDuration(this, countAll ? result.totalTimeCountAll : result.totalTime));
|
||||
listAdapter.update(result.feedTime);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
totalTimeTextView.setVisibility(View.VISIBLE);
|
||||
feedStatisticsList.setVisibility(View.VISIBLE);
|
||||
}
|
||||
totalTimeTextView.setText(Converter
|
||||
.shortLocalizedDuration(this, countAll ? result.totalTimeCountAll : result.totalTime));
|
||||
listAdapter.update(result.feedTime);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
totalTimeTextView.setVisibility(View.VISIBLE);
|
||||
feedStatisticsList.setVisibility(View.VISIBLE);
|
||||
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import android.widget.LinearLayout;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.joanzapata.iconify.Iconify;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
@ -29,7 +28,6 @@ import de.danoeh.antennapod.R;
|
|||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.DateUtils;
|
||||
|
@ -193,12 +191,12 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
|
|||
holder.butSecondary.setTag(item);
|
||||
holder.butSecondary.setOnClickListener(secondaryActionListener);
|
||||
|
||||
Glide.with(mainActivityRef.get())
|
||||
.load(item.getImageLocation())
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(new CoverTarget(item.getFeed().getImageLocation(), holder.placeholder, holder.cover, mainActivityRef.get()));
|
||||
new CoverLoader(mainActivityRef.get())
|
||||
.withUri(item.getImageLocation())
|
||||
.withFallbackUri(item.getFeed().getImageLocation())
|
||||
.withPlaceholderView(holder.placeholder)
|
||||
.withCoverView(holder.cover)
|
||||
.load();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
package de.danoeh.antennapod.adapter;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.CustomViewTarget;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
|
||||
public class CoverLoader {
|
||||
private String uri;
|
||||
private String fallbackUri;
|
||||
private TextView txtvPlaceholder;
|
||||
private ImageView imgvCover;
|
||||
private MainActivity activity;
|
||||
private int errorResource = -1;
|
||||
|
||||
public CoverLoader(MainActivity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
public CoverLoader withUri(String uri) {
|
||||
this.uri = uri;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CoverLoader withFallbackUri(String uri) {
|
||||
fallbackUri = uri;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CoverLoader withCoverView(ImageView coverView) {
|
||||
imgvCover = coverView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CoverLoader withError(int errorResource) {
|
||||
this.errorResource = errorResource;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CoverLoader withPlaceholderView(TextView placeholderView) {
|
||||
txtvPlaceholder = placeholderView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void load() {
|
||||
RequestOptions options = new RequestOptions()
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate();
|
||||
|
||||
if (errorResource != -1) {
|
||||
options = options.error(errorResource);
|
||||
}
|
||||
|
||||
RequestBuilder builder = Glide.with(activity)
|
||||
.load(uri)
|
||||
.apply(options);
|
||||
|
||||
if (fallbackUri != null && txtvPlaceholder != null && imgvCover != null) {
|
||||
builder = builder.error(Glide.with(activity)
|
||||
.load(fallbackUri)
|
||||
.apply(options));
|
||||
}
|
||||
|
||||
builder.into(new CoverTarget(txtvPlaceholder, imgvCover));
|
||||
}
|
||||
|
||||
class CoverTarget extends CustomViewTarget<ImageView, Drawable> {
|
||||
private final WeakReference<TextView> placeholder;
|
||||
private final WeakReference<ImageView> cover;
|
||||
|
||||
public CoverTarget(TextView txtvPlaceholder, ImageView imgvCover) {
|
||||
super(imgvCover);
|
||||
placeholder = new WeakReference<>(txtvPlaceholder);
|
||||
cover = new WeakReference<>(imgvCover);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(Drawable errorDrawable) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||
TextView txtvPlaceholder = placeholder.get();
|
||||
if (txtvPlaceholder != null) {
|
||||
txtvPlaceholder.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
ImageView ivCover = cover.get();
|
||||
ivCover.setImageDrawable(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResourceCleared(@Nullable Drawable placeholder) {
|
||||
ImageView ivCover = cover.get();
|
||||
ivCover.setImageDrawable(placeholder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package de.danoeh.antennapod.adapter;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
||||
import com.bumptech.glide.request.animation.GlideAnimation;
|
||||
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
|
||||
class CoverTarget extends GlideDrawableImageViewTarget {
|
||||
|
||||
private final WeakReference<String> fallback;
|
||||
private final WeakReference<TextView> placeholder;
|
||||
private final WeakReference<ImageView> cover;
|
||||
private final WeakReference<MainActivity> mainActivity;
|
||||
|
||||
public CoverTarget(String fallbackUri, TextView txtvPlaceholder, ImageView imgvCover, MainActivity activity) {
|
||||
super(imgvCover);
|
||||
fallback = new WeakReference<>(fallbackUri);
|
||||
placeholder = new WeakReference<>(txtvPlaceholder);
|
||||
cover = new WeakReference<>(imgvCover);
|
||||
mainActivity = new WeakReference<>(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(Exception e, Drawable errorDrawable) {
|
||||
String fallbackUri = fallback.get();
|
||||
TextView txtvPlaceholder = placeholder.get();
|
||||
ImageView imgvCover = cover.get();
|
||||
if (fallbackUri != null && txtvPlaceholder != null && imgvCover != null) {
|
||||
MainActivity activity = mainActivity.get();
|
||||
Glide.with(activity)
|
||||
.load(fallbackUri)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(new CoverTarget(null, txtvPlaceholder, imgvCover, activity));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResourceReady(GlideDrawable drawable, GlideAnimation<? super GlideDrawable> anim) {
|
||||
super.onResourceReady(drawable, anim);
|
||||
TextView txtvPlaceholder = placeholder.get();
|
||||
if (txtvPlaceholder != null) {
|
||||
txtvPlaceholder.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
|
@ -79,11 +80,12 @@ public class DownloadedEpisodesListAdapter extends BaseAdapter {
|
|||
|
||||
Glide.with(context)
|
||||
.load(item.getImageLocation())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(holder.imageView);
|
||||
|
||||
if(item.isPlayed()) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import android.widget.RelativeLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.joanzapata.iconify.Iconify;
|
||||
import com.joanzapata.iconify.widget.IconTextView;
|
||||
|
||||
|
@ -336,11 +337,12 @@ public class NavListAdapter extends BaseAdapter
|
|||
|
||||
Glide.with(context)
|
||||
.load(feed.getImageLocation())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(holder.image);
|
||||
|
||||
holder.title.setText(feed.getTitle());
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.joanzapata.iconify.Iconify;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
@ -291,12 +292,12 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap
|
|||
butSecondary.setTag(item);
|
||||
butSecondary.setOnClickListener(secondaryActionListener);
|
||||
|
||||
Glide.with(mainActivity.get())
|
||||
.load(item.getImageLocation())
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(new CoverTarget(item.getFeed().getImageLocation(), placeholder, cover, mainActivity.get()));
|
||||
new CoverLoader(mainActivity.get())
|
||||
.withUri(item.getImageLocation())
|
||||
.withFallbackUri(item.getFeed().getImageLocation())
|
||||
.withPlaceholderView(placeholder)
|
||||
.withCoverView(cover)
|
||||
.load();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.feed.FeedComponent;
|
||||
|
@ -81,11 +82,12 @@ public class SearchlistAdapter extends BaseAdapter {
|
|||
|
||||
Glide.with(context)
|
||||
.load(feed.getImageLocation())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(holder.cover);
|
||||
|
||||
} else if (component.getClass() == FeedItem.class) {
|
||||
|
@ -100,11 +102,12 @@ public class SearchlistAdapter extends BaseAdapter {
|
|||
|
||||
Glide.with(context)
|
||||
.load(item.getFeed().getImageLocation())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(holder.cover);
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.bumptech.glide.Glide;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
|
@ -72,11 +73,12 @@ public class StatisticsListAdapter extends BaseAdapter {
|
|||
|
||||
Glide.with(context)
|
||||
.load(feed.getImageLocation())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(holder.image);
|
||||
|
||||
holder.title.setText(feed.getTitle());
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.bumptech.glide.Glide;
|
|||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
|
@ -108,7 +109,7 @@ public class SubscriptionsAdapter extends BaseAdapter implements AdapterView.OnI
|
|||
holder.count.setVisibility(View.INVISIBLE);
|
||||
|
||||
// when this holder is reused, we could else end up with a cover image
|
||||
Glide.clear(holder.imageView);
|
||||
Glide.with(mainActivityRef.get()).clear(holder.imageView);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
@ -125,13 +126,13 @@ public class SubscriptionsAdapter extends BaseAdapter implements AdapterView.OnI
|
|||
} else {
|
||||
holder.count.setVisibility(View.GONE);
|
||||
}
|
||||
Glide.with(mainActivityRef.get())
|
||||
.load(feed.getImageLocation())
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(new CoverTarget(null, holder.feedTitle, holder.imageView, mainActivityRef.get()));
|
||||
|
||||
new CoverLoader(mainActivityRef.get())
|
||||
.withUri(feed.getImageLocation())
|
||||
.withPlaceholderView(holder.feedTitle)
|
||||
.withCoverView(holder.imageView)
|
||||
.withError(R.color.light_gray)
|
||||
.load();
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -52,11 +53,12 @@ public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> {
|
|||
if (StringUtils.isNotBlank(podcast.getLogoUrl())) {
|
||||
Glide.with(convertView.getContext())
|
||||
.load(podcast.getLogoUrl())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(holder.image);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ import android.widget.TextView;
|
|||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
@ -80,10 +82,11 @@ public class ItunesAdapter extends ArrayAdapter<ItunesAdapter.Podcast> {
|
|||
//Update the empty imageView with the image from the feed
|
||||
Glide.with(context)
|
||||
.load(podcast.imageUrl)
|
||||
.placeholder(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(viewHolder.coverView);
|
||||
|
||||
//Feed the grid view
|
||||
|
@ -132,7 +135,7 @@ public class ItunesAdapter extends ArrayAdapter<ItunesAdapter.Podcast> {
|
|||
}
|
||||
|
||||
public static Podcast fromSearch(SearchHit searchHit) {
|
||||
return new Podcast(searchHit.getTitle(), searchHit.getImageUrl(), searchHit.getXmlUrl());
|
||||
return new Podcast(searchHit.getTitle(), searchHit.getThumbImageURL(), searchHit.getXmlUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,7 @@ import de.danoeh.antennapod.core.export.ExportWriter;
|
|||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.util.LangUtils;
|
||||
import rx.Observable;
|
||||
import io.reactivex.Observable;
|
||||
|
||||
/**
|
||||
* Writes an OPML file into the export directory in the background.
|
||||
|
@ -57,7 +57,7 @@ public class ExportWorker {
|
|||
subscriber.onError(e);
|
||||
}
|
||||
}
|
||||
subscriber.onCompleted();
|
||||
subscriber.onComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,14 +29,15 @@ import de.danoeh.antennapod.R;
|
|||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
|
||||
import de.danoeh.antennapod.core.service.download.ProxyConfig;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.Credentials;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
public class ProxyDialog {
|
||||
|
||||
|
@ -54,7 +55,7 @@ public class ProxyDialog {
|
|||
|
||||
private boolean testSuccessful = false;
|
||||
private TextView txtvMessage;
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
public ProxyDialog(Context context) {
|
||||
this.context = context;
|
||||
|
@ -228,8 +229,8 @@ public class ProxyDialog {
|
|||
}
|
||||
|
||||
private void test() {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
if(!checkValidity()) {
|
||||
setTestRequired(true);
|
||||
|
@ -242,7 +243,7 @@ public class ProxyDialog {
|
|||
txtvMessage.setTextColor(textColorPrimary);
|
||||
txtvMessage.setText("{fa-circle-o-notch spin} " + checking);
|
||||
txtvMessage.setVisibility(View.VISIBLE);
|
||||
subscription = Observable.create((Observable.OnSubscribe<Response>) subscriber -> {
|
||||
disposable = Single.create((SingleOnSubscribe<Response>) emitter -> {
|
||||
String type = (String) spType.getSelectedItem();
|
||||
String host = etHost.getText().toString();
|
||||
String port = etPort.getText().toString();
|
||||
|
@ -274,13 +275,12 @@ public class ProxyDialog {
|
|||
.build();
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
subscriber.onNext(response);
|
||||
emitter.onSuccess(response);
|
||||
} catch(IOException e) {
|
||||
subscriber.onError(e);
|
||||
emitter.onError(e);
|
||||
}
|
||||
subscriber.onCompleted();
|
||||
})
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
response -> {
|
||||
|
|
|
@ -50,10 +50,10 @@ import de.danoeh.antennapod.core.util.LongList;
|
|||
import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Shows unread or recently published episodes
|
||||
|
@ -84,7 +84,7 @@ public class AllEpisodesFragment extends Fragment {
|
|||
private boolean isUpdatingFeeds;
|
||||
boolean isMenuInvalidationAllowed = false;
|
||||
|
||||
Subscription subscription;
|
||||
Disposable disposable;
|
||||
private LinearLayoutManager layoutManager;
|
||||
|
||||
boolean showOnlyNewEpisodes() { return false; }
|
||||
|
@ -125,8 +125,8 @@ public class AllEpisodesFragment extends Fragment {
|
|||
public void onStop() {
|
||||
super.onStop();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,15 +462,15 @@ public class AllEpisodesFragment extends Fragment {
|
|||
}
|
||||
|
||||
void loadItems() {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
if (viewsCreated && !itemsLoaded) {
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
progLoading.setVisibility(View.VISIBLE);
|
||||
}
|
||||
subscription = Observable.fromCallable(this::loadData)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(this::loadData)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(data -> {
|
||||
recyclerView.setVisibility(View.VISIBLE);
|
||||
|
@ -495,8 +495,8 @@ public class AllEpisodesFragment extends Fragment {
|
|||
}
|
||||
|
||||
Log.d(TAG, "markItemAsSeenWithUndo(" + item.getId() + ")");
|
||||
if (subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
// we're marking it as unplayed since the user didn't actually play it
|
||||
// but they don't want it considered 'NEW' anymore
|
||||
|
|
|
@ -21,10 +21,10 @@ import de.danoeh.antennapod.core.storage.DBReader;
|
|||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
||||
import de.danoeh.antennapod.dialog.EpisodesApplyActionFragment;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Displays all running downloads and provides a button to delete them
|
||||
|
@ -42,7 +42,7 @@ public class CompletedDownloadsFragment extends ListFragment {
|
|||
|
||||
private boolean viewCreated = false;
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -61,16 +61,16 @@ public class CompletedDownloadsFragment extends ListFragment {
|
|||
public void onStop() {
|
||||
super.onStop();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,8 +79,8 @@ public class CompletedDownloadsFragment extends ListFragment {
|
|||
super.onDestroyView();
|
||||
listAdapter = null;
|
||||
viewCreated = false;
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,21 +182,19 @@ public class CompletedDownloadsFragment extends ListFragment {
|
|||
};
|
||||
|
||||
private void loadItems() {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
if (items == null && viewCreated) {
|
||||
setListShown(false);
|
||||
}
|
||||
subscription = Observable.fromCallable(DBReader::getDownloadedItems)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(DBReader::getDownloadedItems)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
if (result != null) {
|
||||
items = result;
|
||||
if (viewCreated && getActivity() != null) {
|
||||
onFragmentLoaded();
|
||||
}
|
||||
items = result;
|
||||
if (viewCreated && getActivity() != null) {
|
||||
onFragmentLoaded();
|
||||
}
|
||||
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MediaplayerInfoActivity.MediaplayerInfoContentFragment;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
|
@ -60,9 +61,10 @@ public class CoverFragment extends Fragment implements MediaplayerInfoContentFra
|
|||
txtvEpisodeTitle.setText(media.getEpisodeTitle());
|
||||
Glide.with(this)
|
||||
.load(media.getImageLocation())
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.dontAnimate()
|
||||
.fitCenter()
|
||||
.apply(new RequestOptions()
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.dontAnimate()
|
||||
.fitCenter())
|
||||
.into(imgvCover);
|
||||
} else {
|
||||
Log.w(TAG, "loadMediaInfo was called while media was null");
|
||||
|
|
|
@ -23,10 +23,10 @@ import de.danoeh.antennapod.core.feed.FeedMedia;
|
|||
import de.danoeh.antennapod.core.service.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Shows the download log
|
||||
|
@ -41,7 +41,7 @@ public class DownloadLogFragment extends ListFragment {
|
|||
private boolean viewsCreated = false;
|
||||
private boolean itemsLoaded = false;
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
@ -55,8 +55,8 @@ public class DownloadLogFragment extends ListFragment {
|
|||
public void onStop() {
|
||||
super.onStop();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,11 +178,11 @@ public class DownloadLogFragment extends ListFragment {
|
|||
}
|
||||
|
||||
private void loadItems() {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
subscription = Observable.fromCallable(DBReader::getDownloadLog)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(DBReader::getDownloadLog)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
if (result != null) {
|
||||
|
|
|
@ -16,16 +16,17 @@ import android.widget.TextView;
|
|||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.MediaType;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||
import rx.Single;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Maybe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Fragment which is supposed to be displayed outside of the MediaplayerActivity
|
||||
|
@ -41,7 +42,7 @@ public class ExternalPlayerFragment extends Fragment {
|
|||
private TextView mFeedName;
|
||||
private ProgressBar mProgressBar;
|
||||
private PlaybackController controller;
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
public ExternalPlayerFragment() {
|
||||
super();
|
||||
|
@ -143,8 +144,8 @@ public class ExternalPlayerFragment extends Fragment {
|
|||
if (controller != null) {
|
||||
controller.release();
|
||||
}
|
||||
if (subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,13 +182,21 @@ public class ExternalPlayerFragment extends Fragment {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
subscription = Single.create(subscriber -> subscriber.onSuccess(controller.getMedia()))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Maybe.create(emitter -> {
|
||||
Playable media = controller.getMedia();
|
||||
if (media != null) {
|
||||
emitter.onSuccess(media);
|
||||
} else {
|
||||
emitter.onComplete();
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(media -> updateUi((Playable) media));
|
||||
.subscribe(media -> updateUi((Playable) media),
|
||||
error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -199,11 +208,12 @@ public class ExternalPlayerFragment extends Fragment {
|
|||
|
||||
Glide.with(getActivity())
|
||||
.load(media.getImageLocation())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(imgvCover);
|
||||
|
||||
fragmentLayout.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -62,8 +62,8 @@ public class FavoriteEpisodesFragment extends AllEpisodesFragment {
|
|||
AllEpisodesRecycleAdapter.Holder holder = (AllEpisodesRecycleAdapter.Holder)viewHolder;
|
||||
Log.d(TAG, "remove(" + holder.getItemId() + ")");
|
||||
|
||||
if (subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
FeedItem item = holder.getFeedItem();
|
||||
if (item != null) {
|
||||
|
|
|
@ -28,9 +28,9 @@ import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
|||
import de.mfietz.fyydlin.FyydClient;
|
||||
import de.mfietz.fyydlin.FyydResponse;
|
||||
import de.mfietz.fyydlin.SearchHit;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static de.danoeh.antennapod.adapter.itunes.ItunesAdapter.Podcast;
|
||||
import static java.util.Collections.emptyList;
|
||||
|
@ -55,7 +55,7 @@ public class FyydSearchFragment extends Fragment {
|
|||
* List of podcasts retreived from the search
|
||||
*/
|
||||
private List<Podcast> searchResults;
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -98,8 +98,8 @@ public class FyydSearchFragment extends Fragment {
|
|||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
adapter = null;
|
||||
}
|
||||
|
@ -141,12 +141,12 @@ public class FyydSearchFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void search(String query) {
|
||||
if (subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
showOnlyProgressBar();
|
||||
subscription = client.searchPodcasts(query)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = client.searchPodcasts(query, 10)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
@ -174,7 +174,7 @@ public class FyydSearchFragment extends Fragment {
|
|||
if (!response.getData().isEmpty()) {
|
||||
adapter.clear();
|
||||
searchResults = new ArrayList<>();
|
||||
for (SearchHit searchHit : response.getData().values()) {
|
||||
for (SearchHit searchHit : response.getData()) {
|
||||
Podcast podcast = Podcast.fromSearch(searchHit);
|
||||
searchResults.add(podcast);
|
||||
}
|
||||
|
|
|
@ -39,10 +39,10 @@ import de.danoeh.antennapod.core.util.ShownotesProvider;
|
|||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||
import de.danoeh.antennapod.core.util.playback.Timeline;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Displays the description of a Playable object in a Webview.
|
||||
|
@ -66,7 +66,7 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo
|
|||
private ShownotesProvider shownotesProvider;
|
||||
private Playable media;
|
||||
|
||||
private Subscription webViewLoader;
|
||||
private Disposable webViewLoader;
|
||||
|
||||
/**
|
||||
* URL that was selected via long-press.
|
||||
|
@ -167,7 +167,7 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo
|
|||
super.onDestroy();
|
||||
Log.d(TAG, "Fragment destroyed");
|
||||
if (webViewLoader != null) {
|
||||
webViewLoader.unsubscribe();
|
||||
webViewLoader.dispose();
|
||||
}
|
||||
if (webvDescription != null) {
|
||||
webvDescription.removeAllViews();
|
||||
|
@ -198,7 +198,7 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo
|
|||
} else if (args.containsKey(ARG_FEEDITEM_ID)) {
|
||||
long id = getArguments().getLong(ARG_FEEDITEM_ID);
|
||||
Observable.defer(() -> Observable.just(DBReader.getFeedItem(id)))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(feedItem -> {
|
||||
shownotesProvider = feedItem;
|
||||
|
@ -298,13 +298,13 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo
|
|||
private void load() {
|
||||
Log.d(TAG, "load()");
|
||||
if(webViewLoader != null) {
|
||||
webViewLoader.unsubscribe();
|
||||
webViewLoader.dispose();
|
||||
}
|
||||
if(shownotesProvider == null) {
|
||||
return;
|
||||
}
|
||||
webViewLoader = Observable.defer(() -> Observable.just(loadData()))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
webViewLoader = Observable.fromCallable(this::loadData)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(data -> {
|
||||
webvDescription.loadDataWithBaseURL(null, data, "text/html",
|
||||
|
|
|
@ -31,6 +31,7 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.joanzapata.iconify.Iconify;
|
||||
import com.joanzapata.iconify.widget.IconButton;
|
||||
|
||||
|
@ -68,10 +69,10 @@ import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
|
|||
import de.danoeh.antennapod.view.OnSwipeGesture;
|
||||
import de.danoeh.antennapod.view.SwipeGestureDetector;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Displays information about a FeedItem and actions.
|
||||
|
@ -134,7 +135,7 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
|
|||
private IconButton butAction2;
|
||||
private Menu popupMenu;
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
/**
|
||||
* URL that was selected via long-press.
|
||||
|
@ -285,8 +286,8 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
|
|||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
if (webvDescription != null && root != null) {
|
||||
root.removeView(webvDescription);
|
||||
|
@ -378,11 +379,12 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
|
|||
|
||||
Glide.with(getActivity())
|
||||
.load(item.getImageLocation())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(imgvCover);
|
||||
|
||||
progbarDownload.setVisibility(View.GONE);
|
||||
|
@ -571,12 +573,12 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
|
|||
};
|
||||
|
||||
private void load() {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
progbarLoading.setVisibility(View.VISIBLE);
|
||||
subscription = Observable.fromCallable(this::loadInBackground)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(this::loadInBackground)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
progbarLoading.setVisibility(View.GONE);
|
||||
|
|
|
@ -24,6 +24,8 @@ import android.widget.RelativeLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.joanzapata.iconify.IconDrawable;
|
||||
import com.joanzapata.iconify.Iconify;
|
||||
import com.joanzapata.iconify.widget.IconTextView;
|
||||
|
||||
|
@ -66,10 +68,10 @@ import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
|
|||
import de.danoeh.antennapod.menuhandler.FeedMenuHandler;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Displays a list of FeedItems.
|
||||
|
@ -109,7 +111,7 @@ public class ItemlistFragment extends ListFragment {
|
|||
|
||||
private TextView txtvInformation;
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
/**
|
||||
* Creates new ItemlistFragment which shows the Feeditems of a specific
|
||||
|
@ -160,8 +162,8 @@ public class ItemlistFragment extends ListFragment {
|
|||
super.onPause();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
EventBus.getDefault().unregister(this);
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -518,20 +520,22 @@ public class ItemlistFragment extends ListFragment {
|
|||
private void loadFeedImage() {
|
||||
Glide.with(getActivity())
|
||||
.load(feed.getImageLocation())
|
||||
.placeholder(R.color.image_readability_tint)
|
||||
.error(R.color.image_readability_tint)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.transform(new FastBlurTransformation(getActivity()))
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.image_readability_tint)
|
||||
.error(R.color.image_readability_tint)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.transform(new FastBlurTransformation())
|
||||
.dontAnimate())
|
||||
.into(imgvBackground);
|
||||
|
||||
Glide.with(getActivity())
|
||||
.load(feed.getImageLocation())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate())
|
||||
.into(imgvCover);
|
||||
}
|
||||
|
||||
|
@ -607,11 +611,11 @@ public class ItemlistFragment extends ListFragment {
|
|||
|
||||
|
||||
private void loadItems() {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
subscription = Observable.fromCallable(this::loadData)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(this::loadData)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
if (result != null) {
|
||||
|
|
|
@ -36,13 +36,14 @@ import de.danoeh.antennapod.adapter.itunes.ItunesAdapter;
|
|||
import de.danoeh.antennapod.core.ClientConfig;
|
||||
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static de.danoeh.antennapod.adapter.itunes.ItunesAdapter.Podcast;
|
||||
|
||||
|
@ -69,7 +70,7 @@ public class ItunesSearchFragment extends Fragment {
|
|||
*/
|
||||
private List<Podcast> searchResults;
|
||||
private List<Podcast> topList;
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
/**
|
||||
* Replace adapter data with provided search results from SearchTask.
|
||||
|
@ -127,7 +128,7 @@ public class ItunesSearchFragment extends Fragment {
|
|||
} else {
|
||||
gridView.setVisibility(View.GONE);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
subscription = Observable.create((Observable.OnSubscribe<String>) subscriber -> {
|
||||
disposable = Single.create((SingleOnSubscribe<String>) emitter -> {
|
||||
OkHttpClient client = AntennapodHttpClient.getHttpClient();
|
||||
Request.Builder httpReq = new Request.Builder()
|
||||
.url(podcast.feedUrl)
|
||||
|
@ -139,17 +140,16 @@ public class ItunesSearchFragment extends Fragment {
|
|||
JSONObject result = new JSONObject(resultString);
|
||||
JSONObject results = result.getJSONArray("results").getJSONObject(0);
|
||||
String feedUrl = results.getString("feedUrl");
|
||||
subscriber.onNext(feedUrl);
|
||||
emitter.onSuccess(feedUrl);
|
||||
} else {
|
||||
String prefix = getString(R.string.error_msg_prefix);
|
||||
subscriber.onError(new IOException(prefix + response));
|
||||
emitter.onError(new IOException(prefix + response));
|
||||
}
|
||||
} catch (IOException | JSONException e) {
|
||||
subscriber.onError(e);
|
||||
emitter.onError(e);
|
||||
}
|
||||
subscriber.onCompleted();
|
||||
})
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(feedUrl -> {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
@ -183,8 +183,8 @@ public class ItunesSearchFragment extends Fragment {
|
|||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
adapter = null;
|
||||
}
|
||||
|
@ -228,15 +228,15 @@ public class ItunesSearchFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void loadToplist() {
|
||||
if (subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
gridView.setVisibility(View.GONE);
|
||||
txtvError.setVisibility(View.GONE);
|
||||
butRetry.setVisibility(View.GONE);
|
||||
txtvEmpty.setVisibility(View.GONE);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
subscription = Observable.create((Observable.OnSubscribe<List<Podcast>>) subscriber -> {
|
||||
disposable = Single.create((SingleOnSubscribe<List<Podcast>>) emitter -> {
|
||||
String lang = Locale.getDefault().getLanguage();
|
||||
String url = "https://itunes.apple.com/" + lang + "/rss/toppodcasts/limit=25/explicit=true/json";
|
||||
OkHttpClient client = AntennapodHttpClient.getHttpClient();
|
||||
|
@ -268,15 +268,14 @@ public class ItunesSearchFragment extends Fragment {
|
|||
}
|
||||
else {
|
||||
String prefix = getString(R.string.error_msg_prefix);
|
||||
subscriber.onError(new IOException(prefix + response));
|
||||
emitter.onError(new IOException(prefix + response));
|
||||
}
|
||||
} catch (IOException | JSONException e) {
|
||||
subscriber.onError(e);
|
||||
emitter.onError(e);
|
||||
}
|
||||
subscriber.onNext(results);
|
||||
subscriber.onCompleted();
|
||||
emitter.onSuccess(results);
|
||||
})
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(podcasts -> {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
@ -293,15 +292,15 @@ public class ItunesSearchFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void search(String query) {
|
||||
if (subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
gridView.setVisibility(View.GONE);
|
||||
txtvError.setVisibility(View.GONE);
|
||||
butRetry.setVisibility(View.GONE);
|
||||
txtvEmpty.setVisibility(View.GONE);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
subscription = rx.Observable.create((Observable.OnSubscribe<List<Podcast>>) subscriber -> {
|
||||
disposable = Single.create((SingleOnSubscribe<List<Podcast>>) subscriber -> {
|
||||
String encodedQuery = null;
|
||||
try {
|
||||
encodedQuery = URLEncoder.encode(query, "UTF-8");
|
||||
|
@ -341,10 +340,9 @@ public class ItunesSearchFragment extends Fragment {
|
|||
} catch (IOException | JSONException e) {
|
||||
subscriber.onError(e);
|
||||
}
|
||||
subscriber.onNext(podcasts);
|
||||
subscriber.onCompleted();
|
||||
subscriber.onSuccess(podcasts);
|
||||
})
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(podcasts -> {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
|
|
@ -30,10 +30,10 @@ import de.danoeh.antennapod.core.storage.DBWriter;
|
|||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
||||
import de.danoeh.antennapod.core.util.LongList;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class PlaybackHistoryFragment extends ListFragment {
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class PlaybackHistoryFragment extends ListFragment {
|
|||
|
||||
private List<Downloader> downloaderList;
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
|
@ -107,16 +107,16 @@ public class PlaybackHistoryFragment extends ListFragment {
|
|||
public void onStop() {
|
||||
super.onStop();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,11 +269,11 @@ public class PlaybackHistoryFragment extends ListFragment {
|
|||
};
|
||||
|
||||
private void loadItems() {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
subscription = Observable.fromCallable(this::loadData)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(this::loadData)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
if (result != null) {
|
||||
|
|
|
@ -53,10 +53,10 @@ import de.danoeh.antennapod.core.util.QueueSorter;
|
|||
import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Shows all items in the queue
|
||||
|
@ -84,7 +84,7 @@ public class QueueFragment extends Fragment {
|
|||
private static final String PREF_SCROLL_POSITION = "scroll_position";
|
||||
private static final String PREF_SCROLL_OFFSET = "scroll_offset";
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
private LinearLayoutManager layoutManager;
|
||||
private ItemTouchHelper itemTouchHelper;
|
||||
|
||||
|
@ -118,8 +118,8 @@ public class QueueFragment extends Fragment {
|
|||
saveScrollPosition();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
EventBus.getDefault().unregister(this);
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -423,8 +423,8 @@ public class QueueFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
final int position = viewHolder.getAdapterPosition();
|
||||
Log.d(TAG, "remove(" + position + ")");
|
||||
|
@ -623,16 +623,16 @@ public class QueueFragment extends Fragment {
|
|||
|
||||
private void loadItems(final boolean restoreScrollPosition) {
|
||||
Log.d(TAG, "loadItems()");
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
if (queue == null) {
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
txtvEmpty.setVisibility(View.GONE);
|
||||
progLoading.setVisibility(View.VISIBLE);
|
||||
}
|
||||
subscription = Observable.fromCallable(DBReader::getQueue)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(DBReader::getQueue)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(items -> {
|
||||
if(items != null) {
|
||||
|
|
|
@ -24,10 +24,10 @@ import de.danoeh.antennapod.core.feed.FeedComponent;
|
|||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.SearchResult;
|
||||
import de.danoeh.antennapod.core.storage.FeedSearcher;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Performs a search operation on all feeds or one specific feed and displays the search result.
|
||||
|
@ -44,7 +44,7 @@ public class SearchFragment extends ListFragment {
|
|||
private boolean viewCreated = false;
|
||||
private boolean itemsLoaded = false;
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
/**
|
||||
* Create a new SearchFragment that searches all feeds.
|
||||
|
@ -85,8 +85,8 @@ public class SearchFragment extends ListFragment {
|
|||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
}
|
||||
|
@ -94,8 +94,8 @@ public class SearchFragment extends ListFragment {
|
|||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,14 +205,14 @@ public class SearchFragment extends ListFragment {
|
|||
|
||||
|
||||
private void search() {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
if (viewCreated && !itemsLoaded) {
|
||||
setListShown(false);
|
||||
}
|
||||
subscription = Observable.fromCallable(this::performSearch)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(this::performSearch)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
if (result != null) {
|
||||
|
|
|
@ -27,10 +27,10 @@ import de.danoeh.antennapod.core.storage.DBWriter;
|
|||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
import de.danoeh.antennapod.dialog.RenameFeedDialog;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Fragment for displaying feed subscriptions
|
||||
|
@ -48,7 +48,7 @@ public class SubscriptionFragment extends Fragment {
|
|||
|
||||
private int mPosition = -1;
|
||||
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
public SubscriptionFragment() {
|
||||
}
|
||||
|
@ -94,17 +94,17 @@ public class SubscriptionFragment extends Fragment {
|
|||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSubscriptions() {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
subscription = Observable.fromCallable(DBReader::getNavDrawerData)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
disposable = Observable.fromCallable(DBReader::getNavDrawerData)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
navDrawerData = result;
|
||||
|
@ -161,7 +161,7 @@ public class SubscriptionFragment extends Fragment {
|
|||
dialog.dismiss();
|
||||
|
||||
Observable.fromCallable(() -> DBWriter.markFeedSeen(feed.getId()))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> loadSubscriptions(),
|
||||
error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
|
@ -178,7 +178,7 @@ public class SubscriptionFragment extends Fragment {
|
|||
public void onConfirmButtonPressed(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
Observable.fromCallable(() -> DBWriter.markFeedRead(feed.getId()))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> loadSubscriptions(),
|
||||
error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
|
|
|
@ -75,10 +75,10 @@ import de.danoeh.antennapod.dialog.ChooseDataFolderDialog;
|
|||
import de.danoeh.antennapod.dialog.GpodnetSetHostnameDialog;
|
||||
import de.danoeh.antennapod.dialog.ProxyDialog;
|
||||
import de.danoeh.antennapod.dialog.VariableSpeedDialog;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static de.danoeh.antennapod.activity.PreferenceActivity.PARAM_RESOURCE;
|
||||
|
||||
|
@ -137,7 +137,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
|
|||
}
|
||||
};
|
||||
private CheckBoxPreference[] selectedNetworks;
|
||||
private Subscription subscription;
|
||||
private Disposable disposable;
|
||||
|
||||
public PreferenceController(PreferenceUI ui) {
|
||||
this.ui = ui;
|
||||
|
@ -651,7 +651,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
|
|||
final AlertDialog.Builder alert = new AlertDialog.Builder(context)
|
||||
.setNeutralButton(android.R.string.ok, (dialog, which) -> dialog.dismiss());
|
||||
Observable<File> observable = new ExportWorker(exportWriter).exportObservable();
|
||||
subscription = observable.subscribeOn(Schedulers.newThread())
|
||||
disposable = observable.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(output -> {
|
||||
alert.setTitle(R.string.export_success_title);
|
||||
|
@ -729,8 +729,8 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
|
|||
}
|
||||
|
||||
public void unsubscribeExportSubscription() {
|
||||
if (subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,16 +35,17 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class CustomMRControllerDialog extends MediaRouteControllerDialog {
|
||||
public static final String TAG = "CustomMRContrDialog";
|
||||
|
@ -60,7 +61,7 @@ public class CustomMRControllerDialog extends MediaRouteControllerDialog {
|
|||
|
||||
private boolean viewsCreated = false;
|
||||
|
||||
private Subscription fetchArtSubscription;
|
||||
private Disposable fetchArtSubscription;
|
||||
|
||||
private MediaControllerCompat mediaController;
|
||||
private MediaControllerCompat.Callback mediaControllerCallback;
|
||||
|
@ -327,7 +328,7 @@ public class CustomMRControllerDialog extends MediaRouteControllerDialog {
|
|||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
if (fetchArtSubscription != null) {
|
||||
fetchArtSubscription.unsubscribe();
|
||||
fetchArtSubscription.dispose();
|
||||
fetchArtSubscription = null;
|
||||
}
|
||||
super.onDetachedFromWindow();
|
||||
|
@ -396,11 +397,11 @@ public class CustomMRControllerDialog extends MediaRouteControllerDialog {
|
|||
}
|
||||
|
||||
if (fetchArtSubscription != null) {
|
||||
fetchArtSubscription.unsubscribe();
|
||||
fetchArtSubscription.dispose();
|
||||
}
|
||||
|
||||
fetchArtSubscription = Observable.fromCallable(() -> fetchArt(description))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
fetchArtSubscription = null;
|
||||
|
@ -463,10 +464,10 @@ public class CustomMRControllerDialog extends MediaRouteControllerDialog {
|
|||
} else if (iconUri != null) {
|
||||
try {
|
||||
art = Glide.with(getContext().getApplicationContext())
|
||||
.load(iconUri.toString())
|
||||
.asBitmap()
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
||||
.load(iconUri.toString())
|
||||
.apply(RequestOptions.diskCacheStrategyOf(ApGlideSettings.AP_DISK_CACHE_STRATEGY))
|
||||
.submit(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
||||
.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
Log.e(TAG, "Image art load failed", e);
|
||||
|
|
|
@ -49,8 +49,8 @@ project.ext {
|
|||
commonstextVersion = "1.3"
|
||||
eventbusVersion = "2.4.0"
|
||||
flattr4jVersion = "2.14"
|
||||
glideVersion = "3.8.0"
|
||||
glideOkhttpIntegrationVersion = "1.5.0"
|
||||
glideVersion = "4.8.0"
|
||||
glideOkhttpIntegrationVersion = "4.8.0"
|
||||
iconifyVersion = "2.2.2"
|
||||
jsoupVersion = "1.11.2"
|
||||
materialDialogsVersion = "0.9.0.2"
|
||||
|
@ -58,8 +58,8 @@ project.ext {
|
|||
okioVersion = "1.14.0"
|
||||
recyclerviewFlexibledividerVersion = "1.4.0"
|
||||
robotiumSoloVersion = "5.6.3"
|
||||
rxAndroidVersion = "1.2.1"
|
||||
rxJavaVersion = "1.3.8"
|
||||
rxAndroidVersion = "2.1.0"
|
||||
rxJavaVersion = "2.2.2"
|
||||
rxJavaRulesVersion = "1.3.3.0"
|
||||
triangleLabelViewVersion = "1.1.2"
|
||||
|
||||
|
|
|
@ -60,12 +60,14 @@ dependencies {
|
|||
implementation "com.jayway.android.robotium:robotium-solo:$robotiumSoloVersion"
|
||||
implementation "org.jsoup:jsoup:$jsoupVersion"
|
||||
implementation "com.github.bumptech.glide:glide:$glideVersion"
|
||||
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
|
||||
implementation "com.github.bumptech.glide:okhttp3-integration:$glideOkhttpIntegrationVersion@aar"
|
||||
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
||||
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttpVersion"
|
||||
implementation "com.squareup.okio:okio:$okioVersion"
|
||||
implementation "de.greenrobot:eventbus:$eventbusVersion"
|
||||
implementation "io.reactivex:rxandroid:$rxAndroidVersion"
|
||||
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
|
||||
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
|
||||
implementation "org.awaitility:awaitility:$awaitilityVersion"
|
||||
|
||||
implementation "com.google.android.exoplayer:exoplayer:$exoPlayerVersion"
|
||||
|
|
|
@ -2,31 +2,35 @@ package de.danoeh.antennapod.core.glide;
|
|||
|
||||
import android.content.Context;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.GlideBuilder;
|
||||
import com.bumptech.glide.Registry;
|
||||
import com.bumptech.glide.annotation.GlideModule;
|
||||
import com.bumptech.glide.load.DecodeFormat;
|
||||
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory;
|
||||
import com.bumptech.glide.module.GlideModule;
|
||||
import com.bumptech.glide.module.AppGlideModule;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
|
||||
/**
|
||||
* {@see com.bumptech.glide.integration.okhttp.OkHttpGlideModule}
|
||||
*/
|
||||
public class ApGlideModule implements GlideModule {
|
||||
@GlideModule
|
||||
public class ApGlideModule extends AppGlideModule {
|
||||
|
||||
@Override
|
||||
public void applyOptions(Context context, GlideBuilder builder) {
|
||||
builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
|
||||
public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
|
||||
builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_ARGB_8888));
|
||||
builder.setDiskCache(new InternalCacheDiskCacheFactory(context,
|
||||
UserPreferences.getImageCacheSize()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerComponents(Context context, Glide glide) {
|
||||
glide.register(String.class, InputStream.class, new ApOkHttpUrlLoader.Factory());
|
||||
public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
|
||||
registry.append(String.class, InputStream.class, new ApOkHttpUrlLoader.Factory());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package de.danoeh.antennapod.core.glide;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.bumptech.glide.integration.okhttp3.OkHttpStreamFetcher;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.model.GenericLoaderFactory;
|
||||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
import com.bumptech.glide.load.model.ModelLoader;
|
||||
import com.bumptech.glide.load.model.ModelLoaderFactory;
|
||||
|
@ -15,6 +15,8 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
|
||||
import com.bumptech.glide.load.model.MultiModelLoaderFactory;
|
||||
import com.bumptech.glide.signature.ObjectKey;
|
||||
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
|
||||
import de.danoeh.antennapod.core.service.download.HttpDownloader;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
|
@ -56,19 +58,20 @@ class ApOkHttpUrlLoader implements ModelLoader<String, InputStream> {
|
|||
/**
|
||||
* Constructor for a new Factory that runs requests using a static singleton client.
|
||||
*/
|
||||
public Factory() {
|
||||
Factory() {
|
||||
this(getInternalClient());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for a new Factory that runs requests using given client.
|
||||
*/
|
||||
public Factory(OkHttpClient client) {
|
||||
Factory(OkHttpClient client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ModelLoader<String, InputStream> build(Context context, GenericLoaderFactory factories) {
|
||||
public ModelLoader<String, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
|
||||
return new ApOkHttpUrlLoader(client);
|
||||
}
|
||||
|
||||
|
@ -84,20 +87,26 @@ class ApOkHttpUrlLoader implements ModelLoader<String, InputStream> {
|
|||
this.client = client;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DataFetcher<InputStream> getResourceFetcher(String model, int width, int height) {
|
||||
Log.d(TAG, "getResourceFetcher() called with: " + "model = [" + model + "], width = ["
|
||||
public LoadData<InputStream> buildLoadData(@NonNull String model, int width, int height, @NonNull Options options) {
|
||||
Log.d(TAG, "buildLoadData() called with: " + "model = [" + model + "], width = ["
|
||||
+ width + "], height = [" + height + "]");
|
||||
if(TextUtils.isEmpty(model)) {
|
||||
return null;
|
||||
} else if(model.startsWith("/")) {
|
||||
return new AudioCoverFetcher(model);
|
||||
return new LoadData<>(new ObjectKey(model), new AudioCoverFetcher(model));
|
||||
} else {
|
||||
GlideUrl url = new GlideUrl(model);
|
||||
return new OkHttpStreamFetcher(client, url);
|
||||
return new LoadData<>(new ObjectKey(model), new OkHttpStreamFetcher(client, url));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handles(@NonNull String s) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static class NetworkAllowanceInterceptor implements Interceptor {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,9 @@ package de.danoeh.antennapod.core.glide;
|
|||
|
||||
import android.media.MediaMetadataRetriever;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -20,22 +22,20 @@ class AudioCoverFetcher implements DataFetcher<InputStream> {
|
|||
this.path = path;
|
||||
}
|
||||
|
||||
@Override public String getId() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override public InputStream loadData(Priority priority) throws Exception {
|
||||
@Override
|
||||
public void loadData(@NonNull Priority priority, @NonNull DataCallback<? super InputStream> callback) {
|
||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
try {
|
||||
retriever.setDataSource(path);
|
||||
byte[] picture = retriever.getEmbeddedPicture();
|
||||
if (picture != null) {
|
||||
return new ByteArrayInputStream(picture);
|
||||
callback.onDataReady(new ByteArrayInputStream(picture));
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
retriever.release();
|
||||
}
|
||||
throw new IOException("Loading embedded cover did not work");
|
||||
callback.onLoadFailed(new IOException("Loading embedded cover did not work"));
|
||||
}
|
||||
|
||||
@Override public void cleanup() {
|
||||
|
@ -44,4 +44,16 @@ class AudioCoverFetcher implements DataFetcher<InputStream> {
|
|||
@Override public void cancel() {
|
||||
// cannot cancel
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Class<InputStream> getDataClass() {
|
||||
return InputStream.class;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public DataSource getDataSource() {
|
||||
return DataSource.LOCAL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package de.danoeh.antennapod.core.glide;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.ThumbnailUtils;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
public class FastBlurTransformation extends BitmapTransformation {
|
||||
|
||||
private static final String TAG = FastBlurTransformation.class.getSimpleName();
|
||||
|
@ -15,8 +17,8 @@ public class FastBlurTransformation extends BitmapTransformation {
|
|||
private static final int STACK_BLUR_RADIUS = 1;
|
||||
private static final int BLUR_IMAGE_WIDTH = 150;
|
||||
|
||||
public FastBlurTransformation(Context context) {
|
||||
super(context);
|
||||
public FastBlurTransformation() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,11 +35,6 @@ public class FastBlurTransformation extends BitmapTransformation {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return "FastBlurTransformation[width=" + BLUR_IMAGE_WIDTH + "px,radius=" + STACK_BLUR_RADIUS +"]";
|
||||
}
|
||||
|
||||
private static Bitmap fastBlur(Bitmap bitmap, int radius) {
|
||||
|
||||
// Stack Blur v1.0 from
|
||||
|
@ -264,4 +261,8 @@ public class FastBlurTransformation extends BitmapTransformation {
|
|||
return bitmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||
messageDigest.update(TAG.getBytes());
|
||||
}
|
||||
}
|
|
@ -39,6 +39,7 @@ import android.view.SurfaceHolder;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -1165,10 +1166,10 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
builder.putString(MediaMetadataCompat.METADATA_KEY_ART_URI, imageLocation);
|
||||
try {
|
||||
Bitmap art = Glide.with(this)
|
||||
.load(imageLocation)
|
||||
.asBitmap()
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
||||
.load(imageLocation)
|
||||
.apply(RequestOptions.diskCacheStrategyOf(ApGlideSettings.AP_DISK_CACHE_STRATEGY))
|
||||
.submit(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
||||
.get();
|
||||
builder.putBitmap(MediaMetadataCompat.METADATA_KEY_ART, art);
|
||||
} catch (Throwable tr) {
|
||||
|
@ -1239,11 +1240,11 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
android.R.dimen.notification_large_icon_width);
|
||||
try {
|
||||
icon = Glide.with(PlaybackService.this)
|
||||
.load(playable.getImageLocation())
|
||||
.asBitmap()
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.centerCrop()
|
||||
.into(iconSize, iconSize)
|
||||
.load(playable.getImageLocation())
|
||||
.apply(RequestOptions.diskCacheStrategyOf(ApGlideSettings.AP_DISK_CACHE_STRATEGY))
|
||||
.apply(new RequestOptions().centerCrop())
|
||||
.submit(iconSize, iconSize)
|
||||
.get();
|
||||
} catch (Throwable tr) {
|
||||
Log.e(TAG, "Error loading the media icon for the notification", tr);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.danoeh.antennapod.core.storage;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.util.ArrayMap;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -574,6 +575,7 @@ public final class DBReader {
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static Feed getFeed(final long feedId, PodDBAdapter adapter) {
|
||||
Feed feed = null;
|
||||
Cursor cursor = null;
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.concurrent.ExecutorService;
|
|||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import de.danoeh.antennapod.core.ClientConfig;
|
||||
|
@ -28,11 +27,9 @@ import de.danoeh.antennapod.core.feed.Feed;
|
|||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.feed.FeedPreferences;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.service.GpodnetSyncService;
|
||||
import de.danoeh.antennapod.core.service.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.DownloadError;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
import de.danoeh.antennapod.core.util.LongList;
|
||||
|
@ -207,6 +204,11 @@ public final class DBTasks {
|
|||
}).start();
|
||||
}
|
||||
|
||||
public static long getLastRefreshAllFeedsTimeMillis(final Context context) {
|
||||
SharedPreferences prefs = context.getSharedPreferences(DBTasks.PREF_NAME, MODE_PRIVATE);
|
||||
return prefs.getLong(DBTasks.PREF_LAST_REFRESH, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param feedList the list of feeds to refresh
|
||||
|
@ -317,31 +319,6 @@ public final class DBTasks {
|
|||
DownloadRequester.getInstance().downloadFeed(context, f, loadAllPages, force);
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if the app should refresh all feeds, i.e. if the last auto refresh failed.
|
||||
*
|
||||
* The feeds are only refreshed if an update interval or time of day is set and the last
|
||||
* (successful) refresh was before the last interval or more than a day ago, respectively.
|
||||
*/
|
||||
public static void checkShouldRefreshFeeds(Context context) {
|
||||
long interval = 0;
|
||||
if(UserPreferences.getUpdateInterval() > 0) {
|
||||
interval = UserPreferences.getUpdateInterval();
|
||||
} else if(UserPreferences.getUpdateTimeOfDay().length > 0){
|
||||
interval = TimeUnit.DAYS.toMillis(1);
|
||||
}
|
||||
if(interval == 0) { // auto refresh is disabled
|
||||
return;
|
||||
}
|
||||
SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, MODE_PRIVATE);
|
||||
long lastRefresh = prefs.getLong(PREF_LAST_REFRESH, 0);
|
||||
Log.d(TAG, "last refresh: " + Converter.getDurationStringLocalized(context,
|
||||
System.currentTimeMillis() - lastRefresh) + " ago");
|
||||
if(lastRefresh <= System.currentTimeMillis() - interval) {
|
||||
DBTasks.refreshAllFeeds(context, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the database about a missing FeedMedia file. This method will correct the FeedMedia object's values in the
|
||||
* DB and send a FeedUpdateBroadcast.
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package de.danoeh.antennapod.core.util;
|
||||
|
||||
public interface Consumer<T> {
|
||||
void accept(T t);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package de.danoeh.antennapod.core.util;
|
||||
|
||||
import io.reactivex.annotations.NonNull;
|
||||
|
||||
public interface Function<T, R> {
|
||||
R apply(@NonNull T t);
|
||||
}
|
|
@ -18,12 +18,13 @@ import de.danoeh.antennapod.core.feed.FeedMedia;
|
|||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import rx.Observable;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
public class NetworkUtils {
|
||||
private NetworkUtils(){}
|
||||
|
@ -111,11 +112,10 @@ public class NetworkUtils {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static Observable<Long> getFeedMediaSizeObservable(FeedMedia media) {
|
||||
return Observable.create((Observable.OnSubscribe<Long>) subscriber -> {
|
||||
public static Single<Long> getFeedMediaSizeObservable(FeedMedia media) {
|
||||
return Single.create((SingleOnSubscribe<Long>) emitter -> {
|
||||
if (!NetworkUtils.isDownloadAllowed()) {
|
||||
subscriber.onNext(0L);
|
||||
subscriber.onCompleted();
|
||||
emitter.onSuccess(0L);
|
||||
return;
|
||||
}
|
||||
long size = Integer.MIN_VALUE;
|
||||
|
@ -129,8 +129,7 @@ public class NetworkUtils {
|
|||
|
||||
String url = media.getDownload_url();
|
||||
if(TextUtils.isEmpty(url)) {
|
||||
subscriber.onNext(0L);
|
||||
subscriber.onCompleted();
|
||||
emitter.onSuccess(0L);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -150,8 +149,7 @@ public class NetworkUtils {
|
|||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
subscriber.onNext(0L);
|
||||
subscriber.onCompleted();
|
||||
emitter.onSuccess(0L);
|
||||
Log.e(TAG, Log.getStackTraceString(e));
|
||||
return; // better luck next time
|
||||
}
|
||||
|
@ -163,11 +161,10 @@ public class NetworkUtils {
|
|||
} else {
|
||||
media.setSize(size);
|
||||
}
|
||||
subscriber.onNext(size);
|
||||
subscriber.onCompleted();
|
||||
emitter.onSuccess(size);
|
||||
DBWriter.setFeedMedia(media);
|
||||
})
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,12 @@ import android.util.Log;
|
|||
import java.util.Calendar;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.receiver.FeedUpdateReceiver;
|
||||
import de.danoeh.antennapod.core.service.FeedUpdateJobService;
|
||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.FeedUpdateUtils;
|
||||
|
||||
public class AutoUpdateManager {
|
||||
private static final int JOB_ID_FEED_UPDATE = 42;
|
||||
|
@ -153,4 +157,29 @@ public class AutoUpdateManager {
|
|||
updateIntent);
|
||||
Log.d(TAG, "Changed alarm to new time of day " + alarm.get(Calendar.HOUR_OF_DAY) + ":" + alarm.get(Calendar.MINUTE));
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if the app should refresh all feeds, i.e. if the last auto refresh failed.
|
||||
*
|
||||
* The feeds are only refreshed if an update interval or time of day is set and the last
|
||||
* (successful) refresh was before the last interval or more than a day ago, respectively.
|
||||
*
|
||||
*/
|
||||
public static void checkShouldRefreshFeeds(Context context) {
|
||||
long interval = 0;
|
||||
if(UserPreferences.getUpdateInterval() > 0) {
|
||||
interval = UserPreferences.getUpdateInterval();
|
||||
} else if(UserPreferences.getUpdateTimeOfDay().length > 0){
|
||||
interval = TimeUnit.DAYS.toMillis(1);
|
||||
}
|
||||
if(interval == 0) { // auto refresh is disabled
|
||||
return;
|
||||
}
|
||||
long lastRefresh = DBTasks.getLastRefreshAllFeedsTimeMillis(context);
|
||||
Log.d(TAG, "last refresh: " + Converter.getDurationStringLocalized(context,
|
||||
System.currentTimeMillis() - lastRefresh) + " ago");
|
||||
if(lastRefresh <= System.currentTimeMillis() - interval) {
|
||||
FeedUpdateUtils.startAutoUpdate(context, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,11 +38,12 @@ import de.danoeh.antennapod.core.service.playback.PlayerStatus;
|
|||
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable.PlayableUtils;
|
||||
import rx.Observable;
|
||||
import rx.Single;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import io.reactivex.Maybe;
|
||||
import io.reactivex.MaybeOnSubscribe;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Communicates with the playback service. GUI classes should use this class to
|
||||
|
@ -70,7 +71,8 @@ public abstract class PlaybackController {
|
|||
private boolean released = false;
|
||||
private boolean initialized = false;
|
||||
|
||||
private Subscription serviceBinder;
|
||||
private Disposable serviceBinder;
|
||||
private Disposable mediaLoader;
|
||||
|
||||
/**
|
||||
* True if controller should reinit playback service if 'pause' button is
|
||||
|
@ -145,7 +147,7 @@ public abstract class PlaybackController {
|
|||
}
|
||||
|
||||
if(serviceBinder != null) {
|
||||
serviceBinder.unsubscribe();
|
||||
serviceBinder.dispose();
|
||||
}
|
||||
try {
|
||||
activity.unbindService(mConnection);
|
||||
|
@ -180,10 +182,10 @@ public abstract class PlaybackController {
|
|||
private void bindToService() {
|
||||
Log.d(TAG, "Trying to connect to service");
|
||||
if (serviceBinder != null) {
|
||||
serviceBinder.unsubscribe();
|
||||
serviceBinder.dispose();
|
||||
}
|
||||
serviceBinder = Observable.fromCallable(this::getPlayLastPlayedMediaIntent)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(intent -> {
|
||||
boolean bound = false;
|
||||
|
@ -777,15 +779,18 @@ public abstract class PlaybackController {
|
|||
}
|
||||
|
||||
private void initServiceNotRunning() {
|
||||
Single.create(subscriber -> subscriber.onSuccess(getMedia()))
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
mediaLoader = Maybe.create((MaybeOnSubscribe<Playable>) emitter -> {
|
||||
Playable media = getMedia();
|
||||
if (media != null) {
|
||||
emitter.onSuccess(media);
|
||||
} else {
|
||||
emitter.onComplete();
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe((Object media) -> {
|
||||
if (media == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (((Playable) media).getMediaType() == MediaType.AUDIO) {
|
||||
.subscribe(media -> {
|
||||
if (media.getMediaType() == MediaType.AUDIO) {
|
||||
TypedArray res = activity.obtainStyledAttributes(new int[]{
|
||||
de.danoeh.antennapod.core.R.attr.av_play_big});
|
||||
getPlayButton().setImageResource(
|
||||
|
@ -794,7 +799,7 @@ public abstract class PlaybackController {
|
|||
} else {
|
||||
getPlayButton().setImageResource(R.drawable.ic_av_play_circle_outline_80dp);
|
||||
}
|
||||
});
|
||||
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -802,7 +807,7 @@ public abstract class PlaybackController {
|
|||
*/
|
||||
public class MediaPositionObserver implements Runnable {
|
||||
|
||||
public static final int WAITING_INTERVALL = 1000;
|
||||
static final int WAITING_INTERVALL = 1000;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
Loading…
Reference in New Issue