## KotlinAndroidSample
### 1. NetWork with [Kotlin] + [OkHttp] + [RxJava] / [RxAndroid]
Request url("https://github.com/wangjiegulu") and update UI:
```Kotlin
"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.
```Kotlin
@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:
```java
include ':app', ':RapidORM'
project(":RapidORM").projectDir = new File(settingsDir, "[Your relative path of RapidORM library]");
```
```Kotlin
@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 = "tiantian.china.2@gmail.com"
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()
```
[AndroidInject]: https://github.com/wangjiegulu/androidInject
[Kotlin]: http://kotlinlang.org/
[OkHttp]: https://github.com/square/okhttp
[RxJava]: https://github.com/ReactiveX/RxJava
[RxAndroid]: https://github.com/ReactiveX/RxAndroid
[RapidORM]: https://github.com/wangjiegulu/RapidORM
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【Object-C】ios苹果app开发入门object-c例子demo14个实例 一般编程问题 【实例简介】 ios苹果app开发入门,object-c,例子,demo,14个实例 初学者难得的学习实例 【实例截图】 【核心代码】 归档 ├── AirPrinter │ ├── AirPrinter │ │ ├── AirPrinter-Info.plist │ │ ├── AirPrinter-Prefix.pch │ │ ├── AirPrinterAppDelegate.h │ │ ├── AirPrinterAppDelegate.m 。。。。。 【Object-C】ios苹果app开发入门object-c例子demo14个实例 一般编程问题
资源推荐
资源详情
资源评论
收起资源包目录
KotlinAndroidSample-master1.zip (66个子文件)
KotlinAndroidSample-master1
gradle
wrapper
健康养生秘笈.url 133B
主播培训.url 61B
gradle-wrapper.jar 49KB
武术资料获取.url 125B
gradle-wrapper.properties 232B
黑客技术.url 62B
美味小吃技术.url 126B
撩妹套路(120G).url 195B
职业技能培训.url 61B
app
健康养生秘笈.url 133B
src
androidTest
java
com
wangjie
kotlinexample
健康养生秘笈.url 133B
主播培训.url 61B
ApplicationTest.java 356B
武术资料获取.url 125B
黑客技术.url 62B
美味小吃技术.url 126B
撩妹套路(120G).url 195B
职业技能培训.url 61B
main
健康养生秘笈.url 133B
主播培训.url 61B
武术资料获取.url 125B
res
mipmap-xxhdpi
ic_launcher.png 8KB
mipmap-hdpi
ic_launcher.png 3KB
健康养生秘笈.url 133B
主播培训.url 61B
武术资料获取.url 125B
menu
menu_main.xml 392B
mipmap-mdpi
ic_launcher.png 2KB
黑客技术.url 62B
mipmap-xhdpi
ic_launcher.png 5KB
美味小吃技术.url 126B
values-w820dp
dimens.xml 358B
values
dimens.xml 211B
strings.xml 183B
styles.xml 192B
layout
activity_main.xml 2KB
activity_inject.xml 673B
activity_network.xml 928B
撩妹套路(120G).url 195B
职业技能培训.url 61B
黑客技术.url 62B
kotlin
com.wangjie.kotlinexample
ui
inject
InjectWithAIActivity.kt 1KB
InjectWithKotlinActivity.kt 1KB
base
BaseActivity.kt 253B
BaseActivityExt.kt 151B
network
NetWorkExt.kt 2KB
NetWorkActivity.kt 3KB
main
MainActivity.kt 2KB
美味小吃技术.url 126B
撩妹套路(120G).url 195B
AndroidManifest.xml 1KB
职业技能培训.url 61B
武术资料获取.url 125B
proguard-rules.pro 667B
build.gradle 1KB
黑客技术.url 62B
.gitignore 7B
美味小吃技术.url 126B
撩妹套路(120G).url 195B
职业技能培训.url 61B
LICENSE 11KB
gradlew.bat 2KB
build.gradle 436B
gradlew 5KB
.gitignore 439B
README.md 2KB
共 66 条
- 1
资源评论
YG亲测源码屋
- 粉丝: 381
- 资源: 1605
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功