Kotlin 1.4 Online Event, October 12–15, 2020 で発表されたトークについてのメモ
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
public class Circle { | |
public static void main(String[] args) { | |
// Preparation | |
int radius = Integer.parseInt(args[0]); | |
int rasterSize = radius * 2 + 1; | |
boolean[][] raster = new boolean[rasterSize][rasterSize]; | |
// Bresenham algorithm | |
int y = radius; | |
int err = radius; |
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
// implementation("org.zeroturnaround:zt-exec:1.12") LIBRARY USAGED | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.collectAsState | |
import kotlin.coroutines.resume | |
import kotlinx.coroutines.channels.awaitClose | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.callbackFlow | |
import kotlinx.coroutines.flow.collect | |
import kotlinx.coroutines.flow.flow |
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
package com.handstandsam.mutablestateflow | |
import kotlinx.coroutines.flow.MutableStateFlow | |
import kotlinx.coroutines.test.runBlockingTest | |
import org.junit.Test | |
class UseImmutableDataWithMutableStateFlow { | |
data class SomePojo(var name: String = "placeholder") |
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
//image earth: https://media.prod.mdn.mozit.cloud/attachments/2012/07/09/1429/e2d55b8d5c9efd75a12112264d4ac091/Canvas_earth.png | |
//image sun: https://www.extremetech.com/wp-content/uploads/2020/01/NASA-Sun-640x611.jpg (scaled down to 20%) | |
//image sky: https://unblast.com/wp-content/uploads/2018/10/Sky-Stars-Pattern-1600x1190.jpg | |
import androidx.animation.* | |
import androidx.animation.Spring.DampingRatioHighBouncy | |
import androidx.animation.Spring.StiffnessLow | |
import androidx.compose.Composable | |
import androidx.compose.Model | |
import androidx.compose.remember | |
import androidx.ui.animation.Transition |
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
<templateSet group="Kotlin"> | |
<template name="debug" value="also(::println)" description="Print a debug log" toReformat="false" toShortenFQNames="true"> | |
<context> | |
<option name="KOTLIN" value="true" /> | |
<option name="KOTLIN_COMMENT" value="false" /> | |
<option name="KOTLIN_TOPLEVEL" value="false" /> | |
</context> | |
</template> | |
</templateSet> |
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 androidx.animation.PhysicsBuilder | |
import androidx.animation.Spring.DampingRatioHighBouncy | |
import androidx.animation.Spring.StiffnessLow | |
import androidx.compose.Composable | |
import androidx.compose.Model | |
import androidx.compose.remember | |
import androidx.ui.animation.animate | |
import androidx.ui.core.DrawClipToBounds | |
import androidx.ui.core.Text | |
import androidx.ui.core.drawLayer |
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
package com.example | |
import com.slack.api.bolt.App | |
import com.slack.api.bolt.AppConfig | |
import com.slack.api.bolt.request.Request | |
import com.slack.api.bolt.request.RequestHeaders | |
import com.slack.api.bolt.response.Response | |
import com.slack.api.bolt.util.QueryStringParser | |
import com.slack.api.bolt.util.SlackRequestParser | |
import com.slack.api.model.block.Blocks.asBlocks |
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
/* | |
* Copyright 2019 Louis Cognault Ayeva Derman. Use of this source code is governed by the Apache 2.0 license. | |
*/ | |
import android.location.Location | |
import com.google.android.gms.location.LocationCallback | |
import com.google.android.gms.location.LocationRequest | |
import com.google.android.gms.location.LocationResult | |
import com.google.android.gms.location.LocationServices | |
import kotlinx.coroutines.CancellationException |
NewerOlder