Java Code Examples for com.nononsenseapps.filepicker.AbstractFilePickerFragment

The following examples show how to use com.nononsenseapps.filepicker.AbstractFilePickerFragment. These examples are extracted from open source projects. 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
/**
 * 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
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
@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
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
@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 Project: J2ME-Loader   Source File: FilteredFilePickerActivity.java    License: 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
@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
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
@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
@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
@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
@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 Project: rpicheck   Source File: RaspiFilePickerActivity.java    License: 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
@Override
protected AbstractFilePickerFragment getFragment(@Nullable String startPath, int mode, boolean allowMultiple, boolean allowCreateDir, boolean allowExistingFile, boolean singleClick)
{
    return getFragment(startPath, mode, allowMultiple, allowCreateDir);
}