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:
parent
a9bcda95c9
commit
a9a206d83f
3 changed files with 29 additions and 1 deletions
|
@ -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`() {
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
|
@ -23,6 +23,9 @@ android {
|
|||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
debuggable true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue