@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings_special_list);
    Bundle b = getArguments();
    if (b != null) {
      Log.d(TAG, "id= " + getArguments().getInt("id"));
      final SpecialList specialList = SpecialList.getSpecialList(getArguments().getInt("id") * -1);
      ((SpecialListsSettingsActivity) getActivity()).setSpecialList(specialList);

      ActionBar actionbar = getActivity().getActionBar();
      if (specialList == null) actionbar.setTitle("No list");
      else actionbar.setTitle(specialList.getName());
      if (!MirakelCommonPreferences.isTablet()) {
        ImageButton delList = new ImageButton(getActivity());
        delList.setBackgroundResource(android.R.drawable.ic_menu_delete);
        actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM);
        actionbar.setCustomView(
            delList,
            new ActionBar.LayoutParams(
                LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT,
                Gravity.CENTER_VERTICAL | DefinitionsHelper.GRAVITY_RIGHT));
        delList.setOnClickListener(((ListSettings) getActivity()).getDelOnClickListener());
      }
      try {
        new SpecialListSettings(this, specialList).setup();
      } catch (NoSuchListException e) {
        getActivity().finish();
      }
    } else {
      Log.d(TAG, "bundle null");
    }
  }
  public static boolean handleActivityResult(
      final int requestCode,
      final int resultCode,
      final @NonNull Intent data,
      final @NonNull Context ctx) {
    final FileInputStream stream;
    switch (requestCode) {
      case SettingsActivity.FILE_IMPORT_DB:
        if (resultCode != Activity.RESULT_OK) {
          return false;
        }
        final Uri uri = data.getData();
        if (uri == null || !"db".equals(FileUtils.getFileExtension(uri))) {
          ErrorReporter.report(ErrorType.FILE_NOT_MIRAKEL_DB);
        }
        try {
          stream = FileUtils.getStreamFromUri(ctx, uri);
        } catch (final FileNotFoundException ignored) {
          ErrorReporter.report(ErrorType.FILE_NOT_MIRAKEL_DB);
          break;
        }
        new AlertDialogWrapper.Builder(ctx)
            .setTitle(R.string.import_sure)
            .setMessage(
                ctx.getString(R.string.import_sure_summary, FileUtils.getNameFromUri(ctx, uri)))
            .setNegativeButton(android.R.string.cancel, null)
            .setPositiveButton(
                android.R.string.yes,
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(final DialogInterface dialog, final int which) {
                    ExportImport.importDB(ctx, stream);
                  }
                })
            .create()
            .show();
        break;
      case SettingsActivity.FILE_ASTRID:
      case SettingsActivity.FILE_ANY_DO:
      case SettingsActivity.FILE_WUNDERLIST:
        if (resultCode != Activity.RESULT_OK) {
          return true;
        }
        try {
          stream = FileUtils.getStreamFromUri(ctx, data.getData());
        } catch (final FileNotFoundException e) {
          ErrorReporter.report(ErrorType.FILE_NOT_FOUND);
          break;
        }
        // Do the import in a background-task
        new AsyncTask<String, Void, Boolean>() {
          ProgressDialog dialog;

          @Override
          protected Boolean doInBackground(final String... params) {
            switch (requestCode) {
              case SettingsActivity.FILE_ASTRID:
                return ExportImport.importAstrid(
                    ctx, stream, FileUtils.getMimeType(data.getData()));
              case SettingsActivity.FILE_ANY_DO:
                try {
                  return AnyDoImport.exec(ctx, stream);
                } catch (final DefinitionsHelper.NoSuchListException e) {
                  ErrorReporter.report(ErrorType.LIST_VANISHED);
                  Log.wtf(TAG, "list vanished", e);
                  return true;
                }
              case SettingsActivity.FILE_WUNDERLIST:
                return WunderlistImport.exec(stream);
              default:
                return false;
            }
          }

          @Override
          protected void onPostExecute(final Boolean result) {
            this.dialog.dismiss();
            if (!result) {
              ErrorReporter.report(ErrorType.ASTRID_ERROR);
            } else {
              Toast.makeText(ctx, R.string.astrid_success, Toast.LENGTH_SHORT).show();
              // ugly but simple
              Helpers.restartApp(ctx);
            }
          }

          @Override
          protected void onPreExecute() {
            this.dialog =
                ProgressDialog.show(
                    ctx, ctx.getString(R.string.importing), ctx.getString(R.string.wait), true);
          }
        }.execute("");
        break;
      case SettingsActivity.DONATE:
        if (resultCode != Activity.RESULT_OK) {
          return false;
        }
        if (!MirakelCommonPreferences.isTablet()) {
          return true;
        }
        break;
      default:
        break;
    }
    return false;
  }