Search in sources :

Example 1 with DownloadCallback

use of huyifei.mymvp.architecture.common.DownloadCallback in project My-MVP by REBOOTERS.

the class MVCActivity method init.

private void init() {
    // view init
    mImageView = (ImageView) findViewById(R.id.image);
    progressDialog = new ProgressDialog(mContext);
    progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancle", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            progressDialog.dismiss();
        }
    });
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.setTitle("下载文件");
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    // click-event
    findViewById(R.id.downloadBtn).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            progressDialog.show();
            HttpUtil.HttpGet(Constants.DOWNLOAD_URL, new DownloadCallback(mHandler));
        }
    });
    findViewById(R.id.downloadBtn1).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            progressDialog.show();
            HttpUtil.HttpGet(Constants.DOWNLOAD_ERROR_URL, new DownloadCallback(mHandler));
        }
    });
    Looper mLooper = getMainLooper();
    Thread mThread = mLooper.getThread();
    String threadName = mThread.getName();
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
        MessageQueue mMessageQueue = mLooper.getQueue();
    }
    Log.e(TAG, "threadName: " + threadName);
}
Also used : Looper(android.os.Looper) MessageQueue(android.os.MessageQueue) DialogInterface(android.content.DialogInterface) DownloadCallback(huyifei.mymvp.architecture.common.DownloadCallback) ProgressDialog(android.app.ProgressDialog) ImageView(android.widget.ImageView) View(android.view.View)

Aggregations

ProgressDialog (android.app.ProgressDialog)1 DialogInterface (android.content.DialogInterface)1 Looper (android.os.Looper)1 MessageQueue (android.os.MessageQueue)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 DownloadCallback (huyifei.mymvp.architecture.common.DownloadCallback)1