private NotificationCompat.Builder setNotification(final long id) {

    DownloadInfoRunnable info = getDownload(id);

    final NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);

    // TODO
    Intent onClick = new Intent();
    onClick.setClassName(
        getPackageName(), /*Aptoide.getConfiguration().*/ getStartActivityClass().getName());
    onClick.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
    onClick.setAction(Intent.ACTION_VIEW);
    onClick.putExtra("fromDownloadNotification", true);

    // The PendingIntent to launch our activity if the user selects this notification
    PendingIntent onClickAction =
        PendingIntent.getActivity(
            getApplicationContext(), 0, onClick, PendingIntent.FLAG_UPDATE_CURRENT);

    int size = DownloadUtils.dpToPixels(getApplicationContext(), 36);

    Bitmap icon = null;

    try {
      // icon =
      // DownloadUtils.decodeSampledBitmapFromResource(ImageLoader.getInstance().getDiscCache().get(info.getDownload().getIcon()).getAbsolutePath(), size, size);
      icon =
          GlideUtils.downloadOnlyFromCache(
              Aptoide.getContext(), info.getDownload().getIcon(), size, size);
    } catch (Exception e) {
      e.printStackTrace();
    }

    mBuilder.setOngoing(true);
    mBuilder.setContentTitle(
        getString(R.string.aptoide_downloading, Aptoide.getConfiguration().getMarketName()));
    mBuilder.setContentText(info.getDownload().getName());
    if (icon != null) mBuilder.setLargeIcon(icon);
    mBuilder.setSmallIcon(android.R.drawable.stat_sys_download);
    mBuilder.setProgress(0, 0, true);
    mBuilder.setContentIntent(onClickAction);
    // Log.d("download-trace", "ETA: " + info.getEta());
    if (info.getEta() > 0) {
      String remaining = DownloadUtils.formatEta(info.getEta(), "");
      mBuilder.setContentInfo("ETA: " + (!remaining.equals("") ? remaining : "0s"));
    }

    return mBuilder;
  }
  private void permissionsDialog(final FinishedApk viewApk, ArrayList<ApkPermission> permissions) {

    View v = LayoutInflater.from(context).inflate(R.layout.app_permission, null);
    LinearLayout layout = (LinearLayout) v.findViewById(R.id.container);

    if (permissions != null) {

      if (!permissions.isEmpty()) {
        for (int i = 0; i < permissions.size(); i++) {
          ApkPermission permission = permissions.get(i);

          View permissionView = LayoutInflater.from(context).inflate(R.layout.row_permission, null);
          if (i == 0 || !permissions.get(i - 1).getName().equals(permission.getName())) {
            ((TextView) permissionView.findViewById(R.id.permission_name))
                .setText(permission.getName());
          } else {
            permissionView.findViewById(R.id.permission_name).setVisibility(View.GONE);
          }
          ((TextView) permissionView.findViewById(R.id.permission_description))
              .setText(permission.getDescription());
          layout.addView(permissionView);
        }
      } else {
        TextView tv = new TextView(context);
        tv.setPadding(10, 10, 10, 10);
        tv.setText(context.getString(R.string.no_permissions_required));
        layout.addView(tv);
      }
    }

    final AlertDialog dialog = new AlertDialog.Builder(context).setView(v).create();
    dialog.setTitle(context.getString(R.string.restore) + " " + viewApk.getName() + "?");
    // dialog.setIcon(BitmapDrawable.createFromPath(ImageLoader.getInstance().getDiscCache().get(path).getAbsolutePath()));

    dialog.setButton(
        DialogInterface.BUTTON_POSITIVE,
        context.getString(android.R.string.yes),
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            executor.submit(
                new Runnable() {
                  @Override
                  public void run() {
                    DownloadUtils.installWithRoot(viewApk);
                  }
                });
            finish();
          }
        });

    dialog.setButton(
        DialogInterface.BUTTON_NEGATIVE,
        context.getString(android.R.string.no),
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
          }
        });
    dialog.setOnDismissListener(
        new DialogInterface.OnDismissListener() {
          @Override
          public void onDismiss(DialogInterface dialog) {
            finish();
          }
        });
    dialog.setCancelable(false);
    // dialog.show();

    String path = viewApk.getIconPath();
    GlideUtils.showDialogWithGlideLoadingIconFromCache(dialog, path, this);
  }