Compare commits

...
Author SHA1 Message Date
Tobias Kaminsky 25704d19a6 daily dev 20180905 2018-09-05 00:32:12 +02:00
Andy Scherzinger cc21e815d8 Merge pull request #2962 from nextcloud/340alpha1
3.4.0 alpha 1
2018-09-04 15:59:20 +02:00
Andy Scherzinger ce4a4d3652 3.4.0 alpha 1 2018-09-04 15:57:36 +02:00
Andy Scherzinger 051345a647 Merge pull request #2960 from nextcloud/addLinksToSummary
Add links to summary
2018-09-04 15:40:58 +02:00
Andy Scherzinger c83356cd40 Merge pull request #1116 from nextcloud/sso
Proof of concept for Single Sign On
2018-09-04 15:38:47 +02:00
nextcloud-android-bot 625810803f Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-09-04 13:12:38 +00:00
Tobias Kaminsky e329809802 Update lint-results.txt
update lint for #1116
2018-09-04 15:09:33 +02:00
Tobias Kaminsky 2a64998555 Merge branch 'master' into sso 2018-09-04 15:01:32 +02:00
tobiasKaminsky 79fdf11512 manually increase lint
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-04 15:00:40 +02:00
tobiasKaminsky b9998c74f0 add links to summary
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-04 14:19:18 +02:00
David Luhmer b26f5dc5d2 Merge pull request #2954 from nextcloud/sso_hashedToken
Use hashed/salted token
2018-09-04 14:14:24 +02:00
Andy Scherzinger 5ed69587e2 Merge pull request #2935 from nextcloud/improve-share-link-handling
Improve share link handling
2018-09-04 11:53:34 +02:00
AndyScherzinger e765cc8306 updated changelog 2018-09-04 11:43:08 +02:00
AndyScherzinger 6ae79355b5 show send to for sharing link via overflow menu in details screen 2018-09-04 11:38:35 +02:00
AndyScherzinger b9bc9bc84b further color fixes for snackbar action 2018-09-04 11:38:34 +02:00
AndyScherzinger 16836ad119 theme share link color in share link snackbar 2018-09-04 11:38:34 +02:00
Tilo Spannagel 4577084517 Improve share link handling
Signed-off-by: Tilo Spannagel <[email protected]>
2018-09-04 11:38:33 +02:00
tobiasKaminsky d969bc816c fix for codacy
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-04 11:37:38 +02:00
Andy Scherzinger 506acd0bbb Merge pull request #2944 from nextcloud/removeDivider
remove dividers
2018-09-04 11:29:49 +02:00
AndyScherzinger 056dc6ece1 fix user info layout alignments 2018-09-04 11:18:30 +02:00
AndyScherzinger 030d697d85 fix iem text alignment to be properly material design (72dp left column) 2018-09-04 11:18:29 +02:00
AndyScherzinger b607d8d176 remove divider in account list 2018-09-04 11:18:29 +02:00
AndyScherzinger a9027218f5 remove card view divider in user info 2018-09-04 11:18:28 +02:00
AndyScherzinger a09b983209 remove empty line 2018-09-04 11:18:28 +02:00
AndyScherzinger ea74122370 fix r-t-l alignment 2018-09-04 11:18:27 +02:00
AndyScherzinger 3da5db1646 remove dividers 2018-09-04 11:18:24 +02:00
Andy Scherzinger 8585208249 Merge pull request #2958 from nextcloud/fixTimSortAgain
Fix Timsort (again)
2018-09-04 11:03:37 +02:00
tobiasKaminsky 7358c3dd09 - change long to bigInteger
- add another test

Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-04 10:41:35 +02:00
Nextcloud bot e9d4a31f18 [tx-robot] updated from transifex 2018-09-04 00:45:45 +00:00
David Luhmer 322aee0454 remove permissions (fix https://github.com/nextcloud/Android-SingleSignOn/issues/27) 2018-09-03 22:01:16 +02:00
David Luhmer e3c708c87f add token verification method into inputstreambinder class (otherwise client app needs dependency on encryptionutils class) 2018-09-03 21:59:52 +02:00
David Luhmer 6a33b72654 increase serial version uid (otherwise connection will fail without error message) 2018-09-03 18:20:32 +02:00
Andy Scherzinger 537e896e57 Merge pull request #2940 from nextcloud/fixDeletedFilesView
make restore icon grey600
2018-09-03 18:03:45 +02:00
tobiasKaminsky c73ffe0e0c use hashed/salted token
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-03 17:22:42 +02:00
tobiasKaminsky 31c795faa5 change corresponding svgl
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-03 16:19:14 +02:00
AndyScherzinger cd5c360155 make restore icon grey600 2018-09-03 11:25:39 +02:00
David Luhmer 415afeb4e3 fix lint issues 2018-09-02 15:01:17 +02:00
David Luhmer f077a7ef33 use getter methods to access NextcloudRequest's variables / add support to disable follow-redirects 2018-09-02 14:51:14 +02:00
David Luhmer 6978fd35d1 fix lint issue "Do not add empty strings" 2018-08-30 18:24:46 +02:00
David Luhmer 65dde41927 add non-translatable flag to single sign on permission labels 2018-08-30 17:00:50 +02:00
David Luhmer c1d4d3d484 Merge branch 'master' into sso 2018-08-28 20:41:00 +02:00
David Luhmer e360ce456a update NextcloudRequest serialization id 2018-08-27 14:15:55 +02:00
David Luhmer 96e79e71fb add more exceptions / improve error handling 2018-08-27 14:15:33 +02:00
David Luhmer 614982a642 add calling package name if it's not set (when validating auth token) 2018-08-27 12:57:02 +02:00
David Luhmer 0234e8097f validate tokens in a way that timing attacks are not possible 2018-08-27 11:35:20 +02:00
David Luhmer 57e7eee9ff remove check for package name as it can be faked easily 2018-08-27 11:34:44 +02:00
David Luhmer 97b924d545 add custom exception for unsupported http method call 2018-08-27 11:34:07 +02:00
David Luhmer e84be102ff fix broken import of custom exceptions after refactoring 2018-08-27 11:19:52 +02:00
David Luhmer e387edc696 Add custom exceptions to constants class as well 2018-08-27 11:13:52 +02:00
David Luhmer dbef39c436 Use constants for username/token/url 2018-08-27 11:12:58 +02:00
David Luhmer 8133875769 create constants for custom exceptions 2018-08-27 11:05:56 +02:00
AndyScherzinger f97b7e4ea1 place license header at the top of the file 2018-08-27 10:50:10 +02:00
David Luhmer ba89fcba8b Fix code quality issue / reorder statements 2018-08-25 18:03:56 +02:00
David Luhmer 7948876041 Fix more code quality issues 2018-08-25 11:34:34 +02:00
David Luhmer 07a9e8c55f Fix code quality issues 2018-08-24 21:35:08 +02:00
David Luhmer cdf3ec2680 fix everything @AndyScherzinger proposed 2018-08-24 17:47:17 +02:00
David Luhmer 767ca18e5e add missing license headers 2018-08-24 17:45:31 +02:00
David Luhmer 89684052b8 fix refactoring of permissions (from owncloud to nextcloud) 2018-08-24 17:14:47 +02:00
David Luhmer e08cb4dec4 Merge branch 'master' into sso 2018-08-24 16:49:38 +02:00
tobiasKaminsky da79ca4afa package renaming
Signed-off-by: tobiasKaminsky <[email protected]>
2018-06-18 14:27:20 +02:00
David Luhmer 6eec0a3a1c add support to verify calling namespace 2018-06-15 15:28:38 +02:00
David Luhmer 12c86d721d remove duplicated files after merge 2018-06-15 15:19:07 +02:00
David Luhmer f41bd34407 Merge branch 'sso' of https://github.com/nextcloud/android into sso
# Conflicts:
#	src/main/java/com/owncloud/android/services/AccountManagerService.java
2018-06-15 14:41:55 +02:00
David Luhmer 2eece7aa33 Refactoring 2018-06-15 14:40:56 +02:00
tobiasKaminsky c2d18556c3 use token for verification, with SharedProvider as ArbitraryContentProvider does not work on service context
Signed-off-by: tobiasKaminsky <[email protected]>
2018-06-15 00:02:40 +02:00
AndyScherzinger b2d099c39f Fixes after rebase 2018-06-15 00:02:39 +02:00
tobiasKaminsky fb2bd16d4b - use userId instead of loginName
- use serverUrl from ocAccount

Signed-off-by: tobiasKaminsky <[email protected]>
2018-06-15 00:02:39 +02:00
David Luhmer 27970e77ed Code cleanup / add some todos/comments 2018-06-15 00:02:38 +02:00
David Luhmer 45cf8af64f Code cleanup / add check if auth token is correct 2018-06-15 00:02:38 +02:00
David Luhmer 0547a0974d Code cleanup / add basic exception handling 2018-06-15 00:02:37 +02:00
David Luhmer b810a59167 fix permission issues 2018-06-15 00:02:37 +02:00
tobiasKaminsky 9cd3b6cbae satisfy codacy 2018-06-15 00:02:36 +02:00
tobiasKaminsky 09dbb43d74 changes according to codacy 2018-06-15 00:02:36 +02:00
David Luhmer c102b9552a Implement sso prototype by @David-Developement 2018-06-15 00:02:35 +02:00
tobiasKaminsky 347c0edef2 use token for verification, with SharedProvider as ArbitraryContentProvider does not work on service context
Signed-off-by: tobiasKaminsky <[email protected]>
2018-06-12 14:30:03 +02:00
AndyScherzinger ebc50d44b6 Fixes after rebase 2018-06-12 11:40:46 +02:00
tobiasKaminsky 73e41885c6 - use userId instead of loginName
- use serverUrl from ocAccount

Signed-off-by: tobiasKaminsky <[email protected]>
2018-06-12 11:40:46 +02:00
David Luhmer b6593f783e Code cleanup / add some todos/comments 2018-06-12 11:40:45 +02:00
David Luhmer b7712e7580 Code cleanup / add check if auth token is correct 2018-06-12 11:40:45 +02:00
David Luhmer 294d23bfb6 Code cleanup / add basic exception handling 2018-06-12 11:40:44 +02:00
David Luhmer 0435448727 fix permission issues 2018-06-12 11:40:44 +02:00
tobiasKaminsky 68d8499049 satisfy codacy 2018-06-12 11:40:43 +02:00
tobiasKaminsky f52eb08606 changes according to codacy 2018-06-12 11:40:42 +02:00
David Luhmer bdfabd70e9 Implement sso prototype by @David-Developement 2018-06-12 11:40:42 +02:00
37 changed files with 1189 additions and 361 deletions

No files matched your search

+9
View File
@@ -1,3 +1,12 @@
## 3.2.4 (Sept, 04, 2018)
fix push notification on gplay release
## 3.2.3 (Aug, 21, 2018)
- Fix crash on Android Android 4.x
## 3.2.2 (Aug, 20, 2018)
- New simple signup screen
## 3.2.1 (June, 11, 2018)
- Enhanced file detail/sharing screen for mail-shares
- Fix local sorting and file selection
+3 -3
View File
@@ -57,7 +57,7 @@ repositories {
// semantic versioning for version code
def versionMajor = 3
def versionMinor = 3
def versionMinor = 4
def versionPatch = 0
def versionBuild = 0 // 0-49=Alpha / 50-98=RC / 99=stable
@@ -129,8 +129,8 @@ android {
versionDev {
applicationId "com.nextcloud.android.beta"
dimension "default"
versionCode 20180903
versionName "20180903"
versionCode 20180905
versionName "20180905"
}
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16" width="16" height="16">
<path
d="m9.025 1.08c-3.95 0-6.535 3.447-6.364 6.72h-2.161l3.904 3.92 4.08-3.874h-2.147c-0.237-1.7 1.163-3.114 2.689-3.092 1.595 0.024 2.8 1.23 2.8 2.734 0.09 1.594-1.63 3.428-3.966 2.53 0 1.23 0.003 2.545 0 3.765 4.19 0.83 7.64-2.51 7.64-6.25 0-3.563-2.92-6.453-6.475-6.453z"/>
<path style="fill:#757575"
d="m9.025 1.08c-3.95 0-6.535 3.447-6.364 6.72h-2.161l3.904 3.92 4.08-3.874h-2.147c-0.237-1.7 1.163-3.114 2.689-3.092 1.595 0.024 2.8 1.23 2.8 2.734 0.09 1.594-1.63 3.428-3.966 2.53 0 1.23 0.003 2.545 0 3.765 4.19 0.83 7.64-2.51 7.64-6.25 0-3.563-2.92-6.453-6.475-6.453z"/>
</svg>

Before

Width:  |  Height:  |  Size: 396 B

After

Width:  |  Height:  |  Size: 419 B

+7 -7
View File
@@ -21,14 +21,14 @@ lintValue=$?
echo "Branch: $3"
if [ $3 = "master" ]; then
echo "New findbugs result for master at: https://nextcloud.kaminsky.me/index.php/s/fYZa7NeBsnmFZQD"
echo "New findbugs result for master at: https://www.kaminsky.me/nc-dev/client-findbugs/master.html"
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/findbugs/master.html --upload-file build/reports/findbugs/findbugs.html
summary=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/findbugs/findbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s'/Summary/FindBugs (master)/' | tr "\"" "\'" | tr -d "\r\n")
curl -u $4:$5 -X PUT -d "$summary" https://nextcloud.kaminsky.me/remote.php/webdav/findbugs/findbugs.html
if [ $lintValue -ne 1 ]; then
echo "New lint result for master at: https://nextcloud.kaminsky.me/index.php/s/tXwtChzyqMj6I8v"
echo "New lint result for master at: https://www.kaminsky.me/nc-dev/client-lint/master.html"
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/droneLogs/master.html --upload-file build/reports/lint/lint.html
exit 0
fi
@@ -36,10 +36,10 @@ else
if [ -e $6 ]; then
6="master-"$(date +%F)
fi
echo "New lint results at https://nextcloud.kaminsky.me/index.php/s/tXwtChzyqMj6I8v ->" $6.html
echo "New lint results at https://www.kaminsky.me/nc-dev/client-lint/$6.html"
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/droneLogs/$6.html --upload-file build/reports/lint/lint.html
echo "New findbugs results at https://nextcloud.kaminsky.me/index.php/s/fYZa7NeBsnmFZQD ->" $6.html
echo "New findbugs results at https://www.kaminsky.me/nc-dev/client-findbugs/$6.html"
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/findbugs/$6.html --upload-file build/reports/findbugs/findbugs.html
# delete all old comments
@@ -64,9 +64,9 @@ else
lintWarningNew=$(echo $lintResultNew | grep "[0-9]* warning" -o | cut -f1 -d" ")
lintErrorOld=$(grep "[0-9]* error" scripts/analysis/lint-results.txt -o | cut -f1 -d" ")
lintWarningOld=$(grep "[0-9]* warning" scripts/analysis/lint-results.txt -o | cut -f1 -d" ")
lintResult="<h1>Lint</h1><table width='500' cellpadding='5' cellspacing='2'><tr class='tablerow0'><td>Type</td><td>Master</td><td>PR</td></tr><tr class='tablerow1'><td>Warnings</td><td>"$lintWarningOld"</td><td>"$lintWarningNew"</td></tr><tr class='tablerow0'><td>Errors</td><td>"$lintErrorOld"</td><td>"$lintErrorNew"</td></tr></table>"
findbugsResultNew=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/findbugs/findbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s'/Summary/FindBugs (new)/' | tr "\"" "\'" | tr -d "\n")
findbugsResultOld=$(curl 2>/dev/null https://nextcloud.kaminsky.me/index.php/s/YaHngKMM6ERmBeg/download | tr "\"" "\'" | tr -d "\r\n")
lintResult="<h1>Lint</h1><table width='500' cellpadding='5' cellspacing='2'><tr class='tablerow0'><td>Type</td><td><a href='https://www.kaminsky.me/nc-dev/client-lint/master.html'>Master</a></td><td><a href='https://www.kaminsky.me/nc-dev/client-lint/"$6".html'>PR</a></td></tr><tr class='tablerow1'><td>Warnings</td><td>"$lintWarningOld"</td><td>"$lintWarningNew"</td></tr><tr class='tablerow0'><td>Errors</td><td>"$lintErrorOld"</td><td>"$lintErrorNew"</td></tr></table>"
findbugsResultNew=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/findbugs/findbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"#Summary#<a href=\"https://www.kaminsky.me/nc-dev/client-findbugs/$6.html\">FindBugs</a> (new)#" | tr "\"" "\'" | tr -d "\n")
findbugsResultOld=$(curl 2>/dev/null https://nextcloud.kaminsky.me/index.php/s/YaHngKMM6ERmBeg/download | tr "\"" "\'" | tr -d "\r\n" | sed s'#FindBugs#<a href=\"https://www.kaminsky.me/nc-dev/client-findbugs/master.html">FindBugs</a>#'| tr "\"" "\'" | tr -d "\n")
curl -u $1:$2 -X POST https://api.github.com/repos/nextcloud/android/issues/$7/comments -d "{ \"body\" : \"$lintResult $findbugsResultNew $findbugsResultOld $checkLibraryMessage \" }"
if [ $checkLibrary -eq 1 ]; then
+1 -1
View File
@@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 93 warnings</span>
<span class="mdl-layout-title">Lint Report: 94 warnings</span>
@@ -258,6 +258,19 @@ public class EncryptionTestIT {
}
}
@Test
public void testSHA512() {
// sent to 3rd party app in cleartext
String token = "4ae5978bf5354cd284b539015d442141";
String salt = EncryptionUtils.encodeBytesToBase64String(EncryptionUtils.randomBytes(EncryptionUtils.saltLength));
// stored in database
String hashedToken = EncryptionUtils.generateSHA512(token, salt);
// check: use passed cleartext and salt to verify hashed token
assertTrue(EncryptionUtils.verifySHA512(hashedToken, token));
}
// Helper
private boolean compareJsonStrings(String expected, String actual) {
@@ -362,4 +375,4 @@ public class EncryptionTestIT {
return temp;
}
}
}
+9
View File
@@ -66,6 +66,7 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application
android:name=".MainApp"
android:icon="@mipmap/ic_launcher"
@@ -295,6 +296,14 @@
<activity android:name=".ui.activity.ManageSpaceActivity"
android:label="@string/manage_space_title"
android:theme="@style/Theme.ownCloud" />
<service
android:name=".services.AccountManagerService"
android:enabled="true"
android:exported="true" >
</service>
</application>
</manifest>
@@ -0,0 +1,25 @@
/***
Copyright (c) 2008-2011 CommonsWare, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.
From _The Busy Coder's Guide to Advanced Android Development_
http://commonsware.com/AdvAndroid
More information here: https://github.com/abeluck/android-streams-ipc
*/
package com.nextcloud.android.sso.aidl;
// Declare the interface.
interface IInputStreamService {
ParcelFileDescriptor performNextcloudRequest(in ParcelFileDescriptor input);
}
@@ -0,0 +1,16 @@
package com.nextcloud.android.sso;
public class Constants {
// Authenticator related constants
public final static String SSO_USERNAME = "username";
public final static String SSO_TOKEN = "token";
public final static String SSO_SERVER_URL = "server_url";
// Custom Exceptions
static final String EXCEPTION_INVALID_TOKEN = "CE_1";
static final String EXCEPTION_ACCOUNT_NOT_FOUND = "CE_2";
static final String EXCEPTION_UNSUPPORTED_METHOD = "CE_3";
static final String EXCEPTION_INVALID_REQUEST_URL = "CE_4";
static final String EXCEPTION_HTTP_REQUEST_FAILED = "CE_5";
}
@@ -0,0 +1,251 @@
/*
* Nextcloud SingleSignOn
*
* @author David Luhmer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) 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 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 <http://www.gnu.org/licenses/>.
*
* More information here: https://github.com/abeluck/android-streams-ipc
*/
package com.nextcloud.android.sso;
import android.accounts.Account;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Binder;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import com.nextcloud.android.sso.aidl.IInputStreamService;
import com.nextcloud.android.sso.aidl.NextcloudRequest;
import com.nextcloud.android.sso.aidl.ParcelFileDescriptorUtil;
import com.owncloud.android.authentication.AccountAuthenticator;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientManager;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.utils.EncryptionUtils;
import org.apache.commons.httpclient.HttpMethodBase;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.DeleteMethod;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Map;
import static com.nextcloud.android.sso.Constants.EXCEPTION_ACCOUNT_NOT_FOUND;
import static com.nextcloud.android.sso.Constants.EXCEPTION_HTTP_REQUEST_FAILED;
import static com.nextcloud.android.sso.Constants.EXCEPTION_INVALID_REQUEST_URL;
import static com.nextcloud.android.sso.Constants.EXCEPTION_INVALID_TOKEN;
import static com.nextcloud.android.sso.Constants.EXCEPTION_UNSUPPORTED_METHOD;
/**
* Stream binder to pass usable InputStreams across the process boundary in Android.
*/
public class InputStreamBinder extends IInputStreamService.Stub {
private final static String TAG = "InputStreamBinder";
private static final String CONTENT_TYPE_APPLICATION_JSON = "application/json";
private static final String CHARSET_UTF8 = "UTF-8";
private static final int HTTP_STATUS_CODE_OK = 200;
private static final int HTTP_STATUS_CODE_MULTIPLE_CHOICES = 300;
private static final char PATH_SEPARATOR = '/';
private Context context;
public InputStreamBinder(Context context) {
this.context = context;
}
private NameValuePair[] convertMapToNVP(Map<String, String> map) {
NameValuePair[] nvp = new NameValuePair[map.size()];
int i = 0;
for (String key : map.keySet()) {
nvp[i] = new NameValuePair(key, map.get(key));
i++;
}
return nvp;
}
public ParcelFileDescriptor performNextcloudRequest(ParcelFileDescriptor input) {
// read the input
final InputStream is = new ParcelFileDescriptor.AutoCloseInputStream(input);
Exception exception = null;
InputStream httpStream = new InputStream() {
@Override
public int read() {
return 0;
}
};
try {
// Start request and catch exceptions
NextcloudRequest request = deserializeObjectAndCloseStream(is);
httpStream = processRequest(request);
} catch (Exception e) {
Log_OC.e(TAG, e.getMessage());
exception = e;
}
try {
// Write exception to the stream followed by the actual network stream
InputStream exceptionStream = serializeObjectToInputStream(exception);
InputStream resultStream = new java.io.SequenceInputStream(exceptionStream, httpStream);
return ParcelFileDescriptorUtil.pipeFrom(resultStream, thread -> Log.d(TAG, "Done sending result"));
} catch (IOException e) {
Log_OC.e(TAG, e.getMessage());
}
return null;
}
private <T extends Serializable> ByteArrayInputStream serializeObjectToInputStream(T obj) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(obj);
oos.flush();
oos.close();
return new ByteArrayInputStream(baos.toByteArray());
}
private <T extends Serializable> T deserializeObjectAndCloseStream(InputStream is) throws IOException, ClassNotFoundException {
ObjectInputStream ois = new ObjectInputStream(is);
T result = (T) ois.readObject();
is.close();
ois.close();
return result;
}
private InputStream processRequest(final NextcloudRequest request) throws UnsupportedOperationException, com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException, OperationCanceledException, AuthenticatorException, IOException {
Account account = AccountUtils.getOwnCloudAccountByName(context, request.getAccountName()); // TODO handle case that account is not found!
if(account == null) {
throw new IllegalStateException(EXCEPTION_ACCOUNT_NOT_FOUND);
}
// Validate token
if (!isValid(request)) {
throw new IllegalStateException(EXCEPTION_INVALID_TOKEN);
}
// Validate URL
if(request.getUrl().length() == 0 || request.getUrl().charAt(0) != PATH_SEPARATOR) {
throw new IllegalStateException(EXCEPTION_INVALID_REQUEST_URL, new IllegalStateException("URL need to start with a /"));
}
OwnCloudClientManager ownCloudClientManager = OwnCloudClientManagerFactory.getDefaultSingleton();
OwnCloudAccount ocAccount = new OwnCloudAccount(account, context);
OwnCloudClient client = ownCloudClientManager.getClientFor(ocAccount, context);
String requestUrl = client.getBaseUri() + request.getUrl();
HttpMethodBase method;
switch (request.getMethod()) {
case "GET":
method = new GetMethod(requestUrl);
break;
case "POST":
method = new PostMethod(requestUrl);
if (request.getRequestBody() != null) {
StringRequestEntity requestEntity = new StringRequestEntity(
request.getRequestBody(),
CONTENT_TYPE_APPLICATION_JSON,
CHARSET_UTF8);
((PostMethod) method).setRequestEntity(requestEntity);
}
break;
case "PUT":
method = new PutMethod(requestUrl);
if (request.getRequestBody() != null) {
StringRequestEntity requestEntity = new StringRequestEntity(
request.getRequestBody(),
CONTENT_TYPE_APPLICATION_JSON,
CHARSET_UTF8);
((PutMethod) method).setRequestEntity(requestEntity);
}
break;
case "DELETE":
method = new DeleteMethod(requestUrl);
break;
default:
throw new UnsupportedOperationException(EXCEPTION_UNSUPPORTED_METHOD);
}
method.setQueryString(convertMapToNVP(request.getParameter()));
method.addRequestHeader("OCS-APIREQUEST", "true");
client.setFollowRedirects(request.isFollowRedirects());
int status = client.executeMethod(method);
// Check if status code is 2xx --> https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#2xx_Success
if (status >= HTTP_STATUS_CODE_OK && status < HTTP_STATUS_CODE_MULTIPLE_CHOICES) {
return method.getResponseBodyAsStream();
} else {
throw new IllegalStateException(EXCEPTION_HTTP_REQUEST_FAILED, new IllegalStateException(String.valueOf(status)));
}
}
private boolean isValid(NextcloudRequest request) {
String callingPackageName = context.getPackageManager().getNameForUid(Binder.getCallingUid());
SharedPreferences sharedPreferences = context.getSharedPreferences(AccountAuthenticator.SSO_SHARED_PREFERENCE,
Context.MODE_PRIVATE);
String hash = sharedPreferences.getString(callingPackageName, "");
return validateToken(hash, request.getToken());
}
private boolean validateToken(String hash, String token) {
String salt = hash.split("\\$")[1]; // TODO extract "$"
String newHash = EncryptionUtils.generateSHA512(token, salt);
// As discussed with Lukas R. at the Nextcloud Conf 2018, always compare whole strings
// and don't exit prematurely if the string does not match anymore to prevent timing-attacks
return isEqual(hash.getBytes(), newHash.getBytes());
}
// Taken from http://codahale.com/a-lesson-in-timing-attacks/
private static boolean isEqual(byte[] a, byte[] b) {
if (a.length != b.length) {
return false;
}
int result = 0;
for (int i = 0; i < a.length; i++) {
result |= a[i] ^ b[i];
}
return result == 0;
}
}
@@ -0,0 +1,26 @@
/*
* Nextcloud SingleSignOn
*
* @author David Luhmer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) 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 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 <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.android.sso.aidl;
public interface IThreadListener {
void onThreadFinished(final Thread thread);
}
@@ -0,0 +1,147 @@
/*
* Nextcloud SingleSignOn
*
* @author David Luhmer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) 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 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 <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.android.sso.aidl;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class NextcloudRequest implements Serializable {
private static final long serialVersionUID = 215521212534240L; //assign a long value
private String method;
private Map<String, List<String>> header = new HashMap<>();
private Map<String, String> parameter = new HashMap<>();
private String requestBody;
private String url;
private String token;
private String packageName;
private String accountName;
private boolean followRedirects;
private NextcloudRequest() { }
public static class Builder {
private NextcloudRequest ncr;
public Builder() {
ncr = new NextcloudRequest();
}
public NextcloudRequest build() {
return ncr;
}
public Builder setMethod(String method) {
ncr.method = method;
return this;
}
public Builder setHeader(Map<String, List<String>> header) {
ncr.header = header;
return this;
}
public Builder setParameter(Map<String, String> parameter) {
ncr.parameter = parameter;
return this;
}
public Builder setRequestBody(String requestBody) {
ncr.requestBody = requestBody;
return this;
}
public Builder setUrl(String url) {
ncr.url = url;
return this;
}
public Builder setToken(String token) {
ncr.token = token;
return this;
}
public Builder setAccountName(String accountName) {
ncr.accountName = accountName;
return this;
}
/**
* Default value: true
* @param followRedirects
* @return
*/
public Builder setFollowRedirects(boolean followRedirects) {
ncr.followRedirects = followRedirects;
return this;
}
}
public String getMethod() {
return this.method;
}
public Map<String, List<String>> getHeader() {
return this.header;
}
public Map<String, String> getParameter() {
return this.parameter;
}
public String getRequestBody() {
return this.requestBody;
}
public String getUrl() {
return this.url;
}
public String getToken() {
return this.token;
}
public void setToken(String token) {
this.token = token;
}
public String getPackageName() {
return this.packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getAccountName() {
return this.accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public boolean isFollowRedirects() {
return this.followRedirects;
}
}
@@ -0,0 +1,106 @@
/*
* Nextcloud SingleSignOn
*
* @author David Luhmer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) 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 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 <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.android.sso.aidl;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import com.owncloud.android.lib.common.utils.Log_OC;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public final class ParcelFileDescriptorUtil {
private ParcelFileDescriptorUtil() { }
public static ParcelFileDescriptor pipeFrom(InputStream inputStream, IThreadListener listener)
throws IOException {
ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe();
ParcelFileDescriptor readSide = pipe[0];
ParcelFileDescriptor writeSide = pipe[1];
// start the transfer thread
new TransferThread(inputStream, new ParcelFileDescriptor.AutoCloseOutputStream(writeSide),
listener)
.start();
return readSide;
}
public static ParcelFileDescriptor pipeTo(OutputStream outputStream, IThreadListener listener)
throws IOException {
ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe();
ParcelFileDescriptor readSide = pipe[0];
ParcelFileDescriptor writeSide = pipe[1];
// start the transfer thread
new TransferThread(new ParcelFileDescriptor.AutoCloseInputStream(readSide), outputStream,
listener)
.start();
return writeSide;
}
public static class TransferThread extends Thread {
private static final String TAG = TransferThread.class.getCanonicalName();
private final InputStream mIn;
private final OutputStream mOut;
private final IThreadListener mListener;
TransferThread(InputStream in, OutputStream out, IThreadListener listener) {
super("ParcelFileDescriptor Transfer Thread");
mIn = in;
mOut = out;
mListener = listener;
setDaemon(true);
}
@Override
public void run() {
byte[] buf = new byte[1024];
int len;
try {
while ((len = mIn.read(buf)) > 0) {
mOut.write(buf, 0, len);
}
mOut.flush(); // just to be safe
} catch (IOException e) {
Log.e("TransferThread", "writing failed");
} finally {
try {
mIn.close();
} catch (IOException e) {
Log_OC.e(TAG, e.getMessage());
}
try {
mOut.close();
} catch (IOException e) {
Log_OC.e(TAG, e.getMessage());
}
}
if (mListener != null) {
mListener.onThreadFinished(this);
}
}
}
}
@@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author David A. Velasco
@@ -28,14 +28,21 @@ import android.accounts.AccountManager;
import android.accounts.NetworkErrorException;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.widget.Toast;
import com.nextcloud.android.sso.Constants;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.utils.EncryptionUtils;
import java.util.UUID;
/**
@@ -57,6 +64,9 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
public static final String KEY_REQUIRED_FEATURES = "requiredFeatures";
public static final String KEY_LOGIN_OPTIONS = "loginOptions";
public static final String KEY_ACCOUNT = "account";
public static final String SSO_SHARED_PREFERENCE = "sso";
private static final String NEXTCLOUD_SSO = "NextcloudSSO";
private static final String TAG = AccountAuthenticator.class.getSimpleName();
@@ -75,16 +85,15 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
*/
@Override
public Bundle addAccount(AccountAuthenticatorResponse response,
String accountType, String authTokenType,
String[] requiredFeatures, Bundle options)
throws NetworkErrorException {
String accountType, String authTokenType,
String[] requiredFeatures, Bundle options) {
Log_OC.i(TAG, "Adding account with type " + accountType + " and auth token " + authTokenType);
final Bundle bundle = new Bundle();
AccountManager accountManager = AccountManager.get(mContext);
Account[] accounts = accountManager.getAccountsByType(MainApp.getAccountType(mContext));
final Bundle bundle = new Bundle();
if (mContext.getResources().getBoolean(R.bool.multiaccount_support) || accounts.length < 1) {
try {
validateAccountType(accountType);
@@ -104,16 +113,13 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
setIntentFlags(intent);
bundle.putParcelable(AccountManager.KEY_INTENT, intent);
} else {
// Return an error
bundle.putInt(AccountManager.KEY_ERROR_CODE, AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION);
final String message = String.format(mContext.getString(R.string.auth_unsupported_multiaccount), mContext.getString(R.string.app_name));
bundle.putString(AccountManager.KEY_ERROR_MESSAGE, message);
mHandler.post(() -> Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show());
}
return bundle;
@@ -124,7 +130,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
*/
@Override
public Bundle confirmCredentials(AccountAuthenticatorResponse response,
Account account, Bundle options) throws NetworkErrorException {
Account account, Bundle options) {
try {
validateAccountType(account.type);
} catch (AuthenticatorException e) {
@@ -155,9 +161,53 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
*/
@Override
public Bundle getAuthToken(AccountAuthenticatorResponse response,
Account account, String authTokenType, Bundle options)
throws NetworkErrorException {
/// validate parameters
Account account, String authTokenType, Bundle options) {
if (NEXTCLOUD_SSO.equals(authTokenType)) {
final Bundle result = new Bundle();
String packageName = options.getString("androidPackageName");
if (packageName == null) {
Log_OC.e(TAG, "No calling package, exit.");
return result;
}
// create token
SharedPreferences sharedPreferences = mContext.getSharedPreferences(SSO_SHARED_PREFERENCE,
Context.MODE_PRIVATE);
String token = UUID.randomUUID().toString().replaceAll("-", "");
String hashedTokenWithSalt = EncryptionUtils.generateSHA512(token);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(packageName, hashedTokenWithSalt);
editor.apply();
String serverUrl;
String userId;
try {
OwnCloudAccount ocAccount = new OwnCloudAccount(account, mContext);
serverUrl = ocAccount.getBaseUri().toString();
AccountManager accountManager = AccountManager.get(mContext);
userId = accountManager.getUserData(account,
com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_USER_ID);
} catch (AccountUtils.AccountNotFoundException e) {
Log_OC.e(TAG, "Account not found");
return new Bundle();
}
result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
result.putString(AccountManager.KEY_ACCOUNT_TYPE, MainApp.getAccountType(mContext));
result.putString(AccountManager.KEY_AUTHTOKEN, NEXTCLOUD_SSO);
result.putString(Constants.SSO_USERNAME, userId);
result.putString(Constants.SSO_TOKEN, token);
result.putString(Constants.SSO_SERVER_URL, serverUrl);
return result;
}
// validate parameters
try {
validateAccountType(account.type);
validateAuthTokenType(authTokenType);
@@ -203,7 +253,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
@Override
public Bundle hasFeatures(AccountAuthenticatorResponse response,
Account account, String[] features) throws NetworkErrorException {
Account account, String[] features) {
final Bundle result = new Bundle();
result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
return result;
@@ -211,8 +261,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
@Override
public Bundle updateCredentials(AccountAuthenticatorResponse response,
Account account, String authTokenType, Bundle options)
throws NetworkErrorException {
Account account, String authTokenType, Bundle options) {
Intent intent = new Intent(mContext, AuthenticatorActivity.class);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
@@ -0,0 +1,45 @@
/*
* Nextcloud SingleSignOn
*
* @author David Luhmer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) 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 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 <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.services;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import com.nextcloud.android.sso.InputStreamBinder;
public class AccountManagerService extends Service {
private InputStreamBinder mBinder;
@Override
public IBinder onBind(Intent intent) {
if(mBinder == null) {
mBinder = new InputStreamBinder(this);
}
return mBinder;
}
@Override
public boolean onUnbind(Intent intent) {
return super.onUnbind(intent);
}
}
@@ -123,6 +123,7 @@ import com.owncloud.android.ui.preview.PreviewImageFragment;
import com.owncloud.android.ui.preview.PreviewMediaFragment;
import com.owncloud.android.ui.preview.PreviewTextFragment;
import com.owncloud.android.ui.preview.PreviewVideoActivity;
import com.owncloud.android.utils.ClipboardUtil;
import com.owncloud.android.utils.DataHolderUtil;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.ErrorMessageAdapter;
@@ -276,9 +277,7 @@ public class FileDisplayActivity extends HookActivity
PermissionUtil.requestWriteExternalStoreagePermission(FileDisplayActivity.this);
}
});
ThemeUtils.colorSnackbar(this, snackbar);
snackbar.show();
} else {
// No explanation needed, request the permission.
@@ -1907,9 +1906,6 @@ public class FileDisplayActivity extends HookActivity
if (result.isSuccess()) {
updateFileFromDB();
// Create dialog to allow the user choose an app to send the link
Intent intentToShareLink = new Intent(Intent.ACTION_SEND);
// if share to user and share via link multiple ocshares are returned,
// therefore filtering for public_link
String link = "";
@@ -1921,43 +1917,7 @@ public class FileDisplayActivity extends HookActivity
}
}
intentToShareLink.putExtra(Intent.EXTRA_TEXT, link);
intentToShareLink.setType("text/plain");
String username;
try {
OwnCloudAccount oca = new OwnCloudAccount(getAccount(), this);
if (oca.getDisplayName() != null && !oca.getDisplayName().isEmpty()) {
username = oca.getDisplayName();
} else {
username = AccountUtils.getUsernameForAccount(getAccount());
}
} catch (Exception e) {
username = AccountUtils.getUsernameForAccount(getAccount());
}
if (username != null) {
intentToShareLink.putExtra(
Intent.EXTRA_SUBJECT,
getString(
R.string.subject_user_shared_with_you,
username,
getFile().getFileName()
)
);
} else {
intentToShareLink.putExtra(
Intent.EXTRA_SUBJECT,
getString(
R.string.subject_shared_with_you,
getFile().getFileName()
)
);
}
String[] packagesToExclude = new String[]{getPackageName()};
DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink, packagesToExclude);
chooserDialog.show(getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
copyAndShareFileLink(link);
if (fileDetailFragment != null && fileDetailFragment.getFileDetailSharingFragment() != null) {
fileDetailFragment.getFileDetailSharingFragment().refreshPublicShareFromDB();
@@ -1983,15 +1943,71 @@ public class FileDisplayActivity extends HookActivity
if (fileDetailFragment != null && fileDetailFragment.getFileDetailSharingFragment() != null) {
fileDetailFragment.getFileDetailSharingFragment().refreshPublicShareFromDB();
}
Snackbar.make(
Snackbar snackbar = Snackbar.make(
findViewById(android.R.id.content),
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Snackbar.LENGTH_LONG
).show();
);
ThemeUtils.colorSnackbar(this, snackbar);
snackbar.show();
}
}
}
private void copyAndShareFileLink(String link) {
ClipboardUtil.copyToClipboard(this, link, false);
Snackbar snackbar = Snackbar.make(
findViewById(android.R.id.content),
R.string.clipboard_text_copied,
Snackbar.LENGTH_LONG
).setAction(R.string.share, v -> showShareLinkDialog(link));
ThemeUtils.colorSnackbar(this, snackbar);
snackbar.show();
}
public void showShareLinkDialog(String link) {
// Create dialog to allow the user choose an app to send the link
Intent intentToShareLink = new Intent(Intent.ACTION_SEND);
intentToShareLink.putExtra(Intent.EXTRA_TEXT, link);
intentToShareLink.setType("text/plain");
String username;
try {
OwnCloudAccount oca = new OwnCloudAccount(getAccount(), this);
if (oca.getDisplayName() != null && !oca.getDisplayName().isEmpty()) {
username = oca.getDisplayName();
} else {
username = AccountUtils.getUsernameForAccount(getAccount());
}
} catch (Exception e) {
username = AccountUtils.getUsernameForAccount(getAccount());
}
if (username != null) {
intentToShareLink.putExtra(
Intent.EXTRA_SUBJECT,
getString(
R.string.subject_user_shared_with_you,
username,
getFile().getFileName()
)
);
} else {
intentToShareLink.putExtra(
Intent.EXTRA_SUBJECT,
getString(
R.string.subject_shared_with_you,
getFile().getFileName()
)
);
}
String[] packagesToExclude = new String[]{getPackageName()};
DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink, packagesToExclude);
chooserDialog.show(getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
}
private void onUpdateShareInformation(RemoteOperationResult result, @StringRes int errorString) {
Fragment fileDetailFragment = getSecondFragment();
@@ -1999,7 +2015,9 @@ public class FileDisplayActivity extends HookActivity
updateFileFromDB();
refreshListOfFilesFragment(false);
} else if (fileDetailFragment.getView() != null) {
Snackbar.make(fileDetailFragment.getView(), errorString, Snackbar.LENGTH_LONG).show();
Snackbar snackbar = Snackbar.make(fileDetailFragment.getView(), errorString, Snackbar.LENGTH_LONG);
ThemeUtils.colorSnackbar(this, snackbar);
snackbar.show();
}
if (fileDetailFragment != null && fileDetailFragment instanceof FileDetailFragment) {
@@ -249,10 +249,8 @@ public class NotificationsActivity extends FileActivity {
recyclerView.setAdapter(adapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this, layoutManager.getOrientation());
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(dividerItemDecoration);
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation_view);
@@ -148,7 +148,6 @@ public class UserInfoActivity extends FileActivity {
updateActionBarTitleAndHomeButtonByString("");
mUserInfoList.setAdapter(new UserInfoAdapter(null, ThemeUtils.primaryColor(getAccount(), true, this)));
mUserInfoList.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
if (userInfo != null) {
populateUserInfoUi(userInfo);
@@ -54,7 +54,6 @@ import butterknife.ButterKnife;
/**
* Adapter for the trashbin view
*/
public class TrashbinListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int TRASHBIN_ITEM = 100;
@@ -54,6 +54,7 @@ import com.owncloud.android.lib.resources.shares.SharePermissionsBuilder;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.lib.resources.status.OCCapability;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.adapter.UserListAdapter;
import com.owncloud.android.ui.decoration.SimpleListItemDividerDecoration;
import com.owncloud.android.ui.dialog.ExpirationDatePickerDialogFragment;
@@ -235,24 +236,31 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
@OnClick(R.id.share_by_link)
public void toggleShareByLink() {
if (shareByLink.isChecked()) {
if (capabilities != null &&
capabilities.getFilesSharingPublicPasswordEnforced().isTrue()) {
// password enforced by server, request to the user before trying to create
requestPasswordForShareViaLink(true);
} else {
// create without password if not enforced by server or we don't know if enforced;
((FileActivity) getActivity()).getFileOperationsHelper().shareFileViaLink(file, null);
}
createShareLink();
} else {
((FileActivity) getActivity()).getFileOperationsHelper().unshareFileViaLink(file);
}
}
private void createShareLink() {
if (capabilities != null &&
capabilities.getFilesSharingPublicPasswordEnforced().isTrue()) {
// password enforced by server, request to the user before trying to create
requestPasswordForShareViaLink(true);
} else {
// create without password if not enforced by server or we don't know if enforced;
((FileActivity) getActivity()).getFileOperationsHelper().shareFileViaLink(file, null);
}
}
private void showSendLinkTo() {
if (file.isSharedViaLink()) {
((FileActivity) getActivity()).getFileOperationsHelper().getFileWithLink(file);
if (TextUtils.isEmpty(file.getPublicLink())) {
((FileActivity) getActivity()).getFileOperationsHelper().getFileWithLink(file);
} else {
((FileDisplayActivity) getActivity()).showShareLinkDialog(file.getPublicLink());
}
}
}
@@ -260,7 +268,7 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
public void copyLinkToClipboard() {
if (file.isSharedViaLink()) {
if (TextUtils.isEmpty(file.getPublicLink())) {
showSendLinkTo();
((FileActivity) getActivity()).getFileOperationsHelper().getFileWithLink(file);
} else {
ClipboardUtil.copyToClipboard(getActivity(), file.getPublicLink());
}
@@ -336,7 +344,11 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
return true;
}
case R.id.action_share_send_link: {
showSendLinkTo();
if(shareByLink.isChecked() && file.isSharedViaLink() && !TextUtils.isEmpty(file.getPublicLink())) {
((FileDisplayActivity) getActivity()).showShareLinkDialog(file.getPublicLink());
} else {
showSendLinkTo();
}
return true;
}
default:
@@ -39,6 +39,10 @@ public class ClipboardUtil {
}
public static void copyToClipboard(Activity activity, String text) {
copyToClipboard(activity, text, true);
}
public static void copyToClipboard(Activity activity, String text, boolean showToast) {
if (text != null && text.length() > 0) {
try {
ClipData clip = ClipData.newPlainText(
@@ -48,7 +52,9 @@ public class ClipboardUtil {
);
((ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(clip);
Toast.makeText(activity, R.string.clipboard_text_copied, Toast.LENGTH_SHORT).show();
if (showToast) {
Toast.makeText(activity, R.string.clipboard_text_copied, Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Toast.makeText(activity, R.string.clipboard_unexpected_error, Toast.LENGTH_SHORT).show();
Log_OC.e(TAG, "Exception caught while copying to clipboard", e);
@@ -57,7 +57,6 @@ import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
@@ -65,7 +64,6 @@ import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.InvalidParameterSpecException;
import java.security.spec.KeySpec;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.ArrayList;
@@ -80,7 +78,6 @@ import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.ShortBufferException;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
@@ -98,6 +95,7 @@ public class EncryptionUtils {
public static final String MNEMONIC = "MNEMONIC";
public static final int ivLength = 16;
public static final int saltLength = 40;
public static final String HASH_DELIMITER = "$";
private static final String ivDelimiter = "fA=="; // "|" base64 encoded
private static final int iterationCount = 1024;
@@ -132,9 +130,9 @@ public class EncryptionUtils {
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static EncryptedFolderMetadata encryptFolderMetadata(DecryptedFolderMetadata decryptedFolderMetadata,
String privateKey)
throws IOException, NoSuchAlgorithmException, ShortBufferException, InvalidKeyException,
throws NoSuchAlgorithmException, InvalidKeyException,
InvalidAlgorithmParameterException, NoSuchPaddingException, BadPaddingException,
NoSuchProviderException, IllegalBlockSizeException, InvalidKeySpecException, CertificateException {
IllegalBlockSizeException, InvalidKeySpecException {
HashMap<String, EncryptedFolderMetadata.EncryptedFile> files = new HashMap<>();
EncryptedFolderMetadata encryptedFolderMetadata = new EncryptedFolderMetadata(decryptedFolderMetadata
@@ -171,9 +169,9 @@ public class EncryptionUtils {
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static DecryptedFolderMetadata decryptFolderMetaData(EncryptedFolderMetadata encryptedFolderMetadata,
String privateKey)
throws IOException, NoSuchAlgorithmException, ShortBufferException, InvalidKeyException,
throws NoSuchAlgorithmException, InvalidKeyException,
InvalidAlgorithmParameterException, NoSuchPaddingException, BadPaddingException,
NoSuchProviderException, IllegalBlockSizeException, CertificateException, InvalidKeySpecException {
IllegalBlockSizeException, InvalidKeySpecException {
HashMap<String, DecryptedFolderMetadata.DecryptedFile> files = new HashMap<>();
DecryptedFolderMetadata decryptedFolderMetadata = new DecryptedFolderMetadata(
@@ -278,9 +276,9 @@ public class EncryptionUtils {
*/
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static EncryptedFile encryptFile(OCFile ocFile, byte[] encryptionKeyBytes, byte[] iv)
throws NoSuchProviderException, NoSuchAlgorithmException,
throws NoSuchAlgorithmException,
InvalidAlgorithmParameterException, NoSuchPaddingException, InvalidKeyException,
BadPaddingException, IllegalBlockSizeException, IOException, ShortBufferException {
BadPaddingException, IllegalBlockSizeException, IOException {
File file = new File(ocFile.getStoragePath());
return encryptFile(file, encryptionKeyBytes, iv);
@@ -294,9 +292,9 @@ public class EncryptionUtils {
*/
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static EncryptedFile encryptFile(File file, byte[] encryptionKeyBytes, byte[] iv)
throws NoSuchProviderException, NoSuchAlgorithmException,
throws NoSuchAlgorithmException,
InvalidAlgorithmParameterException, NoSuchPaddingException, InvalidKeyException,
BadPaddingException, IllegalBlockSizeException, IOException, ShortBufferException {
BadPaddingException, IllegalBlockSizeException, IOException {
Cipher cipher = Cipher.getInstance(AES_CIPHER);
@@ -325,9 +323,9 @@ public class EncryptionUtils {
*/
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static byte[] decryptFile(File file, byte[] encryptionKeyBytes, byte[] iv, byte[] authenticationTag)
throws NoSuchProviderException, NoSuchAlgorithmException,
throws NoSuchAlgorithmException,
InvalidAlgorithmParameterException, NoSuchPaddingException, InvalidKeyException,
BadPaddingException, IllegalBlockSizeException, IOException, ShortBufferException {
BadPaddingException, IllegalBlockSizeException, IOException {
Cipher cipher = Cipher.getInstance(AES_CIPHER);
@@ -370,9 +368,9 @@ public class EncryptionUtils {
*/
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static String encryptStringAsymmetric(String string, String cert)
throws NoSuchProviderException, NoSuchAlgorithmException,
InvalidAlgorithmParameterException, NoSuchPaddingException, InvalidKeyException,
BadPaddingException, IllegalBlockSizeException, IOException, ShortBufferException, InvalidKeySpecException,
throws NoSuchAlgorithmException,
NoSuchPaddingException, InvalidKeyException,
BadPaddingException, IllegalBlockSizeException, IOException,
CertificateException {
Cipher cipher = Cipher.getInstance(RSA_CIPHER);
@@ -406,9 +404,9 @@ public class EncryptionUtils {
*/
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static String decryptStringAsymmetric(String string, String privateKeyString)
throws NoSuchProviderException, NoSuchAlgorithmException,
InvalidAlgorithmParameterException, NoSuchPaddingException, InvalidKeyException,
BadPaddingException, IllegalBlockSizeException, IOException, ShortBufferException, CertificateException,
throws NoSuchAlgorithmException,
NoSuchPaddingException, InvalidKeyException,
BadPaddingException, IllegalBlockSizeException,
InvalidKeySpecException {
Cipher cipher = Cipher.getInstance(RSA_CIPHER);
@@ -437,10 +435,9 @@ public class EncryptionUtils {
*/
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static String encryptStringSymmetric(String string, byte[] encryptionKeyBytes)
throws NoSuchProviderException, NoSuchAlgorithmException,
throws NoSuchAlgorithmException,
InvalidAlgorithmParameterException, NoSuchPaddingException, InvalidKeyException,
BadPaddingException, IllegalBlockSizeException, IOException, ShortBufferException, InvalidKeySpecException,
CertificateException {
BadPaddingException, IllegalBlockSizeException {
Cipher cipher = Cipher.getInstance(AES_CIPHER);
byte[] iv = randomBytes(ivLength);
@@ -469,10 +466,9 @@ public class EncryptionUtils {
*/
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static String decryptStringSymmetric(String string, byte[] encryptionKeyBytes)
throws NoSuchProviderException, NoSuchAlgorithmException,
throws NoSuchAlgorithmException,
InvalidAlgorithmParameterException, NoSuchPaddingException, InvalidKeyException,
BadPaddingException, IllegalBlockSizeException, IOException, ShortBufferException, CertificateException,
InvalidKeySpecException {
BadPaddingException, IllegalBlockSizeException {
Cipher cipher = Cipher.getInstance(AES_CIPHER);
@@ -502,8 +498,8 @@ public class EncryptionUtils {
* @return encrypted string, bytes first encoded base64, IV separated with "|", then to string
*/
public static String encryptPrivateKey(String privateKey, String keyPhrase) throws NoSuchPaddingException,
NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException, BadPaddingException,
IllegalBlockSizeException, InvalidKeySpecException, InvalidParameterSpecException {
NoSuchAlgorithmException, InvalidKeyException, BadPaddingException,
IllegalBlockSizeException, InvalidKeySpecException {
Cipher cipher = Cipher.getInstance(AES_CIPHER);
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
@@ -533,7 +529,7 @@ public class EncryptionUtils {
* @return decrypted string
*/
public static String decryptPrivateKey(String privateKey, String keyPhrase) throws NoSuchPaddingException,
NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException, BadPaddingException,
NoSuchAlgorithmException, InvalidKeyException, BadPaddingException,
IllegalBlockSizeException, InvalidKeySpecException, InvalidAlgorithmParameterException {
// split up iv, salt
@@ -559,7 +555,7 @@ public class EncryptionUtils {
.replace("-----END PRIVATE KEY-----", "");
}
public static String privateKeyToPEM(PrivateKey privateKey) throws IOException {
public static String privateKeyToPEM(PrivateKey privateKey) {
String privateKeyString = encodeBytesToBase64String(privateKey.getEncoded());
return "-----BEGIN PRIVATE KEY-----\n" + privateKeyString.replaceAll("(.{65})", "$1\n")
@@ -642,4 +638,55 @@ public class EncryptionUtils {
return iv;
}
/**
* Generate a SHA512 with appended salt
*
* @param token token to be hashed
* @return SHA512 with appended salt, delimiter HASH_DELIMITER
*/
public static String generateSHA512(String token) {
String salt = EncryptionUtils.encodeBytesToBase64String(EncryptionUtils.randomBytes(EncryptionUtils.saltLength));
return generateSHA512(token, salt);
}
/**
* Generate a SHA512 with appended salt
*
* @param token token to be hashed
* @return SHA512 with appended salt, delimiter HASH_DELIMITER
*/
public static String generateSHA512(String token, String salt) {
MessageDigest digest;
String hashedToken = "";
byte[] hash;
try {
digest = MessageDigest.getInstance("SHA-512");
digest.update(salt.getBytes());
hash = digest.digest(token.getBytes());
StringBuilder stringBuilder = new StringBuilder();
for (byte hashByte : hash) {
stringBuilder.append(Integer.toString((hashByte & 0xff) + 0x100, 16).substring(1));
}
stringBuilder.append(HASH_DELIMITER).append(salt);
hashedToken = stringBuilder.toString();
} catch (NoSuchAlgorithmException e) {
Log_OC.e(TAG, "Generating SHA512 failed", e);
}
return hashedToken;
}
public static boolean verifySHA512(String hashWithSalt, String compareToken) {
String salt = hashWithSalt.split("\\" + HASH_DELIMITER)[1];
String newHash = generateSHA512(compareToken, salt);
return hashWithSalt.equals(newHash);
}
}
@@ -28,6 +28,7 @@ import com.owncloud.android.lib.resources.files.ServerFileInterface;
import java.io.File;
import java.io.Serializable;
import java.math.BigInteger;
import java.text.Collator;
import java.util.Comparator;
@@ -150,14 +151,10 @@ public class AlphanumComparator<T> implements Comparator<T>, Serializable {
countThat++;
}
try {
long thisChunkValue = Long.parseLong(thisChunk.substring(0, countThis));
long thatChunkValue = Long.parseLong(thatChunk.substring(0, countThat));
BigInteger thisChunkValue = new BigInteger(thisChunk.substring(0, countThis));
BigInteger thatChunkValue = new BigInteger(thatChunk.substring(0, countThat));
result = Long.compare(thisChunkValue, thatChunkValue);
} catch (NumberFormatException exception) {
result = thisChunk.substring(0, countThis).compareTo(thatChunk.substring(0, countThat));
}
result = thisChunkValue.compareTo(thatChunkValue);
if (result == 0) {
// value is equal, compare leading zeros
+1 -1
View File
@@ -6,6 +6,6 @@
android:viewportHeight="16">
<path
android:fillColor="#000000"
android:fillColor="#757575"
android:pathData="M9.025 1.08c-3.95 0-6.535 3.447-6.364 6.72h-2.161l3.904 3.92 4.08-3.874h-2.147c-0.237-1.7 1.163-3.114 2.689-3.092 1.595 0.024 2.8 1.23 2.8 2.734 0.09 1.594-1.63 3.428-3.966 2.53 0 1.23 0.003 2.545 0 3.765 4.19 0.83 7.64-2.51 7.64-6.25 0-3.563-2.92-6.453-6.475-6.453z"/>
</vector>
+4 -3
View File
@@ -41,13 +41,14 @@
android:id="@+id/user_name"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingEnd="@dimen/standard_padding"
android:paddingLeft="28dp"
android:paddingRight="@dimen/standard_padding"
android:paddingLeft="@dimen/standard_padding"
android:paddingStart="28dp"
android:text="@string/prefs_add_account"
android:textColor="@color/primary"
android:textSize="@dimen/two_line_primary_text_size"/>
android:textSize="@dimen/two_line_primary_text_size" />
</LinearLayout>
+7 -3
View File
@@ -64,14 +64,18 @@
android:layout_centerInParent="true"
android:layout_toEndOf="@id/avatar_container"
android:layout_toRightOf="@id/avatar_container"
android:orientation="vertical">
android:orientation="vertical"
android:paddingEnd="@dimen/zero"
android:paddingLeft="3dp"
android:paddingRight="@dimen/zero"
android:paddingStart="3dp">
<TextView
android:id="@+id/user_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/standard_half_margin"
android:layout_marginLeft="@dimen/standard_half_margin"
android:layout_marginLeft="@dimen/standard_margin"
android:layout_marginRight="@dimen/standard_half_margin"
android:layout_marginStart="@dimen/standard_margin"
android:layout_marginTop="@dimen/standard_quarter_margin"
@@ -87,7 +91,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/standard_quarter_margin"
android:layout_marginEnd="@dimen/standard_half_margin"
android:layout_marginLeft="@dimen/standard_half_margin"
android:layout_marginLeft="@dimen/standard_margin"
android:layout_marginRight="@dimen/standard_half_margin"
android:layout_marginStart="@dimen/standard_margin"
android:ellipsize="end"
+1 -3
View File
@@ -33,8 +33,6 @@
android:id="@+id/account_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@color/list_divider_background"
android:dividerHeight="@dimen/divider_height_independent">
</ListView>
android:divider="@null" />
</LinearLayout>
+4 -4
View File
@@ -17,9 +17,9 @@
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/>.
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
@@ -54,7 +54,7 @@
android:paddingRight="@dimen/zero"
android:paddingStart="@dimen/activity_icon_layout_right_end_margin"
android:paddingTop="@dimen/standard_padding"
android:text="@string/placeholder_filename"
tools:text="@string/placeholder_filename"
android:textAppearance="?android:attr/textAppearanceListItem" />
<TextView
@@ -66,7 +66,7 @@
android:paddingRight="@dimen/zero"
android:paddingStart="@dimen/activity_icon_layout_right_end_margin"
android:ellipsize="end"
android:text="@string/placeholder_sentence"
tools:text="@string/placeholder_sentence"
android:textAppearance="?android:attr/textAppearanceListItem"/>
<GridLayout
@@ -92,7 +92,7 @@
android:paddingLeft="@dimen/activity_icon_layout_right_end_margin"
android:paddingRight="@dimen/zero"
android:paddingStart="@dimen/activity_icon_layout_right_end_margin"
android:text="@string/placeholder_sentence"
tools:text="@string/placeholder_sentence"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
+160 -173
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
<?xml version="1.0" encoding="UTF-8"?><!--
ownCloud Android client application
Copyright (C) 2012 Bartek Przybylski
@@ -24,193 +23,181 @@
android:background="@drawable/list_selector"
android:descendantFocusability="blocksDescendants"
android:foreground="?android:attr/selectableItemBackground"
android:orientation="vertical">
android:baselineAligned="false"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="@dimen/standard_list_item_size"
android:layout_height="@dimen/standard_list_item_size"
android:paddingBottom="@dimen/standard_padding"
android:paddingEnd="@dimen/standard_quarter_padding"
android:paddingLeft="@dimen/zero"
android:paddingRight="@dimen/standard_quarter_padding"
android:paddingStart="@dimen/zero"
android:paddingTop="@dimen/standard_padding">
<ImageView
android:id="@+id/thumbnail"
android:layout_width="@dimen/file_icon_size"
android:layout_height="@dimen/file_icon_size"
android:layout_centerInParent="true"
android:layout_marginLeft="@dimen/standard_half_margin"
android:layout_marginStart="@dimen/standard_half_margin"
android:contentDescription="@null"
android:src="@drawable/folder" />
<ImageView
android:id="@+id/favorite_action"
android:layout_width="@dimen/list_item_favorite_action_layout_width"
android:layout_height="@dimen/list_item_favorite_action_layout_height"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:layout_marginRight="@dimen/standard_quarter_margin"
android:contentDescription="@string/favorite"
android:src="@drawable/badge_favorite" />
<ImageView
android:id="@+id/keptOfflineIcon"
android:layout_width="@dimen/list_item_kept_offline_icon_layout_width"
android:layout_height="@dimen/list_item_kept_offline_icon_layout_height"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="@dimen/list_item_kept_offline_icon_layout_right_end_margin"
android:layout_marginRight="@dimen/list_item_kept_offline_icon_layout_right_end_margin"
android:contentDescription="@string/available_offline_icon"
android:src="@drawable/ic_available_offline" />
<ImageView
android:id="@+id/localFileIndicator"
android:layout_width="@dimen/list_item_local_file_indicator_layout_width"
android:layout_height="@dimen/list_item_local_file_indicator_layout_height"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:layout_marginRight="@dimen/standard_quarter_margin"
android:contentDescription="@string/downloader_download_succeeded_ticker"
android:scaleType="fitCenter"
android:src="@drawable/ic_synced" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal">
android:layout_weight="1"
android:gravity="top"
android:orientation="vertical"
android:paddingTop="@dimen/standard_padding">
<RelativeLayout
android:layout_width="@dimen/standard_list_item_size"
android:layout_height="@dimen/standard_list_item_size"
android:paddingBottom="@dimen/standard_padding"
android:paddingEnd="@dimen/standard_quarter_padding"
android:paddingLeft="@dimen/zero"
android:paddingRight="@dimen/standard_quarter_padding"
android:paddingStart="@dimen/zero"
android:paddingTop="@dimen/standard_padding">
<ImageView
android:id="@+id/thumbnail"
android:layout_width="@dimen/file_icon_size"
android:layout_height="@dimen/file_icon_size"
android:layout_centerInParent="true"
android:layout_marginLeft="@dimen/standard_half_margin"
android:layout_marginStart="@dimen/standard_half_margin"
android:contentDescription="@null"
android:src="@drawable/folder" />
<ImageView
android:id="@+id/favorite_action"
android:layout_width="@dimen/list_item_favorite_action_layout_width"
android:layout_height="@dimen/list_item_favorite_action_layout_height"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:layout_marginRight="@dimen/standard_quarter_margin"
android:contentDescription="@string/favorite"
android:src="@drawable/badge_favorite" />
<ImageView
android:id="@+id/keptOfflineIcon"
android:layout_width="@dimen/list_item_kept_offline_icon_layout_width"
android:layout_height="@dimen/list_item_kept_offline_icon_layout_height"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="@dimen/list_item_kept_offline_icon_layout_right_end_margin"
android:layout_marginRight="@dimen/list_item_kept_offline_icon_layout_right_end_margin"
android:contentDescription="@string/available_offline_icon"
android:src="@drawable/ic_available_offline" />
<ImageView
android:id="@+id/localFileIndicator"
android:layout_width="@dimen/list_item_local_file_indicator_layout_width"
android:layout_height="@dimen/list_item_local_file_indicator_layout_height"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:layout_marginRight="@dimen/standard_quarter_margin"
android:contentDescription="@string/downloader_download_succeeded_ticker"
android:scaleType="fitCenter"
android:src="@drawable/ic_synced" />
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="top"
android:orientation="vertical"
android:paddingTop="@dimen/standard_padding">
<TextView
android:id="@+id/Filename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="middle"
android:singleLine="true"
android:text="@string/placeholder_filename"
android:textColor="@color/textColor"
android:textSize="@dimen/two_line_primary_text_size" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/file_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/placeholder_fileSize"
android:textColor="@color/list_item_lastmod_and_filesize_text"
android:textSize="@dimen/two_line_secondary_text_size" />
<TextView
android:id="@+id/file_separator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:paddingEnd="@dimen/standard_quarter_padding"
android:paddingLeft="@dimen/zero"
android:paddingRight="@dimen/standard_quarter_padding"
android:paddingStart="@dimen/zero"
android:text="@string/info_separator"
android:textColor="@color/list_item_lastmod_and_filesize_text"
android:textSize="@dimen/two_line_secondary_text_size" />
<TextView
android:id="@+id/last_mod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="@string/placeholder_media_time"
android:textColor="@color/list_item_lastmod_and_filesize_text"
android:textSize="@dimen/two_line_secondary_text_size" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
<TextView
android:id="@+id/Filename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingEnd="@dimen/zero"
android:paddingLeft="@dimen/standard_half_padding"
android:paddingRight="@dimen/zero"
android:paddingStart="@dimen/standard_half_padding">
android:ellipsize="middle"
android:singleLine="true"
android:text="@string/placeholder_filename"
android:textColor="@color/textColor"
android:textSize="@dimen/two_line_primary_text_size" />
<ImageView
android:id="@+id/sharedIcon"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/file_size"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:clickable="true"
android:contentDescription="@string/shared_icon_share"
android:focusable="true"
android:paddingEnd="@dimen/list_item_share_right_margin"
android:paddingLeft="@dimen/standard_half_padding"
android:paddingRight="@dimen/list_item_share_right_margin"
android:paddingStart="@dimen/standard_half_padding"
android:src="@drawable/ic_unshared" />
android:layout_height="wrap_content"
android:text="@string/placeholder_fileSize"
android:textColor="@color/list_item_lastmod_and_filesize_text"
android:textSize="@dimen/two_line_secondary_text_size" />
<ImageView
android:id="@+id/custom_checkbox"
<TextView
android:id="@+id/file_separator"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/sharedIcon"
android:layout_toRightOf="@id/sharedIcon"
android:clickable="false"
android:contentDescription="@string/checkbox"
android:focusable="false"
android:paddingEnd="@dimen/alternate_padding"
android:paddingLeft="@dimen/standard_half_padding"
android:paddingRight="@dimen/alternate_padding"
android:paddingStart="@dimen/standard_half_padding"
android:src="@drawable/ic_checkbox_blank_outline" />
android:layout_height="wrap_content"
android:gravity="end"
android:paddingEnd="@dimen/standard_quarter_padding"
android:paddingLeft="@dimen/zero"
android:paddingRight="@dimen/standard_quarter_padding"
android:paddingStart="@dimen/zero"
android:text="@string/info_separator"
android:textColor="@color/list_item_lastmod_and_filesize_text"
android:textSize="@dimen/two_line_secondary_text_size" />
<ImageView
android:id="@+id/overflow_menu"
<TextView
android:id="@+id/last_mod"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/custom_checkbox"
android:layout_toRightOf="@id/custom_checkbox"
android:clickable="true"
android:contentDescription="@string/overflow_menu"
android:focusable="true"
android:paddingEnd="@dimen/alternate_padding"
android:paddingLeft="@dimen/standard_half_padding"
android:paddingRight="@dimen/alternate_padding"
android:paddingStart="@dimen/standard_half_padding"
android:src="@drawable/ic_dots_vertical" />
android:layout_height="wrap_content"
android:gravity="end"
android:text="@string/placeholder_media_time"
android:textColor="@color/list_item_lastmod_and_filesize_text"
android:textSize="@dimen/two_line_secondary_text_size" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/list_divider_background" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingEnd="@dimen/zero"
android:paddingLeft="@dimen/standard_half_padding"
android:paddingRight="@dimen/zero"
android:paddingStart="@dimen/standard_half_padding">
<ImageView
android:id="@+id/sharedIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:clickable="true"
android:contentDescription="@string/shared_icon_share"
android:focusable="true"
android:paddingEnd="@dimen/list_item_share_right_margin"
android:paddingLeft="@dimen/standard_half_padding"
android:paddingRight="@dimen/list_item_share_right_margin"
android:paddingStart="@dimen/standard_half_padding"
android:src="@drawable/ic_unshared" />
<ImageView
android:id="@+id/custom_checkbox"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/sharedIcon"
android:layout_toRightOf="@id/sharedIcon"
android:clickable="false"
android:contentDescription="@string/checkbox"
android:focusable="false"
android:paddingEnd="@dimen/alternate_padding"
android:paddingLeft="@dimen/standard_half_padding"
android:paddingRight="@dimen/alternate_padding"
android:paddingStart="@dimen/standard_half_padding"
android:src="@drawable/ic_checkbox_blank_outline" />
<ImageView
android:id="@+id/overflow_menu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/custom_checkbox"
android:layout_toRightOf="@id/custom_checkbox"
android:clickable="true"
android:contentDescription="@string/overflow_menu"
android:focusable="true"
android:paddingEnd="@dimen/alternate_padding"
android:paddingLeft="@dimen/standard_half_padding"
android:paddingRight="@dimen/alternate_padding"
android:paddingStart="@dimen/standard_half_padding"
android:src="@drawable/ic_dots_vertical" />
</RelativeLayout>
</LinearLayout>
@@ -19,9 +19,9 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
@@ -54,7 +54,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:text="@string/placeholder_filename"
tools:text="@string/placeholder_filename"
android:textAppearance="?android:attr/textAppearanceListItem"/>
<TextView
@@ -62,7 +62,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:text="@string/placeholder_sentence"
tools:text="@string/placeholder_sentence"
android:alpha="0.57"
android:textAppearance="?android:attr/textAppearanceListItem"/>
@@ -82,7 +82,7 @@
android:layout_height="wrap_content"
android:layout_gravity="end"
android:ellipsize="end"
android:text="@string/placeholder_sentence"
tools:text="@string/placeholder_sentence"
android:alpha="0.5"
android:textColor="?android:attr/textColorSecondary"/>
@@ -19,9 +19,10 @@
License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_drawer_header_height"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
@@ -96,7 +97,8 @@
android:shadowRadius="2"
android:textColor="@android:color/white"
android:textSize="@dimen/drawer_header_text"
android:textStyle="bold"/>
android:textStyle="bold"
tools:text="Max Mustermann"/>
<TextView
android:id="@+id/userinfo_username"
@@ -110,7 +112,8 @@
android:shadowDy="0"
android:shadowRadius="2"
android:textColor="@android:color/white"
android:textSize="@dimen/drawer_header_subtext"/>
android:textSize="@dimen/drawer_header_subtext"
tools:text="[email protected]/nextcloud"/>
</LinearLayout>
</RelativeLayout>
+21 -29
View File
@@ -18,24 +18,27 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ListItemLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/standard_list_item_size"
android:background="@drawable/list_selector"
android:descendantFocusability="blocksDescendants"
android:orientation="horizontal">
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ListItemLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/standard_list_item_size"
android:background="@drawable/list_selector"
android:descendantFocusability="blocksDescendants"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
android:orientation="horizontal"
android:paddingTop="@dimen/standard_padding"
android:paddingBottom="@dimen/standard_padding">
<ImageView
android:id="@+id/thumbnail"
android:layout_width="@dimen/file_icon_size"
android:layout_height="@dimen/file_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/standard_margin"
android:layout_marginRight="@dimen/standard_margin"
android:contentDescription="@null"
@@ -43,20 +46,18 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="top"
android:orientation="vertical"
android:paddingTop="@dimen/standard_padding">
android:orientation="vertical">
<TextView
android:id="@+id/Filename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="middle"
android:singleLine="true"
android:text="@string/placeholder_filename"
tools:text="@string/placeholder_filename"
android:textColor="@color/textColor"
android:textSize="@dimen/two_line_primary_text_size"/>
@@ -69,7 +70,7 @@
android:id="@+id/fileSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/placeholder_fileSize"
tools:text="@string/placeholder_fileSize"
android:textColor="@color/list_item_lastmod_and_filesize_text"
android:textSize="@dimen/two_line_secondary_text_size"/>
@@ -77,7 +78,6 @@
android:id="@+id/file_separator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:paddingEnd="@dimen/standard_quarter_padding"
android:paddingLeft="@dimen/zero"
android:paddingRight="@dimen/standard_quarter_padding"
@@ -90,8 +90,7 @@
android:id="@+id/deletionTimestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="@string/placeholder_media_time"
tools:text="@string/placeholder_media_time"
android:textColor="@color/list_item_lastmod_and_filesize_text"
android:textSize="@dimen/two_line_secondary_text_size"/>
@@ -101,8 +100,7 @@
android:id="@+id/originalLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="@string/placeholder_filename"
tools:text="@string/placeholder_filename"
android:textColor="@color/list_item_lastmod_and_filesize_text"
android:textSize="@dimen/two_line_secondary_text_size"/>
@@ -111,7 +109,6 @@
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingEnd="@dimen/zero"
android:paddingLeft="@dimen/standard_half_padding"
android:paddingRight="@dimen/zero"
@@ -120,7 +117,7 @@
<ImageView
android:id="@+id/restore"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:clickable="false"
android:contentDescription="@string/restore_button_description"
@@ -134,7 +131,7 @@
<ImageView
android:id="@+id/customCheckbox"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/restore"
android:layout_toRightOf="@id/restore"
@@ -150,7 +147,7 @@
<ImageView
android:id="@+id/overflowMenu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/customCheckbox"
android:layout_toRightOf="@id/customCheckbox"
@@ -167,9 +164,4 @@
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/list_divider_background"/>
</LinearLayout>
@@ -1,18 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<!--
Nextcloud Android client application
Copyright (C) 2018 Andy Scherzinger
Copyright (C) 2018 Nextcloud
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.
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/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/icon"
android:contentDescription="@string/account_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/standard_margin"
android:layout_marginEnd="@dimen/standard_half_margin"
android:layout_marginLeft="@dimen/standard_icon_list_horizontal_margin"
android:layout_marginRight="@dimen/standard_icon_list_horizontal_margin"
android:layout_marginTop="@dimen/standard_margin"/>
android:layout_marginRight="@dimen/standard_half_margin"
android:layout_marginStart="@dimen/standard_icon_list_horizontal_margin"
android:layout_marginTop="@dimen/standard_margin"
android:contentDescription="@string/account_icon"
tools:src="@drawable/ic_phone" />
<TextView
android:id="@+id/text"
@@ -23,6 +45,7 @@
android:layout_toEndOf="@id/icon"
android:layout_toRightOf="@id/icon"
android:maxLines="3"
android:textAppearance="?android:attr/textAppearanceListItem"/>
android:textAppearance="?android:attr/textAppearanceListItem"
tools:text="+49 123 456 789 12" />
</RelativeLayout>
+4
View File
@@ -762,8 +762,12 @@
<string name="prefs_e2e_no_device_credentials">Për të shfaqur kujtesën, ju lutemi aktivizoni kredencialet e pajisje.</string>
<string name="whats_new_device_credentials_title">Përdorni mbrojtjen e brendshme të pajisjes Android</string>
<string name="login">Hyni</string>
<string name="signup_with_provider">Regjistrohu me ofruesin</string>
<string name="host_your_own_server">Hostoni serverin tuaj</string>
<string name="first_run_1_text">Mbani të sigurta dhe nën kontroll të dhënat tuaja</string>
<string name="first_run_2_text">Bashkëpunim i sigurtë &amp;skedar i ndryshuar</string>
<string name="first_run_3_text">E-mail i thjeshtë për t\'u përdorur në web, kalendari &amp;i kontakteve</string>
<string name="first_run_4_text">Ndarja e ekranit, takime në internet &amp; konferenca në web</string>
<string name="whats_new_device_credentials_content">Përdorni diçka si një model, fjalëkalim, pin ose gjurmë gishtash për të mbajtur të dhënat tuaja të sigurta.</string>
<string name="restore_button_description">Rikthe skedarin e fshirë</string>
<string name="restore">Rikthe skedarin</string>
+4
View File
@@ -767,7 +767,11 @@
<string name="whats_new_device_credentials_title">Користи Андроидову интерну заштиту уређаја</string>
<string name="login">Пријава</string>
<string name="signup_with_provider">Пријавите се преко провајдера</string>
<string name="host_your_own_server">Хостујте сопствени сервер</string>
<string name="first_run_1_text">Држите податке безбедним и под Вашом контролом</string>
<string name="first_run_2_text">Безбедна сарадња &amp; и размена фајлова</string>
<string name="first_run_3_text">Веб пошта лака за коришћење, календар &amp; контакти</string>
<string name="first_run_4_text">Дељење екрана, састанци на интернету &amp; веб конференције</string>
<string name="whats_new_device_credentials_content">Користите било шта попут шаблона, лозинке, пина или отиска Вашег прста да заштитите Ваше податке.</string>
<string name="restore_button_description">Поврати обрисани фајл</string>
<string name="restore">Поврати фајл</string>
-1
View File
@@ -61,7 +61,6 @@
<dimen name="alternate_half_padding">5dp</dimen>
<dimen name="alternate_padding_right">55dp</dimen>
<dimen name="display_text_min_height">32dp</dimen>
<dimen name="divider_height_independent">1dip</dimen>
<dimen name="alternate_padding_independent">10dip</dimen>
<dimen name="activity_row_layout_min_width_independent">196dip</dimen>
<dimen name="user_icon_size_independent">40dip</dimen>
@@ -117,6 +117,47 @@ public class TestSorting {
assertTrue(test(sortedArray, unsortedList));
}
@Test
public void testSortCloudFiles() {
List<OCFile> array = new ArrayList<>();
array.add(new OCFile("/Joplin/0ed1778f8f88414286c13b2cbff8664e.md"));
array.add(new OCFile("/Joplin/0edf70ab1b722172088257b3d73d6c46.md"));
array.add(new OCFile("/Joplin/0fb063d4d18128fdf464878d18439ca3.md"));
array.add(new OCFile("/Joplin/10e27391096748b187392f913da048f8.md"));
array.add(new OCFile("/Joplin/4093463de91947b990fccff4a1d13d8f.md"));
array.add(new OCFile("/Joplin/41742897324842849667274b2d1a0bb6.md"));
array.add(new OCFile("/Joplin/41890bd1b11a44f7a6b226120ee1efbc.md"));
array.add(new OCFile("/Joplin/41bd23f62ebb4d0b64c5f78b5ad13133.md"));
array.add(new OCFile("/Joplin/4292ef3223334677bed0ad0268e5bd4b.md"));
array.add(new OCFile("/Joplin/4307355783f4108aad5eba4d1b81ff91.md"));
array.add(new OCFile("/Joplin/448d96a6c76b48b68030c8c11339088d.md"));
array.add(new OCFile("/Joplin/4969e02c5c504899b17a355e61989bed.md"));
array.add(new OCFile("/Joplin/49bfe05d968c3c0612ddceb2250b3a18.md"));
array.add(new OCFile("/Joplin/701409a07ee4464fb82d9bc0c451f204.md"));
array.add(new OCFile("/Joplin/70ba2272c85353a0216577ec76d0d343.md"));
array.add(new OCFile("/Joplin/71563833027a49dcaa86208a3f621402.md"));
array.add(new OCFile("/Joplin/7172f37973434fe3aeb6ef96bb48d968.md"));
array.add(new OCFile("/Joplin/72068539d77c6e7b3271b653422d6e76.md"));
array.add(new OCFile("/Joplin/73098c81e1ae4831b3a90ffda82ddcec.md"));
array.add(new OCFile("/Joplin/730c09e169bc4289af163a34d7fe2553.md"));
array.add(new OCFile("/Joplin/736be455ce8aff18694649001a74722a.md"));
array.add(new OCFile("/Joplin/749c837930174e828620a99a9e7ad7bc.md"));
array.add(new OCFile("/Joplin/8a2d6a6461eb4979bb049837a8710a3d.md"));
array.add(new OCFile("/Joplin/8b7ff9081f5944399e1fc83c6191a09f.md"));
array.add(new OCFile("/Joplin/8c45ac421149a21f32edab06f0955839.md"));
array.add(new OCFile("/Joplin/8cd855a41cca4cbd8a0c20e79c4f2f9e.md"));
array.add(new OCFile("/Joplin/8f062be696e3488ca12a9d3f3f6aa10a.md"));
array.add(new OCFile("/Joplin/8f74a571a11b4709bb1cdf75b4a51a8e.md"));
array.add(new OCFile("/Joplin/90f61d36f4dd4ef79525b7b0812213e2.md"));
array.add(new OCFile("/Joplin/9846fdafaffa718ebcfa19474e8be251.md"));
array.add(new OCFile("/Joplin/a441cb730c22451aa4352129231fe898.md"));
array.add(new OCFile("/Joplin/a551ce1ae06e6f05669a0cadc4eb2f7b.md"));
array.add(new OCFile("/Joplin/a590cd1671b648c7a3bae0d6fbb7da81.md"));
FileSortOrderByName fileSortOrderByName = new FileSortOrderByName("test", true);
fileSortOrderByName.sortCloudFiles(array);
}
private List<Comparable> shuffle(List<? extends Comparable> files) {
List<Comparable> shuffled = new ArrayList<>();
shuffled.addAll(files);