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
import kotlinx.cinterop.* | |
import hello.* | |
fun main(args: Array<String>) { | |
print(hello()?.toKString()) | |
} |
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
group 'com.babedev' | |
version '1.0-SNAPSHOT' | |
buildscript { | |
ext.kotlin_version = '1.1.3-2' | |
repositories { | |
mavenCentral() | |
maven { | |
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" |
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
#ifndef HELLO_H_ | |
#define HELLO_H_ | |
char * hello(); | |
#endif |
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
#include "hello.h" | |
char * hello() { | |
return "Hello World\n"; | |
} |
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 main(args: Array<String>) { | |
print("Hello Native") | |
} |
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
group 'com.babedev' | |
version '1.0-SNAPSHOT' | |
buildscript { | |
repositories { | |
mavenCentral() | |
maven { | |
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" | |
} | |
} |
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
var Hello = require('./dist/hello.js') | |
console.log(Hello.com.babedev.playground.greet()) | |
Hello.com.babedev.playground.sayHello("Hello Kotlin") |
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
package com.babedev.playground | |
fun greet() = "Hello" | |
@JsName("sayHello") | |
fun greet(text: String) { | |
console.log(text) | |
} |
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
private fun generateActivity() { | |
val onCreate = FunSpec.builder("onCreate") | |
.addModifiers(KModifier.OVERRIDE, KModifier.PUBLIC) | |
.addParameter("savedInstanceState", Bundle::class) | |
.addStatement("super.onCreate(savedInstanceState)") | |
.addComment("TODO setContentView()") | |
.addStatement("mPresenter = %T()", presenterType) | |
.addStatement("mPresenter.attachView(this)") | |
.build() |
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 ImageView.show(imageUrl: String = "") { | |
if (imageUrl.isBlank()) return | |
if (context == null) return | |
if (context is Activity && ((context as Activity).isFinishing || (context as Activity).isDestroyed)) return | |
Glide.with(context) | |
.load(imageUrl) | |
.crossFade() |