Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Commit

Permalink
Merge pull request #125 from Ribesg/patch-3
Browse files Browse the repository at this point in the history
Add Int.withAlpha to Helpers
  • Loading branch information
yanex committed Dec 14, 2015
2 parents 3d89147 + 7a39599 commit 499f335
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dsl/static/src/common/Helpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ val Int.gray: Int
val Int.opaque: Int
get() = this or 0xff000000.toInt()

fun Int.withAlpha(alpha: Int) {
require(alpha >= 0 && alpha <= 0xFF)
return this and 0x00FFFFFF or (alpha shl 24)
}

enum class ScreenSize {
SMALL,
Expand Down Expand Up @@ -123,4 +127,4 @@ inline fun <T: Any> Fragment.configuration(
fromSdk, sdk, uiMode, nightMode, rightToLeft, smallestWidth)) init() else null
}
else null
}
}

0 comments on commit 499f335

Please sign in to comment.