本文整理汇总了Java中ru.bartwell.exfilepicker.ExFilePicker类的典型用法代码示例。如果您正苦于以下问题:Java ExFilePicker类的具体用法?Java ExFilePicker怎么用?Java ExFilePicker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExFilePicker类属于ru.bartwell.exfilepicker包,在下文中一共展示了ExFilePicker类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComparator
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
@NonNull
public static FilesListComparator getComparator(ExFilePicker.SortingType sortingType) {
switch (sortingType) {
case NAME_DESC:
return new FilesListNameDescComparator();
case SIZE_ASC:
return new FilesListSizeAscComparator();
case SIZE_DESC:
return new FilesListSizeDescComparator();
case DATE_ASC:
return new FilesListDateAscComparator();
case DATE_DESC:
return new FilesListDateDescComparator();
default:
return new FilesListNameAscComparator();
}
}
示例2: onClick
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
@Override
public void onClick(DialogInterface dialogInterface, int which) {
ExFilePicker.SortingType sortingType = ExFilePicker.SortingType.NAME_ASC;
switch (which) {
case 1:
sortingType = ExFilePicker.SortingType.NAME_DESC;
break;
case 2:
sortingType = ExFilePicker.SortingType.SIZE_ASC;
break;
case 3:
sortingType = ExFilePicker.SortingType.SIZE_DESC;
break;
case 4:
sortingType = ExFilePicker.SortingType.DATE_ASC;
break;
case 5:
sortingType = ExFilePicker.SortingType.DATE_DESC;
break;
}
mOnSortingSelectedListener.onSortingSelected(sortingType);
}
示例3: setupViews
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
private void setupViews() {
mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new FilesListAdapter();
mAdapter.setOnListItemClickListener(this);
mAdapter.setCanChooseOnlyFiles(mChoiceType == ExFilePicker.ChoiceType.FILES);
mAdapter.setUseFirstItemAsUpEnabled(mUseFirstItemAsUpEnabled);
mRecyclerView.setAdapter(mAdapter);
mToolbar = (FilesListToolbar) findViewById(R.id.toolbar);
mToolbar.setOnMenuItemClickListener(this);
mToolbar.setNavigationOnClickListener(this);
mToolbar.setQuitButtonEnabled(mIsQuitButtonEnabled);
mToolbar.setMultiChoiceModeEnabled(false);
Menu menu = mToolbar.getMenu();
setupOkButtonVisibility();
menu.findItem(R.id.new_folder).setVisible(!mIsNewFolderButtonDisabled);
menu.findItem(R.id.sort).setVisible(!mIsSortButtonDisabled);
mEmptyView = findViewById(R.id.empty_view);
}
示例4: getFromIntent
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
@Nullable
public static ExFilePickerResult getFromIntent(@Nullable Intent intent) {
if (intent != null) {
return intent.getParcelableExtra(ExFilePicker.EXTRA_RESULT);
}
return null;
}
示例5: onListItemLongClick
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
@Override
public void onListItemLongClick(int position) {
if (!mIsMultiChoiceModeEnabled && position != OnListItemClickListener.POSITION_UP) {
mIsMultiChoiceModeEnabled = true;
if (mChoiceType != ExFilePicker.ChoiceType.FILES || !mAdapter.getItem(position).isDirectory()) {
mAdapter.setItemSelected(position, true);
}
setMultiChoiceModeEnabled(true);
}
}
示例6: onMenuItemClick
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
@Override
public boolean onMenuItemClick(@NonNull MenuItem item) {
int itemId = item.getItemId();
if (itemId == R.id.ok) {
if (mIsMultiChoiceModeEnabled) {
finishWithResult(mCurrentDirectory, mAdapter.getSelectedItems());
} else if (mChoiceType == ExFilePicker.ChoiceType.DIRECTORIES) {
if (isTopDirectory(mCurrentDirectory)) {
finishWithResult(mCurrentDirectory, "/");
} else {
finishWithResult(mCurrentDirectory.getParentFile(), mCurrentDirectory.getName());
}
}
} else if (itemId == R.id.sort) {
SortingDialog dialog = new SortingDialog(this);
dialog.setOnSortingSelectedListener(this);
dialog.show();
} else if (itemId == R.id.new_folder) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
showNewFolderDialog();
} else {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CODE_WRITE_EXTERNAL_STORAGE);
}
} else if (itemId == R.id.select_all) {
mAdapter.selectAll();
} else if (itemId == R.id.deselect) {
mAdapter.deselect();
} else if (itemId == R.id.invert_selection) {
mAdapter.invertSelection();
} else if (itemId == R.id.change_view) {
toggleViewMode();
} else {
return false;
}
return true;
}
示例7: handleIntent
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
private void handleIntent() {
Intent intent = getIntent();
mCanChooseOnlyOneItem = intent.getBooleanExtra(EXTRA_CAN_CHOOSE_ONLY_ONE_ITEM, false);
mShowOnlyExtensions = intent.getStringArrayExtra(EXTRA_SHOW_ONLY_EXTENSIONS);
mExceptExtensions = intent.getStringArrayExtra(EXTRA_EXCEPT_EXTENSIONS);
mIsNewFolderButtonDisabled = intent.getBooleanExtra(EXTRA_IS_NEW_FOLDER_BUTTON_DISABLED, false);
mIsSortButtonDisabled = intent.getBooleanExtra(EXTRA_IS_SORT_BUTTON_DISABLED, false);
mIsQuitButtonEnabled = intent.getBooleanExtra(EXTRA_IS_QUIT_BUTTON_ENABLED, false);
mChoiceType = (ExFilePicker.ChoiceType) intent.getSerializableExtra(EXTRA_CHOICE_TYPE);
mSortingType = (ExFilePicker.SortingType) intent.getSerializableExtra(EXTRA_SORTING_TYPE);
mCurrentDirectory = getStartDirectory(intent);
mUseFirstItemAsUpEnabled = intent.getBooleanExtra(EXTRA_USE_FIRST_ITEM_AS_UP_ENABLED, false);
mHideHiddenFiles = intent.getBooleanExtra(EXTRA_HIDE_HIDDEN_FILES, false);
}
示例8: finishWithResult
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
private void finishWithResult(@NonNull File path, @NonNull List<String> files) {
String resultPath = path.getAbsolutePath();
if (!resultPath.endsWith("/")) {
resultPath += "/";
}
ExFilePickerResult result = new ExFilePickerResult(resultPath, files);
Intent intent = new Intent();
intent.putExtra(ExFilePicker.EXTRA_RESULT, result);
setResult(RESULT_OK, intent);
finish();
}
示例9: onClick
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
@Override
public void onClick(@NonNull View v) {
ExFilePicker exFilePicker = new ExFilePicker();
if (((AppCompatCheckBox) findViewById(R.id.only_one_item)).isChecked()) {
exFilePicker.setCanChooseOnlyOneItem(true);
}
if (((AppCompatCheckBox) findViewById(R.id.filter_listed)).isChecked()) {
exFilePicker.setShowOnlyExtensions("jpg", "jpeg");
}
if (((AppCompatCheckBox) findViewById(R.id.filter_exclude)).isChecked()) {
exFilePicker.setExceptExtensions("jpg");
}
if (((AppCompatCheckBox) findViewById(R.id.disable_new_folder_button)).isChecked()) {
exFilePicker.setNewFolderButtonDisabled(true);
}
if (((AppCompatCheckBox) findViewById(R.id.disable_sort_button)).isChecked()) {
exFilePicker.setSortButtonDisabled(true);
}
if (((AppCompatCheckBox) findViewById(R.id.enable_quit_button)).isChecked()) {
exFilePicker.setQuitButtonEnabled(true);
}
if (((AppCompatCheckBox) findViewById(R.id.reverse_sorting)).isChecked()) {
exFilePicker.setSortingType(ExFilePicker.SortingType.NAME_DESC);
}
if (((AppCompatCheckBox) findViewById(R.id.start_from_root)).isChecked()) {
exFilePicker.setStartDirectory("/");
}
if (((AppCompatCheckBox) findViewById(R.id.first_item_as_up)).isChecked()) {
exFilePicker.setUseFirstItemAsUpEnabled(true);
}
if (((AppCompatCheckBox) findViewById(R.id.hide_hidden_files)).isChecked()) {
exFilePicker.setHideHiddenFilesEnabled(true);
}
int checkedChoiceRadio = ((RadioGroup) findViewById(R.id.choice_type)).getCheckedRadioButtonId();
if (checkedChoiceRadio == R.id.choice_type_files) {
exFilePicker.setChoiceType(ExFilePicker.ChoiceType.FILES);
} else if (checkedChoiceRadio == R.id.choice_type_directories) {
exFilePicker.setChoiceType(ExFilePicker.ChoiceType.DIRECTORIES);
}
exFilePicker.start(this, EX_FILE_PICKER_RESULT);
}
示例10: setItems
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
public void setItems(@NonNull List<File> items, @NonNull ExFilePicker.SortingType sortingType) {
mSelectedItems.clear();
mItems.clear();
mItems.addAll(items);
sort(sortingType);
}
示例11: sort
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
public void sort(@NonNull ExFilePicker.SortingType sortingType) {
Collections.sort(mItems, FilesListComparatorHelper.getComparator(sortingType));
notifyDataSetChanged();
}
示例12: onSortingSelected
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
@Override
public void onSortingSelected(@NonNull ExFilePicker.SortingType sortingType) {
mSortingType = sortingType;
mAdapter.sort(mSortingType);
}
示例13: setupOkButtonVisibility
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
private void setupOkButtonVisibility() {
mToolbar.getMenu().findItem(R.id.ok).setVisible(mChoiceType == ExFilePicker.ChoiceType.DIRECTORIES);
}
示例14: onSortingSelected
import ru.bartwell.exfilepicker.ExFilePicker; //导入依赖的package包/类
void onSortingSelected(ExFilePicker.SortingType sortingType);