Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
private final long footerId = UUID.randomUUID().getLeastSignificantBits();
private final long headerId = UUID.randomUUID().getLeastSignificantBits();

private List<OCFile> recommendedFiles = new ArrayList<>();
private final List<OCFile> recommendedFiles = new ArrayList<>();
private RecommendedFilesAdapter recommendedFilesAdapter;
private final OCFileListAdapterHelper helper = new OCFileListAdapterHelper();
private final ThumbnailGenerator thumbnailGenerator;
Expand Down Expand Up @@ -189,7 +189,7 @@ public OCFileListAdapter(

setHasStableIds(true);

// initialise thumbnails cache on background thread
// initialize thumbnails cache on background thread
ThumbnailsCacheManager.initDiskCacheAsync();
isRTL = DisplayUtils.isRTL();
}
Expand Down Expand Up @@ -936,6 +936,7 @@ public void setSortOrder(@Nullable OCFile folder, @NonNull FileSortOrder sortOrd
this.sortOrder = sortOrder;
}

@NonNull
public Set<OCFile> getCheckedItems() {
return ocFileListDelegate.getCheckedItems();
}
Expand Down Expand Up @@ -997,15 +998,15 @@ public boolean shouldCallGeneratedCallback(String tag, Object callContext) {
return ((ImageView) callContext).getTag().equals(tag);
}

