Browse Source

some cleanups

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 6 years ago
parent
commit
334155e707
19 changed files with 16 additions and 61 deletions
  1. 1 1
      src/androidTest/java/com/owncloud/android/UploadIT.java
  2. 1 2
      src/androidTest/java/com/owncloud/android/datamodel/UploadStorageManagerTest.java
  3. 0 1
      src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java
  4. 4 2
      src/main/java/com/nextcloud/client/di/AppModule.java
  5. 0 8
      src/main/java/com/owncloud/android/MainApp.java
  6. 0 9
      src/main/java/com/owncloud/android/authentication/AccountUtils.java
  7. 0 13
      src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java
  8. 1 5
      src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java
  9. 0 1
      src/main/java/com/owncloud/android/jobs/OfflineSyncJob.java
  10. 0 1
      src/main/java/com/owncloud/android/providers/DiskLruImageCacheFileProvider.java
  11. 0 1
      src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java
  12. 0 1
      src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java
  13. 0 1
      src/main/java/com/owncloud/android/ui/TextDrawable.java
  14. 0 1
      src/main/java/com/owncloud/android/ui/activity/FileActivity.java
  15. 7 7
      src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java
  16. 0 2
      src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java
  17. 0 1
      src/main/java/com/owncloud/android/ui/adapter/TrashbinListAdapter.java
  18. 1 2
      src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java
  19. 1 2
      src/main/java/com/owncloud/android/utils/glide/HttpStreamFetcher.java

+ 1 - 1
src/androidTest/java/com/owncloud/android/UploadIT.java

@@ -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

+ 1 - 2
src/androidTest/java/com/owncloud/android/datamodel/UploadStorageManagerTest.java

@@ -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")};
     }
 

+ 0 - 1
src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java

@@ -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;

+ 4 - 2
src/main/java/com/nextcloud/client/di/AppModule.java

@@ -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) {

+ 0 - 8
src/main/java/com/owncloud/android/MainApp.java

@@ -49,7 +49,6 @@ import com.nextcloud.client.di.ActivityInjector;
 import com.nextcloud.client.di.DaggerAppComponent;
 import com.nextcloud.client.preferences.AppPreferences;
 import com.nextcloud.client.preferences.AppPreferencesImpl;
-import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.authentication.PassCodeManager;
 import com.owncloud.android.datamodel.ArbitraryDataProvider;
 import com.owncloud.android.datamodel.MediaFolder;
@@ -121,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;

+ 0 - 9
src/main/java/com/owncloud/android/authentication/AccountUtils.java

@@ -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;

+ 0 - 13
src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -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
      */

+ 1 - 5
src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java

@@ -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;
     }
 

+ 0 - 1
src/main/java/com/owncloud/android/jobs/OfflineSyncJob.java

@@ -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;

+ 0 - 1
src/main/java/com/owncloud/android/providers/DiskLruImageCacheFileProvider.java

@@ -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;

+ 0 - 1
src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java

@@ -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;

+ 0 - 1
src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java

@@ -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;

+ 0 - 1
src/main/java/com/owncloud/android/ui/TextDrawable.java

@@ -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;
 

+ 0 - 1
src/main/java/com/owncloud/android/ui/activity/FileActivity.java

@@ -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;

+ 7 - 7
src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java

@@ -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.
  *

+ 0 - 2
src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java

@@ -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;

+ 0 - 1
src/main/java/com/owncloud/android/ui/adapter/TrashbinListAdapter.java

@@ -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;

+ 1 - 2
src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java

@@ -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;

+ 1 - 2
src/main/java/com/owncloud/android/utils/glide/HttpStreamFetcher.java

@@ -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;