Skip to content

Commit

Permalink
Merge pull request #2039 from nextcloud/replaceListWithRecyclerView
Browse files Browse the repository at this point in the history
Replace list with recycler view
  • Loading branch information
tobiasKaminsky authored Mar 23, 2018
2 parents 0d63edb + 17203b1 commit f2f5b7d
Show file tree
Hide file tree
Showing 87 changed files with 2,879 additions and 3,116 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ dependencies {
implementation 'org.lukhnos:nnio:0.2'
implementation 'com.madgag.spongycastle:pkix:1.54.0.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.afollestad:sectioned-recyclerview:0.5.0'

// uncomment for gplay
// implementation "com.google.firebase:firebase-messaging:${googleLibraryVersion}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint/lint-results.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 134 warnings</span>
<span class="mdl-layout-title">Lint Report: 132 warnings</span>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.Vector;

public class FileDataStorageManager {

Expand Down Expand Up @@ -151,34 +150,33 @@ public boolean fileExists(String path) {
}


public Vector<OCFile> getFolderContent(OCFile f, boolean onlyOnDevice) {
public List<OCFile> getFolderContent(OCFile f, boolean onlyOnDevice) {
if (f != null && f.isFolder() && f.getFileId() != -1) {
return getFolderContent(f.getFileId(), onlyOnDevice);

} else {
return new Vector<OCFile>();
return new ArrayList<>();
}
}


public Vector<OCFile> getFolderImages(OCFile folder, boolean onlyOnDevice) {
Vector<OCFile> ret = new Vector<OCFile>();
public List<OCFile> getFolderImages(OCFile folder, boolean onlyOnDevice) {
List<OCFile> ret = new ArrayList<>();

if (folder != null) {
// TODO better implementation, filtering in the access to database instead of here
Vector<OCFile> tmp = getFolderContent(folder, onlyOnDevice);
OCFile current = null;
for (int i = 0; i < tmp.size(); i++) {
current = tmp.get(i);
if (MimeTypeUtil.isImage(current)) {
ret.add(current);
List<OCFile> tmp = getFolderContent(folder, onlyOnDevice);

for (OCFile file : tmp) {
if (MimeTypeUtil.isImage(file)) {
ret.add(file);
}
}
}
return ret;
}

public boolean saveFile(OCFile file) {
boolean overriden = false;
boolean overridden = false;
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.FILE_MODIFIED, file.getModificationTimestamp());
cv.put(
Expand Down Expand Up @@ -222,7 +220,7 @@ public boolean saveFile(OCFile file) {
oldFile = getFileById(file.getFileId());
}

overriden = true;
overridden = true;
if (getContentResolver() != null) {
getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv,
ProviderTableMeta._ID + "=?",
Expand Down Expand Up @@ -253,7 +251,7 @@ public boolean saveFile(OCFile file) {
}
}

return overriden;
return overridden;
}

/**
Expand Down Expand Up @@ -571,7 +569,7 @@ private boolean removeLocalFolder(OCFile folder) {
File localFolder = new File(localFolderPath);
if (localFolder.exists()) {
// stage 1: remove the local files already registered in the files database
Vector<OCFile> files = getFolderContent(folder.getFileId(), false);
List<OCFile> files = getFolderContent(folder.getFileId(), false);
if (files != null) {
for (OCFile file : files) {
if (file.isFolder()) {
Expand Down Expand Up @@ -810,12 +808,12 @@ public void migrateStoredFiles(String srcPath, String dstPath) throws Exception
}
}

private Vector<OCFile> getFolderContent(long parentId, boolean onlyOnDevice) {
private List<OCFile> getFolderContent(long parentId, boolean onlyOnDevice) {

Vector<OCFile> ret = new Vector<>();
List<OCFile> ret = new ArrayList<>();

Uri req_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, String.valueOf(parentId));
Cursor c = null;
Cursor c;

if (getContentProviderClient() != null) {
try {
Expand Down Expand Up @@ -1610,7 +1608,7 @@ private ArrayList<ContentProviderOperation> prepareRemoveSharesInFolder(
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?";
String[] whereArgs = new String[]{"", mAccount.name};

Vector<OCFile> files = getFolderContent(folder, false);
List<OCFile> files = getFolderContent(folder, false);

for (OCFile file : files) {
whereArgs[0] = file.getRemotePath();
Expand Down Expand Up @@ -2135,8 +2133,8 @@ public void saveVirtual(VirtualFolderType type, OCFile file) {
}
}

public Vector<OCFile> getVirtualFolderContent(VirtualFolderType type, boolean onlyImages) {
Vector<OCFile> ocFiles = new Vector<>();
public List<OCFile> getVirtualFolderContent(VirtualFolderType type, boolean onlyImages) {
List<OCFile> ocFiles = new ArrayList<>();
Uri req_uri = ProviderTableMeta.CONTENT_URI_VIRTUAL;
Cursor c;

Expand Down Expand Up @@ -2175,12 +2173,11 @@ public Vector<OCFile> getVirtualFolderContent(VirtualFolderType type, boolean on
}

if (onlyImages) {
OCFile current;
Vector<OCFile> temp = new Vector<>();
for (int i=0; i < ocFiles.size(); i++) {
current = ocFiles.get(i);
if (MimeTypeUtil.isImage(current)) {
temp.add(current);
List<OCFile> temp = new ArrayList<>();

for (OCFile file : temp) {
if (MimeTypeUtil.isImage(file)) {
temp.add(file);
}
}
ocFiles = temp;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/owncloud/android/datamodel/OCFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public String getFileName() {
* directory
*/
public void setFileName(String name) {
Log_OC.d(TAG, "OCFile name changin from " + mRemotePath);
Log_OC.d(TAG, "OCFile name changing from " + mRemotePath);
if (name != null && name.length() > 0 && !name.contains(PATH_SEPARATOR) &&
!mRemotePath.equals(ROOT_PATH)) {
String parent = (new File(getRemotePath())).getParent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Vector;
import java.util.List;

/**
* Job that backup contacts to /Contacts-Backup and deletes files older than x days
Expand Down Expand Up @@ -184,7 +184,7 @@ private void expireFiles(Integer daysToExpire, String backupFolderString, Accoun
Log_OC.d(TAG, "expire: " + daysToExpire + " " + backupFolder.getFileName());
}

Vector<OCFile> backups = storageManager.getFolderContent(backupFolder, false);
List<OCFile> backups = storageManager.getFolderContent(backupFolder, false);

for (OCFile backup : backups) {
if (timestampToExpire > backup.getModificationTimestamp()) {
Expand Down
Loading

0 comments on commit f2f5b7d

Please sign in to comment.