From f2f275512d4ef276e473ffb08b24202fef340c18 Mon Sep 17 00:00:00 2001 From: Somethingweirdhere Date: Fri, 29 Jun 2018 00:39:16 +0200 Subject: [PATCH] It looks good now --- .../subscription/SubscriptionFragment.java | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.java b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.java index 8f02158bc..16f203923 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.java @@ -6,6 +6,7 @@ import android.app.AlertDialog; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; +import android.content.Entity; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ResolveInfo; @@ -76,6 +77,7 @@ import icepick.State; import io.reactivex.Flowable; import io.reactivex.Observable; import io.reactivex.Observer; +import io.reactivex.Scheduler; import io.reactivex.Single; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; @@ -405,26 +407,13 @@ public class SubscriptionFragment extends BaseStateFragment { - new LongOperation().execute(result); - }, (@NonNull Throwable throwable) -> { - + List toDelete = subscriptionService.subscriptionTable().getSubscription(result.getServiceId(), result.getUrl()).blockingFirst(); + subscriptionService.subscriptionTable().delete(toDelete); }); } - - private class LongOperation extends AsyncTask { - - @Override - protected Void doInBackground(ChannelInfo... params) { - ChannelInfo info = params[0]; - Flowable> subscription = subscriptionService.subscriptionTable().getSubscription(info.getServiceId(), info.getUrl()); - subscriptionService.subscriptionTable().delete(subscription.blockingFirst()); - return null; - } - } - private void resetFragment() { if (disposables != null) disposables.clear(); if (infoListAdapter != null) infoListAdapter.clearStreamItemList();