Skip to content
AndroidExtension use kotlin provide useful and smooth extexsions for android developer.
Kotlin Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
gradle/wrapper
library
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

This library is not released formally.

AndroidExtension

AndroidExtension try to provide useful and smooth extensions in kotlin for android developer.

Kotlin Version

As kotlin may have big changes in different version, we will try to adapt the latest version as soon as possible. The library is compatible with latest Kotlin 1.0.0.

Reference

repositories {
    jcenter()
}

compile 'com.ohmerhe.kotlinthree:andex:0.1.6'

Usage

Get Resource

in activity/fragment provide methods to call as list:

getDrawable(R.drawable.ic_launcher)

getColor(R.color.red)

Find View

in activity/fragment/view provide methods to call as list:

val imageView: ImageView = findView(R.id.image_view)

val imageView = findView<ImageView>(R.id.image_view)

findViewOften replace ViewHolder when find view frequently in adapter.

 val textView: TextView = viewItem.findViewOften(R.id.text_view)

Toast

in activity/service/fragment provide methods to call as list:

toast(R.String.toast) 

toast("toast") 

// toastView is custom view
toastView(toastView) 

这个库还没有正式发布

#AndroidExtension

AndroidExtension用kotlin为安卓开发者提供的扩展库,让安卓开发变得更简单。

Kotlin版本

由于kotlin版本更新比较快,我们会尽力让我们的库跟上最新的版本,目前为止我们用最新的kotlin版本1.0.0。

项目依赖

repositories {
    jcenter()
}

compile 'com.ohmerhe.kotlinthree:andex:0.1.3@aar'

使用方法

Resource

activity/fragment提供这样的方法可以调用:

getDrawable(R.drawable.ic_launcher)

getColor(R.color.red)

Find View

activity/fragment/view提供这样的方法可以调用:

val imageView: ImageView = findView(R.id.image_view)

val imageView = findView<ImageView>(R.id.image_view)

使用findViewOften,再也不用在adapter中繁琐的定义ViewHolder

 val textView: TextView = viewItem.findViewOften(R.id.text_view)

Toast

activity/fragment/view提供这样的方法可以调用:

toast(R.String.toast) 

toast("toast")

// toastView是你自定义的视图
toastView(toastView) 

#License

Copyright 2015 KotlinThree

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.