Git Product home page Git Product logo

error-prone's People

Contributors

kkoshin avatar

Watchers

 avatar

error-prone's Issues

tint 后的颜色不符合预期

一般的着色是作用于小图标为了适应暗黑这类的主题切换,其中图标被理解为 dst
image

实现的时候确实按照着色模式了,但最终的效果还是有点偏差。

android 自定义的 theme 应该声明默认 windwowBackground

设置默认值的好处是,可以对大部分的页面布局不需要去声明颜色,减少一些工作量。

同时也是作为一种好的设计规范的一个组成。

如果想保留默认值的话,可以使用 ?android:colorBackground 这类的值

[兼容性问题] vector 嵌套使用时,未能正确展示

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true">
        <vector android:width="22dp" android:height="22dp" android:viewportWidth="22" android:viewportHeight="22">
            <path android:fillColor="@color/primary_button_bg_color" android:pathData="M11,11m-11,0a11,11 0,1 1,22 0a11,11 0,1 1,-22 0" android:strokeWidth="1" android:strokeColor="#00000000" />
            <path android:fillColor="#FFFFFF" android:pathData="M9.7929,13.3284L15.0355,8.0858C15.4261,7.6953 16.0592,7.6953 16.4497,8.0858C16.8403,8.4763 16.8403,9.1095 16.4497,9.5L10.7929,15.1569C10.7427,15.2071 10.6885,15.2508 10.6313,15.2881C10.594,15.3453 10.5502,15.3995 10.5,15.4497C10.1095,15.8403 9.4763,15.8403 9.0858,15.4497L5.5503,11.9142C5.1597,11.5237 5.1597,10.8905 5.5503,10.5C5.9408,10.1095 6.5739,10.1095 6.9645,10.5L9.7929,13.3284Z" android:strokeWidth="1" android:strokeColor="#00000000" />
        </vector>
    </item>
    <item android:state_checked="false">
        <vector android:width="22dp" android:height="22dp" android:viewportWidth="22" android:viewportHeight="22">
            <path android:fillColor="#00000000" android:pathData="M11,11m-10.5,0a10.5,10.5 0,1 1,21 0a10.5,10.5 0,1 1,-21 0" android:strokeWidth="1" android:strokeAlpha="0.1" android:strokeColor="#ff5800" />
        </vector>
    </item>
</selector>

在高版本上展示为,如下:
image

但在低版本上不展示未勾选

setOnCheckedChangeListener 被误触发

确切的说是非用户点击同样触发了回调。

主要的场景会出现在recyclerview复用的时候:

switch.setChecked(??) // #A
swtich.switch.setOnCheckedChangeListener { buttonView, isChecked ->  ...} // #B

#A 这一步会触发上次 #B 的回调。

为了避免这种情况,一般会在 setChecked 之前重置一下「setOnCheckedChangeListener(null)

除了这种方案,还有另外一种:

switch.setOnCheckedChangeListener { buttonView, isChecked ->
    when {        
        buttonView.isPressed -> {
            // 用户点击了触发,有个副作用的是,无障碍功能会受影响
        }
       else -> {
           // 不是用户点击触发的
       }
}

直接使用 Android 的 Log 类进行日志的打印

问题描述:
直接使用原生的 Log 类很容易将一些敏感的信息带到生产环境中

lint 级别:警告

解决方案:

  1. 推荐使用 Timber 这个库,或者自己按需要封装。
  2. 在混淆的时候进行删除对应的日志代码

依赖连接超时

反复检查了项目里的代理,没问题啊,关了啊。为什么老是连接超时。

发现为啥走的是 127.0.0.1:1080 的代理
Android Studio 里 Proxy 是用于 Studio 升级相关的,Gradle 的代理是读取 gradle.properties 的,我确认过好几遍,工程里的这个文件没有设置过。

解决方案:
实际上,除了读取工程里的 gradle.properties 之外,还会读取 ~/.gradle/gradle.properties ,也就是这个文件里设置了代理,所以导致一直走的代理。

App link verify failed

Is your feature request related to a problem? Please describe.

在完全按照官方文档接入的情况下,app认证依旧失败。在 Oneplus 8T (Android 12), Google pixel (Android 10) 都是一样的表现。

Describe the solution you'd like

这个属于网络问题,认证时需要访问一个谷歌的地址,这个在国内访问延迟很高,很可能会触发超时。
所以在国内的网络安装时会降级到 deep link。

Describe alternatives you've considered

可以考虑使用自定义 scheme 的方式来处理 app 的链接,这样一般能避免询问框的出现。

Additional context

App link 在不同版本上的表现会有所不同。
在 Android 12 上,一旦认证通过,这个链接将始终由这个 app 打开。而在之前的版本里是默认使用这个app打开,依旧允许用户修改这个选项。

Too many dex class generated

打出来的包里的dex已经达到 119 了,每个 dex 都及其小。
项目最低支持到 18(4.x),multiDex 的配置问题。

image

解决方案:

  • 要不把最低版本提高至21
  • 修改 dexOptions:
    dexOptions {
            preDexLibraries = false
      	  // ...
    }          
    

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.