com.nononsenseapps.filepicker.AbstractFilePickerFragment Java Examples

The following examples show how to use com.nononsenseapps.filepicker.AbstractFilePickerFragment. 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: BackHandlingFilePickerActivity.java    From NoNonsense-FilePicker with Mozilla Public License 2.0 6 votes vote down vote up
/**
 * Return a copy of the new fragment and set the variable above.
 */
@Override
protected AbstractFilePickerFragment<File> getFragment(
        final String startPath, final int mode, final boolean allowMultiple,
        final boolean allowDirCreate, final boolean allowExistingFile,
        final boolean singleClick) {

    // startPath is allowed to be null.
    // In that case, default folder should be SD-card and not "/"
    String path = (startPath != null ? startPath
            : Environment.getExternalStorageDirectory().getPath());

    currentFragment = new BackHandlingFilePickerFragment();
    currentFragment.setArgs(path, mode, allowMultiple, allowDirCreate,
            allowExistingFile, singleClick);
    return currentFragment;
}
 
Example #2
Source File: FtpPickerFragment.java    From NoNonsense-FilePicker with Mozilla Public License 2.0 6 votes vote down vote up
public static AbstractFilePickerFragment<FtpFile> newInstance(String startPath, int mode,
                                                              boolean allowMultiple,
                                                              boolean allowCreateDir,
                                                              boolean allowExistingFile,
                                                              boolean singleClick,
                                                              String server, int port,
                                                              String username,
                                                              String password,
                                                              String rootDir) {
    FtpPickerFragment fragment = new FtpPickerFragment();
    // Add arguments
    fragment.setArgs(startPath, mode, allowMultiple, allowCreateDir,
            allowExistingFile, singleClick);
    Bundle args = fragment.getArguments();

    // Add ftp related stuff
    args.putString(KEY_FTP_ROOTDIR, rootDir);
    args.putString(KEY_FTP_SERVER, server);
    args.putInt(KEY_FTP_PORT, port);
    if (username != null && password != null) {
        args.putString(KEY_FTP_USERNAME, username);
        args.putString(KEY_FTP_PASSWORD, password);
    }

    return fragment;
}
 
Example #3
Source File: DropboxFilePickerActivity.java    From NoNonsense-FilePicker with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected AbstractFilePickerFragment<Metadata> getFragment(@Nullable final String startPath,
                                                           final int mode, final boolean allowMultiple,
                                                           final boolean allowCreateDir, final boolean allowExistingFile,
                                                           final boolean singleClick) {
    DropboxFilePickerFragment fragment = null;

    if (!dropboxHelper.authenticationFailed(this)) {
        DbxClientV2 dropboxClient = dropboxHelper.getClient(this);

        if (dropboxClient != null) {
            fragment = new DropboxFilePickerFragment(dropboxClient);
            fragment.setArgs(startPath, mode, allowMultiple, allowCreateDir, allowExistingFile, singleClick);
        }
    }

    return fragment;
}
 
Example #4
Source File: FastScrollerFilePickerActivity.java    From video-transcoder with GNU General Public License v3.0 5 votes vote down vote up
protected AbstractFilePickerFragment<File> getFragment(
        @Nullable final String startPath, final int mode, final boolean allowMultiple,
        final boolean allowCreateDir) {
    AbstractFilePickerFragment<File> fragment = new FastScrollerFilePickerFragment();
    // startPath is allowed to be null. In that case, default folder should be SD-card and not "/"
    fragment.setArgs(startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(),
            mode, allowMultiple, allowCreateDir, true, false);
    return fragment;
}
 
Example #5
Source File: CustomFilePickerActivity.java    From citra_android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected AbstractFilePickerFragment<File> getFragment(
        @Nullable final String startPath, final int mode, final boolean allowMultiple,
        final boolean allowCreateDir, final boolean allowExistingFile,
        final boolean singleClick)
{
  AbstractFilePickerFragment<File> fragment = new CustomFilePickerFragment();
  // startPath is allowed to be null. In that case, default folder should be SD-card and not "/"
  fragment.setArgs(
          startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(),
          mode, allowMultiple, allowCreateDir, allowExistingFile, singleClick);
  return fragment;
}
 
