android_base_kotlin模块介绍

Author Avatar
夜孤黎 1月 10, 2018
  • 在其它设备中阅读本文章

android_base_kotlin模块中封装了一些基础的kotlin扩展方法,这里只列出部分,更多扩展方法及其具体实现请查看源码。

View.dip/Context.dip/Fragment.dip         : 大小转换
View.sp /Context.sp/Fragment.sp           : 大小转换
View.px2di/Context.px2dip/Fragment.px2dip : 大小转换
View.px2sp/Context.px2sp/Fragment.px2sp   : 大小转换
View.dimen/Context.dimen/Fragment.dimen   : 大小转换
Activity.find                             : findViewById
Fragment.find                             : findViewById
Dialog.find                               : findViewById
Boolean.yes                               : 当值为true时执行指定操作
Boolean.no                                : 当值为false时执行指定操作
Context.getRawResUri                      : 获取Raw目录下文件uri
Activity.showCustomAlertDialog            : 显示AlertDialog
<T : Fragment> T.withArguments            : 添加arguments
doFromSdk                                 : 高于指定SDK版本时执行指定操作
doIfSdk                                   : 等于指定SDK版本时执行指定操作
doBelowSdk                                : 低于指定SDK版本时执行指定操作

如何使用:

api 'com.sumavision.android_base_kotlin:android_base_kotlin:v1.x.x'

查看源码:

svn://192.165.152.13/sumard5/Project/Tetris/trunk/platform/android-platform/AndroidPlatform/android_base_kotlin

This blog is under a CC BY-NC-SA 3.0 Unported License
本文链接:http://yeguli.cn/2018/01/10/android-base-kotlin模块介绍/