hi-dhl / ktkit Goto Github PK
View Code? Open in Web Editor NEWKtKit 小巧而实用,用 Kotlin 语言编写的工具库(长期更新中)
Home Page: https://ktkit.hi-dhl.com
License: Apache License 2.0
KtKit 小巧而实用,用 Kotlin 语言编写的工具库(长期更新中)
Home Page: https://ktkit.hi-dhl.com
License: Apache License 2.0
app.gradle
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'androidx.navigation.safeargs.kotlin'
id 'kotlin-parcelize'
id "com.google.protobuf" version "0.8.12"
}
//DataStore
implementation "androidx.datastore:datastore:1.0.0"
implementation "androidx.datastore:datastore-preferences:1.0.0"
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.14.0"
}
// Generates the java Protobuf-lite code for the Protobufs in this project. See
// https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
// for more information.
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option 'lite'
}
}
}
}
}
user_info.proto
syntax = "proto3";
option java_package = "com.signcc.adoperations.datastore";
option java_multiple_files = true;
message UserInfo {
string realName = 1;
string se = 2;
string nickname = 3;
string userMobile = 4;
string userName = 5;
string userId = 6;
int32 userStatus = 7;
}
然后添加依赖就会导致编译失败
def ktkitVersion = "1.0.2"
implementation "com.hi-dhl:ktkit:$ktkitVersion"
with(Intent(context, targetClass)) {
params().forEach {
makeParams(it)
}
this
}
就简单两个问题:
String是继承CharSequence
在执行 ./gradlew spotlessApply
这个命令的时候提示 Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
估计是 .gitignore 文件中将 jar 包排除在版本管理外导致项目中根目录下的 gradle 目录中缺失了 gradle-wrapper.jar
而出现的运行错误
拷了一份 gradle-wrapper.jar
到该目录下后运行成功,建议将它添加回去。
view.visible()
我看源码这里是返回一个VIew.VISIBLE,是一个Int类型,并不能改变view,这里应该是一个bug吧
应该写成
inline fun View.visible() {
setVisibility(View.VISIBLE)
}
我看了下大佬的代码,每个扩展都添加了 @kotlin.internal.InlineOnly
注解和 inline
关键字,能不能讲一下这么写的好处,我不太明白
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.