Android sample with kotlin.

Overview

KotlinAndroidSample

1. NetWork with Kotlin + OkHttp + RxJava / RxAndroid

Request url("https://github.com/wangjiegulu") and update UI:

"https://github.com/wangjiegulu".request().get().rxExecute()
                    .map({ r -> r.body().string() })
                    .observeOnMain()
                    .subscribeSafeNext { result -> Log.d(TAG, "request result: $result"); resultTv.setText("Http request succeed, see log") }

2. Inject views & events with AndroidInject library

Inject "tv"(TextView) view and inject click event of the button.

@AILayout(R.layout.activity_inject)
public class InjectWithAIActivity : BaseActivity(){
    @AIView(R.id.activity_inject_tv)
    private var tv: TextView? = null;

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        tv?.setText("TextView inject succeed")
    }

    @AIClick(R.id.activity_inject_btn)
    public fun onClick(view: View){
        when(view.getId()){
            R.id.activity_inject_btn -> toast("clicked, button inject succeed!")
        }
    }

}

3. Database operation with RapidORM

  • Checkout feature-rapidorm branch,
  • Checkout RapidORM library,
  • setting.gradle Configuration:
include ':app', ':RapidORM'
project(":RapidORM").projectDir = new File(settingsDir, "[Your relative path of RapidORM library]");
@Table
public data class Person : Serializable{
    @Column(primaryKey = true)
    var id: Int? = null;
    @Column
    var name: String? = null;
    @Column
    var email: String? = null;
    @Column
    var student: Boolean? = null;
}

// Get Person dao
var personDao = DatabaseFactory.getDao(javaClass<PersonDaoImpl>());

// insert
var p = Person()
p.id = 100023L;
p.name = "wangjie"
p.email = "[email protected]"
p.student = true;
personDao.insert(generatePerson());

// delete
personDao.deleteBuilder()
		.setWhere(Where.eq("student", true))
		.delete(personDao)
		
// update
p.student = false
personDao.update(p)

// query
personDao.queryAll()
You might also like...
Webclient-kotlin-sample - An example of using the http web client to promote synchronous and asynchronous https calls

Web Client Consumer Kotlin Sample The project is an example of using the http we

This is a sample app to demonstrate the power of using EventSourced models and the ease with which these can be modelled using Kotlin.
This is a sample app to demonstrate the power of using EventSourced models and the ease with which these can be modelled using Kotlin.

Lego 4 Rent This is a sample app to demonstrate the power of using EventSourced models and the ease with which these can be modelled using Kotlin. To

Kotlin multi platform project template and sample app with everything shared except the UI. Built with clean architecture + MVI
Kotlin multi platform project template and sample app with everything shared except the UI. Built with clean architecture + MVI

KMMNewsAPP There are two branches Main News App Main The main branch is a complete template that you can clone and use to build the awesome app that y

Nota FaceSDK Sample For Android

Nota Face SDK for Android 노타의 안드로이드용 안면인식 SDK License 노타에서 제공하는 데모 라이센스는 3개월 시용기간을 제공하고 있다 Features SDK에서 제공되는 기능은 아래와 같다 : 얼굴감지 : 이미지에서 얼굴의 BoundingB

A sample code taking picture in android with app permission and simple ui
A sample code taking picture in android with app permission and simple ui

Android Taking Picture Sample Just sample code taking picture in android with ap

LocalisationDemo - A sample project to demonstrate localization in android

LocalisationDemo This is a sample project to demonstrate localization in android

📞 Remote call sample android app using RemoteMonster

📞 Remote call sample android app using RemoteMonster

A sample Music Player project that help you learn about Compose in Android
A sample Music Player project that help you learn about Compose in Android

Music App Compose UI A sample Music Player project that help you learn about Compose in Android. Note that this app only contain UI and has no logic.

❤️ A sample Marvel heroes application based on MVVM (ViewModel, Coroutines, LiveData, Room, Repository, Koin)  architecture.
❤️ A sample Marvel heroes application based on MVVM (ViewModel, Coroutines, LiveData, Room, Repository, Koin) architecture.

MarvelHeroes MarvelHeroes is a demo application based on modern Android application tech-stacks and MVVM architecture. Fetching data from the network

Owner
WangJie
To be an artist-engineer
WangJie
🎓 Learning Kotlin Coroutines for Android by example. 🚀 Sample implementations for real-world Android use cases. 🛠 Unit tests included!

Kotlin Coroutines - Use Cases on Android ?? Learning Kotlin Coroutines for Android by example. ?? Sample implementations for real-world Android use ca

Lukas Lechner 2.1k Jan 3, 2023
📚 Sample Android Components Architecture on a modular word focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack.

Android Components Architecture in a Modular Word Android Components Architecture in a Modular Word is a sample project that presents modern, 2020 app

Madalin Valceleanu 2.3k Dec 30, 2022
Android sample with kotlin.

KotlinAndroidSample 1. NetWork with Kotlin + OkHttp + RxJava / RxAndroid Request url("https://github.com/wangjiegulu") and update UI: "https://github.

WangJie 28 Oct 3, 2022
Sample app to demonstrate the integration code and working of Dyte SDK for android, using Kotlin.

Dyte Kotlin Sample App An example app in kotlin using the Dyte Mobile SDK Explore the docs » View Demo · Report Bug · Request Feature Table of Content

Dyte 8 Dec 3, 2021
Sample Social Login Project of Spring Boot and Kotlin

Sample-Spring-Boot-Social-Kotlin Sample Social Login Project of Spring Boot and Kotlin dependencies dependencies { implementation("org.springframewor

Seokhyun 2 Oct 11, 2021
kotlin micronaut sample

Micronaut 3.1.3 Documentation User Guide API Reference Configuration Reference Micronaut Guides Feature data-r2dbc documentation Micronaut Data R2DBC

Hodong 0 Nov 1, 2021
Kotlin sample codes.

Kotlin Samples Kotlin sample codes. HTML Builder html { lang = "en" head { title { +"Kotlin HTML" } } body { p { +"This is the f

Sadra Samadi 2 Mar 13, 2022
Kotlin Symbol Processing (KSP) sample project

Kotlin Symbol Processing (KSP) Sample Project Sample annotation processor created with Kotlin Symbol Processing (KSP) API. The repository supplements

Pavlo Stavytskyi 33 Dec 23, 2022
Micorservice with event sourcing sample kotlin

micorservice-with-event-sourcing-sample-kotlin Event Sourcing Exercises. Maybe it should work. Project eventsourcing Event Sourcing by Jpa or Cosmos D

nrs 20 Nov 11, 2022
Cloud Bowl Sample - Kotlin Spring Boot

Cloud Bowl Sample - Kotlin Spring Boot To make changes, edit the src/main/kotlin/hello/KotlinApplication.kt file. Run Locally: ./mvnw spring-boot:run

Lukasz Domzalski 0 Dec 13, 2021