Rewrote UpdateDownloader to Kotlin

Added auto update check (every 12 hour)
Warning message optional fix #256
Lots of bug fixes!
This commit is contained in:
NoodleMage
2016-04-18 00:20:58 +02:00
parent ec9c19ce7d
commit 55e9d2880c
23 changed files with 532 additions and 249 deletions
@@ -70,16 +70,17 @@ class PreferenceKeys(context: Context) {
val removeAfterMarkedAsRead = context.getString(R.string.pref_remove_after_marked_as_read_key)
val updateOnlyWhenCharging = context.getString(R.string.pref_update_only_when_charging_key)
val libraryUpdateInterval = context.getString(R.string.pref_library_update_interval_key)
val libraryUpdateRestriction = context.getString(R.string.pref_library_update_restriction_key)
val filterDownloaded = context.getString(R.string.pref_filter_downloaded_key)
val filterUnread = context.getString(R.string.pref_filter_unread_key)
fun sourceUsername(sourceId: Int) = "pref_source_username_$sourceId"
fun sourcePassword(sourceId: Int) = "pref_source_password_$sourceId"
fun syncUsername(syncId: Int) = "pref_mangasync_username_$syncId"
@@ -39,6 +39,11 @@ class PreferencesHelper(private val context: Context) {
context.getString(R.string.pref_library_update_interval_key), 0)
}
fun getAutomaticUpdateStatus(context: Context): Boolean {
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
context.getString(R.string.pref_enable_automatic_updates), false)
}
@JvmStatic
fun getTheme(context: Context): Int {
return PreferenceManager.getDefaultSharedPreferences(context).getInt(
@@ -132,10 +137,10 @@ class PreferencesHelper(private val context: Context) {
fun removeAfterMarkedAsRead() = prefs.getBoolean(keys.removeAfterMarkedAsRead, false)
fun updateOnlyWhenCharging() = prefs.getBoolean(keys.updateOnlyWhenCharging, false)
fun libraryUpdateInterval() = rxPrefs.getInteger(keys.libraryUpdateInterval, 0)
fun libraryUpdateRestriction() = prefs.getStringSet(keys.libraryUpdateRestriction, emptySet())
fun filterDownloaded() = rxPrefs.getBoolean(keys.filterDownloaded, false)
fun filterUnread() = rxPrefs.getBoolean(keys.filterUnread, false)