Java Code Examples for cn.qqtheme.framework.util.StorageUtils

The following examples show how to use cn.qqtheme.framework.util.StorageUtils. 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
Source Project: v9porn   Source File: SettingActivity.java    License: MIT License 5 votes vote down vote up
/**
 * 自定义视频下载地址
 */
public void selectDownloadVideoDir(final QMUICommonListItemView qmuiCommonListItemView) {
    if (presenter.isHaveUnFinishDownloadVideo()) {
        showMessage("当前有未下载完成视频,无法更改", TastyToast.INFO);
        return;
    }
    FilePicker picker = new FilePicker(this, FilePicker.DIRECTORY);
    picker.setRootPath(StorageUtils.getExternalRootPath());
    picker.setTitleText("选择文件夹");
    picker.setItemHeight(40);
    picker.setOnFilePickListener(new FilePicker.OnFilePickListener() {
        @Override
        public void onFilePicked(String currentPath) {
            if (presenter.getCustomDownloadVideoDirPath().equalsIgnoreCase(currentPath + "/")) {
                showMessage("不能选择原目录哦", TastyToast.WARNING);
                return;
            }
            if (presenter.isHaveFinishDownloadVideoFile()) {
                showIsMoveOldDirVideoFileToNewDirDialog(currentPath, qmuiCommonListItemView);
            } else {
                showMessage("设置成功", TastyToast.SUCCESS);
                qmuiCommonListItemView.setDetailText(currentPath);
                presenter.setCustomDownloadVideoDirPath(currentPath);
            }
        }
    });
    picker.show();
}
 
Example 2
Source Project: v9porn   Source File: SettingActivity.java    License: MIT License 5 votes vote down vote up
/**
 * 自定义视频下载地址
 */
public void selectDownloadVideoDir(final QMUICommonListItemView qmuiCommonListItemView) {
    if (presenter.isHaveUnFinishDownloadVideo()) {
        showMessage("当前有未下载完成视频,无法更改", TastyToast.INFO);
        return;
    }
    FilePicker picker = new FilePicker(this, FilePicker.DIRECTORY);
    picker.setRootPath(StorageUtils.getExternalRootPath());
    picker.setTitleText("选择文件夹");
    picker.setItemHeight(40);
    picker.setOnFilePickListener(new FilePicker.OnFilePickListener() {
        @Override
        public void onFilePicked(String currentPath) {
            if (presenter.getCustomDownloadVideoDirPath().equalsIgnoreCase(currentPath + "/")) {
                showMessage("不能选择原目录哦", TastyToast.WARNING);
                return;
            }
            if (presenter.isHaveFinishDownloadVideoFile()) {
                showIsMoveOldDirVideoFileToNewDirDialog(currentPath, qmuiCommonListItemView);
            } else {
                showMessage("设置成功", TastyToast.SUCCESS);
                qmuiCommonListItemView.setDetailText(currentPath);
                presenter.setCustomDownloadVideoDirPath(currentPath);
            }
        }
    });
    picker.show();
}
 
Example 3
Source Project: AndroidPicker   Source File: MainActivity.java    License: MIT License 5 votes vote down vote up
public void onDirPicker(View view) {
    FilePicker picker = new FilePicker(this, FilePicker.DIRECTORY);
    picker.setRootPath(StorageUtils.getExternalRootPath() + "Download/");
    picker.setItemHeight(30);
    picker.setOnFilePickListener(new FilePicker.OnFilePickListener() {
        @Override
        public void onFilePicked(String currentPath) {
            showToast(currentPath);
        }
    });
    picker.show();
}
 
Example 4
Source Project: AndroidPicker   Source File: FilePicker.java    License: MIT License 5 votes vote down vote up
/**
 * @see #FILE
 * @see #DIRECTORY
 */
public FilePicker(Activity activity, @Mode int mode) {
    super(activity);
    setHalfScreen(true);
    try {
        this.initPath = StorageUtils.getDownloadPath();
    } catch (RuntimeException e) {
        this.initPath = StorageUtils.getInternalRootPath(activity);
    }
    this.mode = mode;
    adapter.setOnlyListDir(mode == DIRECTORY);
    adapter.setShowHideDir(false);
    adapter.setShowHomeDir(false);
    adapter.setShowUpDir(false);
}