Java Code Examples for cn.qqtheme.framework.picker.FilePicker#setOnFilePickListener()

The following examples show how to use cn.qqtheme.framework.picker.FilePicker#setOnFilePickListener() . 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: BookmarkActivity.java    From movienow with GNU General Public License v3.0 5 votes vote down vote up
private void importBookmark() {
        FilePicker filePicker = new FilePicker(BookmarkActivity.this, FilePicker.FILE);
        filePicker.setBackgroundColor(0xffF5F5F5);
        filePicker.setTopBackgroundColor(0xffF5F5F5);
        filePicker.setOnFilePickListener(new FilePicker.OnFilePickListener() {
            @Override
            public void onFilePicked(String s) {
                if (!TextUtils.isEmpty(s)) {
                    String bookmarks = FileUtil.fileToString(s);
                    saveWebs(bookmarks);
                    ToastMgr.toastShortCenter(getContext(),"书签导入成功!");
                }else {
                    ToastMgr.toastShortCenter(getContext(),"路径不能为空!");
                }
            }
        });
        filePicker.show();
        filePicker.getSubmitButton().setText("系统文件选择器");
        filePicker.getSubmitButton().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                filePicker.dismiss();
                ToastMgr.toastShortBottomCenter(getContext(),"暂不支持!");
//                Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
//                intent.setType("*/*");//无类型限制
//                intent.addCategory(Intent.CATEGORY_OPENABLE);
//                startActivityForResult(intent, 400);
            }
        });
    }
 
Example 2
Source File: SettingActivity.java    From v9porn with 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 File: SettingActivity.java    From v9porn with 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 4
Source File: MainActivity.java    From AndroidPicker with MIT License 5 votes vote down vote up
public void onFilePicker(View view) {
    FilePicker picker = new FilePicker(this, FilePicker.FILE);
    picker.setShowHideDir(false);
    //picker.setAllowExtensions(new String[]{".apk"});
    picker.setFileIcon(getResources().getDrawable(android.R.drawable.ic_menu_agenda));
    picker.setFolderIcon(getResources().getDrawable(android.R.drawable.ic_menu_upload_you_tube));
    //picker.setArrowIcon(getResources().getDrawable(android.R.drawable.arrow_down_float));
    picker.setOnFilePickListener(new FilePicker.OnFilePickListener() {
        @Override
        public void onFilePicked(String currentPath) {
            showToast(currentPath);
        }
    });
    picker.show();
}
 
Example 5
Source File: MainActivity.java    From AndroidPicker with 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();
}