当前位置: 首页>>代码示例>>Java>>正文


Java FilePickerDialog.setDialogSelectionListener方法代码示例

本文整理汇总了Java中com.github.angads25.filepicker.view.FilePickerDialog.setDialogSelectionListener方法的典型用法代码示例。如果您正苦于以下问题:Java FilePickerDialog.setDialogSelectionListener方法的具体用法?Java FilePickerDialog.setDialogSelectionListener怎么用?Java FilePickerDialog.setDialogSelectionListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.angads25.filepicker.view.FilePickerDialog的用法示例。


在下文中一共展示了FilePickerDialog.setDialogSelectionListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setSelectDialog

import com.github.angads25.filepicker.view.FilePickerDialog; //导入方法依赖的package包/类
private void setSelectDialog() {
        DialogProperties properties = new DialogProperties();
        properties.selection_mode = DialogConfigs.SINGLE_MODE;
        properties.selection_type = DialogConfigs.FILE_SELECT;
        properties.root = new File(DialogConfigs.DEFAULT_DIR);
        properties.error_dir = new File(DialogConfigs.DEFAULT_DIR);
        properties.offset = new File(DialogConfigs.DEFAULT_DIR);
        properties.extensions = null;
        dialog = new FilePickerDialog(MainActivity.this, properties);
        dialog.setTitle("Select a File");
        dialog.setDialogSelectionListener(new DialogSelectionListener() {
            @Override
            public void onSelectedFilePaths(String[] files) {
                //files is the array of the paths of files selected by the Application User.
                videoPath = files[0]; // test
                String suffix = videoPath.substring(videoPath.lastIndexOf("."));
                if(!SUPPORTED_TYPES.contains(suffix)) {
                    Toast.makeText(MainActivity.this, "不支持的格式!", Toast.LENGTH_SHORT).show();
                    return;
                }
                Log.d(TAG, "videoPath" + videoPath);
                videoRenderer.changeVideoPathAndPlay(videoPath);
                pause.setEnabled(true);
//                Log.d(TAG, "clickable" + pause.isClickable());
                pause.setBackgroundResource(R.drawable.pause);
                videoRenderer.pausePlay(PLAY_PAUSE_FLAG);

            }
        });
    }
 
开发者ID:TobiasLee,项目名称:FilterPlayer,代码行数:31,代码来源:MainActivity.java

示例2: load

import com.github.angads25.filepicker.view.FilePickerDialog; //导入方法依赖的package包/类
/**
 * Load a configuration. This method displays the file picker. this file picker get the selected file config.
 * This file content is deserialized and given to the callback cbDone
 * @param context
 * @param cbDone
 */
public void load(@NonNull Context context, @NonNull final GollumCallbackGetGeneric<Configuration> cbDone) {
    Logger.d(TAG, "load()");
    DialogProperties dialogProperties = new DialogProperties();
    dialogProperties.selection_type = DialogConfigs.FILE_SELECT;
    dialogProperties.selection_mode = DialogConfigs.SINGLE_MODE;
    dialogProperties.root = Environment.getExternalStorageDirectory();
    dialogProperties.error_dir = new File(DialogConfigs.DEFAULT_DIR);
    dialogProperties.offset = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
    dialogProperties.extensions = new String[]{"json"};

    FilePickerDialog filePickerDialog = new FilePickerDialog(context, dialogProperties);
    filePickerDialog.setDialogSelectionListener(new DialogSelectionListener() {
        @Override
        public void onSelectedFilePaths(String[] files) {
            if (files.length > 0) {
                Logger.d(TAG, "file selected: " + files[0]);
                Configuration configuration = load(files[0]);
                if (configuration != null) {
                    Logger.d(TAG, "configuration NOT NULL");
                    cbDone.done(configuration, null);
                } else {
                    Logger.d(TAG, "configuration IS NULL");
                    cbDone.done(null, null);
                }
            }
        }
    });
    filePickerDialog.show();
}
 
开发者ID:GRnice,项目名称:PandwarfDefenderProject,代码行数:36,代码来源:FileManager.java

示例3: openFilePickerDialog

import com.github.angads25.filepicker.view.FilePickerDialog; //导入方法依赖的package包/类
/**
 * Open a file picker dialog to ease select a new image from external storage.
 */
public void openFilePickerDialog() {
    DialogProperties properties = new DialogProperties();

    properties.selection_mode = DialogConfigs.SINGLE_MODE;
    properties.selection_type = DialogConfigs.FILE_SELECT;
    // initial directory should be pictures directory
    properties.offset = new File("/mnt/sdcard" + File.separator + Environment.DIRECTORY_PICTURES);
    // show accepted image format only
    properties.extensions = new String[]{"jpg","jpeg","png","gif","bmp","webp"};

    FilePickerDialog dialog = new FilePickerDialog(getActivity(), properties);
    dialog.setTitle(R.string.dialog_edit_doc_cover_image_select_title);
    dialog.setPositiveBtnName(getString(R.string.dialog_edit_doc_cover_image_select_ok));
    dialog.setNegativeBtnName(getString(android.R.string.cancel));

    dialog.setDialogSelectionListener(new DialogSelectionListener() {
        @Override
        public void onSelectedFilePaths(String[] files) {
            if (files.length > 0) {
                mImagePath = files[0];
                updateImage();
            }
        }
    });

    dialog.show();

    // There is a problem with library dialog theme, it does not support a light
    // primary color because header text color is always white.
    // With this hack (we had to study library layout) it ensures that header background
    // is ok.
    dialog.findViewById(R.id.header).setBackgroundColor(
            ContextCompat.getColor(getActivity(), R.color.colorAccent));
}
 