Example #6
Source File: FilteredFilePickerActivity.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
@Override
protected AbstractFilePickerFragment<File> getFragment(@Nullable String startPath, int mode, boolean allowMultiple,
													   boolean allowCreateDir, boolean allowExistingFile, boolean singleClick) {
	currentFragment = new FilteredFilePickerFragment();
	currentFragment.setArgs(startPath, mode, allowMultiple, allowCreateDir, allowExistingFile, singleClick);
	return currentFragment;
}
 
Example #7
Source File: MIVFilePickerActivity.java    From a-sync-browser with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected AbstractFilePickerFragment<File> getFragment(
        final String startPath, final int mode, final boolean allowMultiple,
        final boolean allowCreateDir) {
    // Only the fragment in this line needs to be changed
    AbstractFilePickerFragment<File> fragment = new MIVFilePickerFragment();
    fragment.setArgs(startPath, mode, allowMultiple, allowCreateDir);
    return fragment;
}
 
Example #8
Source File: NoNonsenseFilePicker.java    From NoNonsense-FilePicker with Mozilla Public License 2.0 5 votes vote down vote up
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: FtpPickerActivity.java    From NoNonsense-FilePicker with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected AbstractFilePickerFragment<FtpFile> getFragment(@Nullable String startPath, int mode,
                                                          boolean allowMultiple,
                                                          boolean allowCreateDir,
                                                          boolean allowExistingFile,
                                                          boolean singleClick) {
    return FtpPickerFragment.newInstance(startPath, mode, allowMultiple, allowCreateDir,
            allowExistingFile, singleClick,
            "debian.simnet.is",
            FTPClient.DEFAULT_PORT,
            null,
            null, "/");
}
 
Example #10
Source File: MultimediaPickerActivity.java    From NoNonsense-FilePicker with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected AbstractFilePickerFragment<File> getFragment(
        @Nullable final String startPath, final int mode, final boolean allowMultiple,
        final boolean allowCreateDir, final boolean allowExistingFile,
        final boolean singleClick) {
    AbstractFilePickerFragment<File> fragment = new MultimediaPickerFragment();
    // startPath is allowed to be null. In that case, default folder should be SD-card and not "/"
    fragment.setArgs(startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(),
            mode, allowMultiple, allowCreateDir, allowExistingFile, singleClick);
    return fragment;
}
 
Example #11
Source File: FastScrollerFilePickerActivity.java    From NoNonsense-FilePicker with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected AbstractFilePickerFragment<File> getFragment(
        @Nullable final String startPath, final int mode, final boolean allowMultiple,
        final boolean allowCreateDir, final boolean allowExistingFile,
        final boolean singleClick) {
    AbstractFilePickerFragment<File> fragment = new FastScrollerFilePickerFragment();
    // startPath is allowed to be null. In that case, default folder should be SD-card and not "/"
    fragment.setArgs(startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(),
            mode, allowMultiple, allowCreateDir, allowExistingFile, singleClick);
    return fragment;
}
 
Example #12
Source File: SUPickerActivity.java    From NoNonsense-FilePicker with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected AbstractFilePickerFragment<File> getFragment(@Nullable String startPath,
                                                       int mode,
                                                       boolean allowMultiple,
                                                       boolean allowCreateDir,
                                                       boolean allowExistingFile,
                                                       boolean singleClick) {
    AbstractFilePickerFragment<File> fragment = new SUPickerFragment();
    // startPath is allowed to be null. In that case, default folder should be SD-card and
    // not "/"
    fragment.setArgs(
            startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(),
            mode, allowMultiple, allowCreateDir, allowExistingFile, singleClick);
    return fragment;
}
 
Example #13
Source File: RaspiFilePickerActivity.java    From rpicheck with MIT License 5 votes vote down vote up
@Override
protected AbstractFilePickerFragment<File> getFragment(@Nullable String startPath, int mode, boolean allowMultiple, boolean allowCreateDir, boolean allowExistingFile, boolean singleClick) {
    final FilePickerFragment filePickerFragment = new FilePickerFragment();
    filePickerFragment.setArgs(startPath, mode, allowMultiple, allowCreateDir, allowExistingFile, singleClick);
    filePickerFragment.showHiddenItems(true);
    return filePickerFragment;
}
 
Example #14
Source File: FastScrollerFilePickerActivity.java    From video-transcoder with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected AbstractFilePickerFragment getFragment(@Nullable String startPath, int mode, boolean allowMultiple, boolean allowCreateDir, boolean allowExistingFile, boolean singleClick)
{
    return getFragment(startPath, mode, allowMultiple, allowCreateDir);
}