forked from starfish23/mangafeed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to create manual backups with private preferences too
- Loading branch information
Showing
9 changed files
with
65 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/src/main/java/eu/kanade/tachiyomi/util/lang/BooleanArrayExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package eu.kanade.tachiyomi.util.lang | ||
|
||
import kotlin.reflect.KProperty1 | ||
import kotlin.reflect.full.declaredMemberProperties | ||
import kotlin.reflect.full.primaryConstructor | ||
|
||
fun <T : Any> T.asBooleanArray(): BooleanArray { | ||
return this::class.declaredMemberProperties | ||
.filterIsInstance<KProperty1<T, Boolean>>() | ||
.map { it.get(this) } | ||
.toBooleanArray() | ||
} | ||
|
||
inline fun <reified T : Any> BooleanArray.asDataClass(): T { | ||
val properties = T::class.declaredMemberProperties.filterIsInstance<KProperty1<T, Boolean>>() | ||
require(properties.size == this.size) { "Boolean array size does not match data class property count" } | ||
return T::class.primaryConstructor!!.call(*this.toTypedArray()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters