• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

VictorChow/kotlin-android-lib: Kotlin extensions for android.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

VictorChow/kotlin-android-lib

开源软件地址(OpenSource Url):

https://github.com/VictorChow/kotlin-android-lib

开源编程语言(OpenSource Language):

Kotlin 100.0%

开源软件介绍(OpenSource Introduction):

KotlinAndroidLib

一些Android开发的扩展。

[点这查看所有支持的扩展API(readmore)]

2.x - AndroidX

1.x - Android Support

Usage

//初始化
Ext.with(application)

Gradle

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
//依赖项
//org.jetbrains.kotlin:kotlin-stdlib-jdk7

2.x
dependencies {
    implementation 'com.github.VictorChow:kotlin-android-lib:2.0.0'
}

1.x
dependencies {
    implementation 'com.github.VictorChow:kotlin-android-lib:1.2.4'
}

Brief

ViewExt

//设置宽高
fun View.setWidth(value: Int)
fun View.setHeight(value: Int)
fun View.resize(width: Int, height: Int)
...

CommonExt

fun findColor(@ColorRes resId: Int) 
fun findDrawable(@DrawableRes resId: Int)
fun findColorStateList(@ColorRes resId: Int)
...

DisplayExt

val screenWidth: Int
val screenHeight: Int
val screenDensity: Float
...

DateTimeExt

fun Long.year()
fun Long.month()
fun Long.day()
...

StringExt

fun String.toast()
fun String.md5()
fun String.sha1()
...

ListenerExt

fun Animator.addListener {
    onStart { }
    onCancel { }
    onEnd { }
    onRepeat { }
}

fun Animator.addPauseListener {
    onPause { }
    onResume { }
}
...

ManagerExt

val connectivityManager
val alarmManager
val telephonyManager
val activityManager
...

SharedPreferencesExt

fun spSetInt(key: String, value: Int)
fun spGetInt(key: String, defaultValue: Int = 0)
...

BitmapExt

fun Bitmap.toBase64(): String
fun Bitmap.resize(w: Number, h: Number): Bitmap
...

FileExt

fun File.copy(dest: File)
fun File.copyDirectory(dest: File)
...

ToastExt

fun toast(msg: Any, isShort: Boolean = true) 

ActivityExt

fun Activity.goActivity<T>()
fun Activity.goActivity<T>(requestCode: Int)
...

FragmentExt (support.v4)

fun Fragment.goActivity<T>()
fun Fragment.goActivity<T>(requestCode: Int)
...

ActivityMgr

fun add(activity: Activity)
fun remove(activity: Activity)
fun removeAll()
...

ApiExt

fun aboveApi(api: Int, included: Boolean = false, block: () -> Unit)
fun belowApi(api: Int, included: Boolean = false, block: () -> Unit)

[点这查看所有支持的扩展API(readmore)]




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
SCD-Aix-Marseille-Universite/latexamu: classe LaTeX thèses AMU发布时间:2022-07-09
下一篇:
cortinico/kotlin-gradle-plugin-template: 发布时间:2022-07-07
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap