minor code formatting cleanups

This commit is contained in:
AndyScherzinger 2017-08-08 10:21:01 +02:00
parent 91f7737713
commit bddce2080d
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
13 changed files with 51 additions and 80 deletions

View file

@ -123,7 +123,6 @@
<service
android:name=".jobs.NContentObserverJob"
android:permission="android.permission.BIND_JOB_SERVICE" >
</service>
<service

View file

@ -380,7 +380,6 @@ public class MainApp extends MultiDexApplication {
syncedFolderProvider.deleteSyncedFoldersInList(idsToDelete);
PreferenceManager.setAutoUploadSplitEntries(this, true);
}
}

View file

@ -30,8 +30,8 @@ import com.owncloud.android.lib.common.utils.Log_OC;
import java.util.HashSet;
import java.util.Set;
/*
Provider for stored filesystem data
/**
* Provider for stored filesystem data.
*/
public class FilesystemDataProvider {
@ -57,7 +57,6 @@ public class FilesystemDataProvider {
ProviderMeta.ProviderTableMeta.FILESYSTEM_SYNCED_FOLDER_ID + " = ?",
new String[]{path, syncedFolderId}
);
}
public Set<String> getFilesForUpload(String localPath, String syncedFolderId) {
@ -65,7 +64,6 @@ public class FilesystemDataProvider {
String likeParam = localPath + "%";
Cursor cursor = contentResolver.query(
ProviderMeta.ProviderTableMeta.CONTENT_URI_FILESYSTEM,
null,
@ -88,12 +86,9 @@ public class FilesystemDataProvider {
} while (cursor.moveToNext());
cursor.close();
}
return localPathsToUpload;
}
public void storeOrUpdateFileValue(String localPath, long modifiedAt, boolean isFolder, SyncedFolder syncedFolder) {
@ -105,7 +100,6 @@ public class FilesystemDataProvider {
isFolderValue = 1;
}
ContentValues cv = new ContentValues();
cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_FOUND_RECENTLY, System.currentTimeMillis());
cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_MODIFIED, modifiedAt);

View file

@ -4,17 +4,17 @@
* @author Andy Scherzinger
* Copyright (C) 2016 Andy Scherzinger
* Copyright (C) 2016 Nextcloud
* <p>
*
* 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.
* <p>
*
* 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.
* <p>
*
* 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/>.
*/

View file

@ -1,3 +1,22 @@
/*
* Nextcloud Android client application
*
* @author Andy Scherzinger
* Copyright (C) 2017 Andy Scherzinger
*
* 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/>.
*/
package com.owncloud.android.datamodel;
import android.util.SparseArray;

View file

@ -99,12 +99,11 @@ public class SyncedFolder implements Serializable, Cloneable {
public Object clone() {
try {
return super.clone();
} catch( CloneNotSupportedException e) {
} catch (CloneNotSupportedException e) {
return null;
}
}
public long getId() {
return id;
}

View file

@ -1,6 +1,7 @@
/**
* Nextcloud Android client application
*
* @author Andy Scherzinger
* Copyright (C) 2016 Andy Scherzinger
* Copyright (C) 2016 Nextcloud.
*

View file

@ -424,7 +424,8 @@ public class UploadsStorageManager extends Observable {
}
/**
* Get all failed uploads, except for those that were not performed due to lack of Wifi connection
* Get all failed uploads, except for those that were not performed due to lack of Wifi connection.
*
* @return Array of failed uploads, except for those that were not performed due to lack of Wifi connection.
*/
public OCUpload[] getFailedButNotDelayedUploads() {
@ -472,7 +473,6 @@ public class UploadsStorageManager extends Observable {
ProviderTableMeta.CONTENT_URI_UPLOADS,
ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_SUCCEEDED.value + AND +
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?", new String[]{account.name}
);
Log_OC.d(TAG, "delete all successful uploads");
@ -502,10 +502,12 @@ public class UploadsStorageManager extends Observable {
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?",
whereArgs
);
Log_OC.d(TAG, "delete all finished uploads");
if (result > 0) {
notifyObserversNow();
}
return result;
}
@ -592,6 +594,7 @@ public class UploadsStorageManager extends Observable {
Log_OC.w(TAG, Integer.toString(result) + " uploads where abruptly interrupted");
notifyObserversNow();
}
return result;
}
}

View file

@ -40,7 +40,6 @@ import java.io.File;
/**
* Stores all information in order to start upload operations. PersistentUploadObject can
* be stored persistently by {@link UploadsStorageManager}.
*
*/
public class OCUpload implements Parcelable {
@ -49,7 +48,7 @@ public class OCUpload implements Parcelable {
private long mId;
/**
* Absolute path in the local file system to the file to be uploaded
* Absolute path in the local file system to the file to be uploaded.
*/
private String mLocalPath;
@ -64,7 +63,7 @@ public class OCUpload implements Parcelable {
private String mAccountName;
/**
* File size
* File size.
*/
private long mFileSize;
@ -77,14 +76,17 @@ public class OCUpload implements Parcelable {
* Overwrite destination file?
*/
private boolean mForceOverwrite;
/**
* Create destination folder?
*/
private boolean mIsCreateRemoteFolder;
/**
* Status of upload (later, in_progress, ...).
*/
private UploadStatus mUploadStatus;
/**
* Result from last upload operation. Can be null.
*/
@ -95,7 +97,7 @@ public class OCUpload implements Parcelable {
*/
private int mCreatedBy;
/*
/**
* When the upload ended
*/
private long mUploadEndTimeStamp;
@ -104,15 +106,14 @@ public class OCUpload implements Parcelable {
* Upload only via wifi?
*/
private boolean mIsUseWifiOnly;
/**
* Upload only if phone being charged?
*/
private boolean mIsWhileChargingOnly;
/**
/**
* Main constructor
* Main constructor.
*
* @param localPath Absolute path in the local file system to the file to be uploaded.
* @param remotePath Absolute path in the remote account to set to the uploaded file.
@ -134,9 +135,8 @@ public class OCUpload implements Parcelable {
mAccountName = accountName;
}
/**
* Convenience constructor to reupload already existing {@link OCFile}s
* Convenience constructor to reupload already existing {@link OCFile}s.
*
* @param ocFile {@link OCFile} instance to update in the remote server.
* @param account ownCloud {@link Account} where ocFile is contained.
@ -145,7 +145,6 @@ public class OCUpload implements Parcelable {
this(ocFile.getStoragePath(), ocFile.getRemotePath(), account.name);
}
/**
* Reset all the fields to default values.
*/
@ -242,7 +241,6 @@ public class OCUpload implements Parcelable {
mFileSize = fileSize;
}
/**
* @return the mimeType
*/
@ -407,7 +405,6 @@ public class OCUpload implements Parcelable {
mIsWhileChargingOnly = (source.readInt() == 1);
}
@Override
public int describeContents() {
return this.hashCode();

View file

@ -234,7 +234,6 @@ public abstract class PreferenceManager {
return getDefaultSharedPreferences(context).getBoolean(PREF__AUTO_UPLOAD_SPLIT_OUT, false);
}
/**
* Saves the legacy cleaning flag which the user has set last.
*
@ -269,8 +268,6 @@ public abstract class PreferenceManager {
saveBooleanPreference(context, PREF__AUTO_UPLOAD_SPLIT_OUT, splitOut);
}
/**
* Gets the uploader behavior which the user has set last.
*

View file

@ -158,7 +158,6 @@ public class FileUploader extends Service
public static final String KEY_LOCAL_BEHAVIOUR = "BEHAVIOUR";
public static final int LOCAL_BEHAVIOUR_COPY = 0;
public static final int LOCAL_BEHAVIOUR_MOVE = 1;
public static final int LOCAL_BEHAVIOUR_FORGET = 2;
@ -202,7 +201,6 @@ public class FileUploader extends Service
sendBroadcastUploadStarted(mCurrentUpload);
}
/**
* Helper class providing methods to ease requesting commands to {@link FileUploader} .
*
@ -211,7 +209,6 @@ public class FileUploader extends Service
*/
public static class UploadRequester {
/**
* Call to upload several new files
*/
@ -239,7 +236,6 @@ public class FileUploader extends Service
intent.putExtra(FileUploader.KEY_WHILE_ON_WIFI_ONLY, requiresWifi);
intent.putExtra(FileUploader.KEY_WHILE_CHARGING_ONLY, requiresCharging);
context.startService(intent);
}
@ -356,7 +352,6 @@ public class FileUploader extends Service
}
}
/**
* Retry a subset of all the stored failed uploads.
*
@ -402,10 +397,8 @@ public class FileUploader extends Service
context.startService(i);
}
}
}
/**
* Service initialization
*/
@ -439,7 +432,6 @@ public class FileUploader extends Service
am.addOnAccountsUpdatedListener(this, null, false);
}
/**
* Service clean-up when restarted after being killed
*/
@ -448,7 +440,6 @@ public class FileUploader extends Service
mNotificationManager.cancel(R.string.uploader_upload_in_progress_ticker);
}
/**
* Service clean up
*/
@ -468,7 +459,6 @@ public class FileUploader extends Service
super.onDestroy();
}
/**
* Entry point to add one or several files to the queue of uploads.
*
@ -525,7 +515,6 @@ public class FileUploader extends Service
mimeTypes = intent.getStringArrayExtra(KEY_MIME_TYPE);
}
boolean forceOverwrite = intent.getBooleanExtra(KEY_FORCE_OVERWRITE, false);
int localAction = intent.getIntExtra(KEY_LOCAL_BEHAVIOUR, LOCAL_BEHAVIOUR_FORGET);
@ -717,9 +706,8 @@ public class FileUploader extends Service
}
/**
* Binder to let client components to perform operations on the queue of
* uploads.
* <p/>
* Binder to let client components to perform operations on the queue of uploads.
*
* It provides by itself the available operations.
*/
public class FileUploaderBinder extends Binder implements OnDatatransferProgressListener {
@ -728,9 +716,7 @@ public class FileUploader extends Service
* Map of listeners that will be reported about progress of uploads from a
* {@link FileUploaderBinder} instance
*/
private Map<String, OnDatatransferProgressListener> mBoundListeners =
new HashMap<String, OnDatatransferProgressListener>();
private Map<String, OnDatatransferProgressListener> mBoundListeners = new HashMap<>();
/**
* Cancels a pending or current upload of a remote file.
@ -828,7 +814,6 @@ public class FileUploader extends Service
return (mPendingUploads.contains(account.name, file.getRemotePath()));
}
public boolean isUploadingNow(OCUpload upload) {
return (
upload != null &&
@ -839,7 +824,6 @@ public class FileUploader extends Service
);
}
/**
* Adds a listener interested in the progress of the upload for a concrete file.
*
@ -859,7 +843,6 @@ public class FileUploader extends Service
mBoundListeners.put(targetKey, listener);
}
/**
* Adds a listener interested in the progress of the upload for a concrete file.
*
@ -877,7 +860,6 @@ public class FileUploader extends Service
mBoundListeners.put(targetKey, listener);
}
/**
* Removes a listener interested in the progress of the upload for a concrete file.
*
@ -899,7 +881,6 @@ public class FileUploader extends Service
}
}
/**
* Removes a listener interested in the progress of the upload for a concrete file.
*
@ -919,7 +900,6 @@ public class FileUploader extends Service
}
}
@Override
public void onTransferProgress(long progressRate, long totalTransferredSoFar,
long totalToTransfer, String fileName) {
@ -945,7 +925,7 @@ public class FileUploader extends Service
/**
* Builds a key for the map of listeners.
* <p/>
*
* TODO use method in IndexedForest, or refactor both to a common place
* add to local database) to better policy (add to local database, then upload)
*
@ -963,7 +943,7 @@ public class FileUploader extends Service
/**
* Upload worker. Performs the pending uploads in the order they were
* requested.
* <p/>
*
* Created with the Looper of a new thread, started in
* {@link FileUploader#onCreate()}.
*/
@ -1058,7 +1038,7 @@ public class FileUploader extends Service
mCurrentAccount.name,
mCurrentUpload.getOldFile().getRemotePath()
);
/** TODO: grant that name is also updated for mCurrentUpload.getOCUploadId */
// TODO: grant that name is also updated for mCurrentUpload.getOCUploadId
} else {
removeResult = mPendingUploads.removePayload(
@ -1073,7 +1053,6 @@ public class FileUploader extends Service
notifyUploadResult(mCurrentUpload, uploadResult);
sendBroadcastUploadFinished(mCurrentUpload, uploadResult, removeResult.second);
}
// generate new Thumbnail
@ -1097,8 +1076,7 @@ public class FileUploader extends Service
private void notifyUploadStart(UploadFileOperation upload) {
// / create status notification with a progress bar
mLastPercent = 0;
mNotificationBuilder =
NotificationUtils.newNotificationBuilder(this);
mNotificationBuilder = NotificationUtils.newNotificationBuilder(this);
mNotificationBuilder
.setOngoing(true)
.setSmallIcon(R.drawable.notification_icon)
@ -1122,7 +1100,6 @@ public class FileUploader extends Service
} // else wait until the upload really start (onTransferProgress is called), so that if it's discarded
// due to lack of Wifi, no notification is shown
// TODO generalize for automated uploads
}
/**
@ -1178,9 +1155,7 @@ public class FileUploader extends Service
.setOngoing(false)
.setProgress(0, 0, false);
content = ErrorMessageAdapter.getErrorCauseMessage(
uploadResult, upload, getResources()
);
content = ErrorMessageAdapter.getErrorCauseMessage(uploadResult, upload, getResources());
if (needsToUpdateCredentials) {
// let the user update credentials with one click
@ -1231,7 +1206,6 @@ public class FileUploader extends Service
}
}
/**
* Sends a broadcast in order to the interested activities can update their
* view
@ -1245,7 +1219,6 @@ public class FileUploader extends Service
sendStickyBroadcast(start);
}
/**
* Sends a broadcast in order to the interested activities can update their
* view
@ -1309,5 +1282,4 @@ public class FileUploader extends Service
mPendingUploads.remove(account.name);
mUploadsStorageManager.removeUploads(account.name);
}
}

View file

@ -1063,7 +1063,7 @@ public class FileContentProvider extends ContentProvider {
}
if (oldVersion < 23 && newVersion >= 23) {
Log_OC.i(SQL, "Entering in the #22 adding type colum for synced folders, Create filesystem table");
Log_OC.i(SQL, "Entering in the #23 adding type column for synced folders, Create filesystem table");
db.beginTransaction();
try {
// add type column default being CUSTOM (0)

View file

@ -55,9 +55,8 @@ import com.owncloud.android.utils.GetShareWithUsersAsyncTask;
import java.util.ArrayList;
/**
* Activity for sharing files
* Activity for sharing files.
*/
public class ShareActivity extends FileActivity implements ShareFragmentListener {
private static final String TAG = ShareActivity.class.getSimpleName();
@ -84,7 +83,6 @@ public class ShareActivity extends FileActivity implements ShareFragmentListener
ft.replace(R.id.share_fragment_container, fragment, TAG_SHARE_FRAGMENT);
ft.commit();
}
}
protected void onAccountSet(boolean stateWasRecovered) {
@ -141,7 +139,6 @@ public class ShareActivity extends FileActivity implements ShareFragmentListener
);
}
private int getAppropiatePermissions(ShareType shareType) {
// check if the Share is FEDERATED
@ -242,9 +239,8 @@ public class ShareActivity extends FileActivity implements ShareFragmentListener
}
/**
* Updates the view, reading data from {@link com.owncloud.android.datamodel.FileDataStorageManager}
* Updates the view, reading data from {@link com.owncloud.android.datamodel.FileDataStorageManager}.
*/
private void refreshSharesFromStorageManager() {
@ -267,7 +263,6 @@ public class ShareActivity extends FileActivity implements ShareFragmentListener
editShareFragment.isAdded()) {
editShareFragment.refreshUiFromDB();
}
}
/**
@ -297,7 +292,6 @@ public class ShareActivity extends FileActivity implements ShareFragmentListener
return (EditShareFragment) getSupportFragmentManager().findFragmentByTag(TAG_EDIT_SHARE_FRAGMENT);
}
private void onCreateShareViaLinkOperationFinish(CreateShareViaLinkOperation operation,
RemoteOperationResult result) {
if (result.isSuccess()) {
@ -366,8 +360,5 @@ public class ShareActivity extends FileActivity implements ShareFragmentListener
t.show();
}
}
}
}