CR, GPLv3

This commit is contained in:
Andy Scherzinger 2016-08-02 10:59:31 +02:00 committed by AndyScherzinger
parent d7d2845117
commit 6e73da2809
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
15 changed files with 186 additions and 146 deletions

View file

@ -1,3 +1,22 @@
<!--
Nextcloud Android client application
Copyright (C) 2016 Bartosz Przybylski
Copyright (C) 2016 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/>.
-->
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.datastorage;

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartek Przybylski
* Copyright (C) 2016 Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* @author Bartosz Przybylski
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.datastorage;

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.datastorage;

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.datastorage.providers;

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.datastorage.providers;

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.datastorage.providers;

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.datastorage.providers;

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.datastorage.providers;

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.datastorage.providers;

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.datastorage.providers;

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.datastorage.providers;

View file

@ -1,22 +1,23 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2015 ownCloud Inc.
* Copyright (C) 2015 Bartosz Przybylski
* Copyright (C) 2016 ownCloud Inc.
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 Bartosz Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.ui.activity;

View file

@ -1,22 +1,22 @@
/**
* ownCloud Android client application
* Nextcloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2015 ownCloud Inc.
* Copyright (C) 2015 Bartosz Przybylski
* Copyright (C) 2016 Bartosz Przybylski
* Copyright (C) 2016 Nextcloud
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 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/>.
* 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/>.
*/
package com.owncloud.android.ui.activity;
@ -170,7 +170,11 @@ public class StorageMigration {
protected String mAuthority;
protected Account[] mOcAccounts;
public FileMigrationTaskBase(Context context, String source, String target, ProgressDialog progressDialog, StorageMigrationProgressListener listener) {
public FileMigrationTaskBase(Context context,
String source,
String target,
ProgressDialog progressDialog,
StorageMigrationProgressListener listener) {
mContext = context;
mStorageSource = source;
mStorageTarget = target;
@ -183,8 +187,9 @@ public class StorageMigration {
@Override
protected void onProgressUpdate(Integer... progress) {
if (progress.length > 1 && progress[0] != 0)
if (progress.length > 1 && progress[0] != 0) {
mProgressDialog.setMessage(mContext.getString(progress[0]));
}
}
@Override
@ -203,42 +208,52 @@ public class StorageMigration {
mProgressDialog.setIndeterminateDrawable(mContext.getResources().getDrawable(R.drawable.image_fail));
}
if (mListener != null)
if (mListener != null) {
mListener.onStorageMigrationFinished(succeed ? mStorageTarget : mStorageSource, succeed);
}
}
protected boolean[] saveAccountsSyncStatus() {
boolean[] syncs = new boolean[mOcAccounts.length];
for (int i = 0; i < mOcAccounts.length; ++i)
for (int i = 0; i < mOcAccounts.length; ++i) {
syncs[i] = ContentResolver.getSyncAutomatically(mOcAccounts[i], mAuthority);
}
return syncs;
}
protected void stopAccountsSyncing() {
for (int i = 0; i < mOcAccounts.length; ++i)
for (int i = 0; i < mOcAccounts.length; ++i) {
ContentResolver.setSyncAutomatically(mOcAccounts[i], mAuthority, false);
}
}
protected void waitForUnfinishedSynchronizations() {
for (int i = 0; i < mOcAccounts.length; ++i)
while (ContentResolver.isSyncActive(mOcAccounts[i], mAuthority))
for (int i = 0; i < mOcAccounts.length; ++i) {
while (ContentResolver.isSyncActive(mOcAccounts[i], mAuthority)) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Log_OC.w(TAG, "Thread interrupted while waiting for account to end syncing");
Thread.currentThread().interrupt();
}
}
}
}
protected void restoreAccountsSyncStatus(boolean oldSync[]) {
for (int i = 0; i < mOcAccounts.length; ++i)
for (int i = 0; i < mOcAccounts.length; ++i) {
ContentResolver.setSyncAutomatically(mOcAccounts[i], mAuthority, oldSync[i]);
}
}
}
static private class StoragePathSwitchTask extends FileMigrationTaskBase {
public StoragePathSwitchTask(Context context, String source, String target, ProgressDialog progressDialog, StorageMigrationProgressListener listener) {
public StoragePathSwitchTask(Context context,
String source,
String target,
ProgressDialog progressDialog,
StorageMigrationProgressListener listener) {
super(context, source, target, progressDialog, listener);
}
@ -277,7 +292,11 @@ public class StorageMigration {
int getResId() { return mResId; }
}
public FileMigrationTask(Context context, String source, String target, ProgressDialog progressDialog, StorageMigrationProgressListener listener) {
public FileMigrationTask(Context context,
String source,
String target,
ProgressDialog progressDialog,
StorageMigrationProgressListener listener) {
super(context, source, target, progressDialog, listener);
}

View file

@ -21,12 +21,10 @@
package com.owncloud.android.utils;
import android.accounts.Account;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Environment;
import android.os.StatFs;
import android.preference.PreferenceManager;
import android.webkit.MimeTypeMap;
@ -84,7 +82,11 @@ public class FileStorageUtils {
* Get local owncloud storage path for accountName.
*/
public static final String getSavePath(String accountName) {
return MainApp.getStoragePath() + File.separator + MainApp.getDataFolder() + File.separator + Uri.encode(accountName, "@");
return MainApp.getStoragePath()
+ File.separator
+ MainApp.getDataFolder()
+ File.separator
+ Uri.encode(accountName, "@");
// URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names,
// that can be in the accountName since 0.1.190B
}
@ -102,27 +104,26 @@ public class FileStorageUtils {
* Get absolute path to tmp folder inside datafolder in sd-card for given accountName.
*/
public static final String getTemporalPath(String accountName) {
return MainApp.getStoragePath() + File.separator + MainApp.getDataFolder() + File.separator + "tmp" + File.separator + Uri.encode(accountName, "@");
return MainApp.getStoragePath()
+ File.separator
+ MainApp.getDataFolder()
+ File.separator
+ "tmp"
+ File.separator
+ Uri.encode(accountName, "@");
// URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names,
// that can be in the accountName since 0.1.190B
}
/**
* Optimistic number of bytes available on sd-card. accountName is ignored.
*
* @param accountName not used. can thus be null.
* @return Optimistic number of available bytes (can be less)
*/
@SuppressLint("NewApi")
public static final long getUsableSpace(String accountName) {
File savePath = new File(MainApp.getStoragePath());
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) {
return savePath.getUsableSpace();
} else {
StatFs stats = new StatFs(savePath.getAbsolutePath());
return stats.getAvailableBlocks() * stats.getBlockSize();
}
return savePath.getUsableSpace();
}
public static final String getLogPath() {
@ -518,12 +519,12 @@ public class FileStorageUtils {
if (in != null) try {
in.close();
} catch (IOException e) {
e.printStackTrace(System.err);
Log_OC.e(TAG, "Error closing input stream during copy", e);
}
if (out != null) try {
out.close();
} catch (IOException e) {
e.printStackTrace(System.err);
Log_OC.e(TAG, "Error closing output stream during copy", e);
}
}