This file contains 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
import kotlinx.coroutines.* | |
import kotlinx.coroutines.flow.flow | |
import kotlinx.coroutines.flow.flowOn | |
import kotlinx.coroutines.flow.launchIn | |
import kotlinx.coroutines.flow.onEach | |
import java.io.File | |
import java.net.InetSocketAddress | |
import java.net.Proxy | |
import java.net.Proxy.Type.SOCKS | |
import java.net.Socket |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="colorPrimary">#3F51B5</color> | |
<color name="colorPrimaryDark">#303F9F</color> | |
<color name="colorAccent">#FF4081</color> | |
<color name="ubuntuOrange">#E95420</color> | |
<color name="ubuntuAuberdine">#772953</color> | |
<color name="ubuntuLightAuberdine">#77216F</color> | |
<color name="ubuntuMidAuberdine">#5E2750</color> | |
<color name="ubuntuDarkAuberdine">#2C001E</color> |
This file contains 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 <T: Parcelable> NavHostController.putParcelables(key: String, parcelables: ArrayList<T>) = currentBackStackEntry?.arguments?.putParcelableArrayList(key, parcelables) | |
fun <T: Parcelable> NavHostController.getParcelables(key: String) = previousBackStackEntry?.arguments?.getParcelableArrayList<T>(key) | |
fun <T: Parcelable> NavHostController.putParcelable(key: String, parcelable: T) = currentBackStackEntry?.arguments?.putParcelable(key, parcelable) | |
fun <T: Parcelable> NavHostController.getParcelable(key: String) = previousBackStackEntry?.arguments?.getParcelable<T>(key) |
This file contains 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
@JvmInline | |
value class Bar(private val _foo: Int){ | |
val computed: Int | |
get() = _foo.toString().length | |
} | |
@Throws(AssertionError::class) | |
fun testBar(){ | |
val arg = 22 | |
val argLength = arg.toString().length |
This file contains 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
suspend fun main() { | |
val users = listOf(user,me,otherUser) | |
users.first().apply { | |
addFriend(me) | |
addFriend(otherUser) | |
} | |
verticalList("Users", users){ user -> | |
userRow(user) | |
} | |
} |
This file contains 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 main(){ | |
State.apply { | |
addObserver(StateView) | |
value = UiState.Created | |
value = UiState.Started | |
value = UiState.Resumed | |
value = UiState.Paused | |
value = UiState.Stopped | |
value = UiState.Destroyed | |
} |
This file contains 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 main(){ | |
val user = User().apply { | |
val account = Account("Capital One", 12345) | |
createAccount(account) | |
val cocaCola = Vendor("Coca Cola") | |
createVendor(cocaCola) | |
val beverages = Category("beverages") | |
createCategory(beverages) | |
writeCheck(account, 1, cocaCola, beverages, 113.30) | |
} |
This file contains 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 main() { | |
val builder = Sms.Builder() | |
val message = builder.from("5127208800").to("9727404318").body("Hey, what's up?").build() | |
message.send() | |
} | |
data class Sms private constructor(var to: String, var from: String, var body: String){ | |
fun send(){}//TODO() |
This file contains 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 main() { | |
val foo = Foo("foo","bar") | |
val bar = foo.copy(foo = "bar") | |
} | |
data class Foo(val foo: String, val bar: String) |
This file contains 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 main() { | |
val writer = WriterImpl(0) | |
writer.draw() | |
writer.erase() | |
val copyright = Copyright(writer) | |
copyright.draw() | |
copyright.erase() | |
val permanent = Permanent(copyright) | |
permanent.draw() | |
permanent.erase() |
OlderNewer