mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Minor changes
This commit is contained in:
		| @@ -67,7 +67,7 @@ public class DownloadManager { | ||||
|         downloadSubscription = downloadsSubject | ||||
|                 .subscribeOn(Schedulers.io()) | ||||
|                 .filter(event -> !isChapterDownloaded(event)) | ||||
|                 .flatMap(this::createDownload) | ||||
|                 .flatMap(this::prepareDownload) | ||||
|                 .flatMap(this::downloadChapter, preferences.getDownloadThreads()) | ||||
|                 .onBackpressureBuffer() | ||||
|                 .subscribe(); | ||||
| @@ -100,7 +100,7 @@ public class DownloadManager { | ||||
|     } | ||||
|  | ||||
|     // Create a download object and add it to the downloads queue | ||||
|     private Observable<Download> createDownload(DownloadChapterEvent event) { | ||||
|     private Observable<Download> prepareDownload(DownloadChapterEvent event) { | ||||
|         Download download = new Download( | ||||
|                 sourceManager.get(event.getManga().source), | ||||
|                 event.getManga(), | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| package eu.kanade.mangafeed.data.models; | ||||
|  | ||||
| import eu.kanade.mangafeed.data.helpers.NetworkHelper; | ||||
| import rx.subjects.BehaviorSubject; | ||||
| import rx.subjects.PublishSubject; | ||||
|  | ||||
| public class Page implements NetworkHelper.ProgressListener { | ||||
|  | ||||
| @@ -12,7 +12,7 @@ public class Page implements NetworkHelper.ProgressListener { | ||||
|     private transient volatile int status; | ||||
|     private transient volatile int progress; | ||||
|  | ||||
|     private transient BehaviorSubject<Integer> statusSubject; | ||||
|     private transient PublishSubject<Integer> statusSubject; | ||||
|  | ||||
|     public static final int QUEUE = 0; | ||||
|     public static final int LOAD_PAGE = 1; | ||||
| @@ -61,7 +61,8 @@ public class Page implements NetworkHelper.ProgressListener { | ||||
|  | ||||
|     public void setStatus(int status) { | ||||
|         this.status = status; | ||||
|         notifyStatus(); | ||||
|         if (statusSubject != null) | ||||
|             statusSubject.onNext(status); | ||||
|     } | ||||
|  | ||||
|     public int getProgress() { | ||||
| @@ -73,14 +74,8 @@ public class Page implements NetworkHelper.ProgressListener { | ||||
|         progress = (int) ((100 * bytesRead) / contentLength); | ||||
|     } | ||||
|  | ||||
|     public void setStatusSubject(BehaviorSubject<Integer> subject) { | ||||
|     public void setStatusSubject(PublishSubject<Integer> subject) { | ||||
|         this.statusSubject = subject; | ||||
|         notifyStatus(); | ||||
|     } | ||||
|  | ||||
|     private void notifyStatus() { | ||||
|         if (statusSubject != null) | ||||
|             statusSubject.onNext(status); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -25,7 +25,7 @@ import rx.Observable; | ||||
| import rx.Subscription; | ||||
| import rx.android.schedulers.AndroidSchedulers; | ||||
| import rx.schedulers.Schedulers; | ||||
| import rx.subjects.BehaviorSubject; | ||||
| import rx.subjects.PublishSubject; | ||||
|  | ||||
| public class ReaderPageFragment extends Fragment { | ||||
|  | ||||
| @@ -128,10 +128,11 @@ public class ReaderPageFragment extends Fragment { | ||||
|         if (page == null || statusSubscription != null) | ||||
|             return; | ||||
|  | ||||
|         BehaviorSubject<Integer> statusSubject = BehaviorSubject.create(); | ||||
|         PublishSubject<Integer> statusSubject = PublishSubject.create(); | ||||
|         page.setStatusSubject(statusSubject); | ||||
|  | ||||
|         statusSubscription = statusSubject | ||||
|                 .startWith(page.getStatus()) | ||||
|                 .observeOn(AndroidSchedulers.mainThread()) | ||||
|                 .subscribe(this::processStatus); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user