Creating BooleanExtentions

Starting off with toInt()
This commit is contained in:
Jays2Kings 2021-04-16 02:22:40 -04:00
parent 07cc4eefb3
commit 650c3bc4f8
3 changed files with 4 additions and 3 deletions

View File

@ -18,6 +18,7 @@ import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.databinding.MigrationBottomSheetBinding
import eu.kanade.tachiyomi.ui.migration.MigrationFlags
import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.toInt
import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.setBottomEdge
@ -147,8 +148,6 @@ class MigrationBottomSheetDialog(
pref.set(index == 1)
}
}
private fun Boolean.toInt() = if (this) 1 else 0
}
interface StartMigrationListener {

View File

@ -0,0 +1,3 @@
package eu.kanade.tachiyomi.util.system
fun Boolean.toInt() = if (this) 1 else 0

View File

@ -291,7 +291,6 @@ object ImageUtil {
private val Bitmap.rect: Rect
get() = Rect(0, 0, width, height)
fun Boolean.toInt() = if (this) 1 else 0
private fun isDark(color: Int): Boolean {
return Color.red(color) < 40 && Color.blue(color) < 40 && Color.green(color) < 40 &&
Color.alpha(color) > 200