Browse Source

remove further unused code

AndyScherzinger 7 years ago
parent
commit
0ef2739d26

+ 0 - 1
src/main/java/com/afollestad/sectionedrecyclerview/SectionedRecyclerViewAdapter.java

@@ -35,7 +35,6 @@ public abstract class SectionedRecyclerViewAdapter<VH extends RecyclerView.ViewH
 
     private final ArrayMap<Integer, Integer> mHeaderLocationMap;
     private GridLayoutManager mLayoutManager;
-    private ArrayMap<Integer, Integer> mSpanMap;
     private boolean mShowHeadersForEmptySections;
 
     public SectionedRecyclerViewAdapter() {

+ 2 - 39
src/main/java/com/owncloud/android/datamodel/ArbitraryDataProvider.java

@@ -48,26 +48,21 @@ public class ArbitraryDataProvider {
     }
 
     public int deleteKeyForAccount(String account, String key) {
-        int result = contentResolver.delete(
+        return contentResolver.delete(
                 ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA,
                 ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " = ? AND " +
                         ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_KEY + "= ?",
                 new String[]{account, key}
         );
-
-        return result;
     }
 
     public int deleteForKeyWhereAccountNotIn(ArrayList<String> accounts, String key) {
-
-        int result = contentResolver.delete(
+        return contentResolver.delete(
                 ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA,
                 ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " NOT IN (?) AND " +
                         ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_KEY + "= ?",
                 new String[]{String.valueOf(accounts), key}
         );
-
-        return result;
     }
 
 
@@ -158,38 +153,6 @@ public class ArbitraryDataProvider {
         return getIntegerValue(account.name, key);
     }
 
-    private ArrayList<String> getValues(Account account, String key) {
-        Cursor cursor = contentResolver.query(
-                ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA,
-                null,
-                ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " = ? and " +
-                        ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_KEY + " = ?",
-                new String[]{account.name, key},
-                null
-        );
-
-        if (cursor != null) {
-            ArrayList<String> list = new ArrayList<>();
-            if (cursor.moveToFirst()) {
-                do {
-                    String value = cursor.getString(cursor.getColumnIndex(
-                            ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_VALUE));
-                    if (value == null) {
-                        Log_OC.e(TAG, "Arbitrary value could not be created from cursor");
-                    } else {
-                        list.add(value);
-                    }
-                } while (cursor.moveToNext());
-            }
-            cursor.close();
-            return list;
-        } else {
-            Log_OC.e(TAG, "DB error restoring arbitrary values.");
-        }
-
-        return new ArrayList<>();
-    }
-
     /**
      * Returns stored value as string or empty string
      * @return string if value found or empty string

+ 0 - 1
src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -601,7 +601,6 @@ public class FileDataStorageManager {
         return success;
     }
 
-
     /**
      * Updates database and file system for a file or folder that was moved to a different location.
      *

+ 2 - 8
src/main/java/com/owncloud/android/db/PreferenceManager.java

@@ -308,7 +308,7 @@ public abstract class PreferenceManager {
         saveFloatPreference(context, AUTO_PREF__GRID_COLUMNS, gridColumns);
     }
 
-    public static void saveBooleanPreference(Context context, String key, boolean value) {
+    private static void saveBooleanPreference(Context context, String key, boolean value) {
         SharedPreferences.Editor appPreferences = getDefaultSharedPreferences(context.getApplicationContext()).edit();
         appPreferences.putBoolean(key, value).apply();
     }
@@ -329,17 +329,11 @@ public abstract class PreferenceManager {
         appPreferences.putInt(key, value).apply();
     }
 
-    public static void saveFloatPreference(Context context, String key, float value) {
+    private static void saveFloatPreference(Context context, String key, float value) {
         SharedPreferences.Editor appPreferences = getDefaultSharedPreferences(context.getApplicationContext()).edit();
         appPreferences.putFloat(key, value).apply();
     }
 
-    private static void saveLongPreference(Context context, String key, long value) {
-        SharedPreferences.Editor appPreferences = getDefaultSharedPreferences(context.getApplicationContext()).edit();
-        appPreferences.putLong(key, value);
-        appPreferences.apply();
-    }
-
     public static SharedPreferences getDefaultSharedPreferences(Context context) {
         return android.preference.PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
     }

+ 2 - 7
src/main/java/com/owncloud/android/operations/MoveFileOperation.java

@@ -20,8 +20,6 @@
 
 package com.owncloud.android.operations;
 
-import android.accounts.Account;
-
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@@ -41,17 +39,14 @@ public class MoveFileOperation extends SyncOperation {
     private String mTargetParentPath;
     
     private OCFile mFile;
-
-    
     
     /**
      * Constructor
      * 
      * @param srcPath           Remote path of the {@link OCFile} to move.
      * @param targetParentPath  Path to the folder where the file will be moved into.
-     * @param account           OwnCloud account containing both the file and the target folder 
      */
-    public MoveFileOperation(String srcPath, String targetParentPath, Account account) {
+    public MoveFileOperation(String srcPath, String targetParentPath) {
         mSrcPath = srcPath;
         mTargetParentPath = targetParentPath;
         if (!mTargetParentPath.endsWith(OCFile.PATH_SEPARATOR)) {
@@ -68,7 +63,7 @@ public class MoveFileOperation extends SyncOperation {
      */
     @Override
     protected RemoteOperationResult run(OwnCloudClient client) {
-        RemoteOperationResult result = null;
+        RemoteOperationResult result;
         
         /// 1. check move validity
         if (mTargetParentPath.startsWith(mSrcPath)) {

+ 4 - 7
src/main/java/com/owncloud/android/operations/RefreshFolderOperation.java

@@ -203,7 +203,7 @@ public class RefreshFolderOperation extends RemoteOperation {
 
             if (result.isSuccess()) {
                 // request for the synchronization of KEPT-IN-SYNC file contents
-                startContentSynchronizations(mFilesToSyncContents, client);
+                startContentSynchronizations(mFilesToSyncContents);
             }
         }
         
@@ -453,12 +453,9 @@ public class RefreshFolderOperation extends RemoteOperation {
      * on.
      * 
      * @param filesToSyncContents       Synchronization operations to execute.
-     * @param client                    Interface to the remote ownCloud server.
      */
-    private void startContentSynchronizations(
-            List<SynchronizeFileOperation> filesToSyncContents, OwnCloudClient client
-        ) {
-        RemoteOperationResult contentsResult = null;
+    private void startContentSynchronizations(List<SynchronizeFileOperation> filesToSyncContents) {
+        RemoteOperationResult contentsResult;
         for (SynchronizeFileOperation op: filesToSyncContents) {
             contentsResult = op.execute(mStorageManager, mContext);   // async
             if (!contentsResult.isSuccess()) {
@@ -487,7 +484,7 @@ public class RefreshFolderOperation extends RemoteOperation {
      *                  the operation.
      */
     private RemoteOperationResult refreshSharesForFolder(OwnCloudClient client) {
-        RemoteOperationResult result = null;
+        RemoteOperationResult result;
         
         // remote request 
         GetRemoteSharesForFileOperation operation = 

+ 0 - 13
src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java

@@ -469,19 +469,6 @@ public class SynchronizeFolderOperation extends SyncOperation {
         }
     }
 
-    
-    /**
-     * Creates and populates a new {@link com.owncloud.android.datamodel.OCFile}
-     * object with the data read from the server.
-     *
-     * @param remote    remote file read from the server (remote file or folder).
-     * @return          New OCFile instance representing the remote resource described by we.
-     */
-    private OCFile fillOCFile(RemoteFile remote) {
-        return FileStorageUtils.fillOCFile(remote);
-    }
-
-
     /**
      * Scans the default location for saving local copies of files searching for
      * a 'lost' file with the same full name as the {@link com.owncloud.android.datamodel.OCFile}

+ 1 - 1
src/main/java/com/owncloud/android/services/OperationsService.java

@@ -678,7 +678,7 @@ public class OperationsService extends Service {
                     // Move file/folder
                     String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
                     String newParentPath = operationIntent.getStringExtra(EXTRA_NEW_PARENT_PATH);
-                    operation = new MoveFileOperation(remotePath, newParentPath, account);
+                    operation = new MoveFileOperation(remotePath, newParentPath);
 
                 } else if (action.equals(ACTION_COPY_FILE)) {
                     // Copy file/folder