GithubHelp home page GithubHelp logo

hi-dhl / ktkit Goto Github PK

View Code? Open in Web Editor NEW
163.0 5.0 18.0 268 KB

KtKit 小巧而实用,用 Kotlin 语言编写的工具库(长期更新中)

Home Page: https://ktkit.hi-dhl.com

License: Apache License 2.0

Kotlin 99.76% Java 0.24%
kotlin activity fragment

ktkit's Issues

跟DataStore有冲突

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"

View.clickTrigger的BUG

1632640389(1)
圈中的代码只会在第一次调用View.clickTrigger时候生效,想要实现防抖要放到onEach里面

./gradlew spotlessApply 命令运行不了

现象

在执行 ./gradlew spotlessApply 这个命令的时候提示 Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

原因

估计是 .gitignore 文件中将 jar 包排除在版本管理外导致项目中根目录下的 gradle 目录中缺失了 gradle-wrapper.jar 而出现的运行错误

处理

拷了一份 gradle-wrapper.jar 到该目录下后运行成功,建议将它添加回去。

关于view的操作的bug

view.visible()
我看源码这里是返回一个VIew.VISIBLE,是一个Int类型,并不能改变view,这里应该是一个bug吧
应该写成
inline fun View.visible() {
setVisibility(View.VISIBLE)
}

关于扩展方法的注解和内联

我看了下大佬的代码,每个扩展都添加了 @kotlin.internal.InlineOnly 注解和 inline 关键字,能不能讲一下这么写的好处,我不太明白

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.