com.afollestad.materialdialogs.folderselector.FolderChooserDialog Java Examples

The following examples show how to use com.afollestad.materialdialogs.folderselector.FolderChooserDialog. 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: DownloadOptionAdapter.java    From OneTapVideoDownload with GNU General Public License v3.0 6 votes vote down vote up
private DownloadOptionItem downloadLocationOption() {
    return new DownloadOptionItem(DownloadOptionIds.DownloadLocation,
            R.drawable.directory,
            R.string.download_location,
            CheckPreferences.getDownloadLocation(mContext),
            new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    new FolderChooserDialog.Builder(mContext)
                            .chooseButton(R.string.md_choose_label)
                            .tag(FOLDER_CHOOSER_TAG)
                            .initialPath(mDownloadLocation)
                            .allowNewFolder(true, R.string.new_folder)
                            .show((MainActivity) mContext);
                }
            }
    );
}
 
Example #2
Source File: ActionModePresenter.java    From FileManager with Apache License 2.0 6 votes vote down vote up
@Override
public void folderSelect(FolderChooserDialog dialog, @NonNull File folder) {
    String tag = dialog.getTag();
    if (tag.equals(AppConstant.ZIP)) {
        mView.startZipTask(folder.getAbsolutePath() + File.separator + UUIDUtil.createUUID() + ".zip",
                mFiles);
    } else if (tag.equals(AppConstant.UNZIP)) {
        mView.startUnZipTask(new File(unZipPath), folder);
    } else if (tag.equals(AppConstant.MOVE)) {
        mView.executePaste(folder.getAbsolutePath());
    } else if (tag.equals(AppConstant.COPY)) {
        mView.executePaste(folder.getAbsolutePath());
    }
    mView.finishActionMode();
    RxBus.getDefault().post(new TypeEvent(AppConstant.CLEAN_ACTIONMODE));
    RxBus.getDefault().post(new TypeEvent(AppConstant.CLEAN_CHOICE));
}
 
Example #3
Source File: SettingsActivity.java    From EdXposedManager with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onFolderSelection(@NonNull FolderChooserDialog dialog, @NonNull File folder) {
    if (folder.canWrite()) {
        XposedApp.getPreferences().edit().putString("download_location", folder.getPath()).apply();
    } else {
        Toast.makeText(this, R.string.sdcard_not_writable, Toast.LENGTH_SHORT).show();
    }
}
 
Example #4
Source File: MainPresenter.java    From FileManager with Apache License 2.0 5 votes vote down vote up
@Override
public void folderSelect(FolderChooserDialog dialog, @NonNull File folder) {

    String tag = dialog.getTag();
    if (tag.equals(ZIP)) {
        mView.startZipTask(folder.getAbsolutePath() + File.separator + UUIDUtil.createUUID() + ".zip",
                mFiles);
    } else {
        mView.startUnZipTask(new File(unZipPath), folder);
    }
    mView.finishActionMode();
    RxBus.getDefault().post(new CleanChoiceEvent());
    RxBus.getDefault().post(new RefreshEvent());
}
 
Example #5
Source File: MainActivity.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onFolderSelection(@NonNull FolderChooserDialog dialog, @NonNull File directory) {
    String tag = dialog.getTag();
    switch(tag) {
        case SettingsFragment.FOLDER_CHOOSER_TAG:
            if (directory.canWrite()) {
                CheckPreferences.setDownloadLocation(this, directory.getPath());
                SettingsFragment.updatePreferenceSummary();
            } else {
                Toast.makeText(this, R.string.unable_to_select_sd_card, Toast.LENGTH_LONG).show();
                ApplicationLogMaintainer.sendBroadcast(this, "Unable to write on selected directory :");
                ApplicationLogMaintainer.sendBroadcast(this, directory.getAbsolutePath());
            }
            break;
        case DownloadOptionAdapter.FOLDER_CHOOSER_TAG:
            if (directory.canWrite()) {
                DownloadOptionAdapter downloadOptionAdapter =
                        (DownloadOptionAdapter) mDownloadDialogRecyclerView.getAdapter();
                downloadOptionAdapter.setDownloadLocation(directory.getPath());
                SettingsFragment.updatePreferenceSummary();
            } else {
                Toast.makeText(this, R.string.unable_to_select_sd_card, Toast.LENGTH_LONG).show();
                ApplicationLogMaintainer.sendBroadcast(this, "Unable to write on selected directory :");
                ApplicationLogMaintainer.sendBroadcast(this, directory.getAbsolutePath());
            }
    }
}
 
Example #6
Source File: MainActivity.java    From FileManager with Apache License 2.0 5 votes vote down vote up
@Override
public void showFolderDialog(String TAG) {
    new FolderChooserDialog.Builder(this)
            .chooseButton(R.string.md_choose_label)  // changes label of the choose button
            .initialPath(mSdCardFragment.getCurrentPath())  // changes initial path, defaults to external storage directory
            .tag(TAG)
            .goUpLabel("Up") // custom go up label, default label is "..."
            .show();
}
 
Example #7
Source File: SettingActivity.java    From FileManager with Apache License 2.0 5 votes vote down vote up
@Override
public void initUiAndListener() {
    getFragmentManager().beginTransaction().replace(R.id.content, new SettingFragment()).commit();

    AnimationUtil.showCircularReveal(mContentView, 0, 0, 2, 1500);

    mCompositeSubscription = new CompositeSubscription();
    mCompositeSubscription.add(RxBus.getDefault()
            .IoToUiObservable(ChangeDefaultDirEvent.class)
            .map(ChangeDefaultDirEvent::getType)
            .subscribe(type -> {
                new FolderChooserDialog.Builder(this)
                        .tag(type)
                        .chooseButton(R.string.md_choose_label)  // changes label of the choose button
                        .initialPath(Settings.getDefaultDir())  // changes initial path, defaults to external storage directory
                        .cancelButton(R.string.cancel)
                        .goUpLabel("Up") // custom go up label, default label is "..."
                        .show();
            }, Throwable::printStackTrace));

    mCompositeSubscription.add(RxBus.getDefault()
            .IoToUiObservable(ChangeThemeEvent.class)
            .subscribe(event -> {
                reload();
            }, Throwable::printStackTrace));

    mCompositeSubscription.add(RxBus.getDefault()
            .IoToUiObservable(LanguageEvent.class)
            .subscribe(event -> {
                reload();
            }, Throwable::printStackTrace));

}
 
Example #8
Source File: ActionModeActivity.java    From FileManager with Apache License 2.0 5 votes vote down vote up
@Override
public void showFolderDialog(String TAG) {
    new FolderChooserDialog.Builder(this)
            .chooseButton(R.string.md_choose_label)  // changes label of the choose button
            .cancelButton(R.string.md_cancel_label)
            .initialPath(Settings.getDefaultDir())  // changes initial path, defaults to external storage directory
            .tag(TAG)
            .goUpLabel("Up") // custom go up label, default label is "..."
            .show();
}
 
Example #9
Source File: MainActivity.java    From OneTapVideoDownload with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onFolderChooserDismissed(@NonNull FolderChooserDialog dialog) {
}
 
Example #10
Source File: SettingsFragment.java    From EdXposedManager with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean onPreferenceClick(Preference preference) {
    SettingsActivity act = (SettingsActivity) getActivity();
    if (act == null)
        return false;

    if (preference.getKey().equals("colors")) {
        new ColorChooserDialog.Builder(act, R.string.choose_color)
                .backButton(R.string.back)
                .allowUserColorInput(false)
                .customColors(PRIMARY_COLORS, null)
                .doneButton(R.string.ok)
                .preselect(XposedApp.getColor(act)).show();
    } else if (preference.getKey().equals(downloadLocation.getKey())) {
        if (checkPermissions()) {
            mClickedPreference = downloadLocation;
            return false;
        }

        new FolderChooserDialog.Builder(act)
                .cancelButton(android.R.string.cancel)
                .initialPath(XposedApp.getDownloadPath())
                .show();
    } else if (preference.getKey().equals(stopVerboseLog.getKey())) {
        new Runnable() {
            @Override
            public void run() {
                BaseFragment.areYouSure(requireActivity(), getString(R.string.settings_summary_stop_log), (d, w) -> Shell.su("pkill -P $(cat " + mVerboseLogProcessID.getAbsolutePath() + ")").exec(), (d, w) -> {
                });
            }
        };
    } else if (preference.getKey().equals(stopLog.getKey())) {
        new Runnable() {
            @Override
            public void run() {
                BaseFragment.areYouSure(requireActivity(), getString(R.string.settings_summary_stop_log), (d, w) -> Shell.su("pkill -P $(cat " + mModulesLogProcessID.getAbsolutePath() + ")").exec(), (d, w) -> {
                });
            }
        };
    }
    return true;
}
 
Example #11
Source File: MainActivity.java    From 920-text-editor-v2 with Apache License 2.0 4 votes vote down vote up
public void setFindFolderCallback(FolderChooserDialog.FolderCallback findFolderCallback) {
    this.findFolderCallback = findFolderCallback;
}
 
Example #12
Source File: MainActivity.java    From 920-text-editor-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public void onFolderSelection(@NonNull FolderChooserDialog dialog, @NonNull File file) {
    if (findFolderCallback != null) {
        findFolderCallback.onFolderSelection(dialog, file);
    }
}
 
Example #13
Source File: ActionModeActivity.java    From FileManager with Apache License 2.0 4 votes vote down vote up
@Override
public void onFolderSelection(@NonNull FolderChooserDialog dialog, @NonNull File folder) {

    mPresenter.folderSelect(dialog, folder);
}
 
Example #14
Source File: SettingActivity.java    From FileManager with Apache License 2.0 4 votes vote down vote up
@Override
public void onFolderSelection(@NonNull FolderChooserDialog dialog, @NonNull File folder) {

    String type = dialog.getTag();
    RxBus.getDefault().post(new NewDirEvent(type, folder.getAbsolutePath()));
}
 
Example #15
Source File: MainActivity.java    From FileManager with Apache License 2.0 4 votes vote down vote up
@Override
public void onFolderSelection(@NonNull FolderChooserDialog dialog, @NonNull File folder) {

    mPresenter.folderSelect(dialog, folder);
}
 
Example #16
Source File: ActionModeContact.java    From FileManager with Apache License 2.0 votes vote down vote up
void folderSelect(FolderChooserDialog dialog, @NonNull File folder); 
Example #17
Source File: MainContact.java    From FileManager with Apache License 2.0 votes vote down vote up
void folderSelect(FolderChooserDialog dialog, @NonNull File folder);