本文整理汇总了Java中com.github.angads25.filepicker.model.DialogConfigs.FILE_SELECT属性的典型用法代码示例。如果您正苦于以下问题:Java DialogConfigs.FILE_SELECT属性的具体用法?Java DialogConfigs.FILE_SELECT怎么用?Java DialogConfigs.FILE_SELECT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.github.angads25.filepicker.model.DialogConfigs
的用法示例。
在下文中一共展示了DialogConfigs.FILE_SELECT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSelectDialog
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);
}
});
}
示例2: load
/**
* 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();
}
示例3: openFilePickerDialog
/**
* 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));
}
示例4: onPreferenceSingleClick
@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;
}
示例5: promptForFiles
/**
* 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();
}
示例6: onCreate
@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);
}