Giter VIP home page Giter VIP logo

broccoli's People

Contributors

samlss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

broccoli's Issues

一点建议

使用发现框架是设置背景颜色,如果View没有设置宽高,则无法显示。
如果需要对View新增默认配置,对项目侵入较大。
建议增加一些params 来配置显示的宽高,若没有设置则使用控件的宽高。

发现一个关于TextView背景的bug

android:background="@color/colorAccent"
android:id="@+id/testview"

TextView 在xml文件里面设置了背景颜色(一个粉色),

broccoli.addPlaceholders(this, R.id.testview);
broccoli.show();
Activity里面设置背景,此时TextView背景色变成了框架内默认的 #dddddd。

但在调用broccoli.removeAllPlaceholders()后,TextView的背景颜色还是 默认的#dddddd。

查看源码发现,
placeholderPreStateSaver.setRestoredBackgroundDrawable(textView.getBackground());
存储的是textView原Drawable对象,
随后调用
if (parameter.getColor() != 0){
view.setBackgroundColor(parameter.getColor());
return;
}

@RemotableViewMethod
public void setBackgroundColor(@ColorInt int color) {
if (mBackground instanceof ColorDrawable) {
((ColorDrawable) mBackground.mutate()).setColor(color);
computeOpaqueFlags();
mBackgroundResource = 0;
} else {
setBackground(new ColorDrawable(color));
}
}
发现把颜色设置给了textView原Drawable对象,导致被存储的原Drawable颜色被改变,
所以broccoli.removeAllPlaceholders()恢复的颜色是默认的#dddddd,

使用如下方式生成一个新Drawable对象,则不会对原Drawable对象造成影响,
broccoli.addPlaceholder(new PlaceholderParameter.Builder()
.setView(findViewById(R.id.testview))
.setDrawable(new ColorDrawable(Color.parseColor("#dddddd")))
.build());

可能还有其他地方也会有同样问题(直接储存原对象,设置原对象),希望作者在README声明一下,或者更新解决下这个问题。

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.