项目作者: y2k
项目描述 :
List interpreter for android
高级语言: Kotlin
项目地址: git://github.com/y2k/remote-embeded-repl.git
Удаленный REPL лиспа для Android
Antlr граматика
Пример использования (Kotlin Scratches)
Показать тост
io.y2k.remoteconnector.Client.sendObject(
"""
|(.show
| (android.widget.Toast/makeText
| io.y2k.replexample.App/instance
| "Hello world"
| android.widget.Toast/LENGTH_LONG))
""".trimMargin()
)
Открыть youtube
io.y2k.remoteconnector.Client.sendObject(
"""
|(.startActivity
| io.y2k.replexample.App/instance
| (android.content.Intent.
| android.content.Intent/ACTION_VIEW
| (android.net.Uri/parse "https://youtu.be/dQw4w9WgXcQ")))
""".trimMargin()
)
Показть нотификацию
io.y2k.remoteconnector.Client.sendObject(
"""
|(.notify
| (androidx.core.app.NotificationManagerCompat/from
| io.y2k.replexample.App/instance)
| 0
| (.build
| (.setContentText
| (.setContentTitle
| (.setSmallIcon
| (androidx.core.app.NotificationCompat${"$"}Builder.
| io.y2k.replexample.App/instance
| "default")
| android.R${"$"}drawable/sym_def_app_icon)
| "Hello")
| "World")))
""".trimMargin()
)
Интеграция на клиенте
class MainActivity : Activity() {
private lateinit var server: Closeable
override fun onStart() {
super.onStart()
server = Server.start(Repl::eval)
}
override fun onStop() {
super.onStop()
server.close()
}
}