1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

Fix issue with default text color and default background color (#251)

This commit is contained in:
Konstantin Ivanov 2020-02-22 18:22:21 +03:00 committed by GitHub
parent a9bcda95c9
commit a9a206d83f
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 1 deletions

View file

@ -32,6 +32,19 @@ class BlockAdapterTest {
private val context: Context = ApplicationProvider.getApplicationContext()
@Test
fun `should return transparent hex code when int color value is zero`() {
val transparentColor = 0
val actual = transparentColor.hexColorCode()
assertEquals(
expected = "#00000000",
actual = actual
)
}
@Test
fun `should create paragraph view holder`() {

View file

@ -1,3 +1,15 @@
package com.agileburo.anytype.core_utils.ext
fun Int.hexColorCode(): String = String.format("#%06X", 0xFFFFFF and this)
/**
* This method removes alpha from color.
* @return Transparent color, when input is 0
*/
const val TRANSPARENT_COLOR = "#00000000"
fun Int.hexColorCode(): String =
if (this == 0) {
TRANSPARENT_COLOR
} else {
String.format("#%06X", 0xFFFFFF and this)
}

View file

@ -23,6 +23,9 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}