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
with(webview.settings) { | |
javaScriptEnabled = true | |
databaseEnabled = true | |
} | |
// similarly | |
webview.settings.run { | |
javaScriptEnabled = true | |
databaseEnabled = true |
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
// Yack! | |
with(webview.settings) { | |
this?.javaScriptEnabled = true | |
this?.databaseEnabled = true | |
} | |
} | |
// Nice. | |
webview.settings?.run { | |
javaScriptEnabled = true |
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 test() { | |
var mood = "I am sad" | |
run { | |
val mood = "I am happy" | |
println(mood) // I am happy | |
} | |
println(mood) // I am sad | |
} |
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
run { | |
if (firstTimeView) introView else normalView | |
}.show() |
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
stringVariable?.run { | |
println("The length of this String is $length") | |
} | |
// Similarly. | |
stringVariable?.let { | |
println("The length of this String is ${it.length}") | |
} |
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
/* Java */ | |
package com.chikekotlin.projectx.utils | |
public class UserUtilsKt { | |
public static String checkUserStatus() { | |
return "online"; | |
} | |
} |
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
/* Java */ | |
import com.chikekotlin.projectx.utils.UserUtilsKt | |
... | |
UserUtilsKt.checkUserStatus() |
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
@file:JvmName("UserUtils") | |
package com.chikekotlin.projectx.utils | |
fun checkUserStatus(): String { | |
return "online" | |
} |
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
/* Java */ | |
import com.chikekotlin.projectx.utils.UserUtils | |
... | |
UserUtils.checkUserStatus() |
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
val message = { println("Hey, Kotlin is really cool!") } | |
message() // "Hey, Kotlin is really cool!" |