Reduce spotbugs

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2023-12-13 14:15:10 +01:00 committed by Alper Öztürk (Rebase PR Action)
parent 82c74f0404
commit ae5df18ea4
2 changed files with 17 additions and 34 deletions

View file

@ -260,24 +260,6 @@ public final class ThumbnailsCacheManager {
return null;
}
public static class GalleryImageGenerationTaskObject {
private final OCFile file;
private final String imageKey;
public GalleryImageGenerationTaskObject(OCFile file, String imageKey) {
this.file = file;
this.imageKey = imageKey;
}
private OCFile getFile() {
return file;
}
private String getImageKey() {
return imageKey;
}
}
public static class GalleryImageGenerationTask extends AsyncTask<Object, Void, Bitmap> {
private final User user;
private final FileDataStorageManager storageManager;

View file

@ -313,6 +313,21 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
return mFiles.size() + (shouldShowHeader() ? 2 : 1);
}
@Nullable
public OCFile getItem(int position) {
int newPosition = position;
if (shouldShowHeader() && position > 0) {
newPosition = position - 1;
}
if (newPosition >= mFiles.size()) {
return null;
}
return mFiles.get(newPosition);
}
@Override
public int getItemViewType(int position) {
if (shouldShowHeader() && position == 0) {
@ -636,21 +651,6 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
return output;
}
public @Nullable
OCFile getItem(int position) {
int newPosition = position;
if (shouldShowHeader() && position > 0) {
newPosition = position - 1;
}
if (newPosition >= mFiles.size()) {
return null;
}
return mFiles.get(newPosition);
}
public boolean shouldShowHeader() {
if (currentDirectory == null) {
return false;
@ -679,7 +679,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
@NonNull User account,
@NonNull OCFile directory,
@NonNull FileDataStorageManager updatedStorageManager,
boolean onlyOnDevice, @NonNull String limitToMimeType) {
boolean onlyOnDevice,
@NonNull String limitToMimeType) {
this.onlyOnDevice = onlyOnDevice;
if (!updatedStorageManager.equals(mStorageManager)) {