mirror of
				https://github.com/MinimalBible/MinimalBible
				synced 2025-10-31 09:30:25 -04:00 
			
		
		
		
	Refactor the DLProgressEvent to Kotlin
This commit is contained in:
		| @ -110,8 +110,9 @@ public class BookDownloadManager implements WorkListener, BooksListener { | ||||
|                 downloadEvents.onNext(new DLProgressEvent(DLProgressEvent.PROGRESS_COMPLETE, b)); | ||||
|             } else { | ||||
|                 // Track the ongoing download | ||||
|                 DLProgressEvent event = new DLProgressEvent(job.getWorkDone(), | ||||
|                         job.getTotalWork(), b); | ||||
|                 DLProgressEvent event = new DLProgressEvent( | ||||
|                         (job.getWorkDone() / job.getTotalWork()) * 100, | ||||
|                         b); | ||||
|                 inProgressDownloads.put(b, event); | ||||
|                 downloadEvents.onNext(event); | ||||
|             } | ||||
|  | ||||
| @ -1,40 +0,0 @@ | ||||
| package org.bspeice.minimalbible.activity.downloader.manager; | ||||
|  | ||||
| import org.crosswire.jsword.book.Book; | ||||
|  | ||||
| /** | ||||
|  * Used for notifying that a book's download progress is ongoing | ||||
|  */ | ||||
| public class DLProgressEvent { | ||||
|     private final int progress; | ||||
|     private final Book b; | ||||
|  | ||||
|     public static final int PROGRESS_COMPLETE = 100; | ||||
|     public static final int PROGRESS_BEGINNING = 0; | ||||
|  | ||||
|     public DLProgressEvent(int workDone, int totalWork, Book b) { | ||||
|         if (totalWork == 0) { | ||||
|             this.progress = 0; | ||||
|         } else { | ||||
|             this.progress = (int)((float) workDone / totalWork * 100); | ||||
|         } | ||||
|         this.b = b; | ||||
|     } | ||||
|  | ||||
|     public DLProgressEvent(int workDone, Book b) { | ||||
|         this.progress = workDone; | ||||
|         this.b = b; | ||||
|     } | ||||
|  | ||||
|     public int getProgress() { | ||||
|         return progress; | ||||
|     } | ||||
|  | ||||
|     public float toCircular() { | ||||
|         return ((float)progress) * 360 / 100; | ||||
|     } | ||||
|  | ||||
|     public Book getB() { | ||||
|         return this.b; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Bradlee Speice
					Bradlee Speice