Exemplo n.º 1
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    Log.i(TAG, "onActivityCreated()");

    settings = Settings.getInstance();
    isBiggestFiles = getArguments().getBoolean(Constants.IS_BIGGEST_FILES);
  }
Exemplo n.º 2
0
 public FileListFragment(Context context, List<FileInformation> hogFiles) {
   this.context = context;
   this.hogFiles = hogFiles;
   settings = Settings.getInstance();
 }
Exemplo n.º 3
0
        @Override
        public void onClick(DialogInterface dialog, int which) {

          switch (which) {
            case DialogInterface.BUTTON_POSITIVE:
              // Delete
              AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
              builder.setIcon(android.R.drawable.ic_dialog_alert);
              builder.setTitle("Delete File");
              builder.setMessage("Are you sure?");
              builder.setPositiveButton("Yes", dialogClickListener_YesOrNo);
              builder.setNegativeButton("No", dialogClickListener_YesOrNo).show();
              break;
            case DialogInterface.BUTTON_NEGATIVE:
              // Copy
              builder = null;
              ClipboardManager clipboard =
                  (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
              File file =
                  new File(clickedFile.getFolder() + File.separator + clickedFile.getName());
              Uri uri = Uri.fromFile(file);
              ClipData clip = ClipData.newUri(context.getContentResolver(), "URI", uri);
              clipboard.setPrimaryClip(clip);
              Toast.makeText(
                      context.getApplicationContext(),
                      "File copied to clipboard",
                      Toast.LENGTH_SHORT)
                  .show();
              break;
            case DialogInterface.BUTTON_NEUTRAL:
              // Exclude File
              Log.i(TAG, clickedFile.getFolder() + " added to excludedHogFiles");
              switch (settings.getSelectedSearchDirectory()) {
                case Settings.EXTERNAL_DIRECTORY:
                  if (isBiggestFiles) {
                    settings.getBiggestExternalExcludedHogFiles().add(clickedFile);
                    List<FileInformation> updatedHogFiles =
                        removeExcludedFromHogFiles(settings.getBiggestExternalExcludedHogFiles());
                    fileInformationAdapter.setFileInformations(updatedHogFiles);
                  } else {
                    settings.getSmallestExternalExcludedHogFiles().add(clickedFile);
                    List<FileInformation> updatedHogFiles =
                        removeExcludedFromHogFiles(settings.getSmallestExternalExcludedHogFiles());
                    fileInformationAdapter.setFileInformations(updatedHogFiles);
                  }
                  break;
                case Settings.ROOT_DIRECTORY:
                  if (isBiggestFiles) {
                    settings.getBiggestRootExcludedHogFiles().add(clickedFile);
                    List<FileInformation> updatedHogFiles =
                        removeExcludedFromHogFiles(settings.getBiggestRootExcludedHogFiles());
                    fileInformationAdapter.setFileInformations(updatedHogFiles);
                  } else {
                    settings.getSmallestRootExcludedHogFiles().add(clickedFile);
                    List<FileInformation> updatedHogFiles =
                        removeExcludedFromHogFiles(settings.getSmallestRootExcludedHogFiles());
                    fileInformationAdapter.setFileInformations(updatedHogFiles);
                  }
                  break;
              }
              break;
          }
        }