This file contains hidden or 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
fun rotateBitmap(bitmap: Bitmap, orientation: Int): Bitmap? { | |
val matrix = Matrix() | |
when (orientation) { | |
ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> matrix.setScale(-1F, 1F) | |
ExifInterface.ORIENTATION_ROTATE_180 -> matrix.setRotate(180F) | |
ExifInterface.ORIENTATION_FLIP_VERTICAL -> { | |
matrix.setRotate(180F) | |
matrix.postScale(-1F, 1F) | |
} |
This file contains hidden or 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
fun BottomNavigationView.setFont(@FontRes rId: Int) { | |
val menuView = this.getChildAt(0) as BottomNavigationMenuView | |
val menuCount = menuView.childCount | |
(0 until menuCount).forEach { | |
val itemView = menuView.getChildAt(it) as BottomNavigationItemView | |
val titleView = itemView.getChildAt(1) as BaselineLayout | |
val smallLabel = titleView.getChildAt(0) as TextView | |
val largeLabel = titleView.getChildAt(1) as TextView |
This file contains hidden or 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
println("List ====> ") | |
listOf(1, 2, 3) | |
.filter { | |
println("Filter: $it") | |
it % 2 == 0 | |
} | |
.map { | |
println("Map: $it") | |
it | |
} |
This file contains hidden or 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
println("List ====> ") | |
listOf(1, 2, 3) | |
.filter { println("Filter: $it"); it % 2 == 0 } | |
.map { println("Map: $it"); it + 1 } | |
.forEach { println("Each: $it") } | |
println("Sequence ====> ") | |
sequenceOf(1, 2, 3) | |
.filter { println("Filter: $it"); it % 2 == 0 } | |
.map { println("Map: $it"); it + 1 } |
OlderNewer