Merge remote-tracking branch 'remotes/origin/master' into userTheming

This commit is contained in:
tobiasKaminsky 2017-05-24 15:49:57 +02:00
commit 5f5430dcf8
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
207 changed files with 392 additions and 357 deletions

View file

@ -34,7 +34,7 @@ pipeline:
# needs gplay # needs gplay
- sed -i '/com.google.*.gms/s/^.*\/\///g' build.gradle - sed -i '/com.google.*.gms/s/^.*\/\///g' build.gradle
- export BRANCH=$(scripts/lint/getBranchName.sh ${GIT_USERNAME} ${GIT_TOKEN} ${DRONE_PULL_REQUEST}) - export BRANCH=$(scripts/lint/getBranchName.sh ${GIT_USERNAME} ${GIT_TOKEN} ${DRONE_PULL_REQUEST})
- ruby scripts/lint/lint-up.rb ${GIT_USERNAME} ${GIT_TOKEN} $BRANCH - scripts/lint/lint-up-wrapper.sh ${GIT_USERNAME} ${GIT_TOKEN} $BRANCH ${LOG_USERNAME} ${LOG_PASSWORD} ${DRONE_BUILD_NUMBER}
when: when:
matrix: matrix:
FLAVOUR: Modified FLAVOUR: Modified

View file

@ -1 +1 @@
eyJhbGciOiJIUzI1NiJ9.cGlwZWxpbmU6CiAgdGVzdDoKICAgIGltYWdlOiBuZXh0Y2xvdWRjaS9hbmRyb2lkOmFuZHJvaWQtMTgKICAgIGNvbW1hbmRzOgogICAgICAjIHVuY29tbWVudCBncGxheSBmb3IgR3BsYXksIE1vZGlmaWVkIG9ubHkKICAgICAgLSBzaCAtYyAiaWYgWyAnJEZMQVZPVVInICE9ICdHZW5lcmljJyBdOyB0aGVuIHNlZCAtaSAnL2NvbS5nb29nbGUuKi5nbXMvcy9eLipcL1wvLy9nJyBidWlsZC5ncmFkbGU7IGZpIgoKICAgICAgLSBlY2hvIG5vIHwgYW5kcm9pZCBjcmVhdGUgYXZkIC0tZm9yY2UgLW4gdGVzdCAtdCAkQU5EUk9JRF9UQVJHRVQgLS1hYmkgJEFORFJPSURfQUJJIC1jIDIwTQogICAgICAtIGVtdWxhdG9yIC1hd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LSBNb2RpZmllZAoKYnJhbmNoZXM6IG1hc3Rlcg.vRQiBogC3hjPLCVvLM0-Qrbvk4hnwKscwaPRBlyc8NM

View file

@ -1,3 +1,6 @@
## 1.4.3 (May 22, 2017)
- Hotfix: ignore oauth header for now and use basic auth to allow new logins for nc12
## 1.4.2 (March 14, 2017) ## 1.4.2 (March 14, 2017)
- Auto Upload for newly taken photos/images (Android 6+) - Auto Upload for newly taken photos/images (Android 6+)
- Auto Upload improvements and fixes - Auto Upload improvements and fixes

View file

@ -52,7 +52,6 @@ repositories {
android { android {
lintOptions { lintOptions {
abortOnError false abortOnError false
lintConfig file("${project.rootDir}/lint.xml")
htmlReport true htmlReport true
htmlOutput file("$project.buildDir/reports/lint/lint.html") htmlOutput file("$project.buildDir/reports/lint/lint.html")
disable 'MissingTranslation' disable 'MissingTranslation'

View file

@ -1,21 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg <svg
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#" xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" height="16"
height="16" width="16"
width="16" version="1"
version="1" id="svg4"
id="svg4" sodipodi:docname="ic_list_empty_image.svg"
sodipodi:docname="ic_list_empty_image.svg" inkscape:version="0.91 r13725"
inkscape:version="0.92.1 r15371" inkscape:export-filename="C:\DEV\src\Android\Nextcloud\favourites\src\main\res\drawable-mdpi\ic_list_empty_image.png"
inkscape:export-filename="C:\DEV\src\Android\Nextcloud\favourites\src\main\res\drawable-mdpi\ic_list_empty_image.png" inkscape:export-xdpi="432"
inkscape:export-xdpi="432" inkscape:export-ydpi="432">
inkscape:export-ydpi="432">
<metadata <metadata
id="metadata10"> id="metadata10">
<rdf:RDF> <rdf:RDF>
@ -38,19 +37,19 @@
guidetolerance="10" guidetolerance="10"
inkscape:pageopacity="0" inkscape:pageopacity="0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:window-width="1920" inkscape:window-width="1600"
inkscape:window-height="1005" inkscape:window-height="835"
id="namedview6" id="namedview6"
showgrid="false" showgrid="false"
inkscape:zoom="14.75" inkscape:zoom="14.75"
inkscape:cx="8" inkscape:cx="17.694915"
inkscape:cy="8" inkscape:cy="8"
inkscape:window-x="-9" inkscape:window-x="1600"
inkscape:window-y="-9" inkscape:window-y="0"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:current-layer="svg4" /> inkscape:current-layer="svg4" />
<path <path
style="block-progression:tb;text-transform:none;text-indent:0;fill:#000000;fill-opacity:1;opacity:0.5" style="block-progression:tb;text-transform:none;text-indent:0;fill:#757575;fill-opacity:1;opacity:1"
d="M1.344 2A.445.445 0 0 0 1 2.438v11.124c0 .23.212.44.438.44h13.125a.457.457 0 0 0 .437-.44V2.61c0-.337-.264-.61-.515-.61zM2 3h12v5l-1-1-3 4-3-3-4 4H2zm2.5 1a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z" d="M1.344 2A.445.445 0 0 0 1 2.438v11.124c0 .23.212.44.438.44h13.125a.457.457 0 0 0 .437-.44V2.61c0-.337-.264-.61-.515-.61zM2 3h12v5l-1-1-3 4-3-3-4 4H2zm2.5 1a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z"
fill="#969696" fill="#969696"
color="#000" color="#000"

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -1,21 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg <svg
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#" xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" height="16"
height="16" width="16"
width="16" version="1"
version="1" id="svg4"
id="svg4" sodipodi:docname="ic_list_empty_video.svg"
sodipodi:docname="ic_list_empty_video.svg" inkscape:version="0.91 r13725"
inkscape:version="0.92.1 r15371" inkscape:export-filename="C:\DEV\src\Android\Nextcloud\favourites\src\main\res\drawable-mdpi\ic_list_empty_video.png"
inkscape:export-filename="C:\DEV\src\Android\Nextcloud\favourites\src\main\res\drawable-mdpi\ic_list_empty_video.png" inkscape:export-xdpi="432"
inkscape:export-xdpi="432" inkscape:export-ydpi="432">
inkscape:export-ydpi="432">
<metadata <metadata
id="metadata10"> id="metadata10">
<rdf:RDF> <rdf:RDF>
@ -38,21 +37,21 @@
guidetolerance="10" guidetolerance="10"
inkscape:pageopacity="0" inkscape:pageopacity="0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:window-width="1920" inkscape:window-width="1600"
inkscape:window-height="1005" inkscape:window-height="835"
id="namedview6" id="namedview6"
showgrid="false" showgrid="false"
inkscape:zoom="14.75" inkscape:zoom="20.85965"
inkscape:cx="8" inkscape:cx="-15.290906"
inkscape:cy="8" inkscape:cy="9.1100694"
inkscape:window-x="-9" inkscape:window-x="1600"
inkscape:window-y="-9" inkscape:window-y="0"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:current-layer="svg4" /> inkscape:current-layer="svg4" />
<path <path
style="block-progression:tb;text-transform:none;text-indent:0;fill:#000000;fill-opacity:1;opacity:0.5" style="block-progression:tb;text-transform:none;text-indent:0;fill:#757575;fill-opacity:1;opacity:1"
d="M1.344 2A.445.445 0 0 0 1 2.438v11.124c0 .23.212.44.438.44h13.124a.457.457 0 0 0 .438-.44V2.61c0-.336-.265-.61-.516-.61zM2 3h12v10H2zm3 2v6l6-3z" d="M1.344 2A.445.445 0 0 0 1 2.438v11.124c0 .23.212.44.438.44h13.124a.457.457 0 0 0 .438-.44V2.61c0-.336-.265-.61-.516-.61zM2 3h12v10H2zm3 2v6l6-3z"
id="path2"
fill="#969696" fill="#969696"
color="#000" color="#000" />
id="path2" />
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 75 errors and 852 warnings</span> <span class="mdl-layout-title">Lint Report: 74 errors and 848 warnings</span>

18
scripts/lint/lint-up-wrapper.sh Executable file
View file

@ -0,0 +1,18 @@
#!/bin/sh
#1: GIT_USERNAME
#2: GIT_TOKEN
#3: BRANCH
#4: LOG_USERNAME
#5: LOG_PASSWORD
#6: DRONE_BUILD_NUMBER
ruby scripts/lint/lint-up.rb $1 $2 $3
if [ $? -eq 0 ]; then
echo "New master at: https://nextcloud.kaminsky.me/index.php/s/tXwtChzyqMj6I8v"
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/droneLogs/master.html --upload-file build/reports/lint/lint.html
else
echo "New results at https://nextcloud.kaminsky.me/index.php/s/tXwtChzyqMj6I8v ->" $6.html
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/droneLogs/$6.html --upload-file build/reports/lint/lint.html
fi

View file

@ -19,8 +19,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.owncloud.android" package="com.owncloud.android"
android:versionCode="10040299" android:versionCode="10040399"
android:versionName="1.4.2"> android:versionName="1.4.3">
<application <application
android:name=".MainApp" android:name=".MainApp"

View file

@ -19,10 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.owncloud.android" package="com.owncloud.android"
android:versionCode="10040299" android:versionCode="10040399"
android:versionName="1.4.2"> android:versionName="1.4.3">
<uses-sdk <uses-sdk
android:minSdkVersion="14" android:minSdkVersion="14"

View file

@ -225,7 +225,10 @@ public class AccountUtils {
if (currentAccountVersion == null) { if (currentAccountVersion == null) {
Log_OC.i(TAG, "Upgrading accounts to account version #" + ACCOUNT_VERSION); Log_OC.i(TAG, "Upgrading accounts to account version #" + ACCOUNT_VERSION);
Account[] ocAccounts = accountMgr.getAccountsByType(MainApp.getAccountType()); Account[] ocAccounts = accountMgr.getAccountsByType(MainApp.getAccountType());
String serverUrl, username, newAccountName, password; String serverUrl;
String username;
String newAccountName;
String password;
Account newAccount; Account newAccount;
for (Account account : ocAccounts) { for (Account account : ocAccounts) {
// build new account name // build new account name

View file

@ -279,49 +279,18 @@ public class FileDataStorageManager {
Log_OC.d(TAG, "Saving folder " + folder.getRemotePath() + " with " + updatedFiles.size() Log_OC.d(TAG, "Saving folder " + folder.getRemotePath() + " with " + updatedFiles.size()
+ " children and " + filesToRemove.size() + " files to remove"); + " children and " + filesToRemove.size() + " files to remove");
ArrayList<ContentProviderOperation> operations = ArrayList<ContentProviderOperation> operations = new ArrayList<>(updatedFiles.size());
new ArrayList<ContentProviderOperation>(updatedFiles.size());
// prepare operations to insert or update files to save in the given folder // prepare operations to insert or update files to save in the given folder
for (OCFile file : updatedFiles) { for (OCFile file : updatedFiles) {
ContentValues cv = new ContentValues(); ContentValues cv = createContentValueForFile(file, folder);
cv.put(ProviderTableMeta.FILE_MODIFIED, file.getModificationTimestamp());
cv.put(
ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA,
file.getModificationTimestampAtLastSyncForData()
);
cv.put(ProviderTableMeta.FILE_CREATION, file.getCreationTimestamp());
cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, file.getFileLength());
cv.put(ProviderTableMeta.FILE_CONTENT_TYPE, file.getMimetype());
cv.put(ProviderTableMeta.FILE_NAME, file.getFileName());
//cv.put(ProviderTableMeta.FILE_PARENT, file.getParentId());
cv.put(ProviderTableMeta.FILE_PARENT, folder.getFileId());
cv.put(ProviderTableMeta.FILE_PATH, file.getRemotePath());
if (!file.isFolder()) {
cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
}
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.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_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()); boolean existsByPath = fileExists(file.getRemotePath());
if (existsByPath || fileExists(file.getFileId())) { if (existsByPath || fileExists(file.getFileId())) {
// updating an existing file // updating an existing file
operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI). operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI)
withValues(cv). .withValues(cv)
withSelection(ProviderTableMeta._ID + "=?", .withSelection(ProviderTableMeta._ID + "=?", new String[]{String.valueOf(file.getFileId())})
new String[]{String.valueOf(file.getFileId())})
.build()); .build());
} else { } else {
@ -332,17 +301,14 @@ public class FileDataStorageManager {
} }
// prepare operations to remove files in the given folder // prepare operations to remove files in the given folder
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
ProviderTableMeta.FILE_PATH + "=?";
String [] whereArgs = null; String [] whereArgs = null;
for (OCFile file : filesToRemove) { for (OCFile file : filesToRemove) {
if (file.getParentId() == folder.getFileId()) { if (file.getParentId() == folder.getFileId()) {
whereArgs = new String[]{mAccount.name, file.getRemotePath()}; whereArgs = new String[]{mAccount.name, file.getRemotePath()};
if (file.isFolder()) { if (file.isFolder()) {
operations.add(ContentProviderOperation.newDelete( operations.add(ContentProviderOperation.newDelete(
ContentUris.withAppendedId( ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_DIR, file.getFileId())
ProviderTableMeta.CONTENT_URI_DIR, file.getFileId()
)
).withSelection(where, whereArgs).build()); ).withSelection(where, whereArgs).build());
File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file)); File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file));
@ -351,8 +317,7 @@ public class FileDataStorageManager {
} }
} else { } else {
operations.add(ContentProviderOperation.newDelete( operations.add(ContentProviderOperation.newDelete(
ContentUris.withAppendedId( ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_FILE, file.getFileId()
ProviderTableMeta.CONTENT_URI_FILE, file.getFileId()
) )
).withSelection(where, whereArgs).build()); ).withSelection(where, whereArgs).build());
@ -366,29 +331,7 @@ public class FileDataStorageManager {
} }
// update metadata of folder // update metadata of folder
ContentValues cv = new ContentValues(); ContentValues cv = createContentValueForFile(folder);
cv.put(ProviderTableMeta.FILE_MODIFIED, folder.getModificationTimestamp());
cv.put(
ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA,
folder.getModificationTimestampAtLastSyncForData()
);
cv.put(ProviderTableMeta.FILE_CREATION, folder.getCreationTimestamp());
cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, 0);
cv.put(ProviderTableMeta.FILE_CONTENT_TYPE, folder.getMimetype());
cv.put(ProviderTableMeta.FILE_NAME, folder.getFileName());
cv.put(ProviderTableMeta.FILE_PARENT, folder.getParentId());
cv.put(ProviderTableMeta.FILE_PATH, folder.getRemotePath());
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.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). operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI).
withValues(cv). withValues(cv).
@ -431,7 +374,67 @@ public class FileDataStorageManager {
} }
} }
} }
}
private ContentValues createContentValueForFile(OCFile folder) {
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.FILE_MODIFIED, folder.getModificationTimestamp());
cv.put(
ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA,
folder.getModificationTimestampAtLastSyncForData()
);
cv.put(ProviderTableMeta.FILE_CREATION, folder.getCreationTimestamp());
cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, 0);
cv.put(ProviderTableMeta.FILE_CONTENT_TYPE, folder.getMimetype());
cv.put(ProviderTableMeta.FILE_NAME, folder.getFileName());
cv.put(ProviderTableMeta.FILE_PARENT, folder.getParentId());
cv.put(ProviderTableMeta.FILE_PATH, folder.getRemotePath());
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.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());
return cv;
}
private ContentValues createContentValueForFile(OCFile file, OCFile folder) {
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.FILE_MODIFIED, file.getModificationTimestamp());
cv.put(
ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA,
file.getModificationTimestampAtLastSyncForData()
);
cv.put(ProviderTableMeta.FILE_CREATION, file.getCreationTimestamp());
cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, file.getFileLength());
cv.put(ProviderTableMeta.FILE_CONTENT_TYPE, file.getMimetype());
cv.put(ProviderTableMeta.FILE_NAME, file.getFileName());
//cv.put(ProviderTableMeta.FILE_PARENT, file.getParentId());
cv.put(ProviderTableMeta.FILE_PARENT, folder.getFileId());
cv.put(ProviderTableMeta.FILE_PATH, file.getRemotePath());
if (!file.isFolder()) {
cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
}
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.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_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());
return cv;
} }

View file

@ -425,12 +425,13 @@ public class ThumbnailsCacheManager {
thumbnail = doFileInBackground(mFile); thumbnail = doFileInBackground(mFile);
} }
} }
} // the app should never break due to a problem with thumbnails
catch (OutOfMemoryError t) {
Log_OC.e(TAG, "Generation of thumbnail for " + mFile.getAbsolutePath() + " failed", t);
System.gc();
} catch (Throwable t) { } catch (Throwable t) {
// the app should never break due to a problem with thumbnails // the app should never break due to a problem with thumbnails
Log_OC.e(TAG, "Generation of thumbnail for " + mFile.getAbsolutePath() + " failed", t); Log_OC.e(TAG, "Generation of thumbnail for " + mFile.getAbsolutePath() + " failed", t);
if (t instanceof OutOfMemoryError) {
System.gc();
}
} }
return thumbnail; return thumbnail;

View file

@ -56,6 +56,13 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver {
// http://developer.android.com/reference/android/hardware/Camera.html#ACTION_NEW_VIDEO // http://developer.android.com/reference/android/hardware/Camera.html#ACTION_NEW_VIDEO
private static final String NEW_VIDEO_ACTION = "android.hardware.action.NEW_VIDEO"; private static final String NEW_VIDEO_ACTION = "android.hardware.action.NEW_VIDEO";
/**
* Because we support NEW_PHOTO_ACTION and NEW_PHOTO_ACTION_UNOFFICIAL it can happen that
* handleNewPictureAction is called twice for the same photo. Use this simple static variable to
* remember last uploaded photo to filter duplicates. Must not be null!
*/
static String lastUploadedPhotoPath = "";
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
@ -75,13 +82,6 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver {
} }
} }
/**
* Because we support NEW_PHOTO_ACTION and NEW_PHOTO_ACTION_UNOFFICIAL it can happen that
* handleNewPictureAction is called twice for the same photo. Use this simple static variable to
* remember last uploaded photo to filter duplicates. Must not be null!
*/
static String lastUploadedPhotoPath = "";
private void handleNewPictureAction(Context context, Intent intent) { private void handleNewPictureAction(Context context, Intent intent) {
Cursor c = null; Cursor c = null;
String file_path = null; String file_path = null;

View file

@ -115,7 +115,8 @@ public class IndexedForest<V> {
String currentPath = remotePath; String currentPath = remotePath;
String parentPath = null; String parentPath = null;
String parentKey = null; String parentKey = null;
Node<V> currentNode = valuedNode, parentNode = null; Node<V> currentNode = valuedNode;
Node<V> parentNode = null;
boolean linked = false; boolean linked = false;
while (!OCFile.ROOT_PATH.equals(currentPath) && !linked) { while (!OCFile.ROOT_PATH.equals(currentPath) && !linked) {
parentPath = new File(currentPath).getParent(); parentPath = new File(currentPath).getParent();

View file

@ -197,6 +197,10 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
updatePausePlay(); updatePausePlay();
} }
public void stopMediaPlayerMessages() {
mHandler.removeMessages(SHOW_PROGRESS);
}
private void initControllerView(View v) { private void initControllerView(View v) {
mPauseButton = (ImageButton) v.findViewById(R.id.playBtn); mPauseButton = (ImageButton) v.findViewById(R.id.playBtn);

View file

@ -508,7 +508,6 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
// nobody is bound // nobody is bound
processStopRequest(true); processStopRequest(true);
} }
return;
} }

View file

@ -98,11 +98,8 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
// analyze response // analyze response
if (result.getHttpCode() == HttpStatus.SC_UNAUTHORIZED) { if (result.getHttpCode() == HttpStatus.SC_UNAUTHORIZED) {
String authRequest = ((result.getAuthenticateHeader()).trim()).toLowerCase(); String authRequest = ((result.getAuthenticateHeader()).trim()).toLowerCase();
if (authRequest.startsWith("basic")) { if (authRequest.startsWith("basic") || authRequest.startsWith("bearer")) {
authMethod = AuthenticationMethod.BASIC_HTTP_AUTH; authMethod = AuthenticationMethod.BASIC_HTTP_AUTH;
} else if (authRequest.startsWith("bearer")) {
authMethod = AuthenticationMethod.BEARER_TOKEN;
} }
// else - fall back to UNKNOWN // else - fall back to UNKNOWN

View file

@ -1,20 +1,20 @@
/** /*
* Nextcloud Android client application * Nextcloud Android client application
* *
* @author Tobias Kaminsky * @author Tobias Kaminsky
* Copyright (C) 2017 Tobias Kaminsky * Copyright (C) 2017 Tobias Kaminsky
* Copyright (C) 2017 Nextcloud GmbH. * Copyright (C) 2017 Nextcloud GmbH.
* <p> *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* at your option) any later version. * at your option) any later version.
* <p> *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* <p> *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -173,7 +173,9 @@ public class ContactsBackupJob extends Job {
cal.add(Calendar.DAY_OF_YEAR, -daysToExpire); cal.add(Calendar.DAY_OF_YEAR, -daysToExpire);
Long timestampToExpire = cal.getTimeInMillis(); Long timestampToExpire = cal.getTimeInMillis();
Log_OC.d(TAG, "expire: " + daysToExpire + " " + backupFolder.getFileName()); if (backupFolder != null) {
Log_OC.d(TAG, "expire: " + daysToExpire + " " + backupFolder.getFileName());
}
Vector<OCFile> backups = storageManager.getFolderContent(backupFolder, false); Vector<OCFile> backups = storageManager.getFolderContent(backupFolder, false);

View file

@ -136,7 +136,8 @@ public class CustomPopup {
LayoutParams.WRAP_CONTENT)); LayoutParams.WRAP_CONTENT));
root.measure(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); root.measure(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
int rootW = root.getWidth(), rootH = root.getHeight(); int rootW = root.getWidth();
int rootH = root.getHeight();
int screenW = mWManager.getDefaultDisplay().getWidth(); int screenW = mWManager.getDefaultDisplay().getWidth();
int xpos = ((screenW - rootW) / 2) + x; int xpos = ((screenW - rootW) / 2) + x;

View file

@ -509,6 +509,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
case Menu.NONE: case Menu.NONE:
// account clicked // account clicked
accountClicked(menuItem.getTitle().toString()); accountClicked(menuItem.getTitle().toString());
break;
default: default:
Log_OC.i(TAG, "Unknown drawer menu item clicked: " + menuItem.getTitle()); Log_OC.i(TAG, "Unknown drawer menu item clicked: " + menuItem.getTitle());
} }

View file

@ -316,7 +316,7 @@ public class FileDisplayActivity extends HookActivity
dialog.dismiss(); dialog.dismiss();
} }
}) })
.setIcon(R.drawable.ic_cloud_upload) .setIcon(R.drawable.nav_folder_sync)
.show(); .show();
} }
} }
@ -431,7 +431,12 @@ public class FileDisplayActivity extends HookActivity
/// Second fragment /// Second fragment
OCFile file = getFile(); OCFile file = getFile();
Fragment secondFragment = chooseInitialSecondFragment(file);
Fragment secondFragment = getSecondFragment();
if (secondFragment == null) {
secondFragment = chooseInitialSecondFragment(file);
}
if (secondFragment != null) { if (secondFragment != null) {
setSecondFragment(secondFragment); setSecondFragment(secondFragment);
updateFragmentsVisibility(true); updateFragmentsVisibility(true);
@ -470,13 +475,9 @@ public class FileDisplayActivity extends HookActivity
Fragment secondFragment = null; Fragment secondFragment = null;
if (file != null && !file.isFolder()) { if (file != null && !file.isFolder()) {
if (file.isDown() && PreviewMediaFragment.canBePreviewed(file)) { if (file.isDown() && PreviewMediaFragment.canBePreviewed(file)) {
int startPlaybackPosition = int startPlaybackPosition = getIntent().getIntExtra(PreviewVideoActivity.EXTRA_START_POSITION, 0);
getIntent().getIntExtra(PreviewVideoActivity.EXTRA_START_POSITION, 0); boolean autoplay = getIntent().getBooleanExtra(PreviewVideoActivity.EXTRA_AUTOPLAY, true);
boolean autoplay = secondFragment = new PreviewMediaFragment(file, getAccount(), startPlaybackPosition, autoplay);
getIntent().getBooleanExtra(PreviewVideoActivity.EXTRA_AUTOPLAY, true);
secondFragment = new PreviewMediaFragment(file, getAccount(),
startPlaybackPosition, autoplay);
} else if (file.isDown() && PreviewTextFragment.canBePreviewed(file)) { } else if (file.isDown() && PreviewTextFragment.canBePreviewed(file)) {
secondFragment = null; secondFragment = null;
} else { } else {
@ -550,8 +551,7 @@ public class FileDisplayActivity extends HookActivity
} }
public FileFragment getSecondFragment() { public FileFragment getSecondFragment() {
Fragment second = getSupportFragmentManager().findFragmentByTag( Fragment second = getSupportFragmentManager().findFragmentByTag(FileDisplayActivity.TAG_SECOND_FRAGMENT);
FileDisplayActivity.TAG_SECOND_FRAGMENT);
if (second != null) { if (second != null) {
return (FileFragment) second; return (FileFragment) second;
} }
@ -757,7 +757,7 @@ public class FileDisplayActivity extends HookActivity
R.drawable.ic_view_list)); R.drawable.ic_view_list));
getListOfFilesFragment().setGridAsPreferred(); getListOfFilesFragment().setGridAsPreferred();
} }
return true; break;
} }
default: default:
retval = super.onOptionsItemSelected(item); retval = super.onOptionsItemSelected(item);

View file

@ -49,6 +49,8 @@ public class CreateFolderDialogFragment
public static final String CREATE_FOLDER_FRAGMENT = "CREATE_FOLDER_FRAGMENT"; public static final String CREATE_FOLDER_FRAGMENT = "CREATE_FOLDER_FRAGMENT";
private OCFile mParentFolder;
/** /**
* Public factory method to create new CreateFolderDialogFragment instances. * Public factory method to create new CreateFolderDialogFragment instances.
* *
@ -63,9 +65,6 @@ public class CreateFolderDialogFragment
return frag; return frag;
} }
private OCFile mParentFolder;
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {

View file

@ -54,6 +54,8 @@ public class RenameFileDialogFragment
private static final String ARG_TARGET_FILE = "TARGET_FILE"; private static final String ARG_TARGET_FILE = "TARGET_FILE";
private OCFile mTargetFile;
/** /**
* Public factory method to create new RenameFileDialogFragment instances. * Public factory method to create new RenameFileDialogFragment instances.
* *
@ -69,8 +71,6 @@ public class RenameFileDialogFragment
} }
private OCFile mTargetFile;
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
mTargetFile = getArguments().getParcelable(ARG_TARGET_FILE); mTargetFile = getArguments().getParcelable(ARG_TARGET_FILE);

View file

@ -287,8 +287,8 @@ public class ExtendedListFragment extends Fragment
} }
public boolean onQueryTextChange(final String query) { public boolean onQueryTextChange(final String query) {
if (getFragmentManager().findFragmentByTag(FileDisplayActivity.TAG_SECOND_FRAGMENT) if (getFragmentManager() != null && getFragmentManager().
instanceof ExtendedListFragment){ findFragmentByTag(FileDisplayActivity.TAG_SECOND_FRAGMENT) instanceof ExtendedListFragment) {
performSearch(query, false); performSearch(query, false);
return true; return true;
} else { } else {

View file

@ -23,9 +23,11 @@ package com.owncloud.android.ui.fragment.contactsbackup;
import android.Manifest; import android.Manifest;
import android.accounts.Account; import android.accounts.Account;
import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
@ -53,6 +55,7 @@ import android.widget.LinearLayout;
import com.evernote.android.job.JobRequest; import com.evernote.android.job.JobRequest;
import com.evernote.android.job.util.support.PersistableBundleCompat; import com.evernote.android.job.util.support.PersistableBundleCompat;
import com.owncloud.android.R; import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileDownloader; import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.common.utils.Log_OC;
@ -104,6 +107,7 @@ public class ContactListFragment extends FileFragment {
public Button restoreContacts; public Button restoreContacts;
private ContactListAdapter contactListAdapter; private ContactListAdapter contactListAdapter;
private Account account;
public static ContactListFragment newInstance(OCFile file, Account account) { public static ContactListFragment newInstance(OCFile file, Account account) {
ContactListFragment frag = new ContactListFragment(); ContactListFragment frag = new ContactListFragment();
@ -142,13 +146,19 @@ public class ContactListFragment extends FileFragment {
try { try {
OCFile ocFile = getArguments().getParcelable(FILE_NAME); OCFile ocFile = getArguments().getParcelable(FILE_NAME);
setFile(ocFile); setFile(ocFile);
Account account = getArguments().getParcelable(ACCOUNT); account = getArguments().getParcelable(ACCOUNT);
if (!ocFile.isDown()) { if (!ocFile.isDown()) {
Intent i = new Intent(getContext(), FileDownloader.class); Intent i = new Intent(getContext(), FileDownloader.class);
i.putExtra(FileDownloader.EXTRA_ACCOUNT, account); i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
i.putExtra(FileDownloader.EXTRA_FILE, ocFile); i.putExtra(FileDownloader.EXTRA_FILE, ocFile);
getContext().startService(i); getContext().startService(i);
// Listen for download messages
IntentFilter downloadIntentFilter = new IntentFilter(FileDownloader.getDownloadAddedMessage());
downloadIntentFilter.addAction(FileDownloader.getDownloadFinishMessage());
DownloadFinishReceiver mDownloadFinishReceiver = new DownloadFinishReceiver();
getContext().registerReceiver(mDownloadFinishReceiver, downloadIntentFilter);
} else { } else {
File file = new File(ocFile.getStoragePath()); File file = new File(ocFile.getStoragePath());
vCards.addAll(Ezvcard.parse(file).all()); vCards.addAll(Ezvcard.parse(file).all());
@ -446,6 +456,27 @@ public class ContactListFragment extends FileFragment {
return displayName; return displayName;
} }
} }
private class DownloadFinishReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equalsIgnoreCase(FileDownloader.getDownloadFinishMessage())){
String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);
FileDataStorageManager storageManager = new FileDataStorageManager(account,
getContext().getContentResolver());
OCFile ocFile = storageManager.getFileByPath(downloadedRemotePath);
File file = new File(ocFile.getStoragePath());
try {
contactListAdapter.replaceVCards(Ezvcard.parse(file).all());
} catch (IOException e) {
Log_OC.e(TAG, "IO Exception: " + file.getAbsolutePath());
}
}
}
}
} }
class ContactListAdapter extends RecyclerView.Adapter<ContactListFragment.ContactItemViewHolder> { class ContactListAdapter extends RecyclerView.Adapter<ContactListFragment.ContactItemViewHolder> {
@ -475,6 +506,11 @@ class ContactListAdapter extends RecyclerView.Adapter<ContactListFragment.Contac
} }
} }
public void replaceVCards(List<VCard> vCards) {
this.vCards = vCards;
notifyDataSetChanged();
}
public int[] getCheckedIntArray() { public int[] getCheckedIntArray() {
int[] intArray; int[] intArray;
if (checkedVCards != null && checkedVCards.size() > 0) { if (checkedVCards != null && checkedVCards.size() > 0) {

View file

@ -1,4 +1,4 @@
/** /*
* Nextcloud Android client application * Nextcloud Android client application
* *
* @author Mario Danic * @author Mario Danic
@ -24,6 +24,7 @@ import android.Manifest;
import android.accounts.Account; import android.accounts.Account;
import android.app.DatePickerDialog; import android.app.DatePickerDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
@ -44,7 +45,10 @@ import com.evernote.android.job.JobRequest;
import com.evernote.android.job.util.support.PersistableBundleCompat; import com.evernote.android.job.util.support.PersistableBundleCompat;
import com.owncloud.android.R; import com.owncloud.android.R;
import com.owncloud.android.datamodel.ArbitraryDataProvider; import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.operations.RefreshFolderOperation;
import com.owncloud.android.services.ContactsBackupJob; import com.owncloud.android.services.ContactsBackupJob;
import com.owncloud.android.ui.activity.ContactsPreferenceActivity; import com.owncloud.android.ui.activity.ContactsPreferenceActivity;
import com.owncloud.android.ui.fragment.FileFragment; import com.owncloud.android.ui.fragment.FileFragment;
@ -167,21 +171,48 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi
} }
} }
final ContactsPreferenceActivity contactsPreferenceActivity = (ContactsPreferenceActivity) getActivity(); ContactsPreferenceActivity contactsPreferenceActivity = (ContactsPreferenceActivity) getActivity();
String backupFolderString = getResources().getString(R.string.contacts_backup_folder) + OCFile.PATH_SEPARATOR; String backupFolderPath = getResources().getString(R.string.contacts_backup_folder) + OCFile.PATH_SEPARATOR;
OCFile backupFolder = contactsPreferenceActivity.getStorageManager().getFileByPath(backupFolderString); refreshBackupFolder(backupFolderPath, contactsPreferenceActivity);
}
Vector<OCFile> backupFiles = contactsPreferenceActivity.getStorageManager().getFolderContent(backupFolder, private void refreshBackupFolder(final String backupFolderPath,
false); final ContactsPreferenceActivity contactsPreferenceActivity) {
AsyncTask<String, Integer, Boolean> task = new AsyncTask<String, Integer, Boolean>() {
@Override
protected Boolean doInBackground(String... path) {
FileDataStorageManager storageManager = new FileDataStorageManager(account,
getActivity().getContentResolver());
if (backupFiles == null || backupFiles.size() == 0) { OCFile folder = storageManager.getFileByPath(path[0]);
contactsRestoreHeader.setVisibility(View.GONE); RefreshFolderOperation operation = new RefreshFolderOperation(folder, System.currentTimeMillis(),
contactsDatePickerBtn.setVisibility(View.GONE); false, false, false, storageManager, account, getContext());
} else {
contactsRestoreHeader.setVisibility(View.VISIBLE); RemoteOperationResult result = operation.execute(account, getContext());
contactsDatePickerBtn.setVisibility(View.VISIBLE); return result.isSuccess();
} }
@Override
protected void onPostExecute(Boolean result) {
if (result) {
OCFile backupFolder = contactsPreferenceActivity.getStorageManager().getFileByPath(backupFolderPath);
Vector<OCFile> backupFiles = contactsPreferenceActivity.getStorageManager()
.getFolderContent(backupFolder, false);
if (backupFiles == null || backupFiles.size() == 0) {
contactsRestoreHeader.setVisibility(View.GONE);
contactsDatePickerBtn.setVisibility(View.GONE);
} else {
contactsRestoreHeader.setVisibility(View.VISIBLE);
contactsDatePickerBtn.setVisibility(View.VISIBLE);
}
}
}
};
task.execute(backupFolderPath);
} }

View file

@ -106,6 +106,7 @@ public class PreviewMediaFragment extends FileFragment implements
private MediaServiceConnection mMediaServiceConnection = null; private MediaServiceConnection mMediaServiceConnection = null;
private VideoHelper mVideoHelper; private VideoHelper mVideoHelper;
private boolean mAutoplay; private boolean mAutoplay;
private static boolean mOnResume = false;
public boolean mPrepared; public boolean mPrepared;
private static final String TAG = PreviewMediaFragment.class.getSimpleName(); private static final String TAG = PreviewMediaFragment.class.getSimpleName();
@ -220,6 +221,7 @@ public class PreviewMediaFragment extends FileFragment implements
*/ */
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
mOnResume = true;
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
Log_OC.v(TAG, "onActivityCreated"); Log_OC.v(TAG, "onActivityCreated");
@ -234,14 +236,11 @@ public class PreviewMediaFragment extends FileFragment implements
if (!file.isDown()) { if (!file.isDown()) {
throw new IllegalStateException("There is no local file to preview"); throw new IllegalStateException("There is no local file to preview");
} }
} else {
} file = savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_FILE);
else {
file = (OCFile) savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_FILE);
setFile(file); setFile(file);
mAccount = savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_ACCOUNT); mAccount = savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_ACCOUNT);
mSavedPlaybackPosition = mSavedPlaybackPosition = savedInstanceState.getInt(PreviewMediaFragment.EXTRA_PLAY_POSITION);
savedInstanceState.getInt(PreviewMediaFragment.EXTRA_PLAY_POSITION);
mAutoplay = savedInstanceState.getBoolean(PreviewMediaFragment.EXTRA_PLAYING); mAutoplay = savedInstanceState.getBoolean(PreviewMediaFragment.EXTRA_PLAYING);
} }
@ -251,15 +250,12 @@ public class PreviewMediaFragment extends FileFragment implements
mVideoPreview.setVisibility(View.VISIBLE); mVideoPreview.setVisibility(View.VISIBLE);
mImagePreview.setVisibility(View.GONE); mImagePreview.setVisibility(View.GONE);
prepareVideo(); prepareVideo();
} else {
}
else {
mVideoPreview.setVisibility(View.GONE); mVideoPreview.setVisibility(View.GONE);
mImagePreview.setVisibility(View.VISIBLE); mImagePreview.setVisibility(View.VISIBLE);
extractAndSetCoverArt(file); extractAndSetCoverArt(file);
} }
} }
} }
/** /**
@ -307,11 +303,8 @@ public class PreviewMediaFragment extends FileFragment implements
} }
else { else {
if (mMediaServiceBinder != null) { if (mMediaServiceBinder != null) {
outState.putInt( outState.putInt(PreviewMediaFragment.EXTRA_PLAY_POSITION, mMediaServiceBinder.getCurrentPosition());
PreviewMediaFragment.EXTRA_PLAY_POSITION, outState.putBoolean(PreviewMediaFragment.EXTRA_PLAYING, mMediaServiceBinder.isPlaying());
mMediaServiceBinder.getCurrentPosition());
outState.putBoolean(
PreviewMediaFragment.EXTRA_PLAYING, mMediaServiceBinder.isPlaying());
} }
} }
} }
@ -565,6 +558,8 @@ public class PreviewMediaFragment extends FileFragment implements
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
mOnResume = !mOnResume;
if (getActivity() != null) { if (getActivity() != null) {
AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG); AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
} }
@ -585,6 +580,7 @@ public class PreviewMediaFragment extends FileFragment implements
if (mMediaServiceConnection != null) { if (mMediaServiceConnection != null) {
Log_OC.d(TAG, "Unbinding from MediaService ..."); Log_OC.d(TAG, "Unbinding from MediaService ...");
if (mMediaServiceBinder != null && mMediaController != null) { if (mMediaServiceBinder != null && mMediaController != null) {
mMediaController.stopMediaPlayerMessages();
mMediaServiceBinder.unregisterMediaController(mMediaController); mMediaServiceBinder.unregisterMediaController(mMediaController);
} }
getActivity().unbindService(mMediaServiceConnection); getActivity().unbindService(mMediaServiceConnection);
@ -638,7 +634,7 @@ public class PreviewMediaFragment extends FileFragment implements
private void playAudio() { private void playAudio() {
OCFile file = getFile(); OCFile file = getFile();
if (!mMediaServiceBinder.isPlaying(file)) { if (!mMediaServiceBinder.isPlaying(file) && !mOnResume) {
Log_OC.d(TAG, "starting playback of " + file.getStoragePath()); Log_OC.d(TAG, "starting playback of " + file.getStoragePath());
mMediaServiceBinder.start(mAccount, file, mAutoplay, mSavedPlaybackPosition); mMediaServiceBinder.start(mAccount, file, mAutoplay, mSavedPlaybackPosition);
@ -649,6 +645,8 @@ public class PreviewMediaFragment extends FileFragment implements
mMediaController.updatePausePlay(); mMediaController.updatePausePlay();
} }
} }
mOnResume = false;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

View file

Before

Width:  |  Height:  |  Size: 367 B

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

View file

Before

Width:  |  Height:  |  Size: 840 B

After

Width:  |  Height:  |  Size: 840 B

View file

Before

Width:  |  Height:  |  Size: 772 B

After

Width:  |  Height:  |  Size: 772 B

View file

Before

Width:  |  Height:  |  Size: 714 B

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

View file

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 298 B

View file

Before

Width:  |  Height:  |  Size: 754 B

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,004 B

View file

Before

Width:  |  Height:  |  Size: 995 B

After

Width:  |  Height:  |  Size: 995 B

View file

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

View file

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 576 B

View file

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 537 B

View file

Before

Width:  |  Height:  |  Size: 427 B

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

View file

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 199 B

View file

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

View file

Before

Width:  |  Height:  |  Size: 984 B

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

View file

Before

Width:  |  Height:  |  Size: 733 B

After

Width:  |  Height:  |  Size: 733 B

View file

Before

Width:  |  Height:  |  Size: 183 B

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

View file

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 944 B

After

Width:  |  Height:  |  Size: 944 B

View file

Before

Width:  |  Height:  |  Size: 669 B

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

View file

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 342 B

View file

Before

Width:  |  Height:  |  Size: 910 B

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 936 B

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

Before

Width:  |  Height:  |  Size: 453 B

After

Width:  |  Height:  |  Size: 453 B

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 633 B

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 360 B

Some files were not shown because too many files have changed in this diff Show more