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

颜色,状态监听的一些反馈。 #1

Open
DarkSherlock opened this issue Sep 28, 2017 · 0 comments
Open

颜色,状态监听的一些反馈。 #1

DarkSherlock opened this issue Sep 28, 2017 · 0 comments

Comments

@DarkSherlock
Copy link

/**
* 开始
*/
public void beginStarting(){
initStateData();
......//省略
va.addListener(new Animator.AnimatorListener() {
@OverRide
public void onAnimationStart(Animator animation) {
}
@OverRide
public void onAnimationEnd(Animator animation) {
state = STATE_READY_CHANGEING;
mBgPaint.setStyle(Paint.Style.STROKE);
mBgPaint.setColor(Color.BLACK); //这里应该设置mBgPaint.setColor(progressBarBgColor);不然设置的进度条背景颜色 无效。
changeStateReadyChanging();
}
......//省略
}

另外因为你加载完成和加载错误的状态下
ls.setOntextChangeListener(new SpecialProgressBarView.OntextChangeListener() {
@OverRide
public String onProgressTextChange(SpecialProgressBarView specialProgressBarView, int max, int progress) {
return progress * 100 / max + "%";
}

        @Override
        public String onErrorTextChange(SpecialProgressBarView specialProgressBarView, int max, int progress) {
            return "error";
        }

        @Override
        public String onSuccessTextChange(SpecialProgressBarView specialProgressBarView, int max, int progress) {
            return "done";
        }
    });

这里的监听,后面还有一些后续动画,这样使用的时候并不能知道你什么时候动画结束(比如我把你定义的这个进度条view放在dialog中展示,我希望加载完毕后展示动画后就关闭这个dialog,而你目前的这个监听还不行,因为还有后续的一些动画,所以并不能在你现在这个onSuccessTextChange()就关闭dialog),也就是你这里的监听不够准确。
所以我建议,在
private void changeStateBackHome() {
state = STATE_BACK_HOME;
......
@OverRide
public void onAnimationEnd(Animator animation) {
//将设置的临时变量设置回去
isCanEndSuccessClickable = isTempCanEndSuccessClickable;
postDelayed(new Runnable() {
@OverRide
public void run() {
state = DONE;
**mStateChangedAnimationEndListener.onSuccessAnimationEnd();**在这里,加载完毕动画执行完毕后再加上一个 新的监听。
}
}, 50);
}
同样的Error的时候也应该在动画执行完毕后 再加个监听

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

1 participant