mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 15:15:51 +03:00
fix codacy warnings
This commit is contained in:
parent
d331fe3cfd
commit
84b9bb97d4
24 changed files with 136 additions and 722 deletions
|
@ -38,7 +38,8 @@ import com.owncloud.android.lib.common.utils.Log_OC;
|
|||
/**
|
||||
* Authenticator for ownCloud accounts.
|
||||
*
|
||||
* Controller class accessed from the system AccountManager, providing integration of ownCloud accounts with the Android system.
|
||||
* Controller class accessed from the system AccountManager,
|
||||
* providing integration of ownCloud accounts with the Android system.
|
||||
*
|
||||
* TODO - better separation in operations for OAuth-capable and regular ownCloud accounts.
|
||||
* TODO - review completeness
|
||||
|
@ -46,13 +47,13 @@ import com.owncloud.android.lib.common.utils.Log_OC;
|
|||
public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
||||
|
||||
/**
|
||||
* Is used by android system to assign accounts to authenticators. Should be
|
||||
* used by application and all extensions.
|
||||
* Is used by android system to assign accounts to authenticators.
|
||||
* Should be used by application and all extensions.
|
||||
*/
|
||||
public static final String KEY_AUTH_TOKEN_TYPE = "authTokenType";
|
||||
public static final String KEY_REQUIRED_FEATURES = "requiredFeatures";
|
||||
public static final String KEY_LOGIN_OPTIONS = "loginOptions";
|
||||
public static final String KEY_ACCOUNT = "account";
|
||||
private static final String KEY_AUTH_TOKEN_TYPE = "authTokenType";
|
||||
private static final String KEY_REQUIRED_FEATURES = "requiredFeatures";
|
||||
private static final String KEY_LOGIN_OPTIONS = "loginOptions";
|
||||
private static final String KEY_ACCOUNT = "account";
|
||||
|
||||
private static final String TAG = AccountAuthenticator.class.getSimpleName();
|
||||
|
||||
|
@ -74,8 +75,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|||
String accountType, String authTokenType,
|
||||
String[] requiredFeatures, Bundle options)
|
||||
throws NetworkErrorException {
|
||||
Log_OC.i(TAG, "Adding account with type " + accountType
|
||||
+ " and auth token " + authTokenType);
|
||||
Log_OC.i(TAG, "Adding account with type " + accountType + " and auth token " + authTokenType);
|
||||
|
||||
final Bundle bundle = new Bundle();
|
||||
|
||||
|
@ -131,8 +131,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|||
try {
|
||||
validateAccountType(account.type);
|
||||
} catch (AuthenticatorException e) {
|
||||
Log_OC.e(TAG, "Failed to validate account type " + account.type + ": "
|
||||
+ e.getMessage(), e);
|
||||
Log_OC.e(TAG, "Failed to validate account type " + account.type + ": " + e.getMessage(), e);
|
||||
return e.getFailureBundle();
|
||||
}
|
||||
Intent intent = new Intent(mContext, AuthenticatorActivity.class);
|
||||
|
@ -149,8 +148,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Bundle editProperties(AccountAuthenticatorResponse response,
|
||||
String accountType) {
|
||||
public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -166,8 +164,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|||
validateAccountType(account.type);
|
||||
validateAuthTokenType(authTokenType);
|
||||
} catch (AuthenticatorException e) {
|
||||
Log_OC.e(TAG, "Failed to validate account type " + account.type + ": "
|
||||
+ e.getMessage(), e);
|
||||
Log_OC.e(TAG, "Failed to validate account type " + account.type + ": " + e.getMessage(), e);
|
||||
return e.getFailureBundle();
|
||||
}
|
||||
|
||||
|
@ -219,8 +216,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|||
Account account, String authTokenType, Bundle options)
|
||||
throws NetworkErrorException {
|
||||
final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
|
||||
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
|
||||
response);
|
||||
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
|
||||
intent.putExtra(KEY_ACCOUNT, account);
|
||||
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
|
||||
intent.putExtra(KEY_LOGIN_OPTIONS, options);
|
||||
|
@ -232,8 +228,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Bundle getAccountRemovalAllowed(
|
||||
AccountAuthenticatorResponse response, Account account)
|
||||
public Bundle getAccountRemovalAllowed(AccountAuthenticatorResponse response, Account account)
|
||||
throws NetworkErrorException {
|
||||
return super.getAccountRemovalAllowed(response, account);
|
||||
}
|
||||
|
@ -244,15 +239,13 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|||
intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
|
||||
}
|
||||
|
||||
private void validateAccountType(String type)
|
||||
throws UnsupportedAccountTypeException {
|
||||
private void validateAccountType(String type) throws UnsupportedAccountTypeException {
|
||||
if (!type.equals(MainApp.getAccountType())) {
|
||||
throw new UnsupportedAccountTypeException();
|
||||
}
|
||||
}
|
||||
|
||||
private void validateAuthTokenType(String authTokenType)
|
||||
throws UnsupportedAuthTokenTypeException {
|
||||
private void validateAuthTokenType(String authTokenType) throws UnsupportedAuthTokenTypeException {
|
||||
if (!authTokenType.equals(MainApp.getAuthTokenType()) &&
|
||||
!authTokenType.equals(AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType())) &&
|
||||
!authTokenType.equals(AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType())) &&
|
||||
|
@ -269,8 +262,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|||
public AuthenticatorException(int code, String errorMsg) {
|
||||
mFailureBundle = new Bundle();
|
||||
mFailureBundle.putInt(AccountManager.KEY_ERROR_CODE, code);
|
||||
mFailureBundle
|
||||
.putString(AccountManager.KEY_ERROR_MESSAGE, errorMsg);
|
||||
mFailureBundle.putString(AccountManager.KEY_ERROR_MESSAGE, errorMsg);
|
||||
}
|
||||
|
||||
public Bundle getFailureBundle() {
|
||||
|
@ -278,8 +270,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|||
}
|
||||
}
|
||||
|
||||
public static class UnsupportedAccountTypeException extends
|
||||
AuthenticatorException {
|
||||
public static class UnsupportedAccountTypeException extends AuthenticatorException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UnsupportedAccountTypeException() {
|
||||
|
@ -288,8 +279,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|||
}
|
||||
}
|
||||
|
||||
public static class UnsupportedAuthTokenTypeException extends
|
||||
AuthenticatorException {
|
||||
public static class UnsupportedAuthTokenTypeException extends AuthenticatorException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UnsupportedAuthTokenTypeException() {
|
||||
|
@ -297,23 +287,4 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|||
"Unsupported auth token type");
|
||||
}
|
||||
}
|
||||
|
||||
public static class UnsupportedFeaturesException extends
|
||||
AuthenticatorException {
|
||||
public static final long serialVersionUID = 1L;
|
||||
|
||||
public UnsupportedFeaturesException() {
|
||||
super(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
|
||||
"Unsupported features");
|
||||
}
|
||||
}
|
||||
|
||||
public static class AccessDeniedException extends AuthenticatorException {
|
||||
public AccessDeniedException(int code, String errorMsg) {
|
||||
super(AccountManager.ERROR_CODE_INVALID_RESPONSE, "Access Denied");
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,10 +91,12 @@ import com.owncloud.android.ui.dialog.SamlWebViewDialog;
|
|||
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
|
||||
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Map;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
/**
|
||||
* This Activity is used to add an ownCloud account to the App
|
||||
*/
|
||||
|
@ -401,7 +403,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|||
* @param savedInstanceState Saved activity state, as in {{@link #onCreate(Bundle)}
|
||||
*/
|
||||
private void initServerPreFragment(Bundle savedInstanceState) {
|
||||
boolean checkHostUrl = true;
|
||||
|
||||
/// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)
|
||||
boolean isUrlInputAllowed = getResources().getBoolean(R.bool.show_server_url_input);
|
||||
|
@ -444,9 +445,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|||
mHostUrlInput.setFocusable(false);
|
||||
}
|
||||
if (isUrlInputAllowed) {
|
||||
if (mServerInfo.mBaseUrl.isEmpty()) {
|
||||
checkHostUrl = false;
|
||||
}
|
||||
mRefreshButton = findViewById(R.id.embeddedRefreshButton);
|
||||
} else {
|
||||
findViewById(R.id.hostUrlFrame).setVisibility(View.GONE);
|
||||
|
|
|
@ -21,10 +21,8 @@
|
|||
package com.owncloud.android.files.services;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
|
@ -51,7 +49,7 @@ public class ConnectivityActionReceiver extends BroadcastReceiver {
|
|||
/**
|
||||
* Magic keyword, by Google.
|
||||
*
|
||||
* {@See http://developer.android.com/intl/es/reference/android/net/wifi/WifiInfo.html#getSSID()}
|
||||
* {@see http://developer.android.com/intl/es/reference/android/net/wifi/WifiInfo.html#getSSID()}
|
||||
*/
|
||||
private static final String UNKNOWN_SSID = "<unknown ssid>";
|
||||
|
||||
|
@ -192,7 +190,9 @@ public class ConnectivityActionReceiver extends BroadcastReceiver {
|
|||
}
|
||||
}
|
||||
|
||||
private void wifiDisconnected(Context context) {
|
||||
/**
|
||||
*
|
||||
private void wifiDisconnected() {
|
||||
// TODO something smart
|
||||
|
||||
// NOTE: explicit cancellation of only-wifi instant uploads is not needed anymore, since currently:
|
||||
|
@ -204,6 +204,7 @@ public class ConnectivityActionReceiver extends BroadcastReceiver {
|
|||
}
|
||||
|
||||
|
||||
|
||||
static public void enableActionReceiver(Context context) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
ComponentName compName = new ComponentName(context.getApplicationContext(), ConnectivityActionReceiver.class);
|
||||
|
@ -218,5 +219,5 @@ public class ConnectivityActionReceiver extends BroadcastReceiver {
|
|||
PackageManager.DONT_KILL_APP);
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
}
|
|
@ -674,7 +674,6 @@ public class FileUploader extends Service
|
|||
upload = mCurrentUpload;
|
||||
}
|
||||
if (upload != null) {
|
||||
boolean pending = !upload.isUploadInProgress();
|
||||
upload.cancel();
|
||||
// need to update now table in mUploadsStorageManager,
|
||||
// since the operation will not get to be run by FileUploader#uploadFile
|
||||
|
@ -686,7 +685,7 @@ public class FileUploader extends Service
|
|||
}
|
||||
|
||||
/**
|
||||
* Cancels all the uploads for an account
|
||||
* Cancels all the uploads for an account.
|
||||
*
|
||||
* @param account ownCloud account.
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,7 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
|
|||
private static final String TAG = CreateFolderOperation.class.getSimpleName();
|
||||
|
||||
protected String mRemotePath;
|
||||
protected boolean mCreateFullPath;
|
||||
private boolean mCreateFullPath;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -53,14 +53,12 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
|
|||
public CreateFolderOperation(String remotePath, boolean createFullPath) {
|
||||
mRemotePath = remotePath;
|
||||
mCreateFullPath = createFullPath;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected RemoteOperationResult run(OwnCloudClient client) {
|
||||
CreateRemoteFolderOperation operation = new CreateRemoteFolderOperation(mRemotePath,
|
||||
mCreateFullPath);
|
||||
CreateRemoteFolderOperation operation = new CreateRemoteFolderOperation(mRemotePath, mCreateFullPath);
|
||||
RemoteOperationResult result = operation.execute(client);
|
||||
|
||||
if (result.isSuccess()) {
|
||||
|
@ -75,13 +73,11 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
|
|||
@Override
|
||||
public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
|
||||
if (operation instanceof CreateRemoteFolderOperation) {
|
||||
onCreateRemoteFolderOperationFinish((CreateRemoteFolderOperation)operation, result);
|
||||
onCreateRemoteFolderOperationFinish(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onCreateRemoteFolderOperationFinish(CreateRemoteFolderOperation operation,
|
||||
RemoteOperationResult result) {
|
||||
private void onCreateRemoteFolderOperationFinish(RemoteOperationResult result) {
|
||||
if (result.isSuccess()) {
|
||||
saveFolderInDB();
|
||||
} else {
|
||||
|
@ -90,7 +86,7 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
|
|||
}
|
||||
|
||||
/**
|
||||
* Save new directory in local database
|
||||
* Save new directory in local database.
|
||||
*/
|
||||
public void saveFolderInDB() {
|
||||
if (mCreateFullPath && getStorageManager().
|
||||
|
@ -101,8 +97,7 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
|
|||
String composedRemotePath = "/";
|
||||
|
||||
// For each antecesor folders create them recursively
|
||||
for (int i=0; i<subFolders.length; i++) {
|
||||
String subFolder = subFolders[i];
|
||||
for (String subFolder : subFolders) {
|
||||
if (!subFolder.isEmpty()) {
|
||||
composedRemotePath = composedRemotePath + subFolder + "/";
|
||||
mRemotePath = composedRemotePath;
|
||||
|
@ -112,8 +107,7 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
|
|||
} else { // Create directory on DB
|
||||
OCFile newDir = new OCFile(mRemotePath);
|
||||
newDir.setMimetype(MimeType.DIRECTORY);
|
||||
long parentId = getStorageManager().
|
||||
getFileByPath(FileStorageUtils.getParentPath(mRemotePath)).getFileId();
|
||||
long parentId = getStorageManager().getFileByPath(FileStorageUtils.getParentPath(mRemotePath)).getFileId();
|
||||
newDir.setParentId(parentId);
|
||||
newDir.setModificationTimestamp(System.currentTimeMillis());
|
||||
getStorageManager().saveFile(newDir);
|
||||
|
|
|
@ -32,7 +32,7 @@ import com.owncloud.android.lib.resources.shares.ShareType;
|
|||
import com.owncloud.android.operations.common.SyncOperation;
|
||||
|
||||
/**
|
||||
* Creates a new private share for a given file
|
||||
* Creates a new private share for a given file.
|
||||
*/
|
||||
public class CreateShareWithShareeOperation extends SyncOperation {
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ public class RefreshFolderOperation extends RemoteOperation {
|
|||
Log_OC.d(TAG, "Synchronizing " + mAccount.name + remotePath);
|
||||
|
||||
if (result.isSuccess()) {
|
||||
synchronizeData(result.getData(), client);
|
||||
synchronizeData(result.getData());
|
||||
if (mConflictsFound > 0 || mFailsInFavouritesFound > 0) {
|
||||
result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);
|
||||
// should be a different result code, but will do the job
|
||||
|
@ -346,16 +346,12 @@ public class RefreshFolderOperation extends RemoteOperation {
|
|||
/**
|
||||
* Synchronizes the data retrieved from the server about the contents of the target folder
|
||||
* with the current data in the local database.
|
||||
*
|
||||
* <p>
|
||||
* Grants that mChildren is updated with fresh data after execution.
|
||||
*
|
||||
* @param folderAndFiles Remote folder and children files in Folder
|
||||
*
|
||||
* @param client Client instance to the remote server where the data were
|
||||
* retrieved.
|
||||
* @return 'True' when any change was made in the local data, 'false' otherwise
|
||||
*/
|
||||
private void synchronizeData(ArrayList<Object> folderAndFiles, OwnCloudClient client) {
|
||||
private void synchronizeData(ArrayList<Object> folderAndFiles) {
|
||||
// get 'fresh data' from the database
|
||||
mLocalFolder = mStorageManager.getFileByPath(mLocalFolder.getRemotePath());
|
||||
|
||||
|
|
|
@ -154,9 +154,8 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
}
|
||||
|
||||
if (result.isSuccess()) {
|
||||
syncContents(client);
|
||||
syncContents();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (mCancellationRequested.get()) {
|
||||
|
@ -168,15 +167,13 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private RemoteOperationResult checkForChanges(OwnCloudClient client)
|
||||
throws OperationCancelledException {
|
||||
private RemoteOperationResult checkForChanges(OwnCloudClient client) throws OperationCancelledException {
|
||||
Log_OC.d(TAG, "Checking changes in " + mAccount.name + mRemotePath);
|
||||
|
||||
mRemoteFolderChanged = true;
|
||||
RemoteOperationResult result = null;
|
||||
RemoteOperationResult result;
|
||||
|
||||
if (mCancellationRequested.get()) {
|
||||
throw new OperationCancelledException();
|
||||
|
@ -189,8 +186,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
|
||||
|
||||
// check if remote and local folder are different
|
||||
mRemoteFolderChanged =
|
||||
!(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag()));
|
||||
mRemoteFolderChanged = !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag()));
|
||||
|
||||
result = new RemoteOperationResult(ResultCode.OK);
|
||||
|
||||
|
@ -216,8 +212,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
}
|
||||
|
||||
|
||||
private RemoteOperationResult fetchAndSyncRemoteFolder(OwnCloudClient client)
|
||||
throws OperationCancelledException {
|
||||
private RemoteOperationResult fetchAndSyncRemoteFolder(OwnCloudClient client) throws OperationCancelledException {
|
||||
if (mCancellationRequested.get()) {
|
||||
throw new OperationCancelledException();
|
||||
}
|
||||
|
@ -227,7 +222,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
Log_OC.d(TAG, "Synchronizing " + mAccount.name + mRemotePath);
|
||||
|
||||
if (result.isSuccess()) {
|
||||
synchronizeData(result.getData(), client);
|
||||
synchronizeData(result.getData());
|
||||
if (mConflictsFound > 0 || mFailsInFileSyncsFound > 0) {
|
||||
result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);
|
||||
// should be a different result code, but will do the job
|
||||
|
@ -238,7 +233,6 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -266,13 +260,8 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
* Grants that mChildren is updated with fresh data after execution.
|
||||
*
|
||||
* @param folderAndFiles Remote folder and children files in Folder
|
||||
*
|
||||
* @param client Client instance to the remote server where the data were
|
||||
* retrieved.
|
||||
* @return 'True' when any change was made in the local data, 'false' otherwise
|
||||
*/
|
||||
private void synchronizeData(ArrayList<Object> folderAndFiles, OwnCloudClient client)
|
||||
throws OperationCancelledException {
|
||||
private void synchronizeData(ArrayList<Object> folderAndFiles) throws OperationCancelledException {
|
||||
FileDataStorageManager storageManager = getStorageManager();
|
||||
|
||||
// parse data from remote folder
|
||||
|
@ -283,7 +272,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
Log_OC.d(TAG, "Remote folder " + mLocalFolder.getRemotePath()
|
||||
+ " changed - starting update of local data ");
|
||||
|
||||
List<OCFile> updatedFiles = new Vector<OCFile>(folderAndFiles.size() - 1);
|
||||
List<OCFile> updatedFiles = new Vector<>(folderAndFiles.size() - 1);
|
||||
mFilesForDirectDownload.clear();
|
||||
mFilesToSyncContents.clear();
|
||||
|
||||
|
@ -293,7 +282,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
|
||||
// get current data about local contents of the folder to synchronize
|
||||
List<OCFile> localFiles = storageManager.getFolderContent(mLocalFolder, false);
|
||||
Map<String, OCFile> localFilesMap = new HashMap<String, OCFile>(localFiles.size());
|
||||
Map<String, OCFile> localFilesMap = new HashMap<>(localFiles.size());
|
||||
for (OCFile file : localFiles) {
|
||||
localFilesMap.put(file.getRemotePath(), file);
|
||||
}
|
||||
|
@ -306,15 +295,31 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
r = (RemoteFile) folderAndFiles.get(i);
|
||||
remoteFile = FileStorageUtils.fillOCFile(r);
|
||||
|
||||
/// new OCFile instance to merge fresh data from server with local state
|
||||
updatedFile = FileStorageUtils.fillOCFile(r);
|
||||
updatedFile.setParentId(mLocalFolder.getFileId());
|
||||
|
||||
/// retrieve local data for the read file
|
||||
// localFile = mStorageManager.getFileByPath(remoteFile.getRemotePath());
|
||||
localFile = localFilesMap.remove(remoteFile.getRemotePath());
|
||||
|
||||
/// new OCFile instance to merge fresh data from server with local state
|
||||
updatedFile = FileStorageUtils.fillOCFile(r);
|
||||
updatedFile.setParentId(mLocalFolder.getFileId());
|
||||
|
||||
/// add to updatedFile data about LOCAL STATE (not existing in server)
|
||||
updateLocalStateData(remoteFile, localFile, updatedFile);
|
||||
|
||||
/// check and fix, if needed, local storage path
|
||||
searchForLocalFileInDefaultPath(updatedFile);
|
||||
|
||||
/// classify file to sync/download contents later
|
||||
classifyFileForLaterSyncOrDownload(remoteFile, localFile);
|
||||
|
||||
updatedFiles.add(updatedFile);
|
||||
}
|
||||
|
||||
// save updated contents in local database
|
||||
storageManager.saveFolder(remoteFolder, updatedFiles, localFilesMap.values());
|
||||
}
|
||||
|
||||
private void updateLocalStateData(OCFile remoteFile, OCFile localFile, OCFile updatedFile) {
|
||||
updatedFile.setLastSyncDateForProperties(mCurrentSyncTime);
|
||||
if (localFile != null) {
|
||||
updatedFile.setFileId(localFile.getFileId());
|
||||
|
@ -343,11 +348,10 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
// remote eTag will not be updated unless file CONTENTS are synchronized
|
||||
updatedFile.setEtag("");
|
||||
}
|
||||
}
|
||||
|
||||
/// check and fix, if needed, local storage path
|
||||
searchForLocalFileInDefaultPath(updatedFile);
|
||||
|
||||
/// classify file to sync/download contents later
|
||||
private void classifyFileForLaterSyncOrDownload(OCFile remoteFile, OCFile localFile)
|
||||
throws OperationCancelledException {
|
||||
if (remoteFile.isFolder()) {
|
||||
/// to download children files recursively
|
||||
synchronized (mCancellationRequested) {
|
||||
|
@ -367,15 +371,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
mContext
|
||||
);
|
||||
mFilesToSyncContents.add(operation);
|
||||
|
||||
}
|
||||
|
||||
updatedFiles.add(updatedFile);
|
||||
}
|
||||
|
||||
// save updated contents in local database
|
||||
storageManager.saveFolder(remoteFolder, updatedFiles, localFilesMap.values());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -415,9 +411,9 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
}
|
||||
|
||||
|
||||
private void syncContents(OwnCloudClient client) throws OperationCancelledException {
|
||||
private void syncContents() throws OperationCancelledException {
|
||||
startDirectDownloads();
|
||||
startContentSynchronizations(mFilesToSyncContents, client);
|
||||
startContentSynchronizations(mFilesToSyncContents);
|
||||
}
|
||||
|
||||
|
||||
|
@ -439,18 +435,15 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
* Performs a list of synchronization operations, determining if a download or upload is needed
|
||||
* or if exists conflict due to changes both in local and remote contents of the each file.
|
||||
*
|
||||
* If download or upload is needed, request the operation to the corresponding service and goes
|
||||
* on.
|
||||
* If download or upload is needed, request the operation to the corresponding service and goes on.
|
||||
*
|
||||
* @param filesToSyncContents Synchronization operations to execute.
|
||||
* @param client Interface to the remote ownCloud server.
|
||||
*/
|
||||
private void startContentSynchronizations(List<SyncOperation> filesToSyncContents,
|
||||
OwnCloudClient client)
|
||||
private void startContentSynchronizations(List<SyncOperation> filesToSyncContents)
|
||||
throws OperationCancelledException {
|
||||
|
||||
Log_OC.v(TAG, "Starting content synchronization... ");
|
||||
RemoteOperationResult contentsResult = null;
|
||||
RemoteOperationResult contentsResult;
|
||||
for (SyncOperation op: filesToSyncContents) {
|
||||
if (mCancellationRequested.get()) {
|
||||
throw new OperationCancelledException();
|
||||
|
|
|
@ -709,55 +709,6 @@ public class OperationsService extends Service {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sends a broadcast when a new operation is added to the queue.
|
||||
*
|
||||
* Local broadcasts are only delivered to activities in the same process, but can't be
|
||||
* done sticky :\
|
||||
*
|
||||
* @param target Account or URL pointing to an OC server.
|
||||
* @param operation Added operation.
|
||||
*/
|
||||
private void sendBroadcastNewOperation(Target target, RemoteOperation operation) {
|
||||
Intent intent = new Intent(ACTION_OPERATION_ADDED);
|
||||
if (target.mAccount != null) {
|
||||
intent.putExtra(EXTRA_ACCOUNT, target.mAccount);
|
||||
} else {
|
||||
intent.putExtra(EXTRA_SERVER_URL, target.mServerUrl);
|
||||
}
|
||||
//LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
||||
//lbm.sendBroadcast(intent);
|
||||
sendStickyBroadcast(intent);
|
||||
}
|
||||
|
||||
|
||||
// TODO - maybe add a notification for real start of operations
|
||||
|
||||
/**
|
||||
* Sends a LOCAL broadcast when an operations finishes in order to the interested activities c
|
||||
* an update their view
|
||||
*
|
||||
* Local broadcasts are only delivered to activities in the same process.
|
||||
*
|
||||
* @param target Account or URL pointing to an OC server.
|
||||
* @param operation Finished operation.
|
||||
* @param result Result of the operation.
|
||||
*/
|
||||
private void sendBroadcastOperationFinished(Target target, RemoteOperation operation,
|
||||
RemoteOperationResult result) {
|
||||
Intent intent = new Intent(ACTION_OPERATION_FINISHED);
|
||||
intent.putExtra(EXTRA_RESULT, result);
|
||||
if (target.mAccount != null) {
|
||||
intent.putExtra(EXTRA_ACCOUNT, target.mAccount);
|
||||
} else {
|
||||
intent.putExtra(EXTRA_SERVER_URL, target.mServerUrl);
|
||||
}
|
||||
//LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
||||
//lbm.sendBroadcast(intent);
|
||||
sendStickyBroadcast(intent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notifies the currently subscribed listeners about the end of an operation.
|
||||
*
|
||||
|
@ -784,9 +735,8 @@ public class OperationsService extends Service {
|
|||
}
|
||||
}
|
||||
if (count == 0) {
|
||||
Pair<RemoteOperation, RemoteOperationResult> undispatched =
|
||||
new Pair<RemoteOperation, RemoteOperationResult>(operation, result);
|
||||
mUndispatchedFinishedOperations.put(((Runnable) operation).hashCode(), undispatched);
|
||||
Pair<RemoteOperation, RemoteOperationResult> undispatched = new Pair<>(operation, result);
|
||||
mUndispatchedFinishedOperations.put(operation.hashCode(), undispatched);
|
||||
}
|
||||
Log_OC.d(TAG, "Called " + count + " listeners");
|
||||
}
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
/**
|
||||
* ownCloud Android client application
|
||||
*
|
||||
* @author Bartek Przybylski
|
||||
* Copyright (C) 2011 Bartek Przybylski
|
||||
* Copyright (C) 2015 ownCloud Inc.
|
||||
*
|
||||
* 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 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.ui;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View.OnClickListener;
|
||||
|
||||
/**
|
||||
* Represents an Item on the ActionBar.
|
||||
*/
|
||||
public class ActionItem {
|
||||
private Drawable mIcon;
|
||||
private String mTitle;
|
||||
private OnClickListener mClickListener;
|
||||
|
||||
public ActionItem() {
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
mTitle = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return mTitle;
|
||||
}
|
||||
|
||||
public void setIcon(Drawable icon) {
|
||||
mIcon = icon;
|
||||
}
|
||||
|
||||
public Drawable getIcon() {
|
||||
return mIcon;
|
||||
}
|
||||
|
||||
public void setOnClickListener(OnClickListener listener) {
|
||||
mClickListener = listener;
|
||||
}
|
||||
|
||||
public OnClickListener getOnClickListerner() {
|
||||
return mClickListener;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,307 +0,0 @@
|
|||
/**
|
||||
* ownCloud Android client application
|
||||
*
|
||||
* @author Lorensius. W. T
|
||||
* Copyright (C) 2011 Bartek Przybylski
|
||||
* Copyright (C) 2015 ownCloud Inc.
|
||||
*
|
||||
* 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 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.ui;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
|
||||
|
||||
/**
|
||||
* Popup window, shows action list as icon and text like the one in Gallery3D
|
||||
* app.
|
||||
*/
|
||||
public class QuickAction extends CustomPopup {
|
||||
private final View root;
|
||||
private final ImageView mArrowUp;
|
||||
private final ImageView mArrowDown;
|
||||
private final LayoutInflater inflater;
|
||||
private final Context context;
|
||||
|
||||
protected static final int ANIM_GROW_FROM_LEFT = 1;
|
||||
protected static final int ANIM_GROW_FROM_RIGHT = 2;
|
||||
protected static final int ANIM_GROW_FROM_CENTER = 3;
|
||||
protected static final int ANIM_REFLECT = 4;
|
||||
protected static final int ANIM_AUTO = 5;
|
||||
|
||||
private int animStyle;
|
||||
private ViewGroup mTrack;
|
||||
private ScrollView scroller;
|
||||
private ArrayList<ActionItem> actionList;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param anchor {@link View} on where the popup window should be displayed
|
||||
*/
|
||||
public QuickAction(View anchor) {
|
||||
super(anchor);
|
||||
|
||||
actionList = new ArrayList<ActionItem>();
|
||||
context = anchor.getContext();
|
||||
inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
root = (ViewGroup) inflater.inflate(R.layout.popup, null);
|
||||
|
||||
mArrowDown = (ImageView) root.findViewById(R.id.arrow_down);
|
||||
mArrowUp = (ImageView) root.findViewById(R.id.arrow_up);
|
||||
|
||||
setContentView(root);
|
||||
|
||||
mTrack = (ViewGroup) root.findViewById(R.id.tracks);
|
||||
scroller = (ScrollView) root.findViewById(R.id.scroller);
|
||||
animStyle = ANIM_AUTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set animation style
|
||||
*
|
||||
* @param animStyle animation style, default is set to ANIM_AUTO
|
||||
*/
|
||||
public void setAnimStyle(int animStyle) {
|
||||
this.animStyle = animStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add action item
|
||||
*
|
||||
* @param action {@link ActionItem} object
|
||||
*/
|
||||
public void addActionItem(ActionItem action) {
|
||||
actionList.add(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show popup window. Popup is automatically positioned, on top or bottom of
|
||||
* anchor view.
|
||||
*
|
||||
*/
|
||||
public void show() {
|
||||
preShow();
|
||||
|
||||
int xPos, yPos;
|
||||
|
||||
int[] location = new int[2];
|
||||
|
||||
mAnchor.getLocationOnScreen(location);
|
||||
|
||||
Rect anchorRect = new Rect(location[0], location[1], location[0]
|
||||
+ mAnchor.getWidth(), location[1] + mAnchor.getHeight());
|
||||
|
||||
createActionList();
|
||||
|
||||
root.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT));
|
||||
root.measure(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||
|
||||
int rootHeight = root.getMeasuredHeight();
|
||||
int rootWidth = root.getMeasuredWidth();
|
||||
|
||||
int screenWidth = mWManager.getDefaultDisplay().getWidth();
|
||||
int screenHeight = mWManager.getDefaultDisplay().getHeight();
|
||||
|
||||
// automatically get X coord of popup (top left)
|
||||
if ((anchorRect.left + rootWidth) > screenWidth) {
|
||||
xPos = anchorRect.left - (rootWidth - mAnchor.getWidth());
|
||||
} else {
|
||||
if (mAnchor.getWidth() > rootWidth) {
|
||||
xPos = anchorRect.centerX() - (rootWidth / 2);
|
||||
} else {
|
||||
xPos = anchorRect.left;
|
||||
}
|
||||
}
|
||||
|
||||
int dyTop = anchorRect.top;
|
||||
int dyBottom = screenHeight - anchorRect.bottom;
|
||||
|
||||
boolean onTop = (dyTop > dyBottom) ? true : false;
|
||||
|
||||
if (onTop) {
|
||||
if (rootHeight > dyTop) {
|
||||
yPos = 15;
|
||||
LayoutParams l = scroller.getLayoutParams();
|
||||
l.height = dyTop - mAnchor.getHeight();
|
||||
} else {
|
||||
yPos = anchorRect.top - rootHeight;
|
||||
}
|
||||
} else {
|
||||
yPos = anchorRect.bottom;
|
||||
|
||||
if (rootHeight > dyBottom) {
|
||||
LayoutParams l = scroller.getLayoutParams();
|
||||
l.height = dyBottom;
|
||||
}
|
||||
}
|
||||
|
||||
showArrow(((onTop) ? R.id.arrow_down : R.id.arrow_up),
|
||||
anchorRect.centerX() - xPos);
|
||||
|
||||
setAnimationStyle(screenWidth, anchorRect.centerX(), onTop);
|
||||
|
||||
mWindow.showAtLocation(mAnchor, Gravity.NO_GRAVITY, xPos, yPos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set animation style
|
||||
*
|
||||
* @param screenWidth screen width
|
||||
* @param requestedX distance from left edge
|
||||
* @param onTop flag to indicate where the popup should be displayed. Set
|
||||
* TRUE if displayed on top of anchor view and vice versa
|
||||
*/
|
||||
private void setAnimationStyle(int screenWidth, int requestedX,
|
||||
boolean onTop) {
|
||||
int arrowPos = requestedX - mArrowUp.getMeasuredWidth() / 2;
|
||||
|
||||
switch (animStyle) {
|
||||
case ANIM_GROW_FROM_LEFT:
|
||||
mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Left
|
||||
: R.style.Animations_PopDownMenu_Left);
|
||||
break;
|
||||
|
||||
case ANIM_GROW_FROM_RIGHT:
|
||||
mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Right
|
||||
: R.style.Animations_PopDownMenu_Right);
|
||||
break;
|
||||
|
||||
case ANIM_GROW_FROM_CENTER:
|
||||
mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Center
|
||||
: R.style.Animations_PopDownMenu_Center);
|
||||
break;
|
||||
|
||||
case ANIM_REFLECT:
|
||||
mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Reflect
|
||||
: R.style.Animations_PopDownMenu_Reflect);
|
||||
break;
|
||||
|
||||
case ANIM_AUTO:
|
||||
if (arrowPos <= screenWidth / 4) {
|
||||
mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Left
|
||||
: R.style.Animations_PopDownMenu_Left);
|
||||
} else if (arrowPos > screenWidth / 4
|
||||
&& arrowPos < 3 * (screenWidth / 4)) {
|
||||
mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Center
|
||||
: R.style.Animations_PopDownMenu_Center);
|
||||
} else {
|
||||
mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Right
|
||||
: R.style.Animations_PopDownMenu_Right);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create action list
|
||||
*/
|
||||
private void createActionList() {
|
||||
View view;
|
||||
String title;
|
||||
Drawable icon;
|
||||
OnClickListener listener;
|
||||
|
||||
for (int i = 0; i < actionList.size(); i++) {
|
||||
title = actionList.get(i).getTitle();
|
||||
icon = actionList.get(i).getIcon();
|
||||
listener = actionList.get(i).getOnClickListerner();
|
||||
|
||||
view = getActionItem(title, icon, listener);
|
||||
|
||||
view.setFocusable(true);
|
||||
view.setClickable(true);
|
||||
|
||||
mTrack.addView(view);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get action item {@link View}
|
||||
*
|
||||
* @param title action item title
|
||||
* @param icon {@link Drawable} action item icon
|
||||
* @param listener {@link View.OnClickListener} action item listener
|
||||
* @return action item {@link View}
|
||||
*/
|
||||
private View getActionItem(String title, Drawable icon,
|
||||
OnClickListener listener) {
|
||||
LinearLayout container = (LinearLayout) inflater.inflate(
|
||||
R.layout.action_item, null);
|
||||
|
||||
ImageView img = (ImageView) container.findViewById(R.id.icon);
|
||||
TextView text = (TextView) container.findViewById(R.id.title);
|
||||
|
||||
if (icon != null) {
|
||||
img.setImageDrawable(icon);
|
||||
}
|
||||
|
||||
if (title != null) {
|
||||
text.setText(title);
|
||||
}
|
||||
|
||||
if (listener != null) {
|
||||
container.setOnClickListener(listener);
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show arrow
|
||||
*
|
||||
* @param whichArrow arrow type resource id
|
||||
* @param requestedX distance from left screen
|
||||
*/
|
||||
private void showArrow(int whichArrow, int requestedX) {
|
||||
final View showArrow = (whichArrow == R.id.arrow_up) ? mArrowUp
|
||||
: mArrowDown;
|
||||
final View hideArrow = (whichArrow == R.id.arrow_up) ? mArrowDown
|
||||
: mArrowUp;
|
||||
|
||||
final int arrowWidth = mArrowUp.getMeasuredWidth();
|
||||
|
||||
showArrow.setVisibility(View.VISIBLE);
|
||||
|
||||
ViewGroup.MarginLayoutParams param = (ViewGroup.MarginLayoutParams) showArrow
|
||||
.getLayoutParams();
|
||||
|
||||
param.leftMargin = requestedX - arrowWidth / 2;
|
||||
|
||||
hideArrow.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
|
@ -63,7 +63,6 @@ import static com.owncloud.android.datamodel.SyncedFolderDisplayItem.UNPERSISTED
|
|||
*/
|
||||
public class FolderSyncActivity extends FileActivity implements FolderSyncAdapter.ClickListener,
|
||||
SyncedFolderPreferencesDialogFragment.OnSyncedFolderPreferenceListener {
|
||||
private static final String TAG = FolderSyncActivity.class.getSimpleName();
|
||||
|
||||
private static final String SYNCED_FOLDER_PREFERENCES_DIALOG_TAG = "SYNCED_FOLDER_PREFERENCES_DIALOG";
|
||||
public static final String PRIORITIZED_FOLDER = "Camera";
|
||||
|
|
|
@ -21,6 +21,4 @@ package com.owncloud.android.ui.activity;
|
|||
|
||||
public abstract class HookActivity extends FileActivity {
|
||||
|
||||
private static final String TAG = HookActivity.class.getName();
|
||||
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ public class LogHistoryActivity extends ToolbarActivity {
|
|||
emailAddress = "";
|
||||
}
|
||||
|
||||
ArrayList<Uri> uris = new ArrayList<Uri>();
|
||||
ArrayList<Uri> uris = new ArrayList<>();
|
||||
|
||||
// Convert from paths to Android friendly Parcelable Uri's
|
||||
for (String file : Log_OC.getLogFileNames()) {
|
||||
|
@ -193,7 +193,7 @@ public class LogHistoryActivity extends ToolbarActivity {
|
|||
|
||||
public LoadingLogTask(TextView logTV){
|
||||
// Use of a WeakReference to ensure the TextView can be garbage collected
|
||||
textViewReference = new WeakReference<TextView>(logTV);
|
||||
textViewReference = new WeakReference<>(logTV);
|
||||
}
|
||||
|
||||
protected String doInBackground(String... args) {
|
||||
|
|
|
@ -60,7 +60,6 @@ import com.owncloud.android.ui.helpers.FileOperationsHelper;
|
|||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,6 @@ import android.text.Html;
|
|||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
|
@ -37,7 +36,6 @@ import com.owncloud.android.R;
|
|||
* Activity providing information about ways to participate in the app's development.
|
||||
*/
|
||||
public class ParticipateActivity extends FileActivity {
|
||||
private Button mReportBtn;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -91,8 +89,7 @@ public class ParticipateActivity extends FileActivity {
|
|||
contributeGithubView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
contributeGithubView.setText(Html.fromHtml(getString(R.string.participate_contribute_github_text)));
|
||||
|
||||
mReportBtn = (Button) findViewById(R.id.participate_testing_report);
|
||||
mReportBtn.setOnClickListener(new View.OnClickListener() {
|
||||
findViewById(R.id.participate_testing_report).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.report_issue_link))));
|
||||
|
|
|
@ -28,7 +28,6 @@ import android.support.annotation.ColorInt;
|
|||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
|
@ -92,11 +91,6 @@ public abstract class ToolbarActivity extends BaseActivity {
|
|||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setTitle(titleToSet);
|
||||
|
||||
// also as content description
|
||||
View actionBarTitleView = getWindow().getDecorView().findViewById(
|
||||
getResources().getIdentifier("action_bar_title", "id", "android")
|
||||
);
|
||||
|
||||
// set home button properties
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
|
|
|
@ -45,8 +45,6 @@ import java.util.List;
|
|||
*/
|
||||
public class FolderSyncAdapter extends SectionedRecyclerViewAdapter<FolderSyncAdapter.MainViewHolder> {
|
||||
|
||||
private static final String TAG = FolderSyncAdapter.class.getSimpleName();
|
||||
|
||||
private final Context mContext;
|
||||
private final int mGridWidth;
|
||||
private final int mGridTotal;
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
/**
|
||||
* ownCloud Android client application
|
||||
*
|
||||
* Copyright (C) 2015 ownCloud Inc.
|
||||
*
|
||||
* 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 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.ui.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
|
||||
public class LogListAdapter extends ArrayAdapter<String> {
|
||||
private Context context = null;
|
||||
private String[] values;
|
||||
private Uri fileUri = null;
|
||||
|
||||
|
||||
public LogListAdapter(Context context, String[] values) {
|
||||
super(context, R.layout.log_item, values);
|
||||
this.context = context;
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView,@NonNull ViewGroup parent) {
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
View rowView = inflater.inflate(R.layout.log_item, parent, false);
|
||||
TextView listText = (TextView) rowView.findViewById(R.id.log_item_single);
|
||||
listText.setText(values[position]);
|
||||
listText.setTextSize(15);
|
||||
fileUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory() + File.separator + "owncloud" + File
|
||||
.separator+"log"+File.separator+values[position]));
|
||||
listText.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent emailIntent = new Intent(Intent.ACTION_SEND);
|
||||
emailIntent.setType("text/rtf");
|
||||
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Nextcloud Logfile");
|
||||
emailIntent.putExtra(Intent.EXTRA_TEXT, "This is a automatic E-mail send by nextcloud/android");
|
||||
emailIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
|
||||
emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
|
||||
}
|
||||
});
|
||||
return rowView;
|
||||
}
|
||||
}
|
|
@ -81,12 +81,6 @@ public class SamlWebViewDialog extends DialogFragment {
|
|||
return fragment;
|
||||
}
|
||||
|
||||
|
||||
public SamlWebViewDialog() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
Log_OC.v(TAG, "onAttach");
|
||||
|
|
|
@ -86,13 +86,6 @@ public class EditShareFragment extends Fragment {
|
|||
return fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required empty public constructor
|
||||
*/
|
||||
public EditShareFragment() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -89,10 +89,6 @@ public class SearchShareesFragment extends Fragment implements ShareUserListAdap
|
|||
return fragment;
|
||||
}
|
||||
|
||||
public SearchShareesFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -76,8 +76,7 @@ import java.util.Date;
|
|||
* Use the {@link ShareFileFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class ShareFileFragment extends Fragment
|
||||
implements ShareUserListAdapter.ShareUserAdapterListener {
|
||||
public class ShareFileFragment extends Fragment implements ShareUserListAdapter.ShareUserAdapterListener {
|
||||
|
||||
private static final String TAG = ShareFileFragment.class.getSimpleName();
|
||||
|
||||
|
@ -166,12 +165,6 @@ public class ShareFileFragment extends Fragment
|
|||
return fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required empty public constructor.
|
||||
*/
|
||||
public ShareFileFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
|
@ -49,15 +49,10 @@ import java.net.SocketTimeoutException;
|
|||
|
||||
/**
|
||||
* Class to choose proper error messages to show to the user depending on the results of operations,
|
||||
* always following the same policy
|
||||
* always following the same policy.
|
||||
*/
|
||||
|
||||
public class ErrorMessageAdapter {
|
||||
|
||||
public ErrorMessageAdapter() {
|
||||
|
||||
}
|
||||
|
||||
public static String getErrorCauseMessage(RemoteOperationResult result,
|
||||
RemoteOperation operation, Resources res) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue