diff --git a/androidTest/java/com/owncloud/android/datamodel/OCFileUnitTest.java b/androidTest/java/com/owncloud/android/datamodel/OCFileUnitTest.java
index a66dac922f..725f855553 100644
--- a/androidTest/java/com/owncloud/android/datamodel/OCFileUnitTest.java
+++ b/androidTest/java/com/owncloud/android/datamodel/OCFileUnitTest.java
@@ -85,7 +85,7 @@ public class OCFileUnitTest {
mFile.setModificationTimestampAtLastSyncForData(MODIFICATION_TIMESTAMP_AT_LAST_SYNC_FOR_DATA);
mFile.setLastSyncDateForProperties(LAST_SYNC_DATE_FOR_PROPERTIES);
mFile.setLastSyncDateForData(LAST_SYNC_DATE_FOR_DATA);
- mFile.setFavorite(true);
+ mFile.setAvailableOffline(true);
mFile.setEtag(ETAG);
mFile.setShareViaLink(true);
mFile.setShareWithSharee(true);
@@ -120,7 +120,7 @@ public class OCFileUnitTest {
);
assertThat(fileReadFromParcel.getLastSyncDateForProperties(), is(LAST_SYNC_DATE_FOR_PROPERTIES));
assertThat(fileReadFromParcel.getLastSyncDateForData(), is(LAST_SYNC_DATE_FOR_DATA));
- assertThat(fileReadFromParcel.isFavorite(), is(true));
+ assertThat(fileReadFromParcel.setAvailableOffline(), is(true));
assertThat(fileReadFromParcel.getEtag(), is(ETAG));
assertThat(fileReadFromParcel.isSharedViaLink(), is(true));
assertThat(fileReadFromParcel.isSharedWithSharee(), is(true));
diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileListView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileListView.java
index 3c33864e0b..024f251f3f 100644
--- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileListView.java
+++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileListView.java
@@ -89,7 +89,7 @@ public class FileListView {
private static String localFileIndicator =
"com.owncloud.android:id/localFileIndicator";
private static String favoriteFileIndicator =
- "com.owncloud.android:id/favoriteIcon";
+ "com.owncloud.android:id/keptOfflineIcon";
private static String sharedElementIndicator =
"com.owncloud.android:id/sharedIcon";
diff --git a/build.gradle b/build.gradle
index f0c7c4111e..7408ef9ccf 100644
--- a/build.gradle
+++ b/build.gradle
@@ -23,6 +23,11 @@ apply plugin: 'checkstyle'
apply plugin: 'pmd'
apply plugin: 'findbugs'
+configurations.all {
+ // check for updates every build
+ resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
+}
+
ext {
supportLibraryVersion = '25.0.0'
@@ -173,7 +178,6 @@ dependencies {
compile name: 'touch-image-view'
compile 'com.android.support:multidex:1.0.1'
-
compile 'com.github.nextcloud:android-library:1.0.14'
compile "com.android.support:support-v4:${supportLibraryVersion}"
compile "com.android.support:design:${supportLibraryVersion}"
@@ -187,6 +191,10 @@ dependencies {
compile 'com.github.evernote:android-job:v1.1.8'
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
+ compile 'org.greenrobot:eventbus:3.0.0'
+
+ compile 'org.parceler:parceler-api:1.1.6'
+ annotationProcessor 'org.parceler:parceler:1.1.6'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.caverock:androidsvg:1.2.1'
@@ -202,7 +210,7 @@ dependencies {
androidTestCompile 'com.android.support.test:runner:0.5'
// Android Annotation Support
- androidTestCompile "com.android.support:support-annotations:25.0.0"
+ androidTestCompile "com.android.support:support-annotations:${supportLibraryVersion}"
// Espresso core
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
diff --git a/drawable_resources/ic_list_empty_error.svg b/drawable_resources/ic_list_empty_error.svg
new file mode 100644
index 0000000000..0f2a0360be
--- /dev/null
+++ b/drawable_resources/ic_list_empty_error.svg
@@ -0,0 +1,56 @@
+
+
diff --git a/drawable_resources/ic_list_empty_home.svg b/drawable_resources/ic_list_empty_home.svg
new file mode 100644
index 0000000000..aa11e74102
--- /dev/null
+++ b/drawable_resources/ic_list_empty_home.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/drawable_resources/ic_list_empty_image.svg b/drawable_resources/ic_list_empty_image.svg
new file mode 100644
index 0000000000..bbaa5b6e3f
--- /dev/null
+++ b/drawable_resources/ic_list_empty_image.svg
@@ -0,0 +1,58 @@
+
+
diff --git a/drawable_resources/ic_list_empty_recent.svg b/drawable_resources/ic_list_empty_recent.svg
new file mode 100644
index 0000000000..8a40be5fa5
--- /dev/null
+++ b/drawable_resources/ic_list_empty_recent.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/drawable_resources/ic_list_empty_shared.svg b/drawable_resources/ic_list_empty_shared.svg
new file mode 100644
index 0000000000..e64e6ab64c
--- /dev/null
+++ b/drawable_resources/ic_list_empty_shared.svg
@@ -0,0 +1,56 @@
+
+
diff --git a/drawable_resources/ic_list_empty_video.svg b/drawable_resources/ic_list_empty_video.svg
new file mode 100644
index 0000000000..b2372ef628
--- /dev/null
+++ b/drawable_resources/ic_list_empty_video.svg
@@ -0,0 +1,58 @@
+
+
diff --git a/drawable_resources/ic_star_light_grey.svg b/drawable_resources/ic_star_light_grey.svg
new file mode 100644
index 0000000000..f1d57fb690
--- /dev/null
+++ b/drawable_resources/ic_star_light_grey.svg
@@ -0,0 +1,57 @@
+
+
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 554db405e4..f36e070336 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,4 +1,4 @@
-#Thu Mar 16 17:57:46 CET 2017
+#Wed Mar 15 00:10:20 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
diff --git a/src/main/java/com/owncloud/android/authentication/AccountUtils.java b/src/main/java/com/owncloud/android/authentication/AccountUtils.java
index 7a3043bd2e..1f536492f8 100644
--- a/src/main/java/com/owncloud/android/authentication/AccountUtils.java
+++ b/src/main/java/com/owncloud/android/authentication/AccountUtils.java
@@ -182,6 +182,7 @@ public class AccountUtils {
if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(authTokenType)) {
return SAML_SSO_PATH;
}
+
return WEBDAV_PATH_4_0_AND_LATER;
}
return null;
@@ -322,14 +323,12 @@ public class AccountUtils {
}
public static boolean hasSearchUsersSupport(Account account){
- OwnCloudVersion serverVersion = null;
- if (account != null) {
- AccountManager accountMgr = AccountManager.get(MainApp.getAppContext());
- String serverVersionStr = accountMgr.getUserData(account, Constants.KEY_OC_VERSION);
- if (serverVersionStr != null) {
- serverVersion = new OwnCloudVersion(serverVersionStr);
- }
- }
- return (serverVersion != null ? serverVersion.isSearchUsersSupported() : false);
+ OwnCloudVersion serverVersion = getServerVersion(account);
+ return (serverVersion != null && serverVersion.isSearchUsersSupported());
+ }
+
+ public static boolean hasSearchSupport(Account account) {
+ OwnCloudVersion serverVersion = getServerVersion(account);
+ return (serverVersion != null && serverVersion.isSearchSupported());
}
}
diff --git a/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java b/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java
index cb33f54b72..f3a71caef7 100644
--- a/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java
+++ b/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java
@@ -190,7 +190,7 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, file.getLastSyncDateForData());
- cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isFavorite() ? 1 : 0);
+ cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isAvailableOffline() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_ETAG, file.getEtag());
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, file.isSharedViaLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, file.isSharedWithSharee() ? 1 : 0);
@@ -303,7 +303,7 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, file.getLastSyncDateForData());
- cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isFavorite() ? 1 : 0);
+ cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isAvailableOffline() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_ETAG, file.getEtag());
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, file.isSharedViaLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, file.isSharedWithSharee() ? 1 : 0);
@@ -313,6 +313,7 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, file.needsUpdateThumbnail());
cv.put(ProviderTableMeta.FILE_IS_DOWNLOADING, file.isDownloading());
cv.put(ProviderTableMeta.FILE_ETAG_IN_CONFLICT, file.getEtagInConflict());
+ cv.put(ProviderTableMeta.FILE_FAVORITE, file.getIsFavorite());
boolean existsByPath = fileExists(file.getRemotePath());
if (existsByPath || fileExists(file.getFileId())) {
@@ -380,13 +381,14 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, folder.getLastSyncDateForProperties());
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, folder.getLastSyncDateForData());
- cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, folder.isFavorite() ? 1 : 0);
+ cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, folder.isAvailableOffline() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_ETAG, folder.getEtag());
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, folder.isSharedViaLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, folder.isSharedWithSharee() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, folder.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, folder.getPermissions());
cv.put(ProviderTableMeta.FILE_REMOTE_ID, folder.getRemoteId());
+ cv.put(ProviderTableMeta.FILE_FAVORITE, folder.getIsFavorite());
operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI).
withValues(cv).
@@ -895,7 +897,7 @@ public class FileDataStorageManager {
c.getColumnIndex(ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA)));
file.setLastSyncDateForProperties(c.getLong(c.getColumnIndex(ProviderTableMeta.FILE_LAST_SYNC_DATE)));
file.setLastSyncDateForData(c.getLong(c.getColumnIndex(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA)));
- file.setFavorite(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_KEEP_IN_SYNC)) == 1 ? true : false);
+ file.setAvailableOffline(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_KEEP_IN_SYNC)) == 1 ? true : false);
file.setEtag(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_ETAG)));
file.setShareViaLink(c.getInt(
c.getColumnIndex(ProviderTableMeta.FILE_SHARED_VIA_LINK)) == 1 ? true : false);
@@ -909,6 +911,7 @@ public class FileDataStorageManager {
file.setDownloading(c.getInt(
c.getColumnIndex(ProviderTableMeta.FILE_IS_DOWNLOADING)) == 1 ? true : false);
file.setEtagInConflict(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_ETAG_IN_CONFLICT)));
+ file.setFavorite(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_FAVORITE)) == 1 ? true : false);
}
return file;
@@ -1315,13 +1318,14 @@ public class FileDataStorageManager {
ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA,
file.getLastSyncDateForData()
);
- cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isFavorite() ? 1 : 0);
+ cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isAvailableOffline() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_ETAG, file.getEtag());
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, file.isSharedViaLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, file.isSharedWithSharee() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, file.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, file.getPermissions());
cv.put(ProviderTableMeta.FILE_REMOTE_ID, file.getRemoteId());
+ cv.put(ProviderTableMeta.FILE_FAVORITE, file.getIsFavorite());
cv.put(
ProviderTableMeta.FILE_UPDATE_THUMBNAIL,
file.needsUpdateThumbnail() ? 1 : 0
diff --git a/src/main/java/com/owncloud/android/datamodel/OCFile.java b/src/main/java/com/owncloud/android/datamodel/OCFile.java
index b260671300..5efc357b8a 100644
--- a/src/main/java/com/owncloud/android/datamodel/OCFile.java
+++ b/src/main/java/com/owncloud/android/datamodel/OCFile.java
@@ -74,7 +74,7 @@ public class OCFile implements Parcelable, Comparable {
private boolean mNeedsUpdating;
private long mLastSyncDateForProperties;
private long mLastSyncDateForData;
- private boolean mFavorite;
+ private boolean mAvailableOffline;
private String mEtag;
@@ -92,6 +92,8 @@ public class OCFile implements Parcelable, Comparable {
private boolean mShareWithSharee;
+ private boolean mIsFavorite;
+
/**
* URI to the local path of the file contents, if stored in the device; cached after first call
* to {@link #getStorageUri()}
@@ -139,7 +141,7 @@ public class OCFile implements Parcelable, Comparable {
mLocalPath = source.readString();
mMimeType = source.readString();
mNeedsUpdating = source.readInt() == 0;
- mFavorite = source.readInt() == 1;
+ mAvailableOffline = source.readInt() == 1;
mLastSyncDateForProperties = source.readLong();
mLastSyncDateForData = source.readLong();
mEtag = source.readString();
@@ -151,7 +153,7 @@ public class OCFile implements Parcelable, Comparable {
mIsDownloading = source.readInt() == 1;
mEtagInConflict = source.readString();
mShareWithSharee = source.readInt() == 1;
-
+ mIsFavorite = source.readInt() == 1;
}
@Override
@@ -166,7 +168,7 @@ public class OCFile implements Parcelable, Comparable {
dest.writeString(mLocalPath);
dest.writeString(mMimeType);
dest.writeInt(mNeedsUpdating ? 1 : 0);
- dest.writeInt(mFavorite ? 1 : 0);
+ dest.writeInt(mAvailableOffline ? 1 : 0);
dest.writeLong(mLastSyncDateForProperties);
dest.writeLong(mLastSyncDateForData);
dest.writeString(mEtag);
@@ -178,6 +180,15 @@ public class OCFile implements Parcelable, Comparable {
dest.writeInt(mIsDownloading ? 1 : 0);
dest.writeString(mEtagInConflict);
dest.writeInt(mShareWithSharee ? 1 : 0);
+ dest.writeInt(mIsFavorite ? 1 : 0);
+ }
+
+ public boolean getIsFavorite() {
+ return mIsFavorite;
+ }
+
+ public void setFavorite(boolean mIsFavorite) {
+ this.mIsFavorite = mIsFavorite;
}
/**
@@ -412,7 +423,7 @@ public class OCFile implements Parcelable, Comparable {
mModifiedTimestampAtLastSyncForData = 0;
mLastSyncDateForProperties = 0;
mLastSyncDateForData = 0;
- mFavorite = false;
+ mAvailableOffline = false;
mNeedsUpdating = false;
mEtag = null;
mShareByLink = false;
@@ -423,6 +434,7 @@ public class OCFile implements Parcelable, Comparable {
mIsDownloading = false;
mEtagInConflict = null;
mShareWithSharee = false;
+ mIsFavorite = false;
}
/**
@@ -521,12 +533,12 @@ public class OCFile implements Parcelable, Comparable {
mLastSyncDateForData = lastSyncDate;
}
- public void setFavorite(boolean favorite) {
- mFavorite = favorite;
+ public void setAvailableOffline(boolean availableOffline) {
+ mAvailableOffline = availableOffline;
}
- public boolean isFavorite() {
- return mFavorite;
+ public boolean isAvailableOffline() {
+ return mAvailableOffline;
}
@Override
@@ -570,10 +582,10 @@ public class OCFile implements Parcelable, Comparable {
@Override
public String toString() {
String asString = "[id=%s, name=%s, mime=%s, downloaded=%s, local=%s, remote=%s, " +
- "parentId=%s, favorite=%s etag=%s]";
+ "parentId=%s, availableOffline=%s etag=%s favourite=%s]";
asString = String.format(asString, mId, getFileName(), mMimeType, isDown(),
- mLocalPath, mRemotePath, mParentId, mFavorite,
- mEtag);
+ mLocalPath, mRemotePath, mParentId, mAvailableOffline,
+ mEtag, mIsFavorite);
return asString;
}
diff --git a/src/main/java/com/owncloud/android/db/ProviderMeta.java b/src/main/java/com/owncloud/android/db/ProviderMeta.java
index 2be0499985..a75d6a4d91 100644
--- a/src/main/java/com/owncloud/android/db/ProviderMeta.java
+++ b/src/main/java/com/owncloud/android/db/ProviderMeta.java
@@ -33,7 +33,7 @@ import com.owncloud.android.MainApp;
public class ProviderMeta {
public static final String DB_NAME = "filelist";
- public static final int DB_VERSION = 16;
+ public static final int DB_VERSION = 17;
private ProviderMeta() {
}
@@ -88,6 +88,7 @@ public class ProviderMeta {
public static final String FILE_UPDATE_THUMBNAIL = "update_thumbnail";
public static final String FILE_IS_DOWNLOADING= "is_downloading";
public static final String FILE_ETAG_IN_CONFLICT = "etag_in_conflict";
+ public static final String FILE_FAVORITE = "favorite";
public static final String FILE_DEFAULT_SORT_ORDER = FILE_NAME
+ " collate nocase asc";
diff --git a/src/main/java/com/owncloud/android/files/FileMenuFilter.java b/src/main/java/com/owncloud/android/files/FileMenuFilter.java
index 4189cd8b3c..b3cbb988c4 100644
--- a/src/main/java/com/owncloud/android/files/FileMenuFilter.java
+++ b/src/main/java/com/owncloud/android/files/FileMenuFilter.java
@@ -229,20 +229,35 @@ public class FileMenuFilter {
toShow.add(R.id.action_send_file);
}
- // FAVORITES
- if (!allFiles() || synchronizing || allFavorites()) {
- toHide.add(R.id.action_favorite_file);
+ // Kept available offline
+ if (!allFiles() || synchronizing || allKeptAvailableOffline()) {
+ toHide.add(R.id.action_keep_files_offline);
} else {
- toShow.add(R.id.action_favorite_file);
+ toShow.add(R.id.action_keep_files_offline);
}
- // UNFAVORITES
- if (!allFiles() || synchronizing || allUnfavorites()) {
- toHide.add(R.id.action_unfavorite_file);
+ // Not kept available offline
+ if (!allFiles() || synchronizing || allNotKeptAvailableOffline()) {
+ toHide.add(R.id.action_unset_keep_files_offline);
} else {
- toShow.add(R.id.action_unfavorite_file);
+ toShow.add(R.id.action_unset_keep_files_offline);
}
+ // Favorite
+ if (!allFiles() || synchronizing || allFavorites()) {
+ toHide.add(R.id.action_favorite);
+ } else {
+ toShow.add(R.id.action_favorite);
+ }
+
+ // Unfavorite
+ if (!allFiles() || synchronizing || allNotFavorites()) {
+ toHide.add(R.id.action_unset_favorite);
+ } else {
+ toShow.add(R.id.action_unset_favorite);
+ }
+
+
}
private boolean anyFileSynchronizing() {
@@ -320,18 +335,36 @@ public class FileMenuFilter {
return false;
}
- private boolean allFavorites() {
+ private boolean allKeptAvailableOffline() {
for(OCFile file: mFiles) {
- if(!file.isFavorite()) {
+ if(!file.isAvailableOffline()) {
return false;
}
}
return true;
}
- private boolean allUnfavorites() {
+ private boolean allFavorites() {
for(OCFile file: mFiles) {
- if(file.isFavorite()) {
+ if(!file.getIsFavorite()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean allNotFavorites() {
+ for(OCFile file: mFiles) {
+ if(file.getIsFavorite()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean allNotKeptAvailableOffline() {
+ for(OCFile file: mFiles) {
+ if(file.isAvailableOffline()) {
return false;
}
}
diff --git a/src/main/java/com/owncloud/android/operations/RefreshFolderOperation.java b/src/main/java/com/owncloud/android/operations/RefreshFolderOperation.java
index 2294f4c69b..7f6215a971 100644
--- a/src/main/java/com/owncloud/android/operations/RefreshFolderOperation.java
+++ b/src/main/java/com/owncloud/android/operations/RefreshFolderOperation.java
@@ -91,7 +91,7 @@ public class RefreshFolderOperation extends RemoteOperation {
private int mConflictsFound;
/** Counter of failed operations in synchronization of kept-in-sync files */
- private int mFailsInFavouritesFound;
+ private int mFailsInKeptInSyncFound;
/**
* Map of remote and local paths to files that where locally stored in a location
@@ -156,8 +156,8 @@ public class RefreshFolderOperation extends RemoteOperation {
return mConflictsFound;
}
- public int getFailsInFavouritesFound() {
- return mFailsInFavouritesFound;
+ public int getFailsInKeptInSyncFound() {
+ return mFailsInKeptInSyncFound;
}
public Map getForgottenLocalFiles() {
@@ -182,7 +182,7 @@ public class RefreshFolderOperation extends RemoteOperation {
@Override
protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result = null;
- mFailsInFavouritesFound = 0;
+ mFailsInKeptInSyncFound = 0;
mConflictsFound = 0;
mForgottenLocalFiles.clear();
@@ -197,7 +197,7 @@ public class RefreshFolderOperation extends RemoteOperation {
if (mRemoteFolderChanged) {
result = fetchAndSyncRemoteFolder(client);
} else {
- fetchFavoritesToSyncFromLocalData();
+ fetchKeptInSyncFilesToSyncFromLocalData();
mChildren = mStorageManager.getFolderContent(mLocalFolder, false);
}
@@ -316,7 +316,7 @@ public class RefreshFolderOperation extends RemoteOperation {
if (result.isSuccess()) {
synchronizeData(result.getData());
- if (mConflictsFound > 0 || mFailsInFavouritesFound > 0) {
+ if (mConflictsFound > 0 || mFailsInKeptInSyncFound > 0) {
result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);
// should be a different result code, but will do the job
}
@@ -394,7 +394,7 @@ public class RefreshFolderOperation extends RemoteOperation {
updatedFile.setLastSyncDateForProperties(mCurrentSyncTime);
if (localFile != null) {
updatedFile.setFileId(localFile.getFileId());
- updatedFile.setFavorite(localFile.isFavorite());
+ updatedFile.setAvailableOffline(localFile.isAvailableOffline());
updatedFile.setLastSyncDateForData(localFile.getLastSyncDateForData());
updatedFile.setModificationTimestampAtLastSyncForData(
localFile.getModificationTimestampAtLastSyncForData()
@@ -423,7 +423,7 @@ public class RefreshFolderOperation extends RemoteOperation {
FileStorageUtils.searchForLocalFileInDefaultPath(updatedFile, mAccount);
/// prepare content synchronization for kept-in-sync files
- if (updatedFile.isFavorite()) {
+ if (updatedFile.isAvailableOffline()) {
SynchronizeFileOperation operation = new SynchronizeFileOperation( localFile,
remoteFile,
mAccount,
@@ -463,7 +463,7 @@ public class RefreshFolderOperation extends RemoteOperation {
if (contentsResult.getCode() == ResultCode.SYNC_CONFLICT) {
mConflictsFound++;
} else {
- mFailsInFavouritesFound++;
+ mFailsInKeptInSyncFound++;
if (contentsResult.getException() != null) {
Log_OC.e(TAG, "Error while synchronizing favourites : "
+ contentsResult.getLogMessage(), contentsResult.getException());
@@ -536,10 +536,10 @@ public class RefreshFolderOperation extends RemoteOperation {
}
- private void fetchFavoritesToSyncFromLocalData() {
+ private void fetchKeptInSyncFilesToSyncFromLocalData() {
List children = mStorageManager.getFolderContent(mLocalFolder, false);
for (OCFile child : children) {
- if (!child.isFolder() && child.isFavorite() && !child.isInConflict()) {
+ if (!child.isFolder() && child.isAvailableOffline() && !child.isInConflict()) {
SynchronizeFileOperation operation = new SynchronizeFileOperation(
child,
child, // cheating with the remote file to get an update to server; to refactor
diff --git a/src/main/java/com/owncloud/android/operations/SynchronizeFileOperation.java b/src/main/java/com/owncloud/android/operations/SynchronizeFileOperation.java
index 286f7e091e..549bf1f749 100644
--- a/src/main/java/com/owncloud/android/operations/SynchronizeFileOperation.java
+++ b/src/main/java/com/owncloud/android/operations/SynchronizeFileOperation.java
@@ -247,7 +247,7 @@ public class SynchronizeFileOperation extends SyncOperation {
// service when the upload finishes
} else {
// TODO CHECK: is this really useful in some point in the code?
- mServerFile.setFavorite(mLocalFile.isFavorite());
+ mServerFile.setAvailableOffline(mLocalFile.isAvailableOffline());
mServerFile.setLastSyncDateForData(mLocalFile.getLastSyncDateForData());
mServerFile.setStoragePath(mLocalFile.getStoragePath());
mServerFile.setParentId(mLocalFile.getParentId());
diff --git a/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java
index d8a27dedf1..46288bc6fe 100644
--- a/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java
+++ b/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java
@@ -323,7 +323,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
updatedFile.setLastSyncDateForProperties(mCurrentSyncTime);
if (localFile != null) {
updatedFile.setFileId(localFile.getFileId());
- updatedFile.setFavorite(localFile.isFavorite());
+ updatedFile.setAvailableOffline(localFile.isAvailableOffline());
updatedFile.setLastSyncDateForData(localFile.getLastSyncDateForData());
updatedFile.setModificationTimestampAtLastSyncForData(
localFile.getModificationTimestampAtLastSyncForData()
diff --git a/src/main/java/com/owncloud/android/operations/UpdateOCVersionOperation.java b/src/main/java/com/owncloud/android/operations/UpdateOCVersionOperation.java
index 6db21f0def..1042e5d88d 100644
--- a/src/main/java/com/owncloud/android/operations/UpdateOCVersionOperation.java
+++ b/src/main/java/com/owncloud/android/operations/UpdateOCVersionOperation.java
@@ -20,10 +20,9 @@
package com.owncloud.android.operations;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.json.JSONException;
-import org.json.JSONObject;
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.content.Context;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.lib.common.OwnCloudClient;
@@ -34,9 +33,10 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.content.Context;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.json.JSONException;
+import org.json.JSONObject;
/**
@@ -65,6 +65,9 @@ public class UpdateOCVersionOperation extends RemoteOperation {
statUrl += AccountUtils.STATUS_PATH;
RemoteOperationResult result = null;
GetMethod get = null;
+
+ String webDav = client.getWebdavUri().toString();
+
try {
get = new GetMethod(statUrl);
int status = client.executeMethod(get);
@@ -96,15 +99,17 @@ public class UpdateOCVersionOperation extends RemoteOperation {
result = new RemoteOperationResult(RemoteOperationResult.ResultCode.INSTANCE_NOT_CONFIGURED);
}
}
- Log_OC.i(TAG, "Check for update of ownCloud server version at " + client.getWebdavUri() + ": " + result.getLogMessage());
+
+
+ Log_OC.i(TAG, "Check for update of ownCloud server version at " + webDav + ": " + result.getLogMessage());
} catch (JSONException e) {
result = new RemoteOperationResult(RemoteOperationResult.ResultCode.INSTANCE_NOT_CONFIGURED);
- Log_OC.e(TAG, "Check for update of ownCloud server version at " + client.getWebdavUri() + ": " + result.getLogMessage(), e);
+ Log_OC.e(TAG, "Check for update of ownCloud server version at " + webDav + ": " + result.getLogMessage(), e);
} catch (Exception e) {
result = new RemoteOperationResult(e);
- Log_OC.e(TAG, "Check for update of ownCloud server version at " + client.getWebdavUri() + ": " + result.getLogMessage(), e);
+ Log_OC.e(TAG, "Check for update of ownCloud server version at " + webDav + ": " + result.getLogMessage(), e);
} finally {
if (get != null) {
diff --git a/src/main/java/com/owncloud/android/operations/UploadFileOperation.java b/src/main/java/com/owncloud/android/operations/UploadFileOperation.java
index 87214bcb3d..390a2b11b6 100644
--- a/src/main/java/com/owncloud/android/operations/UploadFileOperation.java
+++ b/src/main/java/com/owncloud/android/operations/UploadFileOperation.java
@@ -572,7 +572,7 @@ public class UploadFileOperation extends SyncOperation {
mFile.getModificationTimestampAtLastSyncForData()
);
newFile.setEtag(mFile.getEtag());
- newFile.setFavorite(mFile.isFavorite());
+ newFile.setAvailableOffline(mFile.isAvailableOffline());
newFile.setLastSyncDateForProperties(mFile.getLastSyncDateForProperties());
newFile.setLastSyncDateForData(mFile.getLastSyncDateForData());
newFile.setStoragePath(mFile.getStoragePath());
diff --git a/src/main/java/com/owncloud/android/providers/FileContentProvider.java b/src/main/java/com/owncloud/android/providers/FileContentProvider.java
index f9854781a7..97baea8419 100644
--- a/src/main/java/com/owncloud/android/providers/FileContentProvider.java
+++ b/src/main/java/com/owncloud/android/providers/FileContentProvider.java
@@ -1,24 +1,23 @@
/**
- * ownCloud Android client application
- *
- * @author Bartek Przybylski
- * @author David A. Velasco
- * @author masensio
- * Copyright (C) 2011 Bartek Przybylski
- * Copyright (C) 2016 ownCloud Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * ownCloud Android client application
*
+ * @author Bartek Przybylski
+ * @author David A. Velasco
+ * @author masensio
+ * Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2016 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package com.owncloud.android.providers;
@@ -139,7 +138,7 @@ public class FileContentProvider extends ContentProvider {
}
*/
Cursor children = query(uri, null, null, null, null);
- if (children != null && children.moveToFirst()) {
+ if (children != null && children.moveToFirst()) {
long childId;
boolean isDir;
while (!children.isAfterLast()) {
@@ -208,13 +207,13 @@ public class FileContentProvider extends ContentProvider {
@Override
public String getType(Uri uri) {
switch (mUriMatcher.match(uri)) {
- case ROOT_DIRECTORY:
- return ProviderTableMeta.CONTENT_TYPE;
- case SINGLE_FILE:
- return ProviderTableMeta.CONTENT_TYPE_ITEM;
- default:
- throw new IllegalArgumentException("Unknown Uri id."
- + uri.toString());
+ case ROOT_DIRECTORY:
+ return ProviderTableMeta.CONTENT_TYPE;
+ case SINGLE_FILE:
+ return ProviderTableMeta.CONTENT_TYPE_ITEM;
+ default:
+ throw new IllegalArgumentException("Unknown Uri id."
+ + uri.toString());
}
}
@@ -234,18 +233,18 @@ public class FileContentProvider extends ContentProvider {
}
private Uri insert(SQLiteDatabase db, Uri uri, ContentValues values) {
- switch (mUriMatcher.match(uri)){
+ switch (mUriMatcher.match(uri)) {
case ROOT_DIRECTORY:
case SINGLE_FILE:
String remotePath = values.getAsString(ProviderTableMeta.FILE_PATH);
String accountName = values.getAsString(ProviderTableMeta.FILE_ACCOUNT_OWNER);
- String[] projection = new String[] {
+ String[] projection = new String[]{
ProviderTableMeta._ID, ProviderTableMeta.FILE_PATH,
ProviderTableMeta.FILE_ACCOUNT_OWNER
};
String where = ProviderTableMeta.FILE_PATH + "=? AND " +
ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?";
- String[] whereArgs = new String[] {remotePath, accountName};
+ String[] whereArgs = new String[]{remotePath, accountName};
Cursor doubleCheck = query(db, uri, projection, where, whereArgs, null);
// ugly patch; serious refactorization is needed to reduce work in
// FileDataStorageManager and bring it to FileContentProvider
@@ -273,7 +272,7 @@ public class FileContentProvider extends ContentProvider {
case SHARES:
Uri insertedShareUri = null;
long rowId = db.insert(ProviderTableMeta.OCSHARES_TABLE_NAME, null, values);
- if (rowId >0) {
+ if (rowId > 0) {
insertedShareUri =
ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_SHARE, rowId);
} else {
@@ -286,7 +285,7 @@ public class FileContentProvider extends ContentProvider {
case CAPABILITIES:
Uri insertedCapUri = null;
long id = db.insert(ProviderTableMeta.CAPABILITIES_TABLE_NAME, null, values);
- if (id >0) {
+ if (id > 0) {
insertedCapUri =
ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_CAPABILITIES, id);
} else {
@@ -298,7 +297,7 @@ public class FileContentProvider extends ContentProvider {
case UPLOADS:
Uri insertedUploadUri = null;
long uploadId = db.insert(ProviderTableMeta.UPLOADS_TABLE_NAME, null, values);
- if (uploadId >0) {
+ if (uploadId > 0) {
insertedUploadUri =
ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_UPLOADS, uploadId);
trimSuccessfulUploads(db);
@@ -328,22 +327,22 @@ public class FileContentProvider extends ContentProvider {
private void updateFilesTableAccordingToShareInsertion(
SQLiteDatabase db, ContentValues newShare
- ) {
+ ) {
ContentValues fileValues = new ContentValues();
int newShareType = newShare.getAsInteger(ProviderTableMeta.OCSHARES_SHARE_TYPE);
if (newShareType == ShareType.PUBLIC_LINK.getValue()) {
fileValues.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, 1);
} else if (
newShareType == ShareType.USER.getValue() ||
- newShareType == ShareType.GROUP.getValue() ||
- newShareType == ShareType.EMAIL.getValue() ||
- newShareType == ShareType.FEDERATED.getValue() ) {
+ newShareType == ShareType.GROUP.getValue() ||
+ newShareType == ShareType.EMAIL.getValue() ||
+ newShareType == ShareType.FEDERATED.getValue()) {
fileValues.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, 1);
}
String where = ProviderTableMeta.FILE_PATH + "=? AND " +
ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?";
- String[] whereArgs = new String[] {
+ String[] whereArgs = new String[]{
newShare.getAsString(ProviderTableMeta.OCSHARES_PATH),
newShare.getAsString(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER)
};
@@ -381,7 +380,7 @@ public class FileContentProvider extends ContentProvider {
String selection,
String[] selectionArgs,
String sortOrder
- ) {
+ ) {
Cursor result = null;
SQLiteDatabase db = mDbHelper.getReadableDatabase();
@@ -402,7 +401,7 @@ public class FileContentProvider extends ContentProvider {
String selection,
String[] selectionArgs,
String sortOrder
- ) {
+ ) {
SQLiteQueryBuilder sqlQuery = new SQLiteQueryBuilder();
@@ -501,17 +500,16 @@ public class FileContentProvider extends ContentProvider {
}
-
private int update(
SQLiteDatabase db,
Uri uri,
ContentValues values,
String selection,
String[] selectionArgs
- ) {
+ ) {
switch (mUriMatcher.match(uri)) {
case DIRECTORY:
- return 0; //updateFolderSize(db, selectionArgs[0]);
+ return 0; //updateFolderSize(db, selectionArgs[0]);
case SHARES:
return db.update(
ProviderTableMeta.OCSHARES_TABLE_NAME, values, selection, selectionArgs
@@ -536,12 +534,12 @@ public class FileContentProvider extends ContentProvider {
}
@Override
- public ContentProviderResult[] applyBatch (ArrayList operations)
+ public ContentProviderResult[] applyBatch(ArrayList operations)
throws OperationApplicationException {
Log_OC.d("FileContentProvider", "applying batch in provider " + this +
- " (temporary: " + isTemporary() + ")" );
+ " (temporary: " + isTemporary() + ")");
ContentProviderResult[] results = new ContentProviderResult[operations.size()];
- int i=0;
+ int i = 0;
SQLiteDatabase db = mDbHelper.getWritableDatabase();
db.beginTransaction(); // it's supposed that transactions can be nested
@@ -592,8 +590,8 @@ public class FileContentProvider extends ContentProvider {
if (oldVersion == 1 && newVersion >= 2) {
Log_OC.i(SQL, "Entering in the #1 ADD in onUpgrade");
db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
- ADD_COLUMN + ProviderTableMeta.FILE_KEEP_IN_SYNC + " INTEGER " +
- " DEFAULT 0");
+ ADD_COLUMN + ProviderTableMeta.FILE_KEEP_IN_SYNC + " INTEGER " +
+ " DEFAULT 0");
upgraded = true;
}
if (oldVersion < 3 && newVersion >= 3) {
@@ -601,8 +599,8 @@ public class FileContentProvider extends ContentProvider {
db.beginTransaction();
try {
db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
- ADD_COLUMN + ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA +
- " INTEGER " + " DEFAULT 0");
+ ADD_COLUMN + ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA +
+ " INTEGER " + " DEFAULT 0");
// assume there are not local changes pending to upload
db.execSQL("UPDATE " + ProviderTableMeta.FILE_TABLE_NAME +
@@ -625,9 +623,9 @@ public class FileContentProvider extends ContentProvider {
" INTEGER " + " DEFAULT 0");
db.execSQL("UPDATE " + ProviderTableMeta.FILE_TABLE_NAME +
- " SET " + ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA + " = " +
+ " SET " + ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA + " = " +
ProviderTableMeta.FILE_MODIFIED +
- " WHERE " + ProviderTableMeta.FILE_STORAGE_PATH + " IS NOT NULL");
+ " WHERE " + ProviderTableMeta.FILE_STORAGE_PATH + " IS NOT NULL");
upgraded = true;
db.setTransactionSuccessful();
@@ -635,6 +633,7 @@ public class FileContentProvider extends ContentProvider {
db.endTransaction();
}
}
+
if (!upgraded) {
Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
}
@@ -661,11 +660,11 @@ public class FileContentProvider extends ContentProvider {
Log_OC.i(SQL, "Entering in the #5 ADD in onUpgrade");
db.beginTransaction();
try {
- db .execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
+ db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
ADD_COLUMN + ProviderTableMeta.FILE_SHARED_VIA_LINK + " INTEGER " +
" DEFAULT 0");
- db .execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
+ db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
ADD_COLUMN + ProviderTableMeta.FILE_PUBLIC_LINK + " TEXT " +
" DEFAULT NULL");
@@ -726,7 +725,7 @@ public class FileContentProvider extends ContentProvider {
Log_OC.i(SQL, "Entering in the #9 ADD in onUpgrade");
db.beginTransaction();
try {
- db .execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
+ db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
ADD_COLUMN + ProviderTableMeta.FILE_IS_DOWNLOADING + " INTEGER " +
" DEFAULT 0");
@@ -745,15 +744,15 @@ public class FileContentProvider extends ContentProvider {
updateAccountName(db);
upgraded = true;
}
- if (!upgraded) {
- Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
- }
+ if (!upgraded) {
+ Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
+ }
if (oldVersion < 11 && newVersion >= 11) {
Log_OC.i(SQL, "Entering in the #11 ADD in onUpgrade");
db.beginTransaction();
try {
- db .execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
+ db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
ADD_COLUMN + ProviderTableMeta.FILE_ETAG_IN_CONFLICT + " TEXT " +
" DEFAULT NULL");
@@ -771,7 +770,7 @@ public class FileContentProvider extends ContentProvider {
Log_OC.i(SQL, "Entering in the #12 ADD in onUpgrade");
db.beginTransaction();
try {
- db .execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
+ db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
ADD_COLUMN + ProviderTableMeta.FILE_SHARED_WITH_SHAREE + " INTEGER " +
" DEFAULT 0");
upgraded = true;
@@ -843,35 +842,56 @@ public class FileContentProvider extends ContentProvider {
if (!upgraded) {
Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
}
+
+ if (oldVersion < 17 && newVersion >= 17) {
+ Log_OC.i(SQL, "Entering in the #4 ADD in onUpgrade");
+ db.beginTransaction();
+ try {
+ db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
+ ADD_COLUMN + ProviderTableMeta.FILE_FAVORITE +
+ " INTEGER " + " DEFAULT 0");
+
+ upgraded = true;
+ db.setTransactionSuccessful();
+ } finally {
+ db.endTransaction();
+ }
+
+ }
+
+ if (!upgraded) {
+ Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
+ }
}
}
- private void createFilesTable(SQLiteDatabase db){
+ private void createFilesTable(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + ProviderTableMeta.FILE_TABLE_NAME + "("
- + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, "
- + ProviderTableMeta.FILE_NAME + TEXT
- + ProviderTableMeta.FILE_PATH + TEXT
- + ProviderTableMeta.FILE_PARENT + INTEGER
- + ProviderTableMeta.FILE_CREATION + INTEGER
- + ProviderTableMeta.FILE_MODIFIED + INTEGER
- + ProviderTableMeta.FILE_CONTENT_TYPE + TEXT
- + ProviderTableMeta.FILE_CONTENT_LENGTH + INTEGER
- + ProviderTableMeta.FILE_STORAGE_PATH + TEXT
- + ProviderTableMeta.FILE_ACCOUNT_OWNER + TEXT
- + ProviderTableMeta.FILE_LAST_SYNC_DATE + INTEGER
- + ProviderTableMeta.FILE_KEEP_IN_SYNC + INTEGER
- + ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA + INTEGER
- + ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA + INTEGER
- + ProviderTableMeta.FILE_ETAG + TEXT
- + ProviderTableMeta.FILE_SHARED_VIA_LINK + INTEGER
- + ProviderTableMeta.FILE_PUBLIC_LINK + TEXT
- + ProviderTableMeta.FILE_PERMISSIONS + " TEXT null,"
- + ProviderTableMeta.FILE_REMOTE_ID + " TEXT null,"
- + ProviderTableMeta.FILE_UPDATE_THUMBNAIL + INTEGER //boolean
- + ProviderTableMeta.FILE_IS_DOWNLOADING + INTEGER //boolean
- + ProviderTableMeta.FILE_ETAG_IN_CONFLICT + TEXT
- + ProviderTableMeta.FILE_SHARED_WITH_SHAREE + " INTEGER);"
+ + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, "
+ + ProviderTableMeta.FILE_NAME + TEXT
+ + ProviderTableMeta.FILE_PATH + TEXT
+ + ProviderTableMeta.FILE_PARENT + INTEGER
+ + ProviderTableMeta.FILE_CREATION + INTEGER
+ + ProviderTableMeta.FILE_MODIFIED + INTEGER
+ + ProviderTableMeta.FILE_CONTENT_TYPE + TEXT
+ + ProviderTableMeta.FILE_CONTENT_LENGTH + INTEGER
+ + ProviderTableMeta.FILE_STORAGE_PATH + TEXT
+ + ProviderTableMeta.FILE_ACCOUNT_OWNER + TEXT
+ + ProviderTableMeta.FILE_LAST_SYNC_DATE + INTEGER
+ + ProviderTableMeta.FILE_KEEP_IN_SYNC + INTEGER
+ + ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA + INTEGER
+ + ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA + INTEGER
+ + ProviderTableMeta.FILE_ETAG + TEXT
+ + ProviderTableMeta.FILE_SHARED_VIA_LINK + INTEGER
+ + ProviderTableMeta.FILE_PUBLIC_LINK + TEXT
+ + ProviderTableMeta.FILE_PERMISSIONS + " TEXT null,"
+ + ProviderTableMeta.FILE_REMOTE_ID + " TEXT null,"
+ + ProviderTableMeta.FILE_UPDATE_THUMBNAIL + INTEGER //boolean
+ + ProviderTableMeta.FILE_IS_DOWNLOADING + INTEGER //boolean
+ + ProviderTableMeta.FILE_FAVORITE + INTEGER // boolean
+ + ProviderTableMeta.FILE_ETAG_IN_CONFLICT + TEXT
+ + ProviderTableMeta.FILE_SHARED_WITH_SHAREE + " INTEGER);"
);
}
@@ -884,7 +904,7 @@ public class FileContentProvider extends ContentProvider {
+ ProviderTableMeta.OCSHARES_SHARE_TYPE + INTEGER
+ ProviderTableMeta.OCSHARES_SHARE_WITH + TEXT
+ ProviderTableMeta.OCSHARES_PATH + TEXT
- + ProviderTableMeta.OCSHARES_PERMISSIONS+ INTEGER
+ + ProviderTableMeta.OCSHARES_PERMISSIONS + INTEGER
+ ProviderTableMeta.OCSHARES_SHARED_DATE + INTEGER
+ ProviderTableMeta.OCSHARES_EXPIRATION_DATE + INTEGER
+ ProviderTableMeta.OCSHARES_TOKEN + TEXT
@@ -892,10 +912,10 @@ public class FileContentProvider extends ContentProvider {
+ ProviderTableMeta.OCSHARES_IS_DIRECTORY + INTEGER // boolean
+ ProviderTableMeta.OCSHARES_USER_ID + INTEGER
+ ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED + INTEGER
- + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + " TEXT );" );
+ + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + " TEXT );");
}
- private void createCapabilitiesTable(SQLiteDatabase db){
+ private void createCapabilitiesTable(SQLiteDatabase db) {
// Create capabilities table
db.execSQL("CREATE TABLE " + ProviderTableMeta.CAPABILITIES_TABLE_NAME + "("
+ ProviderTableMeta._ID + " INTEGER PRIMARY KEY, "
@@ -921,10 +941,10 @@ public class FileContentProvider extends ContentProvider {
+ ProviderTableMeta.CAPABILITIES_FILES_BIGFILECHUNKING + INTEGER // boolean
+ ProviderTableMeta.CAPABILITIES_FILES_UNDELETE + INTEGER // boolean
+ ProviderTableMeta.CAPABILITIES_FILES_VERSIONING + INTEGER // boolean
- + ProviderTableMeta.CAPABILITIES_FILES_DROP + " INTEGER );" ); // boolean
+ + ProviderTableMeta.CAPABILITIES_FILES_DROP + " INTEGER );"); // boolean
}
- private void createUploadsTable(SQLiteDatabase db){
+ private void createUploadsTable(SQLiteDatabase db) {
// Create uploads table
db.execSQL("CREATE TABLE " + ProviderTableMeta.UPLOADS_TABLE_NAME + "("
+ ProviderTableMeta._ID + " INTEGER PRIMARY KEY, "
@@ -953,10 +973,10 @@ public class FileContentProvider extends ContentProvider {
*/
}
- private void createSyncedFoldersTable(SQLiteDatabase db){
+ private void createSyncedFoldersTable(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + ProviderTableMeta.SYNCED_FOLDERS_TABLE_NAME + "("
- + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, " // id
- + ProviderTableMeta.SYNCED_FOLDER_LOCAL_PATH + " TEXT, " // local path
+ + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, " // id
+ + ProviderTableMeta.SYNCED_FOLDER_LOCAL_PATH + " TEXT, " // local path
+ ProviderTableMeta.SYNCED_FOLDER_REMOTE_PATH + " TEXT, " // remote path
+ ProviderTableMeta.SYNCED_FOLDER_WIFI_ONLY + " INTEGER, " // wifi_only
+ ProviderTableMeta.SYNCED_FOLDER_CHARGING_ONLY + " INTEGER, " // charging only
@@ -976,7 +996,7 @@ public class FileContentProvider extends ContentProvider {
*
* @param db Database where table of files is included.
*/
- private void updateAccountName(SQLiteDatabase db){
+ private void updateAccountName(SQLiteDatabase db) {
Log_OC.d(SQL, "THREAD: " + Thread.currentThread().getName());
AccountManager ama = AccountManager.get(getContext());
try {
@@ -986,7 +1006,7 @@ public class FileContentProvider extends ContentProvider {
Account[] accounts = AccountManager.get(getContext()).getAccountsByType(
MainApp.getAccountType());
String serverUrl, username, oldAccountName, newAccountName;
- for (Account account : accounts) {
+ for (Account account : accounts) {
// build both old and new account name
serverUrl = ama.getUserData(account, AccountUtils.Constants.KEY_OC_BASE_URL);
username = AccountUtils.getUsernameForAccount(account);
@@ -1016,7 +1036,7 @@ public class FileContentProvider extends ContentProvider {
} finally {
db.endTransaction();
}
- }
+ }
} catch (Exception e) {
Log_OC.e(TAG, "Exception upgrading account names or paths in database", e);
}
@@ -1038,10 +1058,10 @@ public class FileContentProvider extends ContentProvider {
ProviderTableMeta.FILE_STORAGE_PATH + " IS NOT NULL";
Cursor c = db.query(ProviderTableMeta.FILE_TABLE_NAME,
- null,
- whereClause,
- new String[]{newAccountName},
- null, null, null);
+ null,
+ whereClause,
+ new String[]{newAccountName},
+ null, null, null);
try {
if (c.moveToFirst()) {
@@ -1091,30 +1111,30 @@ public class FileContentProvider extends ContentProvider {
try {
String MAX_SUCCESSFUL_UPLOADS = "30";
c = db.rawQuery(
- "delete from " + ProviderTableMeta.UPLOADS_TABLE_NAME +
- " where " + ProviderTableMeta.UPLOADS_STATUS + " == "
- + UploadsStorageManager.UploadStatus.UPLOAD_SUCCEEDED.getValue() +
- " and " + ProviderTableMeta._ID +
- " not in (select " + ProviderTableMeta._ID +
- " from " + ProviderTableMeta.UPLOADS_TABLE_NAME +
- " where " + ProviderTableMeta.UPLOADS_STATUS + " == "
- + UploadsStorageManager.UploadStatus.UPLOAD_SUCCEEDED.getValue() +
- " order by " + ProviderTableMeta.UPLOADS_UPLOAD_END_TIMESTAMP +
- " desc limit " + MAX_SUCCESSFUL_UPLOADS +
- ")",
- null
+ "delete from " + ProviderTableMeta.UPLOADS_TABLE_NAME +
+ " where " + ProviderTableMeta.UPLOADS_STATUS + " == "
+ + UploadsStorageManager.UploadStatus.UPLOAD_SUCCEEDED.getValue() +
+ " and " + ProviderTableMeta._ID +
+ " not in (select " + ProviderTableMeta._ID +
+ " from " + ProviderTableMeta.UPLOADS_TABLE_NAME +
+ " where " + ProviderTableMeta.UPLOADS_STATUS + " == "
+ + UploadsStorageManager.UploadStatus.UPLOAD_SUCCEEDED.getValue() +
+ " order by " + ProviderTableMeta.UPLOADS_UPLOAD_END_TIMESTAMP +
+ " desc limit " + MAX_SUCCESSFUL_UPLOADS +
+ ")",
+ null
);
c.moveToFirst(); // do something with the cursor, or deletion doesn't happen; true story
} catch (Exception e) {
Log_OC.e(
- TAG,
- "Something wrong trimming successful uploads, database could grow more than expected",
- e
+ TAG,
+ "Something wrong trimming successful uploads, database could grow more than expected",
+ e
);
} finally {
- if (c!= null) {
+ if (c != null) {
c.close();
}
}
diff --git a/src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java b/src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java
index ed040eb3af..1213e19175 100644
--- a/src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java
+++ b/src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java
@@ -279,7 +279,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
if (result.getCode() == ResultCode.SYNC_CONFLICT) {
mConflictsFound += synchFolderOp.getConflictsFound();
- mFailsInFavouritesFound += synchFolderOp.getFailsInFavouritesFound();
+ mFailsInFavouritesFound += synchFolderOp.getFailsInKeptInSyncFound();
}
if (synchFolderOp.getForgottenLocalFiles().size() > 0) {
mForgottenLocalFiles.putAll(synchFolderOp.getForgottenLocalFiles());
diff --git a/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java b/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
index e294863db8..b698306179 100644
--- a/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
+++ b/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
@@ -1,23 +1,23 @@
/**
- * Nextcloud Android client application
+ * Nextcloud Android client application
*
- * @author Andy Scherzinger
- * Copyright (C) 2016 Andy Scherzinger
- * Copyright (C) 2016 Nextcloud
- * Copyright (C) 2016 ownCloud Inc.
+ * @author Andy Scherzinger
+ * Copyright (C) 2016 Andy Scherzinger
+ * Copyright (C) 2016 Nextcloud
+ * Copyright (C) 2016 ownCloud Inc.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
- * You should have received a copy of the GNU Affero General Public
- * License along with this program. If not, see .
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program. If not, see .
*/
package com.owncloud.android.ui.activity;
@@ -53,10 +53,19 @@ import com.owncloud.android.lib.common.UserInfo;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.lib.resources.files.SearchOperation;
import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation;
import com.owncloud.android.ui.TextDrawable;
+import com.owncloud.android.ui.events.ChangeMenuEvent;
+import com.owncloud.android.ui.events.DummyDrawerEvent;
+import com.owncloud.android.ui.events.MenuItemClickEvent;
+import com.owncloud.android.ui.events.SearchEvent;
import com.owncloud.android.utils.DisplayUtils;
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
/**
* Base class to handle setup of the drawer implementation including user switching and avatar fetching and fallback
* generation.
@@ -176,7 +185,8 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
setupQuotaElement();
// show folder sync menu item only for Android 6+
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M &&
+ mNavigationView.getMenu().findItem(R.id.nav_folder_sync) != null) {
mNavigationView.getMenu().removeItem(R.id.nav_folder_sync);
}
}
@@ -285,14 +295,99 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
} else {
navigationView.getMenu().setGroupVisible(R.id.drawer_menu_accounts, false);
}
+
+ Account account = AccountUtils.
+ getCurrentOwnCloudAccount(MainApp.getAppContext());
+ boolean searchSupported = AccountUtils.hasSearchSupport(account);
+
+ if ((getResources().getBoolean(R.bool.bottom_toolbar_enabled) || (!searchSupported)) &&
+ (account != null)){
+ navigationView.getMenu().removeItem(R.id.nav_photos);
+ if (getResources().getBoolean(R.bool.bottom_toolbar_enabled)) {
+ navigationView.getMenu().removeItem(R.id.nav_all_files);
+ navigationView.getMenu().removeItem(R.id.nav_settings);
+ navigationView.getMenu().removeItem(R.id.nav_favorites);
+ }
+ if (!searchSupported) {
+ navigationView.getMenu().removeItem(R.id.nav_videos);
+ }
+ }
+
+ if (getResources().getBoolean(R.bool.use_home) && navigationView.getMenu().findItem(R.id.nav_all_files) !=
+ null) {
+ navigationView.getMenu().findItem(R.id.nav_all_files).setTitle(getResources().
+ getString(R.string.drawer_item_home));
+ navigationView.getMenu().findItem(R.id.nav_all_files).setIcon(R.drawable.ic_home);
+ }
+
+ if (!getResources().getBoolean(R.bool.participate_enabled)) {
+ navigationView.getMenu().removeItem(R.id.nav_participate);
+ }
+
+ if (!getResources().getBoolean(R.bool.shared_enabled)) {
+ navigationView.getMenu().removeItem(R.id.nav_shared);
+ }
+
+ if (AccountUtils.hasSearchSupport(account)) {
+ if (!getResources().getBoolean(R.bool.recently_added_enabled)) {
+ navigationView.getMenu().removeItem(R.id.nav_recently_added);
+ }
+
+ if (!getResources().getBoolean(R.bool.recently_modified_enabled)) {
+ navigationView.getMenu().removeItem(R.id.nav_recently_modified);
+ }
+
+ if (!getResources().getBoolean(R.bool.videos_enabled)) {
+ navigationView.getMenu().removeItem(R.id.nav_videos);
+ }
+ } else if (account != null) {
+ navigationView.getMenu().removeItem(R.id.nav_recently_added);
+ navigationView.getMenu().removeItem(R.id.nav_recently_modified);
+ navigationView.getMenu().removeItem(R.id.nav_videos);
+ }
}
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onMessageEvent(MenuItemClickEvent event) {
+ unsetAllDrawerMenuItems();
+
+ switch (event.menuItem.getItemId()) {
+ case R.id.nav_bar_files:
+ showFiles(false);
+ break;
+ case R.id.nav_bar_settings:
+ Intent settingsIntent = new Intent(getApplicationContext(), Preferences.class);
+ startActivity(settingsIntent);
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onMessageEvent(DummyDrawerEvent event) {
+ unsetAllDrawerMenuItems();
+ }
+
+
private void selectNavigationItem(final MenuItem menuItem) {
+
switch (menuItem.getItemId()) {
case R.id.nav_all_files:
menuItem.setChecked(true);
mCheckedMenuItem = menuItem.getItemId();
showFiles(false);
+ EventBus.getDefault().post(new ChangeMenuEvent());
+ break;
+ case R.id.nav_favorites:
+ menuItem.setChecked(true);
+ mCheckedMenuItem = menuItem.getItemId();
+ EventBus.getDefault().post(new SearchEvent("", SearchOperation.SearchType.FAVORITE_SEARCH,
+ SearchEvent.UnsetType.NO_UNSET));
+ break;
+ case R.id.nav_photos:
+ EventBus.getDefault().post(new SearchEvent("image/%",
+ SearchOperation.SearchType.CONTENT_TYPE_SEARCH, SearchEvent.UnsetType.NO_UNSET));
break;
case R.id.nav_on_device:
menuItem.setChecked(true);
@@ -311,7 +406,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
startActivity(activityIntent);
break;
case R.id.nav_folder_sync:
- Intent folderSyncIntent = new Intent(getApplicationContext(),FolderSyncActivity.class);
+ Intent folderSyncIntent = new Intent(getApplicationContext(), FolderSyncActivity.class);
startActivity(folderSyncIntent);
break;
case R.id.nav_settings:
@@ -331,6 +426,30 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
ManageAccountsActivity.class);
startActivityForResult(manageAccountsIntent, ACTION_MANAGE_ACCOUNTS);
break;
+ case R.id.nav_recently_added:
+ menuItem.setChecked(true);
+ mCheckedMenuItem = menuItem.getItemId();
+ EventBus.getDefault().post(new SearchEvent("%", SearchOperation.SearchType.CONTENT_TYPE_SEARCH,
+ SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR));
+ break;
+ case R.id.nav_recently_modified:
+ menuItem.setChecked(true);
+ mCheckedMenuItem = menuItem.getItemId();
+ EventBus.getDefault().post(new SearchEvent("", SearchOperation.SearchType.RECENTLY_MODIFIED_SEARCH,
+ SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR));
+ break;
+ case R.id.nav_shared:
+ menuItem.setChecked(true);
+ mCheckedMenuItem = menuItem.getItemId();
+ EventBus.getDefault().post(new SearchEvent("", SearchOperation.SearchType.SHARED_SEARCH,
+ SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR));
+ break;
+ case R.id.nav_videos:
+ menuItem.setChecked(true);
+ mCheckedMenuItem = menuItem.getItemId();
+ EventBus.getDefault().post(new SearchEvent("video/%", SearchOperation.SearchType.CONTENT_TYPE_SEARCH,
+ SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR));
+ break;
case Menu.NONE:
// account clicked
accountClicked(menuItem.getTitle().toString());
@@ -346,6 +465,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
*/
public abstract void showFiles(boolean onDeviceOnly);
+
/**
* sets the new/current account and restarts. In case the given account equals the actual/current account the
* call will be ignored.
@@ -514,7 +634,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
/// set home button properties
if (mDrawerToggle != null && chosenFile != null) {
mDrawerToggle.setDrawerIndicatorEnabled(isRoot(chosenFile));
- } else {
+ } else if (mDrawerToggle != null){
mDrawerToggle.setDrawerIndicatorEnabled(false);
}
}
@@ -596,9 +716,9 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
/**
* configured the quota to be displayed.
*
- * @param usedSpace the used space
+ * @param usedSpace the used space
* @param totalSpace the total space
- * @param relative the percentage of space already used
+ * @param relative the percentage of space already used
*/
private void setQuotaInformation(long usedSpace, long totalSpace, int relative) {
mQuotaProgressBar.setProgress(relative);
@@ -612,6 +732,17 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
showQuota(true);
}
+ protected void unsetAllDrawerMenuItems() {
+ if (mNavigationView != null && mNavigationView.getMenu() != null) {
+ Menu menu = mNavigationView.getMenu();
+ for (int i = 0; i < menu.size(); i++) {
+ menu.getItem(i).setChecked(false);
+ }
+ }
+
+ mCheckedMenuItem = Menu.NONE;
+ }
+
/**
* checks/highlights the provided menu item if the drawer has been initialized and the menu item exists.
*
@@ -823,10 +954,10 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
@Override
public void avatarGenerated(Drawable avatarDrawable, Object callContext) {
if (callContext instanceof MenuItem) {
- MenuItem mi = (MenuItem)callContext;
+ MenuItem mi = (MenuItem) callContext;
mi.setIcon(avatarDrawable);
} else if (callContext instanceof ImageView) {
- ImageView iv = (ImageView)callContext;
+ ImageView iv = (ImageView) callContext;
iv.setImageDrawable(avatarDrawable);
}
}
@@ -834,10 +965,10 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
@Override
public boolean shouldCallGeneratedCallback(String tag, Object callContext) {
if (callContext instanceof MenuItem) {
- MenuItem mi = (MenuItem)callContext;
+ MenuItem mi = (MenuItem) callContext;
return String.valueOf(mi.getTitle()).equals(tag);
} else if (callContext instanceof ImageView) {
- ImageView iv = (ImageView)callContext;
+ ImageView iv = (ImageView) callContext;
return String.valueOf(iv.getTag()).equals(tag);
}
return false;
@@ -846,7 +977,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
/**
* Adds other listeners to react on changes of the drawer layout.
*
- * @param listener Object interested in changes of the drawer layout.
+ * @param listener Object interested in changes of the drawer layout.
*/
public void addDrawerListener(DrawerLayout.DrawerListener listener) {
if (mDrawerLayout != null) {
@@ -859,4 +990,16 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
public boolean isDrawerIndicatorAvailable() {
return true;
}
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ EventBus.getDefault().register(this);
+ }
+
+ @Override
+ protected void onStop() {
+ EventBus.getDefault().unregister(this);
+ super.onStop();
+ }
}
diff --git a/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
index 28749a76cc..237baec695 100644
--- a/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
+++ b/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
@@ -1,22 +1,22 @@
/**
- * ownCloud Android client application
+ * ownCloud Android client application
*
- * @author Bartek Przybylski
- * @author David A. Velasco
- * Copyright (C) 2011 Bartek Przybylski
- * Copyright (C) 2016 ownCloud Inc.
+ * @author Bartek Przybylski
+ * @author David A. Velasco
+ * Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2016 ownCloud Inc.
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package com.owncloud.android.ui.activity;
@@ -41,6 +41,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;
+import android.support.design.widget.BottomNavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
@@ -81,6 +82,7 @@ import com.owncloud.android.operations.UploadFileOperation;
import com.owncloud.android.services.observer.FileObserverService;
import com.owncloud.android.syncadapter.FileSyncAdapter;
import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
+import com.owncloud.android.ui.fragment.ExtendedListFragment;
import com.owncloud.android.ui.fragment.FileDetailFragment;
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.ui.fragment.OCFileListFragment;
@@ -148,6 +150,7 @@ public class FileDisplayActivity extends HookActivity
private OCFile mWaitingToSend;
private Collection