Skip to content

Commit d91f911

Browse files
authored
Merge pull request #1858 from owncloud/release_2.2.0
Release 2.2.0
2 parents 2dabb78 + 4f41ae1 commit d91f911

File tree

6 files changed

+130
-93
lines changed

6 files changed

+130
-93
lines changed

AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
-->
2020
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2121
package="com.owncloud.android"
22-
android:versionCode="20100200"
23-
android:versionName="2.1.2" >
22+
android:versionCode="20200000"
23+
android:versionName="2.2.0" >
2424

2525
<uses-sdk
2626
android:minSdkVersion="14"

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 2.2.0 (December 2016)
2+
- Set folders as Available Offline
3+
- New navigation drawer, with avatar and account switch.
4+
- New account manager, accessible from navigation drawer.
5+
- Set edit permissions in federated shares of folders (OC server >= 9.1)
6+
- Monitor and revoke session from web UI (OC server >= 9.1)
7+
- Improved look and contents of file menu.
8+
- Bugs fixed, including:
9+
+ Keep modification time of uploaded files.
10+
+ Stop audio when file is deleted.
11+
+ Upload of big files.
12+
113
## 2.1.2 (September 2016)
214
- Instant uploads fixed in Android 6.
315

oc_jb_workaround/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.owncloud.android.workaround.accounts"
44
android:versionCode="0100032"
5-
android:versionName="1.0.32" >
5+
android:versionName="1.0.33" >
66

77
<uses-sdk
88
android:minSdkVersion="16"

owncloud-android-library

src/com/owncloud/android/datamodel/FileDataStorageManager.java

Lines changed: 107 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ public ContentProviderClient getContentProviderClient() {
104104
public OCFile getFileByPath(String path) {
105105
Cursor c = getFileCursorForValue(ProviderTableMeta.FILE_PATH, path);
106106
OCFile file = null;
107-
if (c.moveToFirst()) {
108-
file = createFileInstance(c);
107+
if (c!= null) {
108+
if (c.moveToFirst()) {
109+
file = createFileInstance(c);
110+
}
111+
c.close();
109112
}
110-
c.close();
111113
if (file == null && OCFile.ROOT_PATH.equals(path)) {
112114
return createRootDir(); // root should always exist
113115
}
@@ -118,20 +120,24 @@ public OCFile getFileByPath(String path) {
118120
public OCFile getFileById(long id) {
119121
Cursor c = getFileCursorForValue(ProviderTableMeta._ID, String.valueOf(id));
120122
OCFile file = null;
121-
if (c.moveToFirst()) {
122-
file = createFileInstance(c);
123+
if (c != null) {
124+
if (c.moveToFirst()) {
125+
file = createFileInstance(c);
126+
}
127+
c.close();
123128
}
124-
c.close();
125129
return file;
126130
}
127131

128132
public OCFile getFileByLocalPath(String path) {
129133
Cursor c = getFileCursorForValue(ProviderTableMeta.FILE_STORAGE_PATH, path);
130134
OCFile file = null;
131-
if (c.moveToFirst()) {
132-
file = createFileInstance(c);
135+
if (c != null) {
136+
if (c.moveToFirst()) {
137+
file = createFileInstance(c);
138+
}
139+
c.close();
133140
}
134-
c.close();
135141
return file;
136142
}
137143

@@ -732,84 +738,87 @@ public void moveLocalFile(OCFile file, String targetPath, String targetParentPat
732738
);
733739
}
734740

735-
/// 2. prepare a batch of update operations to change all the descendants
736-
ArrayList<ContentProviderOperation> operations =
737-
new ArrayList<ContentProviderOperation>(c.getCount());
741+
List<String> originalPathsToTriggerMediaScan = new ArrayList<>();
742+
List<String> newPathsToTriggerMediaScan = new ArrayList<>();
738743
String defaultSavePath = FileStorageUtils.getSavePath(mAccount.name);
739-
List<String> originalPathsToTriggerMediaScan = new ArrayList<String>();
740-
List<String> newPathsToTriggerMediaScan = new ArrayList<String>();
741-
if (c.moveToFirst()) {
742-
int lengthOfOldPath = file.getRemotePath().length();
743-
int lengthOfOldStoragePath = defaultSavePath.length() + lengthOfOldPath;
744-
do {
745-
ContentValues cv = new ContentValues(); // keep construction in the loop
746-
OCFile child = createFileInstance(c);
747-
cv.put(
744+
745+
/// 2. prepare a batch of update operations to change all the descendants
746+
if (c != null) {
747+
ArrayList<ContentProviderOperation> operations =
748+
new ArrayList<>(c.getCount());
749+
if (c.moveToFirst()) {
750+
int lengthOfOldPath = file.getRemotePath().length();
751+
int lengthOfOldStoragePath = defaultSavePath.length() + lengthOfOldPath;
752+
do {
753+
ContentValues cv = new ContentValues(); // keep construction in the loop
754+
OCFile child = createFileInstance(c);
755+
cv.put(
748756
ProviderTableMeta.FILE_PATH,
749757
targetPath + child.getRemotePath().substring(lengthOfOldPath)
750-
);
751-
if (child.getStoragePath() != null &&
758+
);
759+
if (child.getStoragePath() != null &&
752760
child.getStoragePath().startsWith(defaultSavePath)) {
753-
// update link to downloaded content - but local move is not done here!
754-
String targetLocalPath = defaultSavePath + targetPath +
761+
// update link to downloaded content - but local move is not done here!
762+
String targetLocalPath = defaultSavePath + targetPath +
755763
child.getStoragePath().substring(lengthOfOldStoragePath);
756764

757-
cv.put(ProviderTableMeta.FILE_STORAGE_PATH, targetLocalPath);
758-
759-
originalPathsToTriggerMediaScan.add(child.getStoragePath());
760-
newPathsToTriggerMediaScan.add(targetLocalPath);
765+
cv.put(ProviderTableMeta.FILE_STORAGE_PATH, targetLocalPath);
761766

762-
}
763-
if (targetParent.getAvailableOfflineStatus() !=
764-
OCFile.AvailableOfflineStatus.NOT_AVAILABLE_OFFLINE) {
765-
// moving to an available offline subfolder
766-
cv.put(
767-
ProviderTableMeta.FILE_KEEP_IN_SYNC,
768-
OCFile.AvailableOfflineStatus.AVAILABLE_OFFLINE_PARENT.getValue()
769-
);
767+
originalPathsToTriggerMediaScan.add(child.getStoragePath());
768+
newPathsToTriggerMediaScan.add(targetLocalPath);
770769

771-
} else {
772-
// moving to a not available offline subfolder - with care
773-
if (file.getAvailableOfflineStatus() ==
774-
OCFile.AvailableOfflineStatus.AVAILABLE_OFFLINE_PARENT) {
770+
}
771+
if (targetParent.getAvailableOfflineStatus() !=
772+
OCFile.AvailableOfflineStatus.NOT_AVAILABLE_OFFLINE) {
773+
// moving to an available offline subfolder
775774
cv.put(
776775
ProviderTableMeta.FILE_KEEP_IN_SYNC,
777-
OCFile.AvailableOfflineStatus.NOT_AVAILABLE_OFFLINE.getValue()
776+
OCFile.AvailableOfflineStatus.AVAILABLE_OFFLINE_PARENT.getValue()
778777
);
778+
779+
} else {
780+
// moving to a not available offline subfolder - with care
781+
if (file.getAvailableOfflineStatus() ==
782+
OCFile.AvailableOfflineStatus.AVAILABLE_OFFLINE_PARENT) {
783+
cv.put(
784+
ProviderTableMeta.FILE_KEEP_IN_SYNC,
785+
OCFile.AvailableOfflineStatus.NOT_AVAILABLE_OFFLINE.getValue()
786+
);
787+
}
779788
}
780-
}
781789

782-
if (child.getRemotePath().equals(file.getRemotePath())) {
783-
cv.put(
784-
ProviderTableMeta.FILE_PARENT,
785-
targetParent.getFileId()
786-
);
787-
}
788-
operations.add(
790+
if (child.getRemotePath().equals(file.getRemotePath())) {
791+
cv.put(
792+
ProviderTableMeta.FILE_PARENT,
793+
targetParent.getFileId()
794+
);
795+
}
796+
operations.add(
789797
ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI).
790-
withValues(cv).
791-
withSelection(
792-
ProviderTableMeta._ID + "=?",
793-
new String[]{String.valueOf(child.getFileId())}
794-
)
795-
.build());
798+
withValues(cv).
799+
withSelection(
800+
ProviderTableMeta._ID + "=?",
801+
new String[]{String.valueOf(child.getFileId())}
802+
)
803+
.build());
796804

797-
} while (c.moveToNext());
798-
}
799-
c.close();
805+
} while (c.moveToNext());
806+
}
807+
c.close();
800808

801-
/// 3. apply updates in batch
802-
try {
803-
if (getContentResolver() != null) {
804-
getContentResolver().applyBatch(MainApp.getAuthority(), operations);
809+
/// 3. apply updates in batch
810+
try {
811+
if (getContentResolver() != null) {
812+
getContentResolver().applyBatch(MainApp.getAuthority(), operations);
805813

806-
} else {
807-
getContentProviderClient().applyBatch(operations);
808-
}
814+
} else {
815+
getContentProviderClient().applyBatch(operations);
816+
}
809817

810-
} catch (Exception e) {
811-
Log_OC.e(TAG, "Fail to update " + file.getFileId() + " and descendants in database",
818+
} catch (Exception e) {
819+
Log_OC.e(TAG, "Fail to update " + file.getFileId() + " and descendants in database",
812820
e);
821+
}
813822
}
814823

815824
/// 4. move in local file system
@@ -1000,8 +1009,11 @@ private boolean fileExists(String cmp_key, String value) {
10001009
return false;
10011010
}
10021011
}
1003-
boolean retval = c.moveToFirst();
1004-
c.close();
1012+
boolean retval = false;
1013+
if (c!= null) {
1014+
retval = c.moveToFirst();
1015+
c.close();
1016+
}
10051017
return retval;
10061018
}
10071019

@@ -1200,8 +1212,11 @@ private boolean shareExistsForRemoteId(long remoteId) {
12001212
*/
12011213
private boolean shareExistsForValue(String key, String value) {
12021214
Cursor c = getShareCursorForValue(key, value);
1203-
boolean retval = c.moveToFirst();
1204-
c.close();
1215+
boolean retval = false;
1216+
if (c != null) {
1217+
retval = c.moveToFirst();
1218+
c.close();
1219+
}
12051220
return retval;
12061221
}
12071222

@@ -1303,10 +1318,12 @@ public OCShare getFirstShareByPathAndType(String path, ShareType type, String sh
13031318
}
13041319
}
13051320
OCShare share = null;
1306-
if (c.moveToFirst()) {
1307-
share = createShareInstance(c);
1321+
if (c != null) {
1322+
if (c.moveToFirst()) {
1323+
share = createShareInstance(c);
1324+
}
1325+
c.close();
13081326
}
1309-
c.close();
13101327
return share;
13111328
}
13121329

@@ -1831,14 +1848,16 @@ public ArrayList<OCShare> getSharesWithForAFile(String filePath, String accountN
18311848
}
18321849
ArrayList<OCShare> shares = new ArrayList<OCShare>();
18331850
OCShare share = null;
1834-
if (c.moveToFirst()) {
1835-
do {
1836-
share = createShareInstance(c);
1837-
shares.add(share);
1838-
// }
1839-
} while (c.moveToNext());
1851+
if (c != null) {
1852+
if (c.moveToFirst()) {
1853+
do {
1854+
share = createShareInstance(c);
1855+
shares.add(share);
1856+
// }
1857+
} while (c.moveToNext());
1858+
}
1859+
c.close();
18401860
}
1841-
c.close();
18421861

18431862
return shares;
18441863
}
@@ -2161,12 +2180,13 @@ public OCCapability getCapability(String accountName){
21612180
OCCapability capability = null;
21622181
Cursor c = getCapabilityCursorForAccount(accountName);
21632182

2164-
if (c.moveToFirst()) {
2165-
capability = createCapabilityInstance(c);
2166-
} else {
2167-
capability = new OCCapability(); // return default with all UNKNOWN
2183+
capability = new OCCapability(); // default value with all UNKNOWN
2184+
if (c != null) {
2185+
if (c.moveToFirst()) {
2186+
capability = createCapabilityInstance(c);
2187+
}
2188+
c.close();
21682189
}
2169-
c.close();
21702190
return capability;
21712191
}
21722192

src/com/owncloud/android/ui/fragment/OCFileListFragment.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,13 +555,18 @@ private void setChoiceModeAsMultipleModal(Bundle savedInstanceState) {
555555
}
556556

557557
/**
558-
* Saves the current listed folder.
558+
* Saves the current listed folder
559559
*/
560560
@Override
561561
public void onSaveInstanceState(Bundle outState) {
562562
super.onSaveInstanceState(outState);
563563
outState.putParcelable(KEY_FILE, mFile);
564-
mMultiChoiceModeListener.storeStateIn(outState);
564+
565+
// If this fragment is used to show target folders where a selected file/folder can be
566+
// copied/moved, multiple choice is disabled
567+
if (mMultiChoiceModeListener != null) {
568+
mMultiChoiceModeListener.storeStateIn(outState);
569+
}
565570
}
566571

567572
@Override

0 commit comments

Comments
 (0)