com.nononsenseapps.filepicker.FilePickerActivity Java Examples
The following examples show how to use
com.nononsenseapps.filepicker.FilePickerActivity.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppsListFragment.java From J2ME-Loader with Apache License 2.0 | 6 votes |
@Override public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); registerForContextMenu(getListView()); setHasOptionsMenu(true); setListAdapter(adapter); initDb(); FloatingActionButton fab = getActivity().findViewById(R.id.fab); fab.setOnClickListener(v -> { Intent i = new Intent(getActivity(), FilteredFilePickerActivity.class); i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_SINGLE_CLICK, true); i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE); i.putExtra(FilePickerActivity.EXTRA_START_PATH, FilteredFilePickerFragment.getLastPath()); startActivityForResult(i, FILE_CODE); }); }
Example #2
Source File: MainActivity.java From BrainPhaser with GNU General Public License v3.0 | 6 votes |
/** * This method handles the action menu item selections. * * @param item the item which has been selected * @return if the item was found in the menu */ @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.action_switch_user: startActivity(new Intent(getApplicationContext(), UserSelectionActivity.class)); return true; case R.id.action_about: startActivity(new Intent(getApplicationContext(), AboutActivity.class)); return true; case R.id.action_settings: startActivity(new Intent(getApplicationContext(), SettingsActivity.class)); return true; case 0: // Only in debug mode: File Picker Intent i = new Intent(getApplicationContext(), FilePickerActivity.class); startActivityForResult(i, CODE_FILEPICKER); default: return super.onOptionsItemSelected(item); } }
Example #3
Source File: MenuBackgroundSelectorActivity.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem menuItem) { if (menuItem.getItemId() == android.R.id.home) { onBackPressed(); } else if (menuItem.getItemId() == R.id.action_find) { // load custom image Intent i = new Intent(this, FilePickerActivity.class); i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE); i.putExtra(FilePickerActivity.EXTRA_START_PATH, GlobalConfig.pathPickedSave == null || GlobalConfig.pathPickedSave.length() == 0 ? Environment.getExternalStorageDirectory().getPath() : GlobalConfig.pathPickedSave); startActivityForResult(i, 0); } return super.onOptionsItemSelected(menuItem); }
Example #4
Source File: FileBrowserHelper.java From citra_android with GNU General Public License v3.0 | 5 votes |
public static void openDirectoryPicker(FragmentActivity activity) { Intent i = new Intent(activity, CustomFilePickerActivity.class); i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR); i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath()); activity.startActivityForResult(i, MainPresenter.REQUEST_ADD_DIRECTORY); }
Example #5
Source File: AbstractFileChoosingActivity.java From rpicheck with MIT License | 5 votes |
/** * Sends an Intent to FilePickerActivity. */ public final void startFileChooser() { LOGGER.debug("Sending Intent to open FilePicker Activity."); final Intent i = new Intent(this, RaspiFilePickerActivity.class); // Set these depending on your use case. These are the defaults. i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE); i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath()); startActivityForResult(i, REQUEST_CODE_LOAD_FILE); }
Example #6
Source File: Importer.java From masterpassword with GNU General Public License v3.0 | 5 votes |
private Intent getLegacyFileChooserIntent() { Intent getContentIntent = new Intent(activity, FilePickerActivity.class); getContentIntent.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); getContentIntent.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false); getContentIntent.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE); // Configure initial directory by specifying a String. // You could specify a String like "/storage/emulated/0/", but that can // dangerous. Always use Android's API calls to get paths to the SD-card or // internal memory. getContentIntent.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath()); return getContentIntent; }
Example #7
Source File: Exporter.java From masterpassword with GNU General Public License v3.0 | 5 votes |
private Intent getLegacyFolderChooserIntent() { Intent getContentIntent = new Intent(activity, FilePickerActivity.class); getContentIntent.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); getContentIntent.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true); getContentIntent.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR); // Configure initial directory by specifying a String. // You could specify a String like "/storage/emulated/0/", but that can // dangerous. Always use Android's API calls to get paths to the SD-card or // internal memory. getContentIntent.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath()); return getContentIntent; }
Example #8
Source File: NoNonsenseFilePicker.java From NoNonsense-FilePicker with Mozilla Public License 2.0 | 5 votes |
protected void startActivity(final int code, final Class<?> klass) { final Intent i = new Intent(this, klass); i.setAction(Intent.ACTION_GET_CONTENT); i.putExtra(SUPickerActivity.EXTRA_ALLOW_MULTIPLE, binding.checkAllowMultiple.isChecked()); i.putExtra(FilePickerActivity.EXTRA_SINGLE_CLICK, binding.checkSingleClick.isChecked()); i.putExtra(SUPickerActivity.EXTRA_ALLOW_CREATE_DIR, binding.checkAllowCreateDir.isChecked()); i.putExtra(FilePickerActivity.EXTRA_ALLOW_EXISTING_FILE, binding.checkAllowExistingFile.isChecked()); // What mode is selected final int mode; switch (binding.radioGroup.getCheckedRadioButtonId()) { case R.id.radioDir: mode = AbstractFilePickerFragment.MODE_DIR; break; case R.id.radioFilesAndDirs: mode = AbstractFilePickerFragment.MODE_FILE_AND_DIR; break; case R.id.radioNewFile: mode = AbstractFilePickerFragment.MODE_NEW_FILE; break; case R.id.radioFile: default: mode = AbstractFilePickerFragment.MODE_FILE; break; } i.putExtra(FilePickerActivity.EXTRA_MODE, mode); // This line is solely so that test classes can override intents given through UI i.putExtras(getIntent()); startActivityForResult(i, code); }
Example #9
Source File: SettingsFragment.java From Panoramic-Screenshot with GNU General Public License v3.0 | 5 votes |
private void startChooser(int code) { Intent i = new Intent(getActivity(), FilePickerActivity.class); i.setAction(Intent.ACTION_GET_CONTENT); i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR); startActivityForResult(i, code); }
Example #10
Source File: UiUtils.java From droidddle with Apache License 2.0 | 5 votes |
public static void showFileDirPicker(Fragment f, int code) { Intent intent = new Intent(f.getActivity(), FilePickerActivity.class); intent.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR); // Configure initial directory by specifying a String. // You could specify a String like "/storage/emulated/0/", but that can // dangerous. Always use Android's API calls to get paths to the SD-card or // internal memory. File dir = UiUtils.getDownloadFilePath(f.getActivity()); String path = dir == null ? Environment.getExternalStorageDirectory().getPath() : dir.getAbsolutePath(); intent.putExtra(FilePickerActivity.EXTRA_START_PATH, path); f.startActivityForResult(intent, code); }
Example #11
Source File: AdvancedOptions.java From USB_Mass_Storage_Enabler with MIT License | 5 votes |
void selectBlockManually() { Intent i = new Intent(this, FilePickerActivity.class); i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE); i.putExtra(FilePickerActivity.EXTRA_START_PATH, "/"); startActivityForResult(i, BLOCK_FILE_REQ_CODE); }
Example #12
Source File: AdvancedOptions.java From USB_Mass_Storage_Enabler with MIT License | 5 votes |
public void pickRootDir(View v) { // https://github.com/spacecowboy/NoNonsense-FilePicker Intent i = new Intent(this, FilePickerActivity.class); i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR); i.putExtra(FilePickerActivity.EXTRA_START_PATH, "/"); startActivityForResult(i, ROOT_DIR_REQ_CODE); }
Example #13
Source File: MainActivity.java From a-sync-browser with Mozilla Public License 2.0 | 5 votes |
private void showUploadHereDialog() { if (indexBrowser == null) { Log.w("showUploadHereDialog", "unable to open dialog, null index browser"); } else { Intent i = new Intent(this, MIVFilePickerActivity.class); String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath(); Log.i("showUploadHereDialog", "path = " + path); i.putExtra(FilePickerActivity.EXTRA_START_PATH, path); startActivityForResult(i, 0); } }
Example #14
Source File: CustomDictionaryActivity.java From ankihelper with GNU General Public License v3.0 | 5 votes |
void selectFile(){ Intent i = new Intent(this, FilePickerActivity.class); // This works if you defined the intent filter // Intent i = new Intent(Intent.ACTION_GET_CONTENT); // Set these depending on your use case. These are the defaults. i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE); i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath()); startActivityForResult(i, FILE_CODE); }
Example #15
Source File: FileBrowserHelper.java From citra_android with GNU General Public License v3.0 | 5 votes |
public static void openFilePicker(FragmentActivity activity, int requestCode) { Intent i = new Intent(activity, CustomFilePickerActivity.class); i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE); i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath()); activity.startActivityForResult(i, requestCode); }
Example #16
Source File: MainActivity.java From video-transcoder with GNU General Public License v3.0 | 5 votes |
/** * Opening gallery for selecting video file */ private void selectVideo() { Intent i = new Intent(this, FastScrollerFilePickerActivity.class); i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE); String searchFolder; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); String fileSearchPath = prefs.getString("fileSearchPath", "last-used"); switch(fileSearchPath) { case "last-used": default: prefs = getSharedPreferences(SHARED_PREFS_KEY, MODE_PRIVATE); searchFolder = prefs.getString(PICKER_DIR_PREF, Environment.getExternalStorageDirectory().getPath()); break; case "external": searchFolder = Environment.getExternalStorageDirectory().getPath(); break; } i.putExtra(FilePickerActivity.EXTRA_START_PATH, searchFolder); startActivityForResult(i, SELECT_FILE_REQUEST); }
Example #17
Source File: DialogShowPicker.java From cordova-ourcodeworld-filebrowser with MIT License | 4 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { firstTime = false; JSONArray jsonArray = new JSONArray(); // Retrieve file, folders paths if (requestCode == FILE_CODE && resultCode == Activity.RESULT_OK) { if (data.getBooleanExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)) { // For JellyBean and above if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { ClipData clip = data.getClipData(); if (clip != null) { for (int i = 0; i < clip.getItemCount(); i++) { jsonArray.put(clip.getItemAt(i).getUri().toString()); } } // For Ice Cream Sandwich } else { ArrayList<String> paths = data.getStringArrayListExtra (FilePickerActivity.EXTRA_PATHS); if (paths != null) { for (String path: paths) { jsonArray.put(Uri.parse(path).toString()); } } } } else { jsonArray.put(data.getData().toString()); } } // Send information Intent intent = new Intent(); intent.putExtra("information", jsonArray.toString()); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); setResult(Activity.RESULT_OK, intent); finish(); }
Example #18
Source File: DialogShowPicker.java From cordova-ourcodeworld-filebrowser with MIT License | 4 votes |
@Override public void onStart() { super.onStart(); if(firstTime == true){ Bundle extras = getIntent().getExtras(); String action = extras.getString("action"); String startDirectory = extras.getString("start_directory"); Context context = getApplicationContext(); Intent i = new Intent(context, FilePickerActivity.class); i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true); i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // Set start up directory in case it's not the android default if(startDirectory.equals("default")){ i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath()); }else{ i.putExtra(FilePickerActivity.EXTRA_START_PATH, startDirectory); } // Start single filepicker if (action.equals("showPicker")) { i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE); // Start multi filepicker }else if(action.equals("showMultiFilepicker")){ i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, true); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE); // Start folder (dir) picker }else if(action.equals("showFolderpicker")){ i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR); // Start multi folder (dir) picker }else if(action.equals("showMultiFolderpicker")){ i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, true); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR); }else if(action.equals("showMixedPicker")){ i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, true); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE_AND_DIR); }else if(action.equals("showCreatefile")){ //i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, true); i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_NEW_FILE); } startActivityForResult(i, FILE_CODE); } }