Allow to create/remove categories. Some refactoring.

This commit is contained in:
inorichi
2015-12-28 01:13:52 +01:00
parent 3dff7f90e7
commit e548cbf171
31 changed files with 539 additions and 75 deletions

View File

@@ -367,6 +367,12 @@ public class DatabaseHelper {
.prepare();
}
public PreparedDeleteCollectionOfObjects<Category> deleteCategories(List<Category> categories) {
return db.delete()
.objects(categories)
.prepare();
}
public PreparedPutObject<MangaCategory> insertMangaCategory(MangaCategory mangaCategory) {
return db.put()
.object(mangaCategory)

View File

@@ -71,7 +71,7 @@ public class DownloadManager {
if (threadsNumberSubscription != null && !threadsNumberSubscription.isUnsubscribed())
threadsNumberSubscription.unsubscribe();
threadsNumberSubscription = preferences.getDownloadTheadsObservable()
threadsNumberSubscription = preferences.downloadThreads().asObservable()
.subscribe(threadsNumber::onNext);
downloadsSubscription = downloadsQueueSubject

View File

@@ -13,7 +13,6 @@ import java.io.File;
import eu.kanade.mangafeed.R;
import eu.kanade.mangafeed.data.mangasync.base.MangaSyncService;
import eu.kanade.mangafeed.data.source.base.Source;
import rx.Observable;
public class PreferencesHelper {
@@ -138,12 +137,8 @@ public class PreferencesHelper {
prefs.edit().putString(getKey(R.string.pref_download_directory_key), path).apply();
}
public int getDownloadThreads() {
return prefs.getInt(getKey(R.string.pref_download_slots_key), 1);
}
public Observable<Integer> getDownloadTheadsObservable() {
return rxPrefs.getInteger(getKey(R.string.pref_download_slots_key), 1).asObservable();
public Preference<Integer> downloadThreads() {
return rxPrefs.getInteger(getKey(R.string.pref_download_slots_key), 1);
}
}