public boolean isCheckedFile(OCFile file) {
public boolean isCheckedFile(@NonNull OCFile file) {
return ocFileListDelegate.isCheckedFile(file);
}

public void addCheckedFile(OCFile file) {
public void addCheckedFile(@NonNull OCFile file) {
ocFileListDelegate.addCheckedFile(file);
}

public void setHighlightedItem(OCFile file) {
public void setHighlightedItem(@NonNull OCFile file) {
ocFileListDelegate.setHighlightedItem(file);
}

Expand All @@ -1023,7 +1024,7 @@ public void setShowMetadata(boolean bool) {

@NonNull
@Override
public String getPopupText(View view, int position) {
public String getPopupText(@NonNull View view, int position) {
OCFile file = getItem(position);

if (file == null || sortOrder == null) {
Expand Down Expand Up @@ -1073,7 +1074,8 @@ public void setCurrentDirectory(OCFile folder) {
// payload only for local file indicator
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position, @NonNull List<Object> payloads) {
if (!payloads.isEmpty() && payloads.get(0) instanceof Integer iconId && holder instanceof ListViewHolder listViewHolder) {
if (!payloads.isEmpty() && payloads.get(0) instanceof Integer iconId &&
holder instanceof ListViewHolder listViewHolder) {
listViewHolder.getLocalFileIndicator().setImageResource(iconId);
listViewHolder.getLocalFileIndicator().setVisibility(View.VISIBLE);
// skip full rebind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ protected enum MenuItemAddRemove {

protected MenuItemAddRemove menuItemAddRemoveValue = MenuItemAddRemove.ADD_GRID_AND_SORT_WITH_SEARCH;

private List<MenuItem> mOriginalMenuItems = new ArrayList<>();
private final List<MenuItem> mOriginalMenuItems = new ArrayList<>();

private static OCFileDepth fileDepth = OCFileDepth.Root;

Expand Down Expand Up @@ -311,14 +311,14 @@ public void onAttach(@NonNull Context context) {
try {
mContainerActivity = (FileFragment.ContainerActivity) context;
} catch (ClassCastException e) {
throw new IllegalArgumentException(context.toString() + " must implement " +
throw new IllegalArgumentException(context + " must implement " +
FileFragment.ContainerActivity.class.getSimpleName(), e);
}
try {
setOnRefreshListener((OnEnforceableRefreshListener) context);

} catch (ClassCastException e) {
throw new IllegalArgumentException(context.toString() + " must implement " +
throw new IllegalArgumentException(context + " must implement " +
OnEnforceableRefreshListener.class.getSimpleName(), e);
}
}
Expand Down Expand Up @@ -577,7 +577,7 @@ public void uploadFromApp() {
action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
action.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);

getActivity().startActivityForResult(
requireActivity().startActivityForResult(
Intent.createChooser(action, getString(R.string.upload_chooser_title)),
FileDisplayActivity.REQUEST_CODE__SELECT_CONTENT_FROM_APPS
);
Expand Down Expand Up @@ -767,8 +767,9 @@ public void onHeaderClicked() {
}

@Override
public void showTemplate(@NonNull Creator creator, @NonNull String headline) {
ChooseTemplateDialogFragment.newInstance(mFile, creator, headline).show(requireActivity().getSupportFragmentManager(),
public void showTemplate(Creator creator, String headline) {
ChooseTemplateDialogFragment.newInstance(mFile, creator, headline).show(requireActivity()
.getSupportFragmentManager(),
DIALOG_CREATE_DOCUMENT);
}

Expand Down Expand Up @@ -910,7 +911,9 @@ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
final int checkedCount = checkedFiles.size();

if (mActiveActionMode != null) {
String title = getResources().getQuantityString(R.plurals.items_selected_count, checkedCount, checkedCount);
String title = getResources().getQuantityString(R.plurals.items_selected_count,
checkedCount,
checkedCount);
mActiveActionMode.setTitle(title);
}

Expand Down Expand Up @@ -984,7 +987,7 @@ protected void setChoiceModeAsMultipleModal(Bundle savedInstanceState) {
if (savedInstanceState != null) {
mMultiChoiceModeListener.loadStateFrom(savedInstanceState);
}
((FileActivity) getActivity()).addDrawerListener(mMultiChoiceModeListener);
((FileActivity) requireActivity()).addDrawerListener(mMultiChoiceModeListener);
}

/**
Expand Down Expand Up @@ -1132,7 +1135,9 @@ public boolean onLongItemClicked(OCFile file) {

private void folderOnItemClick(OCFile file, int position) {
if (requireActivity() instanceof FolderPickerActivity fpa) {
String filenameErrorMessage = FileNameValidator.INSTANCE.checkFileName(file.getFileName(), getCapabilities(), requireContext());
String filenameErrorMessage = FileNameValidator.INSTANCE.checkFileName(file.getFileName(),
getCapabilities(),
requireContext());
if (filenameErrorMessage != null) {
DisplayUtils.showSnackMessage(fpa, filenameErrorMessage);
return;
Expand Down Expand Up @@ -1329,7 +1334,7 @@ public boolean onFileActionChosen(@IdRes final int itemId, Set<OCFile> checkedFi
return true;
} else if (itemId == R.id.action_rename_file) {
RenameFileDialogFragment dialog = RenameFileDialogFragment.newInstance(singleFile, mFile);
dialog.show(getFragmentManager(), FileDetailFragment.FTAG_RENAME_FILE);
dialog.show(requireFragmentManager(), FileDetailFragment.FTAG_RENAME_FILE);
return true;
} else if (itemId == R.id.action_see_details) {
if (mActiveActionMode != null) {
Expand Down Expand Up @@ -1368,7 +1373,7 @@ public boolean onFileActionChosen(@IdRes final int itemId, Set<OCFile> checkedFi
if (itemId == R.id.action_remove_file) {
RemoveFilesDialogFragment dialog =
RemoveFilesDialogFragment.newInstance(new ArrayList<>(checkedFiles), mActiveActionMode);
dialog.show(getFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION);
dialog.show(requireFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION);
return true;
} else if (itemId == R.id.action_download_file || itemId == R.id.action_sync_file) {
syncAndCheckFiles(checkedFiles);
Expand Down Expand Up @@ -1462,7 +1467,7 @@ private void pickFolderForMoveOrCopy(final Set<OCFile> checkedFiles) {
action.putExtra(FolderPickerActivity.EXTRA_FOLDER, getCurrentFile());
action.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); // No animation since we stay in the same folder
action.putExtra(FolderPickerActivity.EXTRA_ACTION, extraAction);
getActivity().startActivityForResult(action, requestCode);
requireActivity().startActivityForResult(action, requestCode);
}


Expand Down
Loading