Merge pull request #3918 from nextcloud/codacyCleanup

some cleanups
This commit is contained in:
Andy Scherzinger 2019-04-18 08:12:44 +02:00 committed by GitHub
commit 92df32e664
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 16 additions and 60 deletions

View file

@ -34,7 +34,7 @@ public class UploadIT extends AbstractIT {
public void setUp() {
final ContentResolver contentResolver = targetContext.getContentResolver();
final CurrentAccountProvider currentAccountProvider = () -> AccountUtils.getCurrentOwnCloudAccount(targetContext);
storageManager = new UploadsStorageManager(currentAccountProvider, contentResolver, targetContext);
storageManager = new UploadsStorageManager(currentAccountProvider, contentResolver);
}
@Test

View file

@ -15,7 +15,6 @@ import org.junit.runner.RunWith;
import java.io.File;
import androidx.annotation.Nullable;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
@ -36,7 +35,7 @@ public class UploadStorageManagerTest {
public void setUp() {
Context instrumentationCtx = InstrumentationRegistry.getTargetContext();
ContentResolver contentResolver = instrumentationCtx.getContentResolver();
uploadsStorageManager = new UploadsStorageManager(currentAccountProvider, contentResolver, instrumentationCtx);
uploadsStorageManager = new UploadsStorageManager(currentAccountProvider, contentResolver);
Accounts = new Account[]{new Account("A", "A"), new Account("B", "B")};
}

View file

@ -44,7 +44,6 @@ import androidx.annotation.Nullable;
public class UserAccountManagerImpl implements UserAccountManager {
private static final String TAG = AccountUtils.class.getSimpleName();
private static final String PREF_SELECT_OC_ACCOUNT = "select_oc_account";
private Context context;
private AccountManager accountManager;

View file

@ -90,8 +90,10 @@ class AppModule {
return new RemoteFilesRepository(new FilesServiceApiImpl(accountManager));
}
@Provides UploadsStorageManager uploadsStorageManager(Context context, CurrentAccountProvider currentAccountProvider) {
return new UploadsStorageManager(currentAccountProvider, context.getContentResolver(), context);
@Provides
UploadsStorageManager uploadsStorageManager(Context context,
CurrentAccountProvider currentAccountProvider) {
return new UploadsStorageManager(currentAccountProvider, context.getContentResolver());
}
@Provides CurrentAccountProvider currentAccountProvider(UserAccountManager accountManager) {

View file

@ -120,13 +120,6 @@ public class MainApp extends MultiDexApplication implements
private static final String TAG = MainApp.class.getSimpleName();
private static final String AUTH_ON = "on";
@SuppressWarnings("unused")
private static final String POLICY_SINGLE_SESSION_PER_ACCOUNT = "single session per account";
@SuppressWarnings("unused")
private static final String POLICY_ALWAYS_NEW_CLIENT = "always new client";
private static Context mContext;
private static String storagePath;

View file

@ -23,22 +23,14 @@ import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import com.owncloud.android.MainApp;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.UserInfo;
import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation;
import com.owncloud.android.ui.activity.ManageAccountsActivity;
import androidx.annotation.NonNull;
@ -48,7 +40,6 @@ import androidx.annotation.Nullable;
* Helper class for dealing with accounts.
*/
public final class AccountUtils {
private static final String TAG = AccountUtils.class.getSimpleName();
private static final String PREF_SELECT_OC_ACCOUNT = "select_oc_account";
public static final int ACCOUNT_VERSION = 1;

View file

@ -1859,19 +1859,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
public abstract boolean onDrawableTouch(final MotionEvent event);
}
private void getRemoteUserNameOperation(String sessionCookie) {
Intent getUserNameIntent = new Intent();
getUserNameIntent.setAction(OperationsService.ACTION_GET_USER_NAME);
getUserNameIntent.putExtra(OperationsService.EXTRA_SERVER_URL, mServerInfo.mBaseUrl);
getUserNameIntent.putExtra(OperationsService.EXTRA_COOKIE, sessionCookie);
if (mOperationsServiceBinder != null) {
mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getUserNameIntent);
}
}
/**
* Show untrusted cert dialog
*/

View file

@ -26,7 +26,6 @@ package com.owncloud.android.datamodel;
import android.accounts.Account;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
@ -55,19 +54,16 @@ public class UploadsStorageManager extends Observable {
private static final int SINGLE_RESULT = 1;
private ContentResolver mContentResolver;
private Context mContext;
private CurrentAccountProvider currentAccountProvider;
public UploadsStorageManager(
CurrentAccountProvider currentAccountProvider,
ContentResolver contentResolver,
Context context
ContentResolver contentResolver
) {
if (contentResolver == null) {
throw new IllegalArgumentException("Cannot create an instance with a NULL contentResolver");
}
mContentResolver = contentResolver;
mContext = context;
this.currentAccountProvider = currentAccountProvider;
}

View file

@ -32,7 +32,6 @@ import com.evernote.android.job.JobRequest;
import com.evernote.android.job.util.Device;
import com.nextcloud.client.account.UserAccountManager;
import com.owncloud.android.MainApp;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;

View file

@ -33,7 +33,6 @@ import android.provider.OpenableColumns;
import com.nextcloud.client.account.UserAccountManager;
import com.owncloud.android.MainApp;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.ThumbnailsCacheManager;

View file

@ -50,7 +50,6 @@ import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.ThumbnailsCacheManager;

View file

@ -36,7 +36,6 @@ import android.widget.Toast;
import com.nextcloud.client.account.UserAccountManager;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;

View file

@ -32,7 +32,6 @@ import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import com.nextcloud.client.account.UserAccountManager;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.utils.BitmapUtils;
import com.owncloud.android.utils.NextcloudServer;

View file

@ -42,7 +42,6 @@ import com.google.android.material.snackbar.Snackbar;
import com.nextcloud.client.account.UserAccountManager;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.OCFile;

View file

@ -51,12 +51,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.webkit.URLUtil;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.res.ResourcesCompat;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.di.Injectable;
@ -65,7 +59,6 @@ import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.PassCodeManager;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.ExternalLinksProvider;
@ -87,6 +80,13 @@ import java.util.ArrayList;
import javax.inject.Inject;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.res.ResourcesCompat;
/**
* An Activity that allows the user to change the application's settings.
*

View file

@ -53,11 +53,9 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.google.gson.Gson;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.preferences.AppPreferences;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.PushConfigurationState;
import com.owncloud.android.lib.common.UserInfo;

View file

@ -33,7 +33,6 @@ import android.widget.TextView;
import com.nextcloud.client.preferences.AppPreferences;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
import com.owncloud.android.lib.common.utils.Log_OC;

View file

@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author David A. Velasco
@ -40,7 +40,6 @@ import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.preferences.AppPreferences;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.VirtualFolderType;

View file

@ -1,4 +1,4 @@
/**
/*
* Nextcloud Android client application
*
* @author Alejandro Bautista
@ -28,7 +28,6 @@ import com.bumptech.glide.Priority;
import com.bumptech.glide.load.data.DataFetcher;
import com.nextcloud.client.account.CurrentAccountProvider;
import com.owncloud.android.MainApp;
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.OwnCloudClientManagerFactory;