mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-17 23:34:54 +00:00
It looks good now
This commit is contained in:
parent
5150c2ee62
commit
f2f275512d
@ -6,6 +6,7 @@ import android.app.AlertDialog;
|
|||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Entity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
@ -76,6 +77,7 @@ import icepick.State;
|
|||||||
import io.reactivex.Flowable;
|
import io.reactivex.Flowable;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.Observer;
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.Scheduler;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
@ -405,26 +407,13 @@ public class SubscriptionFragment extends BaseStateFragment<List<SubscriptionEnt
|
|||||||
private void deleteChannel (ChannelInfoItem selectedItem) {
|
private void deleteChannel (ChannelInfoItem selectedItem) {
|
||||||
ExtractorHelper.getChannelInfo(selectedItem.getServiceId(), selectedItem.getUrl(), true)
|
ExtractorHelper.getChannelInfo(selectedItem.getServiceId(), selectedItem.getUrl(), true)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(Schedulers.newThread())
|
||||||
.subscribe((@NonNull ChannelInfo result) -> {
|
.subscribe((@NonNull ChannelInfo result) -> {
|
||||||
new LongOperation().execute(result);
|
List<SubscriptionEntity> toDelete = subscriptionService.subscriptionTable().getSubscription(result.getServiceId(), result.getUrl()).blockingFirst();
|
||||||
}, (@NonNull Throwable throwable) -> {
|
subscriptionService.subscriptionTable().delete(toDelete);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class LongOperation extends AsyncTask<ChannelInfo, Void, Void> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Void doInBackground(ChannelInfo... params) {
|
|
||||||
ChannelInfo info = params[0];
|
|
||||||
Flowable<List<SubscriptionEntity>> subscription = subscriptionService.subscriptionTable().getSubscription(info.getServiceId(), info.getUrl());
|
|
||||||
subscriptionService.subscriptionTable().delete(subscription.blockingFirst());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resetFragment() {
|
private void resetFragment() {
|
||||||
if (disposables != null) disposables.clear();
|
if (disposables != null) disposables.clear();
|
||||||
if (infoListAdapter != null) infoListAdapter.clearStreamItemList();
|
if (infoListAdapter != null) infoListAdapter.clearStreamItemList();
|
||||||
|
Loading…
Reference in New Issue
Block a user