private void init() {
    Rect rect = new Rect();
    Window window = ((Activity) context).getWindow();
    window.getDecorView().getWindowVisibleDisplayFrame(rect);

    LayoutInflater layoutInflater = LayoutInflater.from(context);
    layout = layoutInflater.inflate(R.layout.dialog_confirm_delete_task, null);

    layout.setMinimumWidth((int) (rect.width() * 1f));

    txtContent = (TextView) layout.findViewById(R.id.tvContent);
    txtTitle = (TextView) layout.findViewById(R.id.title_actionbar);

    imgBack = (ImageView) layout.findViewById(R.id.back);

    btnCancel = (Button) layout.findViewById(R.id.btnCancel);
    btnDelete = (Button) layout.findViewById(R.id.btnDelete);

    progressDialog = new ProgressDialog(context);

    txtTitle.setText(context.getResources().getString(R.string.confirm_delete));
    txtContent.setText(
        Html.fromHtml(
            context.getString(R.string.content_dialog_delete_task)
                + "<font color=\"#ff0000\">"
                + task.getTen_cong_viec()
                + "</font>"));
    imgBack.setOnClickListener(this);
    btnDelete.setOnClickListener(this);
    btnCancel.setOnClickListener(this);
    progressDialog.setMessage(context.getString(R.string.waiting));
  }
  // display lisview
  public void displayLisview() {
    // set adapter
    task = new Task(context);
    arrTask = new ArrayList<Task>();
    arrTask =
        task.getData(
            context,
            context.getString(R.string.api_get_task),
            new Task.OnLoadListener() {

              @Override
              public void onStart() {
                loading.setVisibility(View.VISIBLE);
                connectError.setVisibility(View.GONE);
              }

              @Override
              public void onSuccess() {
                loading.setVisibility(View.GONE);
                adapter.notifyDataSetChanged();
                if (adapter.getCount() <= 0) {
                  listTask.setEmptyView(emptyView);
                }
              }

              @Override
              public void onFalse() {
                loading.setVisibility(View.GONE);
                connectError.setVisibility(View.VISIBLE);
              }
            });
    adapter = new TaskAdapter(context, arrTask, 3);
    listTask.setAdapter(adapter);
  }
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.back:
        alertDialog.dismiss();
        break;
      case R.id.btnDelete:
        alertDialog.dismiss();
        task.deleteTaskById(
            context.getString(R.string.api_xoacongviec),
            task.getId(),
            new OnLoadListener() {

              @Override
              public void onSuccess() {
                AssignedTaskActivity.displayLisview();
                progressDialog.dismiss();
                Toast.makeText(context, context.getString(R.string.success), Toast.LENGTH_SHORT)
                    .show();
              }

              @Override
              public void onStart() {
                Log.d("NgaDV", "onstart");
                progressDialog.show();
              }

              @Override
              public void onFalse() {
                Log.d("NgaDV", "onfalse");
                progressDialog.dismiss();
                Toast.makeText(
                        context, context.getString(R.string.error_occured), Toast.LENGTH_SHORT)
                    .show();
              }
            });
        break;
      case R.id.btnCancel:
        alertDialog.dismiss();
        break;
      default:
        break;
    }
  }
  @Override
  public void onClick(View v) {
    int id = v.getId();
    switch (id) {
      case R.id.back:
        finish();
        break;
      case R.id.search:
        showSearchView();
        break;
      case R.id.close:
        closeSearchView();
        break;
      case R.id.empty:
        editSearch.setText("");
        break;
      case R.id.btnAssignNew:
        Intent intent = new Intent(OtherTaskActivity.this, AssignTaskActivity.class);
        startActivity(intent);
        break;
      case R.id.retry:
        adapter.setData(
            task.getData(
                OtherTaskActivity.this,
                getResources().getString(R.string.api_get_task),
                new Task.OnLoadListener() {

                  @Override
                  public void onStart() {
                    loading.setVisibility(View.VISIBLE);
                    connectError.setVisibility(View.GONE);
                  }

                  @Override
                  public void onSuccess() {
                    loading.setVisibility(View.GONE);
                    adapter.notifyDataSetChanged();
                    if (adapter.getCount() <= 0) {
                      listTask.setEmptyView(emptyView);
                    }
                  }

                  @Override
                  public void onFalse() {
                    loading.setVisibility(View.GONE);
                    connectError.setVisibility(View.VISIBLE);
                  }
                }));
        break;
    }
  }