android-file-chooser icon indicating copy to clipboard operation
android-file-chooser copied to clipboard

select multiple

Open pateljigar7210 opened this issue 5 years ago • 1 comments

pateljigar7210 avatar Nov 26 '19 06:11 pateljigar7210

ArrayList <String> paths = new ArrayList<>();

    new ChooserDialog(getActivity())
            .withStartFile(Environment.getExternalStorageDirectory().getAbsolutePath().toString())
            .enableMultiple(true)

            .withChosenListener(new ChooserDialog.Result() {
                @Override
                public void onChoosePath(String path, File pathFile) {
                    if("/storage/emulated/0".equals(path)){
                        LogClass.e("FILEs", "list : "+paths);
                    }else {
                        if(paths.contains(path)){
                            paths.remove(path);
                        }else {
                            paths.add(path);
                        } 
                    }
                }
            })
            // to handle the back key pressed or clicked outside the dialog:
            .withOnCancelListener(new DialogInterface.OnCancelListener() {
                public void onCancel(DialogInterface dialog) {
                    LogClass.e("CANCEL", "CANCEL");
                    dialog.cancel(); // MUST have
                }
            })
            .withResources(R.string.title_choose_any_file, R.string.title_choose, R.string.dialog_cancel)
            .withStringResources("Title", "OK", "Cancel")
            .build()
            .show();

pateljigar7210 avatar Nov 26 '19 06:11 pateljigar7210