Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

作者是否可以将DateTimePicker改为open class呢? #82

Closed
liyuhaolol opened this issue Apr 19, 2023 · 3 comments
Closed

作者是否可以将DateTimePicker改为open class呢? #82

liyuhaolol opened this issue Apr 19, 2023 · 3 comments

Comments

@liyuhaolol
Copy link

liyuhaolol commented Apr 19, 2023

因为class类在kotlin里被视为final类型,我们这边不能再次继承这个类,进行我们自己的修改了,反而NumberPicker就是一个public class的类,我们就能继承。如果想要继承DateTimePicker,我们还要下载源码,导入到项目里,自己加open,这样未免也太不友好了,希望作者可以改一下,kotlin全都加open,这样让我们使用起来容易一点。

@liyuhaolol
Copy link
Author

  • 对了额外提一个建议,比如NumberPicker里的setSelectedTextColor,setDividerColor此类的方法,如果Picker已经被显示,调用这两个方法,颜色不会被立刻重绘,需要在方法最后加入invalidate();让View立刻进行重绘。范例:
    public void setSelectedTextColor(@ColorInt int color) {
        mSelectedTextColor = color;
        mSelectedText.setTextColor(mSelectedTextColor);
        invalidate();//加在这里让View重绘
    }
  • 具体的需求场景,当Picker正在显示的时候,发生了手机的深浅色(颜色)切换,App跟随系统变换时,Picker无法进行预计的颜色变换,因为Picker已经被绘制,但是调用的方法没有调用invalidate();强制让View进行重绘导致的。所以推荐作者能将此类方法都加入invalidate();来进行View的重绘。
  • 目前因为上述提到的这些问题,所以只能调用作者源码进行使用,相对麻烦一点。如果作者能完善此类问题,以后直接通过jitpack依赖,会让代码少很多,也容易一些。

@loper7
Copy link
Owner

loper7 commented Apr 20, 2023

👍非常棒的建议,如果方便可以直接fork然后提pr😊

@loper7
Copy link
Owner

loper7 commented May 11, 2023

已处理

@loper7 loper7 closed this as completed May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants