@Override
public void onFileSelection(@NonNull FileChooserDialog dialog, @NonNull File file) {
Log.d(TAG, file.getAbsolutePath());
final String presetName = getCustomFolderName();
// install zip
fileHelper.unzip(file.getAbsolutePath(),
PROJECT_LOCATION_PRESETS,
presetName,
activity,
new Runnable() {
@Override
public void run() {
Log.d(TAG, "installed " + presetName);
setViewPager();
}
}
);
}
java类com.afollestad.materialdialogs.folderselector.FileChooserDialog的实例源码
PresetStoreActivity.java 文件源码
项目:Tapad
阅读 19
收藏 0
点赞 0
评论 0
SettingsActivity.java 文件源码
项目:Munch
阅读 32
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setActivityTheme();
setContentView(R.layout.activity_settings);
ButterKnife.bind(this);
//bind progress bar
mMaterialProgressBar = (MaterialProgressBar) findViewById(R.id.indeterminate_progress);
if (!NetworkConnectionUtil.isNetworkAvailable(SettingsActivity.this)) {
mMaterialProgressBar.setVisibility(View.GONE);
}
setToolBar();
getFragmentManager().beginTransaction().replace(R.id.frame_layout_settings, new SettingsFragment()).commit();
sFileChooserDialog = new FileChooserDialog.Builder(SettingsActivity.this)
.cancelButton(R.string.cancel)
.build();
}
NumberValidation.java 文件源码
项目:androidclient
阅读 21
收藏 0
点赞 0
评论 0
/** Opens import keys from another device wizard. */
private void importKey() {
checkInput(true, new ParameterRunnable<Boolean>() {
@Override
public void run(Boolean result) {
if (result) {
// import keys -- number verification with server is still needed
// though because of key rollback protection
// TODO allow for manual validation too
// do not wait for the generated key
stopKeyReceiver();
new FileChooserDialog.Builder(NumberValidation.this)
.initialPath(PersonalKeyPack.DEFAULT_KEYPACK.getParent())
.mimeType(PersonalKeyPack.KEYPACK_MIME)
.show(getSupportFragmentManager());
}
}
});
}
MainActivity.java 文件源码
项目:GitHub
阅读 22
收藏 0
点赞 0
评论 0
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@OnClick(R.id.file_chooser)
public void showFileChooser() {
chooserDialog = R.id.file_chooser;
if (ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, STORAGE_PERMISSION_RC);
return;
}
new FileChooserDialog.Builder(this)
.show();
}
ExportImportDialog.java 文件源码
项目:TwistyTimer
阅读 20
收藏 0
点赞 0
评论 0
/**
* Handles the selection of a file when solve times are being imported. If the "external" file
* format is chosen, the user must be further prompted to select the puzzle type and category
* to assign to the imported solve times. If the chosen file does not end with the expected
* file extension
*
* @param dialog The file chooser dialog that reported the selection.
* @param file The file that was chosen.
*/
@Override
public void onFileSelection(@NonNull FileChooserDialog dialog, @NonNull File file) {
if (ExportImportUtils.isFileExtensionOK(file)) {
mImportFile = file;
if (mFileFormat == EXIM_FORMAT_EXTERNAL) {
// Need to get the puzzle type and category before importing the data. There will
// be a call-back to "onPuzzleSelected" before returning to the activity.
PuzzleChooserDialog.newInstance(
R.string.action_import, ExportImportDialog.this.getTag())
.show(getActivity().getSupportFragmentManager(), null);
} else {
// Importing from a back-up file. There is no need to know the puzzle type and
// category, as those are in the file. Hand back to the activity to do the import.
getExImActivity().onImportSolveTimes(mImportFile, mFileFormat, null, null);
dismiss();
}
} else {
// TODO: ADD HELP
new MaterialDialog.Builder(getActivity())
.title(R.string.file_selection_error_title)
.content(R.string.file_selection_error_content, ".txt")
.positiveText(R.string.action_ok)
.show();
dismiss();
}
}
MainActivity.java 文件源码
项目:TwistyTimer
阅读 22
收藏 0
点赞 0
评论 0
/**
* Handles the call-back from a file chooser dialog when a file is selected. This is used for
* communication between the {@code FileChooserDialog} and the export/import fragments. The
* originating fragment that opened the file chooser dialog should set the "tag" of the file
* chooser dialog to the value of the fragment tag that this activity uses to identify that
* originating fragment. This activity will then forward this notification to that fragment,
* which is expected to implement this same interface method.
*
* @param dialog
* The file chooser dialog that has reported the file selection.
* @param file
* The file that was chosen.
*/
@Override
public void onFileSelection(@NonNull FileChooserDialog dialog, @NonNull File file) {
// This "relay" scheme ensures that this activity is not embroiled in the gory details of
// what the "destinationFrag" wanted with the file.
final Fragment destinationFrag = fragmentManager.findFragmentByTag(FRAG_TAG_EXIM_DIALOG);
if (destinationFrag instanceof FileChooserDialog.FileCallback) {
((FileChooserDialog.FileCallback) destinationFrag).onFileSelection(dialog, file);
} else {
// This is not expected unless there is a bug to be fixed.
Log.e(TAG, "onFileSelection(): Unknown or incompatible fragment: " + destinationFrag.getTag());
}
}
PresetStoreActivity.java 文件源码
项目:Tapad
阅读 21
收藏 0
点赞 0
评论 0
private void openPreset() {
new FileChooserDialog.Builder(this)
.initialPath(Environment.getExternalStorageDirectory().getPath())
.mimeType("application/zip")
.tag("optional-identifier")
.show(this);
Toast.makeText(activity, R.string.preset_store_open_preset, Toast.LENGTH_LONG).show();
}
NumberValidation.java 文件源码
项目:androidclient
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void onFileSelection(@NonNull FileChooserDialog fileChooserDialog, @NonNull File file) {
try {
startImport(new FileInputStream(file));
}
catch (FileNotFoundException e) {
Log.e(TAG, "error importing keys", e);
Toast.makeText(this,
R.string.err_import_keypair_read,
Toast.LENGTH_LONG).show();
}
}
MainActivity.java 文件源码
项目:material-dialogs
阅读 20
收藏 0
点赞 0
评论 0
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@OnClick(R.id.file_chooser)
public void showFileChooser() {
chooserDialog = R.id.file_chooser;
if (ActivityCompat.checkSelfPermission(
MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(
MainActivity.this,
new String[] {Manifest.permission.READ_EXTERNAL_STORAGE},
STORAGE_PERMISSION_RC);
return;
}
new FileChooserDialog.Builder(this).show();
}
MainActivity.java 文件源码
项目:GitHub
阅读 23
收藏 0
点赞 0
评论 0
@Override public void onFileSelection(@NonNull FileChooserDialog dialog, @NonNull File file) {
showToast(file.getAbsolutePath());
}
GeoJsonActivity.java 文件源码
项目:mapbox-plugins-android
阅读 21
收藏 0
点赞 0
评论 0
private void showFileChooserDialog() {
new FileChooserDialog.Builder(this)
.extensionsFilter(".geojson", ".json", ".js", ".txt")
.goUpLabel("Up")
.show(getSupportFragmentManager());
}
GeoJsonActivity.java 文件源码
项目:mapbox-plugins-android
阅读 22
收藏 0
点赞 0
评论 0
@Override
public void onFileSelection(@NonNull FileChooserDialog dialog, @NonNull File file) {
drawFromPath(file);
}
ExportImportDialog.java 文件源码
项目:TwistyTimer
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void onClick(View view) {
// NOTE: The call-backs from the "FileChooserDialog" and "PuzzleChooserDialog"
//
switch (view.getId()) {
case R.id.export_backup:
// All puzzle types and categories are exported to a single back-up file.
// There is no need to identify the export file or the puzzle type/category.
// Just invoke the activity and dismiss this dialog.
getExImActivity().onExportSolveTimes(EXIM_FORMAT_BACKUP, null, null);
dismiss();
break;
case R.id.export_external:
mFileFormat = EXIM_FORMAT_EXTERNAL;
// Select the single puzzle type and category that will be exported. When the
// call-back from this puzzle chooser is received ("onPuzzleTypeSelected"),
// this dialog will exit and hand control back to the activity to perform the
// export. The call-back uses "getTag()" to tell the chooser to tell the
// activity that the chosen puzzle type/category should be relayed back to this
// dialog fragment.
PuzzleChooserDialog.newInstance(
R.string.action_export, ExportImportDialog.this.getTag())
.show(getActivity().getSupportFragmentManager(), null);
break;
case R.id.import_backup:
mFileFormat = EXIM_FORMAT_BACKUP;
// Select the file to import. When the call-back from this file chooser is
// received ("onFileSelection"), this dialog will exit and hand control back
// to the activity to perform the export. The call-back uses "getTag()" to tell
// the chooser to tell the activity that the chosen puzzle type/category should
// be relayed back to this dialog fragment.
new FileChooserDialog.Builder(getExImActivity())
.chooseButton(R.string.action_choose)
.tag(FRAG_TAG_EXIM_FILECHOOSER)
.show();
break;
case R.id.import_external:
// Show a dialog that explains the required text format, then, when that is
// closed, select the file to import. When the call-back from this file chooser
// is received ("onFileSelection"), this dialog will check that the file name
// is valid. If valid, the puzzle chooser will be shown. When the call-back
// from that puzzle chooser is received ("onPuzzleTypeSelected"), this dialog
// will exit and hand control back to the activity to perform the import.
mFileFormat = EXIM_FORMAT_EXTERNAL;
new MaterialDialog.Builder(getContext())
.title(R.string.import_external_title)
.content(R.string.import_external_content_first)
.positiveText(R.string.action_ok)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog,
@NonNull DialogAction which) {
new FileChooserDialog.Builder(getExImActivity())
.chooseButton(R.string.action_choose)
.tag(FRAG_TAG_EXIM_FILECHOOSER)
.show();
}
})
.show();
break;
case R.id.export_button:
AnimUtils.toggleContentVisibility(exportBackup, exportExternal);
break;
case R.id.import_button:
AnimUtils.toggleContentVisibility(importBackup, importExternal);
break;
//case R.id.help_button:
// break;
}
}
PresetStoreActivity.java 文件源码
项目:Tapad
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void onFileChooserDismissed(@NonNull FileChooserDialog dialog) {
}
MainActivity.java 文件源码
项目:MockLocations
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void initView() {
//设置标题
setActionBarWithTitle(toolbar, getResources().getString(R.string.app_name));
//设置地图
mainPresenter.configBaiduMap();
//绑定轨迹绘制工具
drawTool = new DrawTool(mBaiduMap, this);
//设置初始位置
mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(new LatLng(32.129927, 118.913191)));
//绑定位置模拟显示当前位置,控制模拟线程
mockLocationHelper = new MockLocationHelper(this, mBaiduMap);
RxBus.getDefault().toObserverable(EmulatorPanelView.EmulatorPanelEvent.class)
.subscribe(
new Action1<EmulatorPanelView.EmulatorPanelEvent>() {
@Override
public void call(EmulatorPanelView.EmulatorPanelEvent emulatorPanelEvent) {
if (emulatorPanelEvent.getState() == EmulatorPanelView.EmulatorPanelState.OPEN_FILE) {
new FileChooserDialog.Builder(MainActivity.this)
.chooseButton(R.string.choose_file) // changes label of the choose button
.cancelButton(R.string.cancel)
.initialPath(GpsJsonFileHelper.sAppFolder) // changes initial path, defaults to external storage directory
.mimeType("text/plain") // Optional MIME type filter
.tag("choose-location-file-id")
.show();
//startActivityForResult(new Intent(MainActivity.this, LocationFilesActivity.class), MLConstant.ACTIVITY_REQUEST_CODE.JSON_FILES);
} else {
// ignore , mocklocation helper will take these
}
}
},
new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
Logger.e(throwable, "on EmulatorPanelEvent Error in MainAc");
}
}
);
}
MainActivity.java 文件源码
项目:MockLocations
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void onFileSelection(@NonNull FileChooserDialog dialog, @NonNull File file) {
dialog.dismiss();
mainPresenter.processJson(file.getAbsolutePath());
}
SettingsActivity.java 文件源码
项目:Munch
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void onFileSelection(FileChooserDialog dialog, File file) {
ImportOpmlPresenter.onFileSelected(file);
}
NumberValidation.java 文件源码
项目:androidclient
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void onFileChooserDismissed(@NonNull FileChooserDialog dialog) {
}
GeoJsonPluginActivity.java 文件源码
项目:mapbox-android-demo
阅读 21
收藏 0
点赞 0
评论 0
private void showFileChooserDialog() {
new FileChooserDialog.Builder(this)
.extensionsFilter(".geojson", ".json", ".js", ".txt")
.goUpLabel("Up")
.show();
}
GeoJsonPluginActivity.java 文件源码
项目:mapbox-android-demo
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void onFileSelection(@NonNull FileChooserDialog dialog, @NonNull File file) {
drawFromPath(file);
}
MainActivity.java 文件源码
项目:material-dialogs
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void onFileSelection(FileChooserDialog dialog, File file) {
showToast(file.getAbsolutePath());
}
MainActivity.java 文件源码
项目:material-dialogs
阅读 18
收藏 0
点赞 0
评论 0
@Override
public void onFileChooserDismissed(FileChooserDialog dialog) {
showToast("File chooser dismissed!");
}
MainActivity.java 文件源码
项目:GitHub
阅读 22
收藏 0
点赞 0
评论 0
@Override public void onFileChooserDismissed(@NonNull FileChooserDialog dialog) {
}
GeoJsonActivity.java 文件源码
项目:mapbox-plugins-android
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void onFileChooserDismissed(@NonNull FileChooserDialog dialog) {
}
ExportImportDialog.java 文件源码
项目:TwistyTimer
阅读 19
收藏 0
点赞 0
评论 0
/**
* Gets the activity reference type cast to support the required interfaces and base classes
* for export/import operations.
*
* @return The attached activity, or {@code null} if no activity is attached.
*/
private <A extends AppCompatActivity & FileChooserDialog.FileCallback & ExportImportCallbacks>
A getExImActivity() {
//noinspection unchecked
return (A) getActivity();
}
GeoJsonPluginActivity.java 文件源码
项目:mapbox-android-demo
阅读 23
收藏 0
点赞 0
评论 0
@Override
public void onFileChooserDismissed(@NonNull FileChooserDialog dialog) {
}