Expose the modulesByLanguage

Can be refactored later, internal implementation uses the "proper" way of accessing things.
This commit is contained in:
Bradlee Speice 2014-11-08 00:34:08 -05:00
parent 1ea27f50b9
commit d7e9dd34c9
2 changed files with 7 additions and 3 deletions

View File

@ -2,15 +2,19 @@ package org.bspeice.minimalbible.activity.downloader.manager
import org.crosswire.common.util.Language import org.crosswire.common.util.Language
import rx.Observable import rx.Observable
import rx.observables.GroupedObservable
class LocaleManager(val rM: RefreshManager) { class LocaleManager(val rM: RefreshManager) {
val currentLanguage = Language.DEFAULT_LANG val currentLanguage = Language.DEFAULT_LANG
val languageModuleMap = rM.flatModules private val languageModuleMap = rM.flatModules
// Language doesn't have hashCode(), so we actually group by its String // Language doesn't have hashCode(), so we actually group by its String
.groupBy { FixedLanguage(it.getLanguage()) } .groupBy { FixedLanguage(it.getLanguage()) }
val modulesByLanguage = languageModuleMap
.map { GroupedObservable.from(it.getKey(): Language, it) }
// Cast back to the original Language implementation // Cast back to the original Language implementation
val availableLanguages: Observable<Language> = languageModuleMap.map { it.getKey() } val availableLanguages: Observable<Language> = languageModuleMap.map { it.getKey() }
val sortedLanguagesList = val sortedLanguagesList =

View File

@ -1,6 +1,6 @@
#Wed Oct 22 20:42:04 EDT 2014 #Fri Nov 07 23:02:34 EST 2014
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-all.zip