开发者ID:nfdz,项目名称:foco,代码行数:38,代码来源:EditDocCoverDialog.java

示例4: browseForLibrary

import com.github.angads25.filepicker.view.FilePickerDialog; //导入方法依赖的package包/类
private void browseForLibrary() {
    fab.setEnabled(false);
    String rootdir = "/storage/";

    final DialogProperties properties = new DialogProperties();
    properties.selection_mode = DialogConfigs.SINGLE_MODE;
    properties.selection_type = DialogConfigs.DIR_SELECT;
    properties.root = new File(DialogConfigs.DEFAULT_DIR);
    properties.root = new File(rootdir);
    properties.extensions = null;

    final FilePickerDialog dialog = new FilePickerDialog(BookLibrary.this, properties);
    dialog.setDialogSelectionListener(new DialogSelectionListener() {
        @Override
        public void onSelectedFilePaths(String[] files) {
            if (files.length > 0) {
                String[] fileBits = files[0].split("/");
                String libraryName = fileBits[fileBits.length - 1];
                progressBar.setMax(2500);
                progressBar.setProgress(0);
                progressBar.setVisibility(View.VISIBLE);
                progressBarContainer.setVisibility(View.VISIBLE);
                ((BookLibApplication) getApplicationContext()).getLibManager().addLibrary(prgBrHandler, mHandler, libraryName, files[0]);
            }
        }
    });
    dialog.show();
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:29,代码来源:BookLibrary.java

示例5: onPreferenceSingleClick

import com.github.angads25.filepicker.view.FilePickerDialog; //导入方法依赖的package包/类
@Override
public boolean onPreferenceSingleClick(Preference preference) {
    mPreference = preference;

    File offset = null;
    String current = HiSettingsHelper.getInstance().getStringValue(preference.getKey(), "");
    if (!TextUtils.isEmpty(current)) {
        File currentFile = new File(current);
        if (currentFile.exists()) {
            offset = currentFile.getParentFile();
        }
    }

    DialogProperties properties = new DialogProperties();
    properties.root = Environment.getExternalStorageDirectory();
    properties.error_dir = Environment.getExternalStorageDirectory();
    properties.selection_mode = DialogConfigs.SINGLE_MODE;
    if (offset != null)
        properties.offset = offset;
    if (mType == FONT_FILE) {
        properties.selection_type = DialogConfigs.FILE_SELECT;
        properties.extensions = "ttf:otf".split(":");
        properties.enable_clear_button = true;
    } else if (mType == SAVE_DIR) {
        properties.selection_type = DialogConfigs.DIR_SELECT;
    }

    FilePickerDialog mDialog = new FilePickerDialog(mActivity);
    mDialog.setProperties(properties);
    mDialog.setDialogSelectionListener(this);
    mDialog.setTitle(preference.getTitle());
    mDialog.show();
    return false;
}
 
开发者ID:GreenSkinMonster,项目名称:hipda,代码行数:35,代码来源:FilePickerListener.java

示例6: promptForFiles

import com.github.angads25.filepicker.view.FilePickerDialog; //导入方法依赖的package包/类
/**
 * step 1, users selects files
 */
private void promptForFiles() {
    DialogProperties properties = new DialogProperties();
    properties.selection_mode = DialogConfigs.MULTI_MODE;
    properties.selection_type = DialogConfigs.FILE_SELECT;
    properties.root = new File(DialogConfigs.DEFAULT_DIR);
    ;//(Configuration.getInstance().getOsmdroidBasePath());
    properties.error_dir = new File(DialogConfigs.DEFAULT_DIR);
    properties.offset = new File(DialogConfigs.DEFAULT_DIR);

    Set<String> registeredExtensions = ArchiveFileFactory.getRegisteredExtensions();
    //api check
    if (Build.VERSION.SDK_INT >= 14)
        registeredExtensions.add("gpkg");
    if (Build.VERSION.SDK_INT >= 10)
        registeredExtensions.add("map");


    String[] ret = new String[registeredExtensions.size()];
    ret = registeredExtensions.toArray(ret);
    properties.extensions = ret;

    FilePickerDialog dialog = new FilePickerDialog(getContext(), properties);
    dialog.setTitle("Select a File");
    dialog.setDialogSelectionListener(new DialogSelectionListener() {
        @Override
        public void onSelectedFilePaths(String[] files) {
            //files is the array of the paths of files selected by the Application User.
            setProviderConfig(files);
        }

    });
    dialog.show();
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:37,代码来源:OfflinePickerSample.java


注:本文中的com.github.angads25.filepicker.view.FilePickerDialog.setDialogSelectionListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。