• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FilePickerDialog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



FilePickerDialog类属于com.github.angads25.filepicker.view包,在下文中一共展示了FilePickerDialog类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: onRequestPermissionsResult

import com.github.angads25.filepicker.view.FilePickerDialog; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode,@NonNull String permissions[],@NonNull int[] grantResults) {
    switch (requestCode) {
        case FilePickerDialog.EXTERNAL_READ_PERMISSION_GRANT: {
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                if(dialog!=null) {
                    //Show dialog if the read permission has been granted.
                    dialog.show();
                }
            }
            else {
                //Permission has not been granted. Notify the user.
                Toast.makeText(MainActivity.this,"Permission is Required for getting list of files",Toast.LENGTH_SHORT).show();
            }
        }
    }
}
 
开发者ID:Angads25,项目名称:android-filepicker,代码行数:18,代码来源:MainActivity.java


示例3: onRequestPermissionsResult

import com.github.angads25.filepicker.view.FilePickerDialog; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode,
                                       @NonNull String permissions[], @NonNull int[] grantResults) {
    switch (requestCode) {
        case PERMISSIONS_REQUEST_CODE_STORAGE: {
            // If request is cancelled, the result arrays are empty.
            if (grantResults.length > 0
                    && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                UIUtils.toast("授权成功");
            }
            break;
        }
        case FilePickerDialog.EXTERNAL_READ_PERMISSION_GRANT: {
            if (grantResults.length == 0
                    || grantResults[0] != PackageManager.PERMISSION_GRANTED) {
                UIUtils.askForStoragePermission(this);
            }
            break;
        }
    }
}
 
开发者ID:GreenSkinMonster,项目名称:hipda,代码行数:22,代码来源:MainFrameActivity.java


示例4: 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


示例5: 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


示例6: 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


示例7: 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


示例8: initPicturePanel

import com.github.angads25.filepicker.view.FilePickerDialog; //导入依赖的package包/类
private void initPicturePanel(final View root) {
    ((ImageView) root.findViewById(R.id.picture_preview)).setImageResource(R.drawable.pause_publish);
    root.findViewById(R.id.picture_preview).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            DialogProperties properties = new DialogProperties();
            properties.selection_mode = DialogConfigs.SINGLE_MODE;
            properties.selection_type = DialogConfigs.FILE_SELECT;
            properties.root = new File(DialogConfigs.STORAGE_DIR);
            properties.error_dir = new File(DialogConfigs.DEFAULT_DIR);
            properties.extensions = new String[]{"jpg", "png"};

            FilePickerDialog dialog = new FilePickerDialog(getActivity(), properties);
            dialog.setTitle("Select a File");
            dialog.setDialogSelectionListener(new DialogSelectionListener() {
                @Override
                public void onSelectedFilePaths(String[] files) {
                    ImageView imageView = ((ImageView) getView().findViewById(R.id.picture_preview));
                    if (files != null && files.length > 0){
                        mPictureFilePath = files[0];
                        imageView.setImageBitmap(BitmapFactory.decodeFile(mPictureFilePath));
                    } else {
                        mPictureFilePath = null;
                        imageView.setImageResource(R.drawable.pause_publish);
                    }
                }
            });
            dialog.show();
        }
    });
}
 
开发者ID:pili-engineering,项目名称:PLDroidMediaStreaming,代码行数:32,代码来源:EncodingConfigFragment.java


示例9: 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


示例10: onCreate

import com.github.angads25.filepicker.view.FilePickerDialog; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_normal);

    ListView messageTimeline = (ListView) this.findViewById(R.id.timeline);

    fileChooseButton = (Button) this.findViewById(R.id.filebutton);

    final 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.extensions = null;

    final FilePickerDialog dialog = new FilePickerDialog(NormalActivity.this, properties);
    dialog.setTitle("File to send");

    final Activity  current = this;
    fileChooseButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
                dialog.show();
        }
    });

    MsgBox = (EditText) this.findViewById(R.id.editText);
    Messages = new MessageBoxAdapter(this);

    messageTimeline.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
    messageTimeline.setStackFromBottom(true);
    messageTimeline.setAdapter(Messages);

    //messagebox handeling
    Button sendButton = (Button) this.findViewById(R.id.send);
    sendButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            updateList();
        }
    });

    Intent bindIntent = new Intent(this, ScatterRoutingService.class);
    bindService(bindIntent, mConnection, Context.BIND_AUTO_CREATE);


}
 
开发者ID:gnu3ra,项目名称:Scatterbrain,代码行数:49,代码来源:NormalActivity.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java X509IssuerSerialResolver类代码示例发布时间:2022-05-22
下一篇:
Java AlignmentHorizontal类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap