mirror of
https://github.com/MinimalBible/MinimalBible-Legacy
synced 2024-12-21 22:28:18 -05:00
[broken] Slight semantic change to RefreshManager
This commit is contained in:
parent
8f346f17e4
commit
899b054c8b
@ -1,33 +0,0 @@
|
||||
package org.bspeice.minimalbible.activities.downloader.manager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.crosswire.jsword.book.Book;
|
||||
import org.crosswire.jsword.book.install.Installer;
|
||||
|
||||
/**
|
||||
* POJO class for {@link de.greenrobot.event.EventBus} to broadcast whenever
|
||||
* we've finished updating the book list.
|
||||
*/
|
||||
public class EventBookList {
|
||||
|
||||
private Map<Installer, List<Book>> bookMapping;
|
||||
|
||||
public EventBookList(Map<Installer, List<Book>> bookList) {
|
||||
this.bookMapping = bookList;
|
||||
}
|
||||
|
||||
public Map<Installer, List<Book>> getInstallerMapping() {
|
||||
return bookMapping;
|
||||
}
|
||||
|
||||
public List<Book> getBookList() {
|
||||
List<Book> bookList = new ArrayList<Book>();
|
||||
for (Installer i: bookMapping.keySet()) {
|
||||
bookList.addAll(bookMapping.get(i));
|
||||
}
|
||||
return bookList;
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -29,7 +30,7 @@ public class RefreshManager {
|
||||
* Cached copy of modules that are available so we don't refresh for everyone who requests it.
|
||||
*/
|
||||
private Observable<Map<Installer, List<Book>>> availableModules;
|
||||
private boolean refreshComplete;
|
||||
private final AtomicBoolean refreshComplete = new AtomicBoolean();
|
||||
|
||||
public RefreshManager() {
|
||||
MinimalBible.getApplication().inject(this);
|
||||
@ -53,7 +54,7 @@ public class RefreshManager {
|
||||
|
||||
// Set refresh complete when it is.
|
||||
availableModules.subscribeOn(AndroidSchedulers.handlerThread(backgroundHandler))
|
||||
.subscribe(null, null, () -> refreshComplete = true);
|
||||
.subscribe(null, null, () -> refreshComplete.set(true));
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,4 +90,8 @@ public class RefreshManager {
|
||||
.take(1)
|
||||
.map(element -> element.entrySet().iterator().next().getKey());
|
||||
}
|
||||
|
||||
public boolean isRefreshComplete() {
|
||||
return refreshComplete.get();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user