Skip to content

add load() method for handle download progress percent #51

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

add load() method for handle download progress percent #51

wants to merge 6 commits into from

Conversation

youxiachai
Copy link

I think it useful when sometimes show downloading persent;
Example:
private Handler handler = new Handler(){

    @Override
    public void handleMessage(Message msg) {
        super.handleMessage(msg);
        tv.setText("" + msg.obj);
    }

};

aq.id(R.id.button1).clicked(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            String imageurl = "http://jpp2.imghb.com/pic/pic/52/60/24/1396053752602447_a602x602.jpg";

            aq.id(R.id.imageView1).load(new LoadListener() {

                @Override
                public void onLoadProgress(int current, float max) {
                    float present = (float) (max - current)/ max;
                    Log.d("api", "present"+ String.format("%.2f", (present * 100)));
                    Message msg = new Message();
                    msg.obj =  String.format("%.2f%%", (present * 100));
                    handler.sendMessage(msg);
                \
                }
            }).image(imageurl, false, false);

        }
    });

support acquire downloading progress count
handle loadlistener
set the downloadlistener in ajaxCallback
set bitmapAjaxCallback listen downloading percent
update bitmapAjaxCallback set the downloading listener
@Malachiasz
Copy link

you could give more meaningful topic name

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

Successfully merging this pull request may close these issues.

2 participants