androidutilcode使用_AndroidUtilCodeKTX !是时候提升你的开发效率了 !(持续更新中...)...

AndroidUtilCodeKTX ! 专注提升 Android 开发效率 !

该类库利用 Kotlin 语言特性合理封装了 Android 开发中的常用操作,同时也收集了开发过程中的常用工具类。

旨在做同样的事情,写最少的代码,提升开发效率。

Use

implementation 'luyao.util.ktx:AndroidUtilKTX:0.0.5'

最新版本将第一时间用在我的另外两个开源项目,wanandroid 和 Box,欢迎关注 !

APIS (keep updating...)

FragmentActivity.request(vararg permissions: String, callbacks: PermissionsCallbackDSL.() -> Unit)

Context.versionName: String

Context.versionCode: Long

Context.getAppInfo(apkPath: String): AppInfo

Context.getAppInfos(apkFolderPath: String): List

Context.getAppSignature(packageName: String = this.packageName): ByteArray?

Context.dp2px(dp: Float): Int

Context.px2dp(px: Float): Int

View.dp2px(dp: Float): Int

View.px2dp(px: Float): Int

Context.screenWidth

Context.screenHeight

Context.copyToClipboard(label: String, text: String)

ByteArray.hash(algorithm: Hash): String

String.hash(algorithm: Hash, charset: Charset = Charset.forName("utf-8")): String

ByteArray.md5Bytes(): ByteArray

ByteArray.md5(): String

String.md5(charset: Charset = Charset.forName("utf-8")): String

ByteArray.sha1Bytes(): ByteArray

ByteArray.sha1(): String

String.sha1(charset: Charset = Charset.forName("utf-8")): String

ByteArray.sha224Bytes(): ByteArray

ByteArray.sha224(): String

String.sha224(charset: Charset = Charset.forName("utf-8")): String

ByteArray.sha256Bytes(): ByteArray

ByteArray.sha256(): String

String.sha256(charset: Charset = Charset.forName("utf-8")): String

ByteArray.sha384Bytes(): ByteArray

ByteArray.sha384(): String

String.sha384(charset: Charset = Charset.forName("utf-8")): String

ByteArray.sha512Bytes(): ByteArray

ByteArray.sha512(): String

String.sha512(charset: Charset = Charset.forName("utf-8")): String

File.hash(algorithm: Hash = Hash.SHA1): String

ByteArray.aesEncrypt(key: ByteArray, iv: ByteArray, cipherAlgotirhm: String = AES_CFB_NOPADDING): ByteArray

ByteArray.aesDecrypt(key: ByteArray, iv: ByteArray, cipherAlgotirhm: String = AES_CFB_NOPADDING): ByteArray

File.aesEncrypt(key: ByteArray, iv: ByteArray, destFilePath: String): File?

File.aesDecrypt(key: ByteArray, iv: ByteArray, destFilePath: String): File?

Context.getAppInfoIntent(packageName: String = this.packageName): Intent

Context.goToAppInfoPage(packageName: String = this.packageName)

Context.getDateAndTimeIntent(): Intent

Context.goToDateAndTimePage()

Context.getLanguageIntent()

Context.goToLanguagePage()

Context.getInstallIntent(apkFile: File): Intent?

Context.goToAccessibilitySetting()

Context.installApk(apkFile: File)

Context.openBrowser(url: String)

Context.openInAppStore(packageName: String = this.packageName)

Context.openApp(packageName: String)

Context.uninstallApp(packageName: String)

String.logv(tag: String = TAG)

String.logd(tag: String = TAG)

String.logi(tag: String = TAG)

String.logw(tag: String = TAG)

String.loge(tag: String = TAG)

Context.toast(content: String, duration: Int = Toast.LENGTH_SHORT)

Context.toast(@StringRes id: Int, duration: Int = Toast.LENGTH_SHORT)

Context.longToast(content: String)

Context.longToast(@StringRes id: Int)

Any.toast(context: Context, content: String, duration: Int = Toast.LENGTH_SHORT)

Any.toast(context: Context, @StringRes id: Int, duration: Int=Toast.LENGTH_SHORT)

Any.longToast(context: Context, content: String)

Any.longToast(context: Context, @StringRes id: Int)

fun Context.putSpValue(key: String, value: T, name: String = packageName)

fun Activity.putSpValue(key: String, value: T, name: String = packageName)

fun Context.getSpValue(key: String, default: T, name: String = packageName ): T

fun Activity.getSpValue(key: String, default: T, name: String = packageName): T

val Context.windowManager

val Context.clipboardManager

val Context.layoutInflater

val Context.activityManager

val Context.powerManager

val Context.alarmManager

val Context.notificationManager

val Context.keyguardManager

val Context.locationManager

val Context.searchManager

val Context.storageManager

val Context.vibrator

val Context.connectivityManager

val Context.wifiManager

val Context.audioManager

val Context.mediaRouter

val Context.telephonyManager

val Context.sensorManager

val Context.subscriptionManager

val Context.carrierConfigManager

val Context.inputMethodManager

val Context.uiModeManager

val Context.downloadManager

val Context.batteryManager

val Context.jobScheduler

ByteArray.toHexString() : 字节数组转十六进制字符串

View.visible()

View.invisible()

View.gone()

var View.isVisible: Boolean

var View.isInvisible: Boolean

var View.isGone: Boolean

View.setPadding(@Px size: Int)

View.postDelayed(delayInMillis: Long, crossinline action: () -> Unit): Runnable

View.toBitmap(config: Bitmap.Config = Bitmap.Config.ARGB_8888): Bitmap

